comctl32: rebar: Store the coordinates of infoPtr->calcSize swapped for CCS_VERT.

This commit is contained in:
Mikołaj Zalewski 2007-02-19 14:10:01 +01:00 committed by Alexandre Julliard
parent ffbf61ae55
commit a268538e0e
1 changed files with 10 additions and 25 deletions

View File

@ -133,7 +133,7 @@ typedef struct
UINT fStatus; /* status flags, reset only by _Validate */ UINT fStatus; /* status flags, reset only by _Validate */
UINT fDraw; /* drawing flags, reset only by _Layout */ UINT fDraw; /* drawing flags, reset only by _Layout */
UINT uCDret; /* last return from NM_CUSTOMDRAW */ UINT uCDret; /* last return from NM_CUSTOMDRAW */
RECT rcBand; /* calculated band rectangle */ RECT rcBand; /* calculated band rectangle - coordinates swapped for CCS_VERT */
RECT rcGripper; /* calculated gripper rectangle */ RECT rcGripper; /* calculated gripper rectangle */
RECT rcCapImage; /* calculated caption image rectangle */ RECT rcCapImage; /* calculated caption image rectangle */
RECT rcCapText; /* calculated caption text rectangle */ RECT rcCapText; /* calculated caption text rectangle */
@ -174,7 +174,7 @@ typedef struct
SIZE imageSize; /* image size (image list) */ SIZE imageSize; /* image size (image list) */
DWORD dwStyle; /* window style */ DWORD dwStyle; /* window style */
DWORD orgStyle; /* original style (dwStyle may change) */ DWORD orgStyle; /* original style (dwStyle may change) */
SIZE calcSize; /* calculated rebar size */ SIZE calcSize; /* calculated rebar size - coordinates swapped for CCS_VERT */
SIZE oldSize; /* previous calculated rebar size */ SIZE oldSize; /* previous calculated rebar size */
BOOL bUnicode; /* TRUE if parent wants notify in W format */ BOOL bUnicode; /* TRUE if parent wants notify in W format */
BOOL DoRedraw; /* TRUE to acutally draw bands */ BOOL DoRedraw; /* TRUE to acutally draw bands */
@ -465,16 +465,6 @@ static int get_rect_cy(REBAR_INFO *infoPtr, RECT *lpRect)
return lpRect->bottom - lpRect->top; return lpRect->bottom - lpRect->top;
} }
static void swap_size_if_vert(REBAR_INFO *infoPtr, SIZE *size)
{
if (infoPtr->dwStyle & CCS_VERT)
{
LONG tmp = size->cx;
size->cx = size->cy;
size->cy = tmp;
}
}
static void round_child_height(REBAR_BAND *lpBand, int cyHeight) static void round_child_height(REBAR_BAND *lpBand, int cyHeight)
{ {
int cy = 0; int cy = 0;
@ -966,13 +956,12 @@ REBAR_ForceResize (REBAR_INFO *infoPtr)
MapWindowPoints(HWND_DESKTOP, GetParent(infoPtr->hwndSelf), (LPPOINT)&rcSelf, 2); MapWindowPoints(HWND_DESKTOP, GetParent(infoPtr->hwndSelf), (LPPOINT)&rcSelf, 2);
translate_rect(infoPtr, &rcSelf, &rcSelf); translate_rect(infoPtr, &rcSelf, &rcSelf);
height = (infoPtr->dwStyle & CCS_VERT ? infoPtr->calcSize.cx : infoPtr->calcSize.cy) + 2*yedge; height = infoPtr->calcSize.cy + 2*yedge;
if (!(infoPtr->dwStyle & CCS_NOPARENTALIGN)) { if (!(infoPtr->dwStyle & CCS_NOPARENTALIGN)) {
RECT rcParent; RECT rcParent;
SIZE calcSize;
x = -xedge; x = -xedge;
width = (infoPtr->dwStyle & CCS_VERT ? infoPtr->calcSize.cy : infoPtr->calcSize.cx) + 2*xedge; width = infoPtr->calcSize.cx + 2*xedge;
y = 0; /* quiet compiler warning */ y = 0; /* quiet compiler warning */
switch ( infoPtr->dwStyle & CCS_LAYOUT_MASK) { switch ( infoPtr->dwStyle & CCS_LAYOUT_MASK) {
case 0: /* shouldn't happen - see NCCreate */ case 0: /* shouldn't happen - see NCCreate */
@ -985,9 +974,7 @@ REBAR_ForceResize (REBAR_INFO *infoPtr)
case CCS_BOTTOM: case CCS_BOTTOM:
GetClientRect(GetParent(infoPtr->hwndSelf), &rcParent); GetClientRect(GetParent(infoPtr->hwndSelf), &rcParent);
translate_rect(infoPtr, &rcParent, &rcParent); translate_rect(infoPtr, &rcParent, &rcParent);
calcSize = infoPtr->calcSize; y = rcParent.bottom - infoPtr->calcSize.cy - yedge;
swap_size_if_vert(infoPtr, &calcSize);
y = rcParent.bottom - calcSize.cy - yedge;
break; break;
} }
} }
@ -1375,7 +1362,6 @@ REBAR_Layout(REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify)
infoPtr->oldSize = infoPtr->calcSize; infoPtr->oldSize = infoPtr->calcSize;
infoPtr->calcSize.cx = adjcx; infoPtr->calcSize.cx = adjcx;
infoPtr->calcSize.cy = 0; infoPtr->calcSize.cy = 0;
swap_size_if_vert(infoPtr, &infoPtr->calcSize);
infoPtr->uNumRows = 0; infoPtr->uNumRows = 0;
REBAR_ForceResize(infoPtr); REBAR_ForceResize(infoPtr);
return; return;
@ -1417,9 +1403,8 @@ REBAR_Layout(REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify)
infoPtr->calcSize.cx = adjcx; infoPtr->calcSize.cx = adjcx;
infoPtr->calcSize.cy = yPos; infoPtr->calcSize.cy = yPos;
swap_size_if_vert(infoPtr, &infoPtr->calcSize); if (notify && (infoPtr->oldSize.cy != infoPtr->calcSize.cy))
if (infoPtr->calcSize.cx != infoPtr->oldSize.cx || infoPtr->calcSize.cy != infoPtr->oldSize.cy) infoPtr->fStatus |= NTF_HGHTCHG;
if (notify && (yPos != infoPtr->calcSize.cy)) infoPtr->fStatus |= NTF_HGHTCHG;
TRACE("calcsize notify=%d, size=(%d, %d), origheight=(%d,%d)\n", notify, TRACE("calcsize notify=%d, size=(%d, %d), origheight=(%d,%d)\n", notify,
infoPtr->calcSize.cx, infoPtr->calcSize.cy, infoPtr->calcSize.cx, infoPtr->calcSize.cy,
@ -1717,7 +1702,7 @@ REBAR_InternalEraseBkGnd (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, REC
rcRowSep = rcBand; rcRowSep = rcBand;
if (infoPtr->dwStyle & CCS_VERT) { if (infoPtr->dwStyle & CCS_VERT) {
rcRowSep.right += SEP_WIDTH_SIZE; rcRowSep.right += SEP_WIDTH_SIZE;
rcRowSep.bottom = infoPtr->calcSize.cy; rcRowSep.bottom = infoPtr->calcSize.cx;
if (theme) if (theme)
DrawThemeEdge (theme, hdc, RP_BAND, 0, &rcRowSep, EDGE_ETCHED, BF_RIGHT, NULL); DrawThemeEdge (theme, hdc, RP_BAND, 0, &rcRowSep, EDGE_ETCHED, BF_RIGHT, NULL);
else else
@ -2120,7 +2105,7 @@ REBAR_GetBarHeight (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
{ {
INT nHeight; INT nHeight;
nHeight = (infoPtr->dwStyle & CCS_VERT) ? infoPtr->calcSize.cx : infoPtr->calcSize.cy; nHeight = infoPtr->calcSize.cy;
TRACE("height = %d\n", nHeight); TRACE("height = %d\n", nHeight);
@ -2382,7 +2367,7 @@ REBAR_MaximizeBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
if (lParam && (lpBand->cxEffective < cxIdealBand)) if (lParam && (lpBand->cxEffective < cxIdealBand))
cxDesired = cxIdealBand; cxDesired = cxIdealBand;
else else
cxDesired = (infoPtr->dwStyle&CCS_VERT ? infoPtr->calcSize.cy : infoPtr->calcSize.cx); cxDesired = infoPtr->calcSize.cx;
iRowBegin = get_row_begin_for_band(infoPtr, uBand); iRowBegin = get_row_begin_for_band(infoPtr, uBand);
iRowEnd = get_row_end_for_band(infoPtr, uBand); iRowEnd = get_row_end_for_band(infoPtr, uBand);