+ void FitToRebar(PRECT pRect)
+ {
+ /* Get the rect of the rebar */
+ RECT rebarRect, taskbarRect;
+ ::GetWindowRect(m_Rebar, &rebarRect);
+ ::GetWindowRect(m_hWnd, &taskbarRect);
+ OffsetRect(&rebarRect, -taskbarRect.left, -taskbarRect.top);
+
+ /* Calculate the difference of size of the taskbar and the rebar */
+ SIZE margins;
+ margins.cx = taskbarRect.right - taskbarRect.left - rebarRect.right + rebarRect.left;
+ margins.cy = taskbarRect.bottom - taskbarRect.top - rebarRect.bottom + rebarRect.top;
+
+ /* Calculate the new size of the rebar and make it resize, then change the new taskbar size */
+ switch (m_Position)
+ {
+ case ABE_TOP:
+ rebarRect.bottom = rebarRect.top + pRect->bottom - pRect->top - margins.cy;
+ ::SendMessageW(m_Rebar, RB_SIZETORECT, RBSTR_CHANGERECT, (LPARAM)&rebarRect);
+ pRect->bottom = pRect->top + rebarRect.bottom - rebarRect.top + margins.cy;
+ break;
+ case ABE_BOTTOM:
+ rebarRect.top = rebarRect.bottom - (pRect->bottom - pRect->top - margins.cy);
+ ::SendMessageW(m_Rebar, RB_SIZETORECT, RBSTR_CHANGERECT, (LPARAM)&rebarRect);
+ ERR("rebarRect: %d, %d, %d,%d\n", rebarRect.top, rebarRect.left, rebarRect.right, rebarRect.bottom);
+ pRect->top = pRect->bottom - (rebarRect.bottom - rebarRect.top + margins.cy);
+ break;
+ case ABE_LEFT:
+ case ABE_RIGHT:
+ /* FIXME: what to do here? */
+ break;
+ }
+
+ CalculateValidSize(m_Position, pRect);
+ }
+