4 * Copyright 1998, 1999 Eric Kohl
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 * This code was audited for completeness against the documented features
23 * of Comctl32.dll version 6.0 on Oct. 19, 2004, by Robert Shearman.
25 * Unless otherwise noted, we believe this code to be complete, as per
26 * the specification mentioned above.
27 * If you discover missing features or bugs please note them below.
51 * - WM_QUERYNEWPALETTE
59 * - NM_RELEASEDCAPTURE
65 * Native uses (on each draw!!) SM_CYBORDER (or SM_CXBORDER for CCS_VERT)
66 * to set the size of the separator width (the value SEP_WIDTH_SIZE
67 * in here). Should be fixed!!
71 * Testing: set to 1 to make background brush *always* green
76 * 3. REBAR_MoveChildWindows should have a loop because more than
77 * one pass is made (together with the RBN_CHILDSIZEs) is made on
78 * at least RB_INSERTBAND
88 #include "wine/unicode.h"
95 #include "wine/debug.h"
97 WINE_DEFAULT_DEBUG_CHANNEL(rebar
);
107 UINT cxMinChild
; /* valid if _CHILDSIZE */
108 UINT cyMinChild
; /* valid if _CHILDSIZE */
109 UINT cx
; /* valid if _SIZE */
112 UINT cyChild
; /* valid if _CHILDSIZE */
113 UINT cyMaxChild
; /* valid if _CHILDSIZE */
114 UINT cyIntegral
; /* valid if _CHILDSIZE */
119 INT cxEffective
; /* current cx for band */
120 UINT lcx
; /* minimum cx for band */
121 UINT lcy
; /* minimum cy for band */
123 INT iRow
; /* zero-based index of the row this band assigned to */
124 UINT fStatus
; /* status flags, reset only by _Validate */
125 UINT fDraw
; /* drawing flags, reset only by _Layout */
126 UINT uCDret
; /* last return from NM_CUSTOMDRAW */
127 RECT rcBand
; /* calculated band rectangle - coordinates swapped for CCS_VERT */
128 RECT rcGripper
; /* calculated gripper rectangle */
129 RECT rcCapImage
; /* calculated caption image rectangle */
130 RECT rcCapText
; /* calculated caption text rectangle */
131 RECT rcChild
; /* calculated child rectangle */
132 RECT rcChevron
; /* calculated chevron rectangle */
139 #define HAS_GRIPPER 0x00000001
140 #define HAS_IMAGE 0x00000002
141 #define HAS_TEXT 0x00000004
144 #define DRAW_GRIPPER 0x00000001
145 #define DRAW_IMAGE 0x00000002
146 #define DRAW_TEXT 0x00000004
147 #define DRAW_CHEVRONHOT 0x00000040
148 #define DRAW_CHEVRONPUSHED 0x00000080
149 #define NTF_INVALIDATE 0x01000000
153 COLORREF clrBk
; /* background color */
154 COLORREF clrText
; /* text color */
155 COLORREF clrBtnText
; /* system color for BTNTEXT */
156 COLORREF clrBtnFace
; /* system color for BTNFACE */
157 HIMAGELIST himl
; /* handle to imagelist */
158 UINT uNumBands
; /* # of bands in rebar (first=0, last=uNumBands-1 */
159 UINT uNumRows
; /* # of rows of bands (first=1, last=uNumRows */
160 HWND hwndSelf
; /* handle of REBAR window itself */
161 HWND hwndToolTip
; /* handle to the tool tip control */
162 HWND hwndNotify
; /* notification window (parent) */
164 HFONT hFont
; /* handle to the rebar's font */
165 SIZE imageSize
; /* image size (image list) */
166 DWORD dwStyle
; /* window style */
167 DWORD orgStyle
; /* original style (dwStyle may change) */
168 SIZE calcSize
; /* calculated rebar size - coordinates swapped for CCS_VERT */
169 BOOL bUnicode
; /* TRUE if parent wants notify in W format */
170 BOOL DoRedraw
; /* TRUE to acutally draw bands */
171 UINT fStatus
; /* Status flags (see below) */
172 HCURSOR hcurArrow
; /* handle to the arrow cursor */
173 HCURSOR hcurHorz
; /* handle to the EW cursor */
174 HCURSOR hcurVert
; /* handle to the NS cursor */
175 HCURSOR hcurDrag
; /* handle to the drag cursor */
176 INT iVersion
; /* version number */
177 POINT dragStart
; /* x,y of button down */
178 POINT dragNow
; /* x,y of this MouseMove */
179 INT iOldBand
; /* last band that had the mouse cursor over it */
180 INT ihitoffset
; /* offset of hotspot from gripper.left */
181 INT ichevronhotBand
; /* last band that had a hot chevron */
182 INT iGrabbedBand
;/* band number of band whose gripper was grabbed */
184 REBAR_BAND
*bands
; /* pointer to the array of rebar bands */
188 #define BEGIN_DRAG_ISSUED 0x00000001
189 #define AUTO_RESIZE 0x00000002
190 #define BAND_NEEDS_LAYOUT 0x00000010
191 #define BAND_NEEDS_REDRAW 0x00000020
193 /* used by Windows to mark that the header size has been set by the user and shouldn't be changed */
194 #define RBBS_UNDOC_FIXEDHEADER 0x40000000
196 /* ---- REBAR layout constants. Mostly determined by ---- */
197 /* ---- experiment on WIN 98. ---- */
199 /* Width (or height) of separators between bands (either horz. or */
200 /* vert.). True only if RBS_BANDBORDERS is set */
201 #define SEP_WIDTH_SIZE 2
202 #define SEP_WIDTH ((infoPtr->dwStyle & RBS_BANDBORDERS) ? SEP_WIDTH_SIZE : 0)
204 /* Blank (background color) space between Gripper (if present) */
205 /* and next item (image, text, or window). Always present */
206 #define REBAR_ALWAYS_SPACE 4
208 /* Blank (background color) space after Image (if present). */
209 #define REBAR_POST_IMAGE 2
211 /* Blank (background color) space after Text (if present). */
212 #define REBAR_POST_TEXT 4
214 /* Height of vertical gripper in a CCS_VERT rebar. */
215 #define GRIPPER_HEIGHT 16
217 /* Blank (background color) space before Gripper (if present). */
218 #define REBAR_PRE_GRIPPER 2
220 /* Width (of normal vertical gripper) or height (of horz. gripper) */
222 #define GRIPPER_WIDTH 3
224 /* Width of the chevron button if present */
225 #define CHEVRON_WIDTH 10
227 /* the gap between the child and the next band */
228 #define REBAR_POST_CHILD 4
230 /* Height of divider for Rebar if not disabled (CCS_NODIVIDER) */
231 /* either top or bottom */
232 #define REBAR_DIVIDER 2
234 /* height of a rebar without a child */
235 #define REBAR_NO_CHILD_HEIGHT 4
237 /* minimium vertical height of a normal bar */
238 /* or minimum width of a CCS_VERT bar - from experiment on Win2k */
239 #define REBAR_MINSIZE 23
241 /* This is the increment that is used over the band height */
242 #define REBARSPACE(a) ((a->fStyle & RBBS_CHILDEDGE) ? 2*REBAR_DIVIDER : 0)
244 /* ---- End of REBAR layout constants. ---- */
246 #define RB_GETBANDINFO_OLD (WM_USER+5) /* obsoleted after IE3, but we have to support it anyway */
248 /* The following define determines if a given band is hidden */
249 #define HIDDENBAND(a) (((a)->fStyle & RBBS_HIDDEN) || \
250 ((infoPtr->dwStyle & CCS_VERT) && \
251 ((a)->fStyle & RBBS_NOVERT)))
253 #define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)GetWindowLongPtrW (hwnd, 0))
255 static LRESULT
REBAR_NotifyFormat(REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
);
258 /* "constant values" retrieved when DLL was initialized */
259 /* FIXME we do this when the classes are registered. */
260 static UINT mindragx
= 0;
261 static UINT mindragy
= 0;
263 static const char * const band_stylename
[] = {
264 "RBBS_BREAK", /* 0001 */
265 "RBBS_FIXEDSIZE", /* 0002 */
266 "RBBS_CHILDEDGE", /* 0004 */
267 "RBBS_HIDDEN", /* 0008 */
268 "RBBS_NOVERT", /* 0010 */
269 "RBBS_FIXEDBMP", /* 0020 */
270 "RBBS_VARIABLEHEIGHT", /* 0040 */
271 "RBBS_GRIPPERALWAYS", /* 0080 */
272 "RBBS_NOGRIPPER", /* 0100 */
275 static const char * const band_maskname
[] = {
276 "RBBIM_STYLE", /* 0x00000001 */
277 "RBBIM_COLORS", /* 0x00000002 */
278 "RBBIM_TEXT", /* 0x00000004 */
279 "RBBIM_IMAGE", /* 0x00000008 */
280 "RBBIM_CHILD", /* 0x00000010 */
281 "RBBIM_CHILDSIZE", /* 0x00000020 */
282 "RBBIM_SIZE", /* 0x00000040 */
283 "RBBIM_BACKGROUND", /* 0x00000080 */
284 "RBBIM_ID", /* 0x00000100 */
285 "RBBIM_IDEALSIZE", /* 0x00000200 */
286 "RBBIM_LPARAM", /* 0x00000400 */
287 "RBBIM_HEADERSIZE", /* 0x00000800 */
291 static CHAR line
[200];
293 static const WCHAR themeClass
[] = { 'R','e','b','a','r',0 };
296 REBAR_FmtStyle( UINT style
)
301 while (band_stylename
[i
]) {
302 if (style
& (1<<i
)) {
303 if (*line
!= 0) strcat(line
, " | ");
304 strcat(line
, band_stylename
[i
]);
313 REBAR_FmtMask( UINT mask
)
318 while (band_maskname
[i
]) {
320 if (*line
!= 0) strcat(line
, " | ");
321 strcat(line
, band_maskname
[i
]);
330 REBAR_DumpBandInfo(LPREBARBANDINFOW pB
)
332 if( !TRACE_ON(rebar
) ) return;
333 TRACE("band info: ");
334 if (pB
->fMask
& RBBIM_ID
)
335 TRACE("ID=%u, ", pB
->wID
);
336 TRACE("size=%u, child=%p", pB
->cbSize
, pB
->hwndChild
);
337 if (pB
->fMask
& RBBIM_COLORS
)
338 TRACE(", clrF=0x%06x, clrB=0x%06x", pB
->clrFore
, pB
->clrBack
);
341 TRACE("band info: mask=0x%08x (%s)\n", pB
->fMask
, REBAR_FmtMask(pB
->fMask
));
342 if (pB
->fMask
& RBBIM_STYLE
)
343 TRACE("band info: style=0x%08x (%s)\n", pB
->fStyle
, REBAR_FmtStyle(pB
->fStyle
));
344 if (pB
->fMask
& (RBBIM_SIZE
| RBBIM_IDEALSIZE
| RBBIM_HEADERSIZE
| RBBIM_LPARAM
)) {
346 if (pB
->fMask
& RBBIM_SIZE
)
347 TRACE(" cx=%u", pB
->cx
);
348 if (pB
->fMask
& RBBIM_IDEALSIZE
)
349 TRACE(" xIdeal=%u", pB
->cxIdeal
);
350 if (pB
->fMask
& RBBIM_HEADERSIZE
)
351 TRACE(" xHeader=%u", pB
->cxHeader
);
352 if (pB
->fMask
& RBBIM_LPARAM
)
353 TRACE(" lParam=0x%08lx", pB
->lParam
);
356 if (pB
->fMask
& RBBIM_CHILDSIZE
)
357 TRACE("band info: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n",
359 pB
->cyMinChild
, pB
->cyChild
, pB
->cyMaxChild
, pB
->cyIntegral
);
363 REBAR_DumpBand (REBAR_INFO
*iP
)
368 if(! TRACE_ON(rebar
) ) return;
370 TRACE("hwnd=%p: color=%08x/%08x, bands=%u, rows=%u, cSize=%d,%d\n",
371 iP
->hwndSelf
, iP
->clrText
, iP
->clrBk
, iP
->uNumBands
, iP
->uNumRows
,
372 iP
->calcSize
.cx
, iP
->calcSize
.cy
);
373 TRACE("hwnd=%p: flags=%08x, dragStart=%d,%d, dragNow=%d,%d, iGrabbedBand=%d\n",
374 iP
->hwndSelf
, iP
->fStatus
, iP
->dragStart
.x
, iP
->dragStart
.y
,
375 iP
->dragNow
.x
, iP
->dragNow
.y
,
377 TRACE("hwnd=%p: style=%08x, notify in Unicode=%s, redraw=%s\n",
378 iP
->hwndSelf
, iP
->dwStyle
, (iP
->bUnicode
)?"TRUE":"FALSE",
379 (iP
->DoRedraw
)?"TRUE":"FALSE");
380 for (i
= 0; i
< iP
->uNumBands
; i
++) {
382 TRACE("band # %u:", i
);
383 if (pB
->fMask
& RBBIM_ID
)
384 TRACE(" ID=%u", pB
->wID
);
385 if (pB
->fMask
& RBBIM_CHILD
)
386 TRACE(" child=%p", pB
->hwndChild
);
387 if (pB
->fMask
& RBBIM_COLORS
)
388 TRACE(" clrF=0x%06x clrB=0x%06x", pB
->clrFore
, pB
->clrBack
);
390 TRACE("band # %u: mask=0x%08x (%s)\n", i
, pB
->fMask
, REBAR_FmtMask(pB
->fMask
));
391 if (pB
->fMask
& RBBIM_STYLE
)
392 TRACE("band # %u: style=0x%08x (%s)\n",
393 i
, pB
->fStyle
, REBAR_FmtStyle(pB
->fStyle
));
394 TRACE("band # %u: xHeader=%u",
396 if (pB
->fMask
& (RBBIM_SIZE
| RBBIM_IDEALSIZE
| RBBIM_LPARAM
)) {
397 if (pB
->fMask
& RBBIM_SIZE
)
398 TRACE(" cx=%u", pB
->cx
);
399 if (pB
->fMask
& RBBIM_IDEALSIZE
)
400 TRACE(" xIdeal=%u", pB
->cxIdeal
);
401 if (pB
->fMask
& RBBIM_LPARAM
)
402 TRACE(" lParam=0x%08lx", pB
->lParam
);
406 TRACE("band # %u: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n",
407 i
, pB
->cxMinChild
, pB
->cyMinChild
, pB
->cyChild
, pB
->cyMaxChild
, pB
->cyIntegral
);
408 if (pB
->fMask
& RBBIM_TEXT
)
409 TRACE("band # %u: text=%s\n",
410 i
, (pB
->lpText
) ? debugstr_w(pB
->lpText
) : "(null)");
411 TRACE("band # %u: lcx=%u, cxEffective=%u, lcy=%u\n",
412 i
, pB
->lcx
, pB
->cxEffective
, pB
->lcy
);
413 TRACE("band # %u: fStatus=%08x, fDraw=%08x, Band=(%d,%d)-(%d,%d), Grip=(%d,%d)-(%d,%d)\n",
414 i
, pB
->fStatus
, pB
->fDraw
,
415 pB
->rcBand
.left
, pB
->rcBand
.top
, pB
->rcBand
.right
, pB
->rcBand
.bottom
,
416 pB
->rcGripper
.left
, pB
->rcGripper
.top
, pB
->rcGripper
.right
, pB
->rcGripper
.bottom
);
417 TRACE("band # %u: Img=(%d,%d)-(%d,%d), Txt=(%d,%d)-(%d,%d), Child=(%d,%d)-(%d,%d)\n",
419 pB
->rcCapImage
.left
, pB
->rcCapImage
.top
, pB
->rcCapImage
.right
, pB
->rcCapImage
.bottom
,
420 pB
->rcCapText
.left
, pB
->rcCapText
.top
, pB
->rcCapText
.right
, pB
->rcCapText
.bottom
,
421 pB
->rcChild
.left
, pB
->rcChild
.top
, pB
->rcChild
.right
, pB
->rcChild
.bottom
);
426 /* dest can be equal to src */
427 static void translate_rect(REBAR_INFO
*infoPtr
, RECT
*dest
, const RECT
*src
)
429 if (infoPtr
->dwStyle
& CCS_VERT
) {
432 dest
->left
= src
->top
;
436 dest
->right
= src
->bottom
;
443 static int get_rect_cx(REBAR_INFO
*infoPtr
, RECT
*lpRect
)
445 if (infoPtr
->dwStyle
& CCS_VERT
)
446 return lpRect
->bottom
- lpRect
->top
;
447 return lpRect
->right
- lpRect
->left
;
450 static int get_rect_cy(REBAR_INFO
*infoPtr
, RECT
*lpRect
)
452 if (infoPtr
->dwStyle
& CCS_VERT
)
453 return lpRect
->right
- lpRect
->left
;
454 return lpRect
->bottom
- lpRect
->top
;
457 static void round_child_height(REBAR_BAND
*lpBand
, int cyHeight
)
460 if (lpBand
->cyIntegral
== 0)
462 cy
= max(cyHeight
- (int)lpBand
->cyMinChild
, 0);
463 cy
= lpBand
->cyMinChild
+ (cy
/lpBand
->cyIntegral
) * lpBand
->cyIntegral
;
464 cy
= min(cy
, lpBand
->cyMaxChild
);
465 lpBand
->cyChild
= cy
;
469 REBAR_DrawChevron (HDC hdc
, INT left
, INT top
, INT colorRef
)
474 if (!(hPen
= CreatePen( PS_SOLID
, 1, GetSysColor( colorRef
)))) return;
475 hOldPen
= SelectObject ( hdc
, hPen
);
478 MoveToEx (hdc
, x
, y
, NULL
);
479 LineTo (hdc
, x
+5, y
++); x
++;
480 MoveToEx (hdc
, x
, y
, NULL
);
481 LineTo (hdc
, x
+3, y
++); x
++;
482 MoveToEx (hdc
, x
, y
, NULL
);
483 LineTo (hdc
, x
+1, y
++);
484 SelectObject( hdc
, hOldPen
);
485 DeleteObject( hPen
);
489 REBAR_GetNotifyParent (REBAR_INFO
*infoPtr
)
493 parent
= infoPtr
->hwndNotify
;
495 parent
= GetParent (infoPtr
->hwndSelf
);
496 owner
= GetWindow (infoPtr
->hwndSelf
, GW_OWNER
);
497 if (owner
) parent
= owner
;
504 REBAR_Notify (NMHDR
*nmhdr
, REBAR_INFO
*infoPtr
, UINT code
)
508 parent
= REBAR_GetNotifyParent (infoPtr
);
509 nmhdr
->idFrom
= GetDlgCtrlID (infoPtr
->hwndSelf
);
510 nmhdr
->hwndFrom
= infoPtr
->hwndSelf
;
513 TRACE("window %p, code=%08x, via %s\n", parent
, code
, (infoPtr
->bUnicode
)?"Unicode":"ANSI");
515 return SendMessageW(parent
, WM_NOTIFY
, (WPARAM
)nmhdr
->idFrom
, (LPARAM
)nmhdr
);
519 REBAR_Notify_NMREBAR (REBAR_INFO
*infoPtr
, UINT uBand
, UINT code
)
521 NMREBAR notify_rebar
;
524 notify_rebar
.dwMask
= 0;
526 lpBand
= &infoPtr
->bands
[uBand
];
527 if (lpBand
->fMask
& RBBIM_ID
) {
528 notify_rebar
.dwMask
|= RBNM_ID
;
529 notify_rebar
.wID
= lpBand
->wID
;
531 if (lpBand
->fMask
& RBBIM_LPARAM
) {
532 notify_rebar
.dwMask
|= RBNM_LPARAM
;
533 notify_rebar
.lParam
= lpBand
->lParam
;
535 if (lpBand
->fMask
& RBBIM_STYLE
) {
536 notify_rebar
.dwMask
|= RBNM_STYLE
;
537 notify_rebar
.fStyle
= lpBand
->fStyle
;
540 notify_rebar
.uBand
= uBand
;
541 return REBAR_Notify ((NMHDR
*)¬ify_rebar
, infoPtr
, code
);
545 REBAR_DrawBand (HDC hdc
, REBAR_INFO
*infoPtr
, REBAR_BAND
*lpBand
)
550 HTHEME theme
= GetWindowTheme (infoPtr
->hwndSelf
);
553 translate_rect(infoPtr
, &rcBand
, &lpBand
->rcBand
);
555 if (lpBand
->fDraw
& DRAW_TEXT
) {
556 hOldFont
= SelectObject (hdc
, infoPtr
->hFont
);
557 oldBkMode
= SetBkMode (hdc
, TRANSPARENT
);
560 /* should test for CDRF_NOTIFYITEMDRAW here */
561 nmcd
.dwDrawStage
= CDDS_ITEMPREPAINT
;
564 nmcd
.rc
.right
= lpBand
->rcCapText
.right
;
565 nmcd
.rc
.bottom
= lpBand
->rcCapText
.bottom
;
566 nmcd
.dwItemSpec
= lpBand
->wID
;
568 nmcd
.lItemlParam
= lpBand
->lParam
;
569 lpBand
->uCDret
= REBAR_Notify ((NMHDR
*)&nmcd
, infoPtr
, NM_CUSTOMDRAW
);
570 if (lpBand
->uCDret
== CDRF_SKIPDEFAULT
) {
571 if (oldBkMode
!= TRANSPARENT
)
572 SetBkMode (hdc
, oldBkMode
);
573 SelectObject (hdc
, hOldFont
);
578 if (lpBand
->fDraw
& DRAW_GRIPPER
)
582 RECT rcGripper
= lpBand
->rcGripper
;
583 int partId
= (infoPtr
->dwStyle
& CCS_VERT
) ? RP_GRIPPERVERT
: RP_GRIPPER
;
584 GetThemeBackgroundExtent (theme
, hdc
, partId
, 0, &rcGripper
, &rcGripper
);
585 OffsetRect (&rcGripper
, lpBand
->rcGripper
.left
- rcGripper
.left
,
586 lpBand
->rcGripper
.top
- rcGripper
.top
);
587 DrawThemeBackground (theme
, hdc
, partId
, 0, &rcGripper
, NULL
);
590 DrawEdge (hdc
, &lpBand
->rcGripper
, BDR_RAISEDINNER
, BF_RECT
| BF_MIDDLE
);
593 /* draw caption image */
594 if (lpBand
->fDraw
& DRAW_IMAGE
) {
598 pt
.y
= (lpBand
->rcCapImage
.bottom
+ lpBand
->rcCapImage
.top
- infoPtr
->imageSize
.cy
)/2;
599 pt
.x
= (lpBand
->rcCapImage
.right
+ lpBand
->rcCapImage
.left
- infoPtr
->imageSize
.cx
)/2;
601 ImageList_Draw (infoPtr
->himl
, lpBand
->iImage
, hdc
,
606 /* draw caption text */
607 if (lpBand
->fDraw
& DRAW_TEXT
) {
608 /* need to handle CDRF_NEWFONT here */
609 INT oldBkMode
= SetBkMode (hdc
, TRANSPARENT
);
610 COLORREF oldcolor
= CLR_NONE
;
612 if (lpBand
->clrFore
!= CLR_NONE
) {
613 new = (lpBand
->clrFore
== CLR_DEFAULT
) ? infoPtr
->clrBtnText
:
615 oldcolor
= SetTextColor (hdc
, new);
617 DrawTextW (hdc
, lpBand
->lpText
, -1, &lpBand
->rcCapText
,
618 DT_CENTER
| DT_VCENTER
| DT_SINGLELINE
);
619 if (oldBkMode
!= TRANSPARENT
)
620 SetBkMode (hdc
, oldBkMode
);
621 if (lpBand
->clrFore
!= CLR_NONE
)
622 SetTextColor (hdc
, oldcolor
);
623 SelectObject (hdc
, hOldFont
);
626 if (!IsRectEmpty(&lpBand
->rcChevron
))
631 if (lpBand
->fDraw
& DRAW_CHEVRONPUSHED
)
632 stateId
= CHEVS_PRESSED
;
633 else if (lpBand
->fDraw
& DRAW_CHEVRONHOT
)
636 stateId
= CHEVS_NORMAL
;
637 DrawThemeBackground (theme
, hdc
, RP_CHEVRON
, stateId
, &lpBand
->rcChevron
, NULL
);
641 if (lpBand
->fDraw
& DRAW_CHEVRONPUSHED
)
643 DrawEdge(hdc
, &lpBand
->rcChevron
, BDR_SUNKENOUTER
, BF_RECT
| BF_MIDDLE
);
644 REBAR_DrawChevron(hdc
, lpBand
->rcChevron
.left
+1, lpBand
->rcChevron
.top
+ 11, COLOR_WINDOWFRAME
);
646 else if (lpBand
->fDraw
& DRAW_CHEVRONHOT
)
648 DrawEdge(hdc
, &lpBand
->rcChevron
, BDR_RAISEDINNER
, BF_RECT
| BF_MIDDLE
);
649 REBAR_DrawChevron(hdc
, lpBand
->rcChevron
.left
, lpBand
->rcChevron
.top
+ 10, COLOR_WINDOWFRAME
);
652 REBAR_DrawChevron(hdc
, lpBand
->rcChevron
.left
, lpBand
->rcChevron
.top
+ 10, COLOR_WINDOWFRAME
);
656 if (lpBand
->uCDret
== (CDRF_NOTIFYPOSTPAINT
| CDRF_NOTIFYITEMDRAW
)) {
657 nmcd
.dwDrawStage
= CDDS_ITEMPOSTPAINT
;
660 nmcd
.rc
.right
= lpBand
->rcCapText
.right
;
661 nmcd
.rc
.bottom
= lpBand
->rcCapText
.bottom
;
662 nmcd
.dwItemSpec
= lpBand
->wID
;
664 nmcd
.lItemlParam
= lpBand
->lParam
;
665 lpBand
->uCDret
= REBAR_Notify ((NMHDR
*)&nmcd
, infoPtr
, NM_CUSTOMDRAW
);
671 REBAR_Refresh (REBAR_INFO
*infoPtr
, HDC hdc
)
676 if (!infoPtr
->DoRedraw
) return;
678 for (i
= 0; i
< infoPtr
->uNumBands
; i
++) {
679 lpBand
= &infoPtr
->bands
[i
];
681 if (HIDDENBAND(lpBand
)) continue;
683 /* now draw the band */
684 TRACE("[%p] drawing band %i, flags=%08x\n",
685 infoPtr
->hwndSelf
, i
, lpBand
->fDraw
);
686 REBAR_DrawBand (hdc
, infoPtr
, lpBand
);
693 REBAR_CalcHorzBand (REBAR_INFO
*infoPtr
, UINT rstart
, UINT rend
)
694 /* Function: this routine initializes all the rectangles in */
695 /* each band in a row to fit in the adjusted rcBand rect. */
696 /* *** Supports only Horizontal bars. *** */
702 for(i
=rstart
; i
<rend
; i
++){
703 lpBand
= &infoPtr
->bands
[i
];
704 if (HIDDENBAND(lpBand
)) {
705 SetRect (&lpBand
->rcChild
,
706 lpBand
->rcBand
.right
, lpBand
->rcBand
.top
,
707 lpBand
->rcBand
.right
, lpBand
->rcBand
.bottom
);
711 /* set initial gripper rectangle */
712 SetRect (&lpBand
->rcGripper
, lpBand
->rcBand
.left
, lpBand
->rcBand
.top
,
713 lpBand
->rcBand
.left
, lpBand
->rcBand
.bottom
);
715 /* calculate gripper rectangle */
716 if ( lpBand
->fStatus
& HAS_GRIPPER
) {
717 lpBand
->fDraw
|= DRAW_GRIPPER
;
718 lpBand
->rcGripper
.left
+= REBAR_PRE_GRIPPER
;
719 lpBand
->rcGripper
.right
= lpBand
->rcGripper
.left
+ GRIPPER_WIDTH
;
720 lpBand
->rcGripper
.top
+= 2;
721 lpBand
->rcGripper
.bottom
-= 2;
723 SetRect (&lpBand
->rcCapImage
,
724 lpBand
->rcGripper
.right
+REBAR_ALWAYS_SPACE
, lpBand
->rcBand
.top
,
725 lpBand
->rcGripper
.right
+REBAR_ALWAYS_SPACE
, lpBand
->rcBand
.bottom
);
727 else { /* no gripper will be drawn */
729 if (lpBand
->fStatus
& (HAS_IMAGE
| HAS_TEXT
))
730 /* if no gripper but either image or text, then leave space */
731 xoff
= REBAR_ALWAYS_SPACE
;
732 SetRect (&lpBand
->rcCapImage
,
733 lpBand
->rcBand
.left
+xoff
, lpBand
->rcBand
.top
,
734 lpBand
->rcBand
.left
+xoff
, lpBand
->rcBand
.bottom
);
737 /* image is visible */
738 if (lpBand
->fStatus
& HAS_IMAGE
) {
739 lpBand
->fDraw
|= DRAW_IMAGE
;
740 lpBand
->rcCapImage
.right
+= infoPtr
->imageSize
.cx
;
741 lpBand
->rcCapImage
.bottom
= lpBand
->rcCapImage
.top
+ infoPtr
->imageSize
.cy
;
743 /* set initial caption text rectangle */
744 SetRect (&lpBand
->rcCapText
,
745 lpBand
->rcCapImage
.right
+REBAR_POST_IMAGE
, lpBand
->rcBand
.top
+1,
746 lpBand
->rcBand
.left
+lpBand
->cxHeader
, lpBand
->rcBand
.bottom
-1);
749 /* set initial caption text rectangle */
750 SetRect (&lpBand
->rcCapText
, lpBand
->rcCapImage
.right
, lpBand
->rcBand
.top
+1,
751 lpBand
->rcBand
.left
+lpBand
->cxHeader
, lpBand
->rcBand
.bottom
-1);
754 /* text is visible */
755 if ((lpBand
->fStatus
& HAS_TEXT
) && !(lpBand
->fStyle
& RBBS_HIDETITLE
)) {
756 lpBand
->fDraw
|= DRAW_TEXT
;
757 lpBand
->rcCapText
.right
= max(lpBand
->rcCapText
.left
,
758 lpBand
->rcCapText
.right
-REBAR_POST_TEXT
);
761 /* set initial child window rectangle if there is a child */
762 if (lpBand
->hwndChild
!= NULL
) {
763 int cyBand
= lpBand
->rcBand
.bottom
- lpBand
->rcBand
.top
;
764 yoff
= (cyBand
- lpBand
->cyChild
) / 2;
765 SetRect (&lpBand
->rcChild
,
766 lpBand
->rcBand
.left
+ lpBand
->cxHeader
, lpBand
->rcBand
.top
+ yoff
,
767 lpBand
->rcBand
.right
- REBAR_POST_CHILD
, lpBand
->rcBand
.top
+ yoff
+ lpBand
->cyChild
);
768 if ((lpBand
->fStyle
& RBBS_USECHEVRON
) && (lpBand
->rcChild
.right
- lpBand
->rcChild
.left
< lpBand
->cxIdeal
))
770 lpBand
->rcChild
.right
-= CHEVRON_WIDTH
;
771 SetRect(&lpBand
->rcChevron
, lpBand
->rcChild
.right
,
772 lpBand
->rcChild
.top
, lpBand
->rcChild
.right
+ CHEVRON_WIDTH
,
773 lpBand
->rcChild
.bottom
);
777 SetRect (&lpBand
->rcChild
,
778 lpBand
->rcBand
.left
+lpBand
->cxHeader
, lpBand
->rcBand
.top
,
779 lpBand
->rcBand
.right
, lpBand
->rcBand
.bottom
);
782 /* flag if notify required and invalidate rectangle */
783 if (lpBand
->fDraw
& NTF_INVALIDATE
) {
784 TRACE("invalidating (%d,%d)-(%d,%d)\n",
787 lpBand
->rcBand
.right
+ SEP_WIDTH
,
788 lpBand
->rcBand
.bottom
+ SEP_WIDTH
);
789 lpBand
->fDraw
&= ~NTF_INVALIDATE
;
790 work
= lpBand
->rcBand
;
791 work
.right
+= SEP_WIDTH
;
792 work
.bottom
+= SEP_WIDTH
;
793 InvalidateRect(infoPtr
->hwndSelf
, &work
, TRUE
);
802 REBAR_CalcVertBand (REBAR_INFO
*infoPtr
, UINT rstart
, UINT rend
)
803 /* Function: this routine initializes all the rectangles in */
804 /* each band in a row to fit in the adjusted rcBand rect. */
805 /* *** Supports only Vertical bars. *** */
811 for(i
=rstart
; i
<rend
; i
++){
813 lpBand
= &infoPtr
->bands
[i
];
814 if (HIDDENBAND(lpBand
)) continue;
816 translate_rect(infoPtr
, &rcBand
, &lpBand
->rcBand
);
818 /* set initial gripper rectangle */
819 SetRect (&lpBand
->rcGripper
, rcBand
.left
, rcBand
.top
, rcBand
.right
, rcBand
.top
);
821 /* calculate gripper rectangle */
822 if (lpBand
->fStatus
& HAS_GRIPPER
) {
823 lpBand
->fDraw
|= DRAW_GRIPPER
;
825 if (infoPtr
->dwStyle
& RBS_VERTICALGRIPPER
) {
826 /* vertical gripper */
827 lpBand
->rcGripper
.left
+= 3;
828 lpBand
->rcGripper
.right
= lpBand
->rcGripper
.left
+ GRIPPER_WIDTH
;
829 lpBand
->rcGripper
.top
+= REBAR_PRE_GRIPPER
;
830 lpBand
->rcGripper
.bottom
= lpBand
->rcGripper
.top
+ GRIPPER_HEIGHT
;
832 /* initialize Caption image rectangle */
833 SetRect (&lpBand
->rcCapImage
, rcBand
.left
,
834 lpBand
->rcGripper
.bottom
+ REBAR_ALWAYS_SPACE
,
836 lpBand
->rcGripper
.bottom
+ REBAR_ALWAYS_SPACE
);
839 /* horizontal gripper */
840 lpBand
->rcGripper
.left
+= 2;
841 lpBand
->rcGripper
.right
-= 2;
842 lpBand
->rcGripper
.top
+= REBAR_PRE_GRIPPER
;
843 lpBand
->rcGripper
.bottom
= lpBand
->rcGripper
.top
+ GRIPPER_WIDTH
;
845 /* initialize Caption image rectangle */
846 SetRect (&lpBand
->rcCapImage
, rcBand
.left
,
847 lpBand
->rcGripper
.bottom
+ REBAR_ALWAYS_SPACE
,
849 lpBand
->rcGripper
.bottom
+ REBAR_ALWAYS_SPACE
);
852 else { /* no gripper will be drawn */
854 if (lpBand
->fStatus
& (HAS_IMAGE
| HAS_TEXT
))
855 /* if no gripper but either image or text, then leave space */
856 xoff
= REBAR_ALWAYS_SPACE
;
857 /* initialize Caption image rectangle */
858 SetRect (&lpBand
->rcCapImage
,
859 rcBand
.left
, rcBand
.top
+xoff
,
860 rcBand
.right
, rcBand
.top
+xoff
);
863 /* image is visible */
864 if (lpBand
->fStatus
& HAS_IMAGE
) {
865 lpBand
->fDraw
|= DRAW_IMAGE
;
867 lpBand
->rcCapImage
.right
= lpBand
->rcCapImage
.left
+ infoPtr
->imageSize
.cx
;
868 lpBand
->rcCapImage
.bottom
+= infoPtr
->imageSize
.cy
;
870 /* set initial caption text rectangle */
871 SetRect (&lpBand
->rcCapText
,
872 rcBand
.left
, lpBand
->rcCapImage
.bottom
+REBAR_POST_IMAGE
,
873 rcBand
.right
, rcBand
.top
+lpBand
->cxHeader
);
876 /* set initial caption text rectangle */
877 SetRect (&lpBand
->rcCapText
,
878 rcBand
.left
, lpBand
->rcCapImage
.bottom
,
879 rcBand
.right
, rcBand
.top
+lpBand
->cxHeader
);
882 /* text is visible */
883 if ((lpBand
->fStatus
& HAS_TEXT
) && !(lpBand
->fStyle
& RBBS_HIDETITLE
)) {
884 lpBand
->fDraw
|= DRAW_TEXT
;
885 lpBand
->rcCapText
.bottom
= max(lpBand
->rcCapText
.top
,
886 lpBand
->rcCapText
.bottom
);
889 /* set initial child window rectangle if there is a child */
890 if (lpBand
->hwndChild
!= NULL
) {
891 int cxBand
= rcBand
.right
- rcBand
.left
;
892 xoff
= (cxBand
- lpBand
->cyChild
) / 2;
893 SetRect (&lpBand
->rcChild
,
894 rcBand
.left
+ xoff
, rcBand
.top
+ lpBand
->cxHeader
,
895 rcBand
.left
+ xoff
+ lpBand
->cyChild
, rcBand
.bottom
- REBAR_POST_CHILD
);
898 SetRect (&lpBand
->rcChild
,
899 rcBand
.left
, rcBand
.top
+lpBand
->cxHeader
,
900 rcBand
.right
, rcBand
.bottom
);
903 if (lpBand
->fDraw
& NTF_INVALIDATE
) {
904 TRACE("invalidating (%d,%d)-(%d,%d)\n",
907 rcBand
.right
+ SEP_WIDTH
,
908 rcBand
.bottom
+ SEP_WIDTH
);
909 lpBand
->fDraw
&= ~NTF_INVALIDATE
;
911 work
.bottom
+= SEP_WIDTH
;
912 work
.right
+= SEP_WIDTH
;
913 InvalidateRect(infoPtr
->hwndSelf
, &work
, TRUE
);
921 REBAR_ForceResize (REBAR_INFO
*infoPtr
)
922 /* Function: This changes the size of the REBAR window to that */
923 /* calculated by REBAR_Layout. */
925 INT x
, y
, width
, height
;
926 INT xedge
= 0, yedge
= 0;
929 TRACE("new size [%d x %d]\n", infoPtr
->calcSize
.cx
, infoPtr
->calcSize
.cy
);
931 if (infoPtr
->dwStyle
& CCS_NORESIZE
)
934 if (infoPtr
->dwStyle
& WS_BORDER
)
936 xedge
= GetSystemMetrics(SM_CXEDGE
);
937 yedge
= GetSystemMetrics(SM_CYEDGE
);
938 /* swap for CCS_VERT? */
941 /* compute rebar window rect in parent client coordinates */
942 GetWindowRect(infoPtr
->hwndSelf
, &rcSelf
);
943 MapWindowPoints(HWND_DESKTOP
, GetParent(infoPtr
->hwndSelf
), (LPPOINT
)&rcSelf
, 2);
944 translate_rect(infoPtr
, &rcSelf
, &rcSelf
);
946 height
= infoPtr
->calcSize
.cy
+ 2*yedge
;
947 if (!(infoPtr
->dwStyle
& CCS_NOPARENTALIGN
)) {
951 width
= infoPtr
->calcSize
.cx
+ 2*xedge
;
952 y
= 0; /* quiet compiler warning */
953 switch ( infoPtr
->dwStyle
& CCS_LAYOUT_MASK
) {
954 case 0: /* shouldn't happen - see NCCreate */
956 y
= ((infoPtr
->dwStyle
& CCS_NODIVIDER
) ? 0 : REBAR_DIVIDER
) - yedge
;
962 GetClientRect(GetParent(infoPtr
->hwndSelf
), &rcParent
);
963 translate_rect(infoPtr
, &rcParent
, &rcParent
);
964 y
= rcParent
.bottom
- infoPtr
->calcSize
.cy
- yedge
;
970 /* As on Windows if the CCS_NODIVIDER is not present the control will move
971 * 2 pixel down after every layout */
972 y
= rcSelf
.top
+ ((infoPtr
->dwStyle
& CCS_NODIVIDER
) ? 0 : REBAR_DIVIDER
);
973 width
= rcSelf
.right
- rcSelf
.left
;
976 TRACE("hwnd %p, style=%08x, setting at (%d,%d) for (%d,%d)\n",
977 infoPtr
->hwndSelf
, infoPtr
->dwStyle
, x
, y
, width
, height
);
979 /* Set flag to ignore next WM_SIZE message and resize the window */
980 infoPtr
->fStatus
|= AUTO_RESIZE
;
981 if ((infoPtr
->dwStyle
& CCS_VERT
) == 0)
982 SetWindowPos(infoPtr
->hwndSelf
, 0, x
, y
, width
, height
, SWP_NOZORDER
);
984 SetWindowPos(infoPtr
->hwndSelf
, 0, y
, x
, height
, width
, SWP_NOZORDER
);
985 infoPtr
->fStatus
&= ~AUTO_RESIZE
;
990 REBAR_MoveChildWindows (REBAR_INFO
*infoPtr
, UINT start
, UINT endplus
)
992 static const WCHAR strComboBox
[] = { 'C','o','m','b','o','B','o','x',0 };
994 WCHAR szClassName
[40];
996 NMREBARCHILDSIZE rbcz
;
999 if (!(deferpos
= BeginDeferWindowPos(infoPtr
->uNumBands
)))
1000 ERR("BeginDeferWindowPos returned NULL\n");
1002 for (i
= start
; i
< endplus
; i
++) {
1003 lpBand
= &infoPtr
->bands
[i
];
1005 if (HIDDENBAND(lpBand
)) continue;
1006 if (lpBand
->hwndChild
) {
1007 TRACE("hwndChild = %p\n", lpBand
->hwndChild
);
1009 /* Always geterate the RBN_CHILDSIZE even it child
1012 rbcz
.wID
= lpBand
->wID
;
1013 rbcz
.rcChild
= lpBand
->rcChild
;
1014 translate_rect(infoPtr
, &rbcz
.rcBand
, &lpBand
->rcBand
);
1015 if (infoPtr
->dwStyle
& CCS_VERT
)
1016 rbcz
.rcBand
.top
+= lpBand
->cxHeader
;
1018 rbcz
.rcBand
.left
+= lpBand
->cxHeader
;
1019 REBAR_Notify ((NMHDR
*)&rbcz
, infoPtr
, RBN_CHILDSIZE
);
1020 if (!EqualRect (&lpBand
->rcChild
, &rbcz
.rcChild
)) {
1021 TRACE("Child rect changed by NOTIFY for band %u\n", i
);
1022 TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n",
1023 lpBand
->rcChild
.left
, lpBand
->rcChild
.top
,
1024 lpBand
->rcChild
.right
, lpBand
->rcChild
.bottom
,
1025 rbcz
.rcChild
.left
, rbcz
.rcChild
.top
,
1026 rbcz
.rcChild
.right
, rbcz
.rcChild
.bottom
);
1027 lpBand
->rcChild
= rbcz
.rcChild
; /* *** ??? */
1030 /* native (IE4 in "Favorites" frame **1) does:
1031 * SetRect (&rc, -1, -1, -1, -1)
1032 * EqualRect (&rc,band->rc???)
1034 * CopyRect (band->rc????, &rc)
1035 * set flag outside of loop
1038 GetClassNameW (lpBand
->hwndChild
, szClassName
, sizeof(szClassName
)/sizeof(szClassName
[0]));
1039 if (!lstrcmpW (szClassName
, strComboBox
) ||
1040 !lstrcmpW (szClassName
, WC_COMBOBOXEXW
)) {
1041 INT nEditHeight
, yPos
;
1044 /* special placement code for combo or comboex box */
1047 /* get size of edit line */
1048 GetWindowRect (lpBand
->hwndChild
, &rc
);
1049 nEditHeight
= rc
.bottom
- rc
.top
;
1050 yPos
= (lpBand
->rcChild
.bottom
+ lpBand
->rcChild
.top
- nEditHeight
)/2;
1052 /* center combo box inside child area */
1053 TRACE("moving child (Combo(Ex)) %p to (%d,%d) for (%d,%d)\n",
1055 lpBand
->rcChild
.left
, yPos
,
1056 lpBand
->rcChild
.right
- lpBand
->rcChild
.left
,
1058 deferpos
= DeferWindowPos (deferpos
, lpBand
->hwndChild
, HWND_TOP
,
1059 lpBand
->rcChild
.left
,
1060 /*lpBand->rcChild.top*/ yPos
,
1061 lpBand
->rcChild
.right
- lpBand
->rcChild
.left
,
1065 ERR("DeferWindowPos returned NULL\n");
1068 TRACE("moving child (Other) %p to (%d,%d) for (%d,%d)\n",
1070 lpBand
->rcChild
.left
, lpBand
->rcChild
.top
,
1071 lpBand
->rcChild
.right
- lpBand
->rcChild
.left
,
1072 lpBand
->rcChild
.bottom
- lpBand
->rcChild
.top
);
1073 deferpos
= DeferWindowPos (deferpos
, lpBand
->hwndChild
, HWND_TOP
,
1074 lpBand
->rcChild
.left
,
1075 lpBand
->rcChild
.top
,
1076 lpBand
->rcChild
.right
- lpBand
->rcChild
.left
,
1077 lpBand
->rcChild
.bottom
- lpBand
->rcChild
.top
,
1080 ERR("DeferWindowPos returned NULL\n");
1084 if (!EndDeferWindowPos(deferpos
))
1085 ERR("EndDeferWindowPos returned NULL\n");
1087 if (infoPtr
->DoRedraw
)
1088 UpdateWindow (infoPtr
->hwndSelf
);
1090 /* native (from **1 above) does:
1091 * UpdateWindow(rebar)
1093 * RBN_HEIGHTCHANGE if necessary
1094 * if ret from any EqualRect was 0
1095 * Goto "BeginDeferWindowPos"
1100 static int next_band(REBAR_INFO
*infoPtr
, int i
)
1103 for (n
= i
+ 1; n
< infoPtr
->uNumBands
; n
++)
1104 if (!HIDDENBAND(&infoPtr
->bands
[n
]))
1109 static int prev_band(REBAR_INFO
*infoPtr
, int i
)
1112 for (n
= i
- 1; n
>= 0; n
--)
1113 if (!HIDDENBAND(&infoPtr
->bands
[n
]))
1118 static int get_row_begin_for_band(REBAR_INFO
*infoPtr
, INT iBand
)
1120 int iLastBand
= iBand
;
1121 int iRow
= infoPtr
->bands
[iBand
].iRow
;
1122 while ((iBand
= prev_band(infoPtr
, iBand
)) >= 0) {
1123 if (infoPtr
->bands
[iBand
].iRow
!= iRow
)
1131 static int get_row_end_for_band(REBAR_INFO
*infoPtr
, INT iBand
)
1133 int iRow
= infoPtr
->bands
[iBand
].iRow
;
1134 while ((iBand
= next_band(infoPtr
, iBand
)) < infoPtr
->uNumBands
)
1135 if (infoPtr
->bands
[iBand
].iRow
!= iRow
)
1140 static void REBAR_SetRowRectsX(REBAR_INFO
*infoPtr
, INT iBeginBand
, INT iEndBand
)
1143 for (i
= iBeginBand
; i
< iEndBand
; i
= next_band(infoPtr
, i
))
1145 REBAR_BAND
*lpBand
= &infoPtr
->bands
[i
];
1147 lpBand
= &infoPtr
->bands
[i
];
1148 if (lpBand
->rcBand
.left
!= xPos
|| lpBand
->rcBand
.right
!= xPos
+ lpBand
->cxEffective
) {
1149 lpBand
->fDraw
|= NTF_INVALIDATE
;
1150 TRACE("Setting rect %d to %d,%d\n", i
, xPos
, xPos
+ lpBand
->cxEffective
);
1151 lpBand
->rcBand
.left
= xPos
;
1152 lpBand
->rcBand
.right
= xPos
+ lpBand
->cxEffective
;
1154 xPos
+= lpBand
->cxEffective
+ SEP_WIDTH
;
1158 /* The rationale of this function is probably as follows: if we have some space
1159 * to distribute we want to add it to a band on the right. However we don't want
1160 * to unminimize a minimized band so we search for a band that is big enough.
1161 * For some reason "big enough" is defined as bigger than the minimum size of the
1162 * first band in the row
1164 static REBAR_BAND
*REBAR_FindBandToGrow(REBAR_INFO
*infoPtr
, INT iBeginBand
, INT iEndBand
)
1168 iLcx
= infoPtr
->bands
[iBeginBand
].lcx
;
1170 for (i
= prev_band(infoPtr
, iEndBand
); i
>= iBeginBand
; i
= prev_band(infoPtr
, i
))
1171 if (infoPtr
->bands
[i
].cxEffective
> iLcx
&& !(infoPtr
->bands
[i
].fStyle
&RBBS_FIXEDSIZE
))
1175 for (i
= prev_band(infoPtr
, iEndBand
); i
>= iBeginBand
; i
= prev_band(infoPtr
, i
))
1176 if (infoPtr
->bands
[i
].lcx
== iLcx
)
1179 TRACE("Extra space for row [%d..%d) should be added to band %d\n", iBeginBand
, iEndBand
, i
);
1180 return &infoPtr
->bands
[i
];
1183 static int REBAR_ShrinkBandsRTL(REBAR_INFO
*infoPtr
, INT iBeginBand
, INT iEndBand
, INT cxShrink
, BOOL bEnforce
)
1188 TRACE("Shrinking bands [%d..%d) by %d, right-to-left\n", iBeginBand
, iEndBand
, cxShrink
);
1189 for (i
= prev_band(infoPtr
, iEndBand
); i
>= iBeginBand
; i
= prev_band(infoPtr
, i
))
1191 lpBand
= &infoPtr
->bands
[i
];
1193 width
= max(lpBand
->cxEffective
- cxShrink
, (int)lpBand
->lcx
);
1194 cxShrink
-= lpBand
->cxEffective
- width
;
1195 lpBand
->cxEffective
= width
;
1196 if (bEnforce
&& lpBand
->cx
> lpBand
->cxEffective
)
1197 lpBand
->cx
= lpBand
->cxEffective
;
1205 static int REBAR_ShrinkBandsLTR(REBAR_INFO
*infoPtr
, INT iBeginBand
, INT iEndBand
, INT cxShrink
, BOOL bEnforce
)
1210 TRACE("Shrinking bands [%d..%d) by %d, left-to-right\n", iBeginBand
, iEndBand
, cxShrink
);
1211 for (i
= iBeginBand
; i
< iEndBand
; i
= next_band(infoPtr
, i
))
1213 lpBand
= &infoPtr
->bands
[i
];
1215 width
= max(lpBand
->cxEffective
- cxShrink
, (int)lpBand
->lcx
);
1216 cxShrink
-= lpBand
->cxEffective
- width
;
1217 lpBand
->cxEffective
= width
;
1219 lpBand
->cx
= lpBand
->cxEffective
;
1226 static int REBAR_SetBandsHeight(REBAR_INFO
*infoPtr
, INT iBeginBand
, INT iEndBand
, INT yStart
)
1231 int row
= infoPtr
->bands
[iBeginBand
].iRow
;
1233 for (i
= iBeginBand
; i
< iEndBand
; i
= next_band(infoPtr
, i
))
1235 lpBand
= &infoPtr
->bands
[i
];
1236 yMaxHeight
= max(yMaxHeight
, lpBand
->lcy
);
1238 TRACE("Bands [%d; %d) height: %d\n", iBeginBand
, iEndBand
, yMaxHeight
);
1240 for (i
= iBeginBand
; i
< iEndBand
; i
= next_band(infoPtr
, i
))
1242 lpBand
= &infoPtr
->bands
[i
];
1243 /* we may be called for multiple rows if RBS_VARHEIGHT not set */
1244 if (lpBand
->iRow
!= row
) {
1245 yPos
+= yMaxHeight
+ SEP_WIDTH
;
1249 if (lpBand
->rcBand
.top
!= yPos
|| lpBand
->rcBand
.bottom
!= yPos
+ yMaxHeight
) {
1250 lpBand
->fDraw
|= NTF_INVALIDATE
;
1251 lpBand
->rcBand
.top
= yPos
;
1252 lpBand
->rcBand
.bottom
= yPos
+ yMaxHeight
;
1253 TRACE("Band %d: %s\n", i
, wine_dbgstr_rect(&lpBand
->rcBand
));
1256 return yPos
+ yMaxHeight
;
1259 static void REBAR_LayoutRow(REBAR_INFO
*infoPtr
, int iBeginBand
, int iEndBand
, int cx
, int *piRow
, int *pyPos
)
1265 TRACE("Adjusting row [%d;%d). Width: %d\n", iBeginBand
, iEndBand
, cx
);
1266 for (i
= iBeginBand
; i
< iEndBand
; i
++)
1267 infoPtr
->bands
[i
].iRow
= *piRow
;
1269 /* compute the extra space */
1270 for (i
= iBeginBand
; i
< iEndBand
; i
= next_band(infoPtr
, i
))
1272 lpBand
= &infoPtr
->bands
[i
];
1275 lpBand
->cxEffective
= max(lpBand
->lcx
, lpBand
->cx
);
1276 width
+= lpBand
->cxEffective
;
1280 TRACE("Extra space: %d\n", extra
);
1282 int ret
= REBAR_ShrinkBandsRTL(infoPtr
, iBeginBand
, iEndBand
, -extra
, FALSE
);
1283 if (ret
> 0 && next_band(infoPtr
, iBeginBand
) != iEndBand
) /* one band may be longer than expected... */
1284 ERR("Error layouting row %d - couldn't shrink for %d pixels (%d total shrink)\n", *piRow
, ret
, -extra
);
1287 lpBand
= REBAR_FindBandToGrow(infoPtr
, iBeginBand
, iEndBand
);
1288 lpBand
->cxEffective
+= extra
;
1291 REBAR_SetRowRectsX(infoPtr
, iBeginBand
, iEndBand
);
1292 if (infoPtr
->dwStyle
& RBS_VARHEIGHT
)
1295 *pyPos
+= SEP_WIDTH
;
1296 *pyPos
= REBAR_SetBandsHeight(infoPtr
, iBeginBand
, iEndBand
, *pyPos
);
1302 REBAR_Layout(REBAR_INFO
*infoPtr
, LPRECT lpRect
, BOOL notify
)
1307 INT adjcx
, adjcy
, i
;
1312 const INT yInit
= 0;
1314 if (!(infoPtr
->fStatus
& BAND_NEEDS_LAYOUT
)) {
1315 TRACE("no layout done. No band changed.\n");
1316 REBAR_DumpBand (infoPtr
);
1320 infoPtr
->fStatus
&= ~BAND_NEEDS_LAYOUT
;
1321 if (!infoPtr
->DoRedraw
) infoPtr
->fStatus
|= BAND_NEEDS_REDRAW
;
1326 cyTarget
= get_rect_cy(infoPtr
, lpRect
);
1327 } else if (infoPtr
->dwStyle
& (CCS_NORESIZE
| CCS_NOPARENTALIGN
) || GetParent(infoPtr
->hwndSelf
) == NULL
)
1328 GetClientRect(infoPtr
->hwndSelf
, &rcAdj
);
1330 GetClientRect(GetParent(infoPtr
->hwndSelf
), &rcAdj
);
1331 TRACE("adjustment rect is (%d,%d)-(%d,%d)\n", rcAdj
.left
, rcAdj
.top
, rcAdj
.right
, rcAdj
.bottom
);
1333 adjcx
= get_rect_cx(infoPtr
, &rcAdj
);
1334 adjcy
= get_rect_cy(infoPtr
, &rcAdj
);
1336 if (infoPtr
->uNumBands
== 0) {
1337 TRACE("No bands - setting size to (0,%d), vert: %lx\n", adjcx
, infoPtr
->dwStyle
& CCS_VERT
);
1338 infoPtr
->calcSize
.cx
= adjcx
;
1339 /* the calcSize.cy won't change for a 0 band rebar */
1340 infoPtr
->uNumRows
= 0;
1341 REBAR_ForceResize(infoPtr
);
1349 for (i
= 0; i
< infoPtr
->uNumBands
; i
++)
1351 lpBand
= &infoPtr
->bands
[i
];
1352 if (HIDDENBAND(lpBand
)) continue;
1354 if (i
> rowstart
&& (lpBand
->fStyle
& RBBS_BREAK
|| xMin
+ lpBand
->lcx
> adjcx
)) {
1355 TRACE("%s break on band %d\n", (lpBand
->fStyle
& RBBS_BREAK
? "Hard" : "Soft"), i
- 1);
1356 REBAR_LayoutRow(infoPtr
, rowstart
, i
, adjcx
, &row
, &yPos
);
1363 xMin
+= lpBand
->lcx
;
1365 REBAR_LayoutRow(infoPtr
, rowstart
, infoPtr
->uNumBands
, adjcx
, &row
, &yPos
);
1367 if (!(infoPtr
->dwStyle
& RBS_VARHEIGHT
))
1368 yPos
= REBAR_SetBandsHeight(infoPtr
, 0, infoPtr
->uNumBands
, yInit
);
1370 infoPtr
->uNumRows
= row
;
1372 if (infoPtr
->dwStyle
& CCS_VERT
)
1373 REBAR_CalcVertBand(infoPtr
, 0, infoPtr
->uNumBands
);
1375 REBAR_CalcHorzBand(infoPtr
, 0, infoPtr
->uNumBands
);
1376 /* now compute size of Rebar itself */
1377 oldSize
= infoPtr
->calcSize
;
1379 infoPtr
->calcSize
.cx
= adjcx
;
1380 infoPtr
->calcSize
.cy
= yPos
;
1381 TRACE("calcsize notify=%d, size=(%d, %d), origheight=(%d,%d)\n", notify
,
1382 infoPtr
->calcSize
.cx
, infoPtr
->calcSize
.cy
,
1383 oldSize
.cx
, oldSize
.cy
);
1385 REBAR_DumpBand (infoPtr
);
1386 REBAR_MoveChildWindows (infoPtr
, 0, infoPtr
->uNumBands
);
1387 REBAR_ForceResize (infoPtr
);
1389 /* note: after a RBN_HEIGHTCHANGE native sends once again all the RBN_CHILDSIZE
1390 * and does another ForceResize */
1391 if (notify
&& (oldSize
.cy
!= infoPtr
->calcSize
.cy
))
1394 REBAR_Notify(&heightchange
, infoPtr
, RBN_HEIGHTCHANGE
);
1400 REBAR_ValidateBand (REBAR_INFO
*infoPtr
, REBAR_BAND
*lpBand
)
1401 /* Function: This routine evaluates the band specs supplied */
1402 /* by the user and updates the following 5 fields in */
1403 /* the internal band structure: cxHeader, lcx, lcy, hcx, hcy*/
1410 lpBand
->fStatus
= 0;
1414 /* Data coming in from users into the cx... and cy... fields */
1415 /* may be bad, just garbage, because the user never clears */
1416 /* the fields. RB_{SET|INSERT}BAND{A|W} just passes the data */
1417 /* along if the fields exist in the input area. Here we must */
1418 /* determine if the data is valid. I have no idea how MS does */
1419 /* the validation, but it does because the RB_GETBANDINFO */
1420 /* returns a 0 when I know the sample program passed in an */
1421 /* address. Here I will use the algorithm that if the value */
1422 /* is greater than 65535 then it is bad and replace it with */
1423 /* a zero. Feel free to improve the algorithm. - GA 12/2000 */
1424 if (lpBand
->cxMinChild
> 65535) lpBand
->cxMinChild
= 0;
1425 if (lpBand
->cyMinChild
> 65535) lpBand
->cyMinChild
= 0;
1426 if (lpBand
->cx
> 65535) lpBand
->cx
= 0;
1427 if (lpBand
->cyChild
> 65535) lpBand
->cyChild
= 0;
1428 if (lpBand
->cyIntegral
> 65535) lpBand
->cyIntegral
= 0;
1429 if (lpBand
->cxIdeal
> 65535) lpBand
->cxIdeal
= 0;
1430 if (lpBand
->cxHeader
> 65535) lpBand
->cxHeader
= 0;
1432 /* FIXME: probably should only set NEEDS_LAYOUT flag when */
1433 /* values change. Till then always set it. */
1434 TRACE("setting NEEDS_LAYOUT\n");
1435 infoPtr
->fStatus
|= BAND_NEEDS_LAYOUT
;
1437 /* Header is where the image, text and gripper exist */
1438 /* in the band and precede the child window. */
1440 /* count number of non-FIXEDSIZE and non-Hidden bands */
1442 for (i
=0; i
<infoPtr
->uNumBands
; i
++){
1443 tBand
= &infoPtr
->bands
[i
];
1444 if (!HIDDENBAND(tBand
) && !(tBand
->fStyle
& RBBS_FIXEDSIZE
))
1448 /* calculate gripper rectangle */
1449 if ( (!(lpBand
->fStyle
& RBBS_NOGRIPPER
)) &&
1450 ( (lpBand
->fStyle
& RBBS_GRIPPERALWAYS
) ||
1451 ( !(lpBand
->fStyle
& RBBS_FIXEDSIZE
) && (nonfixed
> 1)))
1453 lpBand
->fStatus
|= HAS_GRIPPER
;
1454 if (infoPtr
->dwStyle
& CCS_VERT
)
1455 if (infoPtr
->dwStyle
& RBS_VERTICALGRIPPER
)
1456 header
+= (GRIPPER_HEIGHT
+ REBAR_PRE_GRIPPER
);
1458 header
+= (GRIPPER_WIDTH
+ REBAR_PRE_GRIPPER
);
1460 header
+= (REBAR_PRE_GRIPPER
+ GRIPPER_WIDTH
);
1461 /* Always have 4 pixels before anything else */
1462 header
+= REBAR_ALWAYS_SPACE
;
1465 /* image is visible */
1466 if ((lpBand
->fMask
& RBBIM_IMAGE
) && (infoPtr
->himl
)) {
1467 lpBand
->fStatus
|= HAS_IMAGE
;
1468 if (infoPtr
->dwStyle
& CCS_VERT
) {
1469 header
+= (infoPtr
->imageSize
.cy
+ REBAR_POST_IMAGE
);
1470 lpBand
->lcy
= infoPtr
->imageSize
.cx
+ 2;
1473 header
+= (infoPtr
->imageSize
.cx
+ REBAR_POST_IMAGE
);
1474 lpBand
->lcy
= infoPtr
->imageSize
.cy
+ 2;
1478 /* text is visible */
1479 if ((lpBand
->fMask
& RBBIM_TEXT
) && (lpBand
->lpText
) &&
1480 !(lpBand
->fStyle
& RBBS_HIDETITLE
)) {
1481 HDC hdc
= GetDC (0);
1482 HFONT hOldFont
= SelectObject (hdc
, infoPtr
->hFont
);
1485 lpBand
->fStatus
|= HAS_TEXT
;
1486 GetTextExtentPoint32W (hdc
, lpBand
->lpText
,
1487 lstrlenW (lpBand
->lpText
), &size
);
1488 header
+= ((infoPtr
->dwStyle
& CCS_VERT
) ? (size
.cy
+ REBAR_POST_TEXT
) : (size
.cx
+ REBAR_POST_TEXT
));
1489 textheight
= (infoPtr
->dwStyle
& CCS_VERT
) ? 0 : size
.cy
;
1491 SelectObject (hdc
, hOldFont
);
1495 /* if no gripper but either image or text, then leave space */
1496 if ((lpBand
->fStatus
& (HAS_IMAGE
| HAS_TEXT
)) &&
1497 !(lpBand
->fStatus
& HAS_GRIPPER
)) {
1498 header
+= REBAR_ALWAYS_SPACE
;
1501 /* check if user overrode the header value */
1502 if (!(lpBand
->fStyle
& RBBS_UNDOC_FIXEDHEADER
))
1503 lpBand
->cxHeader
= header
;
1506 /* Now compute minimum size of child window */
1507 lpBand
->lcy
= textheight
;
1508 if (lpBand
->hwndChild
!= NULL
) {
1509 /* Set the .cy values for CHILDSIZE case */
1510 lpBand
->lcy
= max(lpBand
->lcy
, lpBand
->cyChild
+ REBARSPACE(lpBand
));
1511 TRACE("_CHILDSIZE\n");
1514 lpBand
->lcy
= max(lpBand
->lcy
, REBAR_NO_CHILD_HEIGHT
);
1516 lpBand
->lcx
= lpBand
->cxMinChild
+ lpBand
->cxHeader
+ REBAR_POST_CHILD
;
1517 if (lpBand
->fStyle
& RBBS_USECHEVRON
&& lpBand
->cxMinChild
< lpBand
->cxIdeal
)
1518 lpBand
->lcx
+= CHEVRON_WIDTH
;
1522 REBAR_CommonSetupBand(HWND hwnd
, LPREBARBANDINFOW lprbbi
, REBAR_BAND
*lpBand
)
1523 /* Function: This routine copies the supplied values from */
1524 /* user input (lprbbi) to the internal band structure. */
1525 /* It returns true if something changed and false if not. */
1527 BOOL bChanged
= FALSE
;
1529 lpBand
->fMask
|= lprbbi
->fMask
;
1531 if( (lprbbi
->fMask
& RBBIM_STYLE
) &&
1532 (lpBand
->fStyle
!= lprbbi
->fStyle
) )
1534 lpBand
->fStyle
= lprbbi
->fStyle
;
1538 if( (lprbbi
->fMask
& RBBIM_COLORS
) &&
1539 ( ( lpBand
->clrFore
!= lprbbi
->clrFore
) ||
1540 ( lpBand
->clrBack
!= lprbbi
->clrBack
) ) )
1542 lpBand
->clrFore
= lprbbi
->clrFore
;
1543 lpBand
->clrBack
= lprbbi
->clrBack
;
1547 if( (lprbbi
->fMask
& RBBIM_IMAGE
) &&
1548 ( lpBand
->iImage
!= lprbbi
->iImage
) )
1550 lpBand
->iImage
= lprbbi
->iImage
;
1554 if( (lprbbi
->fMask
& RBBIM_CHILD
) &&
1555 (lprbbi
->hwndChild
!= lpBand
->hwndChild
) )
1557 if (lprbbi
->hwndChild
) {
1558 lpBand
->hwndChild
= lprbbi
->hwndChild
;
1559 lpBand
->hwndPrevParent
=
1560 SetParent (lpBand
->hwndChild
, hwnd
);
1561 /* below in trace from WinRAR */
1562 ShowWindow(lpBand
->hwndChild
, SW_SHOWNOACTIVATE
| SW_SHOWNORMAL
);
1563 /* above in trace from WinRAR */
1566 TRACE("child: %p prev parent: %p\n",
1567 lpBand
->hwndChild
, lpBand
->hwndPrevParent
);
1568 lpBand
->hwndChild
= 0;
1569 lpBand
->hwndPrevParent
= 0;
1574 if( (lprbbi
->fMask
& RBBIM_CHILDSIZE
) &&
1575 ( (lpBand
->cxMinChild
!= lprbbi
->cxMinChild
) ||
1576 (lpBand
->cyMinChild
!= lprbbi
->cyMinChild
) ||
1577 ( (lprbbi
->cbSize
>= sizeof (REBARBANDINFOA
)) &&
1578 ( (lpBand
->cyChild
!= lprbbi
->cyChild
) ||
1579 (lpBand
->cyMaxChild
!= lprbbi
->cyMaxChild
) ||
1580 (lpBand
->cyIntegral
!= lprbbi
->cyIntegral
) ) ) ||
1581 ( (lprbbi
->cbSize
< sizeof (REBARBANDINFOA
)) &&
1582 ( (lpBand
->cyChild
||
1583 lpBand
->cyMaxChild
||
1584 lpBand
->cyIntegral
) ) ) ) )
1586 lpBand
->cxMinChild
= lprbbi
->cxMinChild
;
1587 lpBand
->cyMinChild
= lprbbi
->cyMinChild
;
1588 /* These fields where added in WIN32_IE == 0x400 and are set only for RBBS_VARIABLEHEIGHT bands */
1589 if (lprbbi
->cbSize
>= sizeof (REBARBANDINFOA
) && (lprbbi
->fStyle
& RBBS_VARIABLEHEIGHT
)) {
1590 lpBand
->cyMaxChild
= lprbbi
->cyMaxChild
;
1591 lpBand
->cyIntegral
= lprbbi
->cyIntegral
;
1593 lpBand
->cyChild
= lpBand
->cyMinChild
;
1594 round_child_height(lpBand
, lprbbi
->cyChild
); /* try to increase cyChild */
1597 lpBand
->cyChild
= lpBand
->cyMinChild
;
1598 lpBand
->cyMaxChild
= 0x7fffffff;
1599 lpBand
->cyIntegral
= 0;
1604 if( (lprbbi
->fMask
& RBBIM_SIZE
) &&
1605 (lpBand
->cx
!= lprbbi
->cx
) )
1607 lpBand
->cx
= lprbbi
->cx
;
1611 if( (lprbbi
->fMask
& RBBIM_BACKGROUND
) &&
1612 ( lpBand
->hbmBack
!= lprbbi
->hbmBack
) )
1614 lpBand
->hbmBack
= lprbbi
->hbmBack
;
1618 if( (lprbbi
->fMask
& RBBIM_ID
) &&
1619 (lpBand
->wID
!= lprbbi
->wID
) )
1621 lpBand
->wID
= lprbbi
->wID
;
1625 /* check for additional data */
1626 if (lprbbi
->cbSize
>= sizeof (REBARBANDINFOA
)) {
1627 if( (lprbbi
->fMask
& RBBIM_IDEALSIZE
) &&
1628 ( lpBand
->cxIdeal
!= lprbbi
->cxIdeal
) )
1630 lpBand
->cxIdeal
= lprbbi
->cxIdeal
;
1634 if( (lprbbi
->fMask
& RBBIM_LPARAM
) &&
1635 (lpBand
->lParam
!= lprbbi
->lParam
) )
1637 lpBand
->lParam
= lprbbi
->lParam
;
1641 if( (lprbbi
->fMask
& RBBIM_HEADERSIZE
) &&
1642 (lpBand
->cxHeader
!= lprbbi
->cxHeader
) )
1644 lpBand
->cxHeader
= lprbbi
->cxHeader
;
1645 lpBand
->fStyle
|= RBBS_UNDOC_FIXEDHEADER
;
1654 REBAR_InternalEraseBkGnd (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
, RECT
*clip
)
1655 /* Function: This erases the background rectangle by drawing */
1656 /* each band with its background color (or the default) and */
1657 /* draws each bands right separator if necessary. The row */
1658 /* separators are drawn on the first band of the next row. */
1663 HDC hdc
= (HDC
)wParam
;
1665 COLORREF old
= CLR_NONE
, new;
1666 HTHEME theme
= GetWindowTheme (infoPtr
->hwndSelf
);
1668 GetClientRect (infoPtr
->hwndSelf
, &cr
);
1671 for(i
=0; i
<infoPtr
->uNumBands
; i
++) {
1673 lpBand
= &infoPtr
->bands
[i
];
1674 if (HIDDENBAND(lpBand
)) continue;
1675 translate_rect(infoPtr
, &rcBand
, &lpBand
->rcBand
);
1677 /* draw band separator between rows */
1678 if (lpBand
->iRow
!= oldrow
) {
1679 oldrow
= lpBand
->iRow
;
1680 if (infoPtr
->dwStyle
& RBS_BANDBORDERS
) {
1683 if (infoPtr
->dwStyle
& CCS_VERT
) {
1684 rcRowSep
.right
+= SEP_WIDTH_SIZE
;
1685 rcRowSep
.bottom
= infoPtr
->calcSize
.cx
;
1687 DrawThemeEdge (theme
, hdc
, RP_BAND
, 0, &rcRowSep
, EDGE_ETCHED
, BF_RIGHT
, NULL
);
1689 DrawEdge (hdc
, &rcRowSep
, EDGE_ETCHED
, BF_RIGHT
);
1692 rcRowSep
.bottom
+= SEP_WIDTH_SIZE
;
1693 rcRowSep
.right
= infoPtr
->calcSize
.cx
;
1695 DrawThemeEdge (theme
, hdc
, RP_BAND
, 0, &rcRowSep
, EDGE_ETCHED
, BF_BOTTOM
, NULL
);
1697 DrawEdge (hdc
, &rcRowSep
, EDGE_ETCHED
, BF_BOTTOM
);
1699 TRACE ("drawing band separator bottom (%d,%d)-(%d,%d)\n",
1700 rcRowSep
.left
, rcRowSep
.top
,
1701 rcRowSep
.right
, rcRowSep
.bottom
);
1705 /* draw band separator between bands in a row */
1706 if (infoPtr
->dwStyle
& RBS_BANDBORDERS
&& lpBand
->rcBand
.left
> 0) {
1709 if (infoPtr
->dwStyle
& CCS_VERT
) {
1710 rcSep
.bottom
= rcSep
.top
;
1711 rcSep
.top
-= SEP_WIDTH_SIZE
;
1713 DrawThemeEdge (theme
, hdc
, RP_BAND
, 0, &rcSep
, EDGE_ETCHED
, BF_BOTTOM
, NULL
);
1715 DrawEdge (hdc
, &rcSep
, EDGE_ETCHED
, BF_BOTTOM
);
1718 rcSep
.right
= rcSep
.left
;
1719 rcSep
.left
-= SEP_WIDTH_SIZE
;
1721 DrawThemeEdge (theme
, hdc
, RP_BAND
, 0, &rcSep
, EDGE_ETCHED
, BF_RIGHT
, NULL
);
1723 DrawEdge (hdc
, &rcSep
, EDGE_ETCHED
, BF_RIGHT
);
1725 TRACE("drawing band separator right (%d,%d)-(%d,%d)\n",
1726 rcSep
.left
, rcSep
.top
, rcSep
.right
, rcSep
.bottom
);
1729 /* draw the actual background */
1730 if (lpBand
->clrBack
!= CLR_NONE
) {
1731 new = (lpBand
->clrBack
== CLR_DEFAULT
) ? infoPtr
->clrBtnFace
:
1734 /* testing only - make background green to see it */
1739 /* In the absence of documentation for Rebar vs. CLR_NONE,
1740 * we will use the default BtnFace color. Note documentation
1741 * exists for Listview and Imagelist.
1743 new = infoPtr
->clrBtnFace
;
1745 /* testing only - make background green to see it */
1752 /* When themed, the background color is ignored (but not a
1753 * background bitmap */
1754 DrawThemeBackground (theme
, hdc
, 0, 0, &cr
, &rcBand
);
1758 old
= SetBkColor (hdc
, new);
1759 TRACE("%s background color=0x%06x, band (%d,%d)-(%d,%d), clip (%d,%d)-(%d,%d)\n",
1760 (lpBand
->clrBack
== CLR_NONE
) ? "none" :
1761 ((lpBand
->clrBack
== CLR_DEFAULT
) ? "dft" : ""),
1763 rcBand
.left
,rcBand
.top
,
1764 rcBand
.right
,rcBand
.bottom
,
1765 clip
->left
, clip
->top
,
1766 clip
->right
, clip
->bottom
);
1767 ExtTextOutW (hdc
, 0, 0, ETO_OPAQUE
, &rcBand
, NULL
, 0, 0);
1768 if (lpBand
->clrBack
!= CLR_NONE
)
1769 SetBkColor (hdc
, old
);
1776 REBAR_InternalHitTest (REBAR_INFO
*infoPtr
, const LPPOINT lpPt
, UINT
*pFlags
, INT
*pBand
)
1782 GetClientRect (infoPtr
->hwndSelf
, &rect
);
1784 *pFlags
= RBHT_NOWHERE
;
1785 if (PtInRect (&rect
, *lpPt
))
1787 if (infoPtr
->uNumBands
== 0) {
1788 *pFlags
= RBHT_NOWHERE
;
1795 /* somewhere inside */
1796 for (iCount
= 0; iCount
< infoPtr
->uNumBands
; iCount
++) {
1798 lpBand
= &infoPtr
->bands
[iCount
];
1799 translate_rect(infoPtr
, &rcBand
, &lpBand
->rcBand
);
1800 if (HIDDENBAND(lpBand
)) continue;
1801 if (PtInRect (&rcBand
, *lpPt
)) {
1804 if (PtInRect (&lpBand
->rcGripper
, *lpPt
)) {
1805 *pFlags
= RBHT_GRABBER
;
1806 TRACE("ON GRABBER %d\n", iCount
);
1809 else if (PtInRect (&lpBand
->rcCapImage
, *lpPt
)) {
1810 *pFlags
= RBHT_CAPTION
;
1811 TRACE("ON CAPTION %d\n", iCount
);
1814 else if (PtInRect (&lpBand
->rcCapText
, *lpPt
)) {
1815 *pFlags
= RBHT_CAPTION
;
1816 TRACE("ON CAPTION %d\n", iCount
);
1819 else if (PtInRect (&lpBand
->rcChild
, *lpPt
)) {
1820 *pFlags
= RBHT_CLIENT
;
1821 TRACE("ON CLIENT %d\n", iCount
);
1824 else if (PtInRect (&lpBand
->rcChevron
, *lpPt
)) {
1825 *pFlags
= RBHT_CHEVRON
;
1826 TRACE("ON CHEVRON %d\n", iCount
);
1830 *pFlags
= RBHT_NOWHERE
;
1831 TRACE("NOWHERE %d\n", iCount
);
1837 *pFlags
= RBHT_NOWHERE
;
1846 *pFlags
= RBHT_NOWHERE
;
1855 REBAR_HandleLRDrag (REBAR_INFO
*infoPtr
, const POINT
*ptsmove
)
1856 /* Function: This will implement the functionality of a */
1857 /* Gripper drag within a row. It will not implement "out- */
1858 /* of-row" drags. (They are detected and handled in */
1859 /* REBAR_MouseMove.) */
1860 /* **** FIXME Switching order of bands in a row not **** */
1861 /* **** yet implemented. **** */
1863 REBAR_BAND
*hitBand
;
1864 INT iHitBand
, iRowBegin
, iRowEnd
;
1865 INT movement
, xBand
;
1867 /* on first significant mouse movement, issue notify */
1868 if (!(infoPtr
->fStatus
& BEGIN_DRAG_ISSUED
)) {
1869 if (REBAR_Notify_NMREBAR (infoPtr
, -1, RBN_BEGINDRAG
)) {
1870 /* Notify returned TRUE - abort drag */
1871 infoPtr
->dragStart
.x
= 0;
1872 infoPtr
->dragStart
.y
= 0;
1873 infoPtr
->dragNow
= infoPtr
->dragStart
;
1874 infoPtr
->iGrabbedBand
= -1;
1878 infoPtr
->fStatus
|= BEGIN_DRAG_ISSUED
;
1881 iHitBand
= infoPtr
->iGrabbedBand
;
1882 iRowBegin
= get_row_begin_for_band(infoPtr
, iHitBand
);
1883 iRowEnd
= get_row_end_for_band(infoPtr
, iHitBand
);
1884 hitBand
= &infoPtr
->bands
[iHitBand
];
1886 xBand
= hitBand
->rcBand
.left
;
1887 movement
= (infoPtr
->dwStyle
&CCS_VERT
? ptsmove
->y
: ptsmove
->x
)
1888 - (xBand
+ REBAR_PRE_GRIPPER
- infoPtr
->ihitoffset
);
1891 int cxLeft
= REBAR_ShrinkBandsRTL(infoPtr
, iRowBegin
, iHitBand
, -movement
, TRUE
);
1892 hitBand
->cxEffective
+= -movement
- cxLeft
;
1893 hitBand
->cx
= hitBand
->cxEffective
;
1894 } else if (movement
> 0) {
1895 int cxLeft
= REBAR_ShrinkBandsLTR(infoPtr
, iHitBand
, iRowEnd
, movement
, TRUE
);
1896 REBAR_BAND
*lpPrev
= &infoPtr
->bands
[prev_band(infoPtr
, iHitBand
)];
1897 lpPrev
->cxEffective
+= movement
- cxLeft
;
1898 lpPrev
->cx
= lpPrev
->cxEffective
;
1901 REBAR_SetRowRectsX(infoPtr
, iRowBegin
, iRowEnd
);
1902 if (infoPtr
->dwStyle
& CCS_VERT
)
1903 REBAR_CalcVertBand(infoPtr
, 0, infoPtr
->uNumBands
);
1905 REBAR_CalcHorzBand(infoPtr
, 0, infoPtr
->uNumBands
);
1906 REBAR_MoveChildWindows(infoPtr
, iRowBegin
, iRowEnd
);
1911 /* << REBAR_BeginDrag >> */
1915 REBAR_DeleteBand (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
1917 UINT uBand
= (UINT
)wParam
;
1920 if (uBand
>= infoPtr
->uNumBands
)
1923 TRACE("deleting band %u!\n", uBand
);
1924 lpBand
= &infoPtr
->bands
[uBand
];
1925 REBAR_Notify_NMREBAR (infoPtr
, uBand
, RBN_DELETINGBAND
);
1926 /* TODO: a return of 1 should probably cancel the deletion */
1928 if (lpBand
->hwndChild
)
1929 ShowWindow(lpBand
->hwndChild
, SW_HIDE
);
1930 Free(lpBand
->lpText
);
1932 infoPtr
->uNumBands
--;
1933 memmove(&infoPtr
->bands
[uBand
], &infoPtr
->bands
[uBand
+1],
1934 (infoPtr
->uNumBands
- uBand
) * sizeof(REBAR_BAND
));
1935 infoPtr
->bands
= ReAlloc(infoPtr
->bands
, infoPtr
->uNumBands
* sizeof(REBAR_BAND
));
1937 REBAR_Notify_NMREBAR (infoPtr
, -1, RBN_DELETEDBAND
);
1939 /* if only 1 band left the re-validate to possible eliminate gripper */
1940 if (infoPtr
->uNumBands
== 1)
1941 REBAR_ValidateBand (infoPtr
, &infoPtr
->bands
[0]);
1943 TRACE("setting NEEDS_LAYOUT\n");
1944 infoPtr
->fStatus
|= BAND_NEEDS_LAYOUT
;
1945 REBAR_Layout(infoPtr
, NULL
, TRUE
);
1951 /* << REBAR_DragMove >> */
1952 /* << REBAR_EndDrag >> */
1956 REBAR_GetBandBorders (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
1958 LPRECT lpRect
= (LPRECT
)lParam
;
1963 if ((UINT
)wParam
>= infoPtr
->uNumBands
)
1966 lpBand
= &infoPtr
->bands
[(UINT
)wParam
];
1968 /* FIXME - the following values were determined by experimentation */
1969 /* with the REBAR Control Spy. I have guesses as to what the 4 and */
1970 /* 1 are, but I am not sure. There doesn't seem to be any actual */
1971 /* difference in size of the control area with and without the */
1973 if (infoPtr
->dwStyle
& RBS_BANDBORDERS
) {
1974 if (infoPtr
->dwStyle
& CCS_VERT
) {
1976 lpRect
->top
= lpBand
->cxHeader
+ 4;
1981 lpRect
->left
= lpBand
->cxHeader
+ 4;
1988 lpRect
->left
= lpBand
->cxHeader
;
1994 inline static LRESULT
1995 REBAR_GetBandCount (REBAR_INFO
*infoPtr
)
1997 TRACE("band count %u!\n", infoPtr
->uNumBands
);
1999 return infoPtr
->uNumBands
;
2004 REBAR_GetBandInfoT(REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
, BOOL bUnicode
)
2006 LPREBARBANDINFOW lprbbi
= (LPREBARBANDINFOW
)lParam
;
2011 if (lprbbi
->cbSize
< REBARBANDINFOA_V3_SIZE
)
2013 if ((UINT
)wParam
>= infoPtr
->uNumBands
)
2016 TRACE("index %u (bUnicode=%d)\n", (UINT
)wParam
, bUnicode
);
2018 /* copy band information */
2019 lpBand
= &infoPtr
->bands
[(UINT
)wParam
];
2021 if (lprbbi
->fMask
& RBBIM_STYLE
)
2022 lprbbi
->fStyle
= lpBand
->fStyle
;
2024 if (lprbbi
->fMask
& RBBIM_COLORS
) {
2025 lprbbi
->clrFore
= lpBand
->clrFore
;
2026 lprbbi
->clrBack
= lpBand
->clrBack
;
2027 if (lprbbi
->clrBack
== CLR_DEFAULT
)
2028 lprbbi
->clrBack
= infoPtr
->clrBtnFace
;
2031 if (lprbbi
->fMask
& RBBIM_TEXT
) {
2033 Str_GetPtrW(lpBand
->lpText
, lprbbi
->lpText
, lprbbi
->cch
);
2035 Str_GetPtrWtoA(lpBand
->lpText
, (LPSTR
)lprbbi
->lpText
, lprbbi
->cch
);
2038 if (lprbbi
->fMask
& RBBIM_IMAGE
)
2039 lprbbi
->iImage
= lpBand
->iImage
;
2041 if (lprbbi
->fMask
& RBBIM_CHILD
)
2042 lprbbi
->hwndChild
= lpBand
->hwndChild
;
2044 if (lprbbi
->fMask
& RBBIM_CHILDSIZE
) {
2045 lprbbi
->cxMinChild
= lpBand
->cxMinChild
;
2046 lprbbi
->cyMinChild
= lpBand
->cyMinChild
;
2047 /* to make tests pass we follow Windows behaviour and allow to read these fields only
2048 * for RBBS_VARIABLEHEIGHTS bands */
2049 if (lprbbi
->cbSize
>= sizeof (REBARBANDINFOA
) && (lpBand
->fStyle
& RBBS_VARIABLEHEIGHT
)) {
2050 lprbbi
->cyChild
= lpBand
->cyChild
;
2051 lprbbi
->cyMaxChild
= lpBand
->cyMaxChild
;
2052 lprbbi
->cyIntegral
= lpBand
->cyIntegral
;
2056 if (lprbbi
->fMask
& RBBIM_SIZE
)
2057 lprbbi
->cx
= lpBand
->cx
;
2059 if (lprbbi
->fMask
& RBBIM_BACKGROUND
)
2060 lprbbi
->hbmBack
= lpBand
->hbmBack
;
2062 if (lprbbi
->fMask
& RBBIM_ID
)
2063 lprbbi
->wID
= lpBand
->wID
;
2065 /* check for additional data */
2066 if (lprbbi
->cbSize
>= sizeof (REBARBANDINFOA
)) {
2067 if (lprbbi
->fMask
& RBBIM_IDEALSIZE
)
2068 lprbbi
->cxIdeal
= lpBand
->cxIdeal
;
2070 if (lprbbi
->fMask
& RBBIM_LPARAM
)
2071 lprbbi
->lParam
= lpBand
->lParam
;
2073 if (lprbbi
->fMask
& RBBIM_HEADERSIZE
)
2074 lprbbi
->cxHeader
= lpBand
->cxHeader
;
2077 REBAR_DumpBandInfo(lprbbi
);
2084 REBAR_GetBarHeight (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2088 nHeight
= infoPtr
->calcSize
.cy
;
2090 TRACE("height = %d\n", nHeight
);
2097 REBAR_GetBarInfo (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2099 LPREBARINFO lpInfo
= (LPREBARINFO
)lParam
;
2104 if (lpInfo
->cbSize
< sizeof (REBARINFO
))
2107 TRACE("getting bar info!\n");
2109 if (infoPtr
->himl
) {
2110 lpInfo
->himl
= infoPtr
->himl
;
2111 lpInfo
->fMask
|= RBIM_IMAGELIST
;
2118 inline static LRESULT
2119 REBAR_GetBkColor (REBAR_INFO
*infoPtr
)
2121 COLORREF clr
= infoPtr
->clrBk
;
2123 if (clr
== CLR_DEFAULT
)
2124 clr
= infoPtr
->clrBtnFace
;
2126 TRACE("background color 0x%06x!\n", clr
);
2132 /* << REBAR_GetColorScheme >> */
2133 /* << REBAR_GetDropTarget >> */
2137 REBAR_GetPalette (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2139 FIXME("empty stub!\n");
2146 REBAR_GetRect (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2148 INT iBand
= (INT
)wParam
;
2149 LPRECT lprc
= (LPRECT
)lParam
;
2152 if ((iBand
< 0) || ((UINT
)iBand
>= infoPtr
->uNumBands
))
2157 lpBand
= &infoPtr
->bands
[iBand
];
2158 /* For CCS_VERT the coordintes will be swapped - like on Windows */
2159 CopyRect (lprc
, &lpBand
->rcBand
);
2161 TRACE("band %d, (%d,%d)-(%d,%d)\n", iBand
,
2162 lprc
->left
, lprc
->top
, lprc
->right
, lprc
->bottom
);
2168 inline static LRESULT
2169 REBAR_GetRowCount (REBAR_INFO
*infoPtr
)
2171 TRACE("%u\n", infoPtr
->uNumRows
);
2173 return infoPtr
->uNumRows
;
2178 REBAR_GetRowHeight (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2180 INT iRow
= (INT
)wParam
;
2185 for (i
=0; i
<infoPtr
->uNumBands
; i
++) {
2186 lpBand
= &infoPtr
->bands
[i
];
2187 if (HIDDENBAND(lpBand
)) continue;
2188 if (lpBand
->iRow
!= iRow
) continue;
2189 j
= lpBand
->rcBand
.bottom
- lpBand
->rcBand
.top
;
2190 if (j
> ret
) ret
= j
;
2193 TRACE("row %d, height %d\n", iRow
, ret
);
2199 inline static LRESULT
2200 REBAR_GetTextColor (REBAR_INFO
*infoPtr
)
2202 TRACE("text color 0x%06x!\n", infoPtr
->clrText
);
2204 return infoPtr
->clrText
;
2208 inline static LRESULT
2209 REBAR_GetToolTips (REBAR_INFO
*infoPtr
)
2211 return (LRESULT
)infoPtr
->hwndToolTip
;
2215 inline static LRESULT
2216 REBAR_GetUnicodeFormat (REBAR_INFO
*infoPtr
)
2218 TRACE("%s hwnd=%p\n",
2219 infoPtr
->bUnicode
? "TRUE" : "FALSE", infoPtr
->hwndSelf
);
2221 return infoPtr
->bUnicode
;
2225 inline static LRESULT
2226 REBAR_GetVersion (REBAR_INFO
*infoPtr
)
2228 TRACE("version %d\n", infoPtr
->iVersion
);
2229 return infoPtr
->iVersion
;
2234 REBAR_HitTest (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2236 LPRBHITTESTINFO lprbht
= (LPRBHITTESTINFO
)lParam
;
2241 REBAR_InternalHitTest (infoPtr
, &lprbht
->pt
, &lprbht
->flags
, &lprbht
->iBand
);
2243 return lprbht
->iBand
;
2248 REBAR_IdToIndex (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2252 if (infoPtr
== NULL
)
2255 if (infoPtr
->uNumBands
< 1)
2258 for (i
= 0; i
< infoPtr
->uNumBands
; i
++) {
2259 if (infoPtr
->bands
[i
].wID
== (UINT
)wParam
) {
2260 TRACE("id %u is band %u found!\n", (UINT
)wParam
, i
);
2265 TRACE("id %u is not found\n", (UINT
)wParam
);
2271 REBAR_InsertBandT(REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
, BOOL bUnicode
)
2273 LPREBARBANDINFOW lprbbi
= (LPREBARBANDINFOW
)lParam
;
2274 UINT uIndex
= (UINT
)wParam
;
2277 if (infoPtr
== NULL
)
2281 if (lprbbi
->cbSize
< REBARBANDINFOA_V3_SIZE
)
2284 /* trace the index as signed to see the -1 */
2285 TRACE("insert band at %d (bUnicode=%d)!\n", (INT
)uIndex
, bUnicode
);
2286 REBAR_DumpBandInfo(lprbbi
);
2288 infoPtr
->bands
= ReAlloc(infoPtr
->bands
, (infoPtr
->uNumBands
+1) * sizeof(REBAR_BAND
));
2289 if (((INT
)uIndex
== -1) || (uIndex
> infoPtr
->uNumBands
))
2290 uIndex
= infoPtr
->uNumBands
;
2291 memmove(&infoPtr
->bands
[uIndex
+1], &infoPtr
->bands
[uIndex
],
2292 sizeof(REBAR_BAND
) * (infoPtr
->uNumBands
- uIndex
));
2293 infoPtr
->uNumBands
++;
2295 TRACE("index %u!\n", uIndex
);
2297 /* initialize band (infoPtr->bands[uIndex])*/
2298 lpBand
= &infoPtr
->bands
[uIndex
];
2299 ZeroMemory(lpBand
, sizeof(*lpBand
));
2300 lpBand
->clrFore
= infoPtr
->clrText
;
2301 lpBand
->clrBack
= infoPtr
->clrBk
;
2302 lpBand
->iImage
= -1;
2304 REBAR_CommonSetupBand(infoPtr
->hwndSelf
, lprbbi
, lpBand
);
2305 if ((lprbbi
->fMask
& RBBIM_TEXT
) && (lprbbi
->lpText
)) {
2307 Str_SetPtrW(&lpBand
->lpText
, lprbbi
->lpText
);
2309 Str_SetPtrAtoW(&lpBand
->lpText
, (LPSTR
)lprbbi
->lpText
);
2312 REBAR_ValidateBand (infoPtr
, lpBand
);
2313 /* On insert of second band, revalidate band 1 to possible add gripper */
2314 if (infoPtr
->uNumBands
== 2)
2315 REBAR_ValidateBand (infoPtr
, &infoPtr
->bands
[0]);
2317 REBAR_DumpBand (infoPtr
);
2319 REBAR_Layout(infoPtr
, NULL
, TRUE
);
2320 InvalidateRect(infoPtr
->hwndSelf
, 0, TRUE
);
2327 REBAR_MaximizeBand (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2330 UINT uBand
= (UINT
) wParam
;
2331 int iRowBegin
, iRowEnd
;
2332 int cxDesired
, extra
, extraOrig
;
2336 if ((infoPtr
->uNumBands
== 0) ||
2337 ((INT
)uBand
< 0) || (uBand
>= infoPtr
->uNumBands
)) {
2339 ERR("Illegal MaximizeBand, requested=%d, current band count=%d\n",
2340 (INT
)uBand
, infoPtr
->uNumBands
);
2344 lpBand
= &infoPtr
->bands
[uBand
];
2346 cxIdealBand
= lpBand
->cxIdeal
+ lpBand
->cxHeader
+ REBAR_POST_CHILD
;
2347 if (lParam
&& (lpBand
->cxEffective
< cxIdealBand
))
2348 cxDesired
= cxIdealBand
;
2350 cxDesired
= infoPtr
->calcSize
.cx
;
2352 iRowBegin
= get_row_begin_for_band(infoPtr
, uBand
);
2353 iRowEnd
= get_row_end_for_band(infoPtr
, uBand
);
2354 extraOrig
= extra
= cxDesired
- lpBand
->cxEffective
;
2356 extra
= REBAR_ShrinkBandsRTL(infoPtr
, iRowBegin
, uBand
, extra
, TRUE
);
2358 extra
= REBAR_ShrinkBandsLTR(infoPtr
, next_band(infoPtr
, uBand
), iRowEnd
, extra
, TRUE
);
2359 lpBand
->cxEffective
+= extraOrig
- extra
;
2360 lpBand
->cx
= lpBand
->cxEffective
;
2361 TRACE("(%d, %ld): Wanted size %d, obtained %d (shrink %d, %d)\n", wParam
, lParam
, cxDesired
, lpBand
->cx
, extraOrig
, extra
);
2362 REBAR_SetRowRectsX(infoPtr
, iRowBegin
, iRowEnd
);
2364 if (infoPtr
->dwStyle
& CCS_VERT
)
2365 REBAR_CalcVertBand(infoPtr
, iRowBegin
, iRowEnd
);
2367 REBAR_CalcHorzBand(infoPtr
, iRowBegin
, iRowEnd
);
2368 REBAR_MoveChildWindows(infoPtr
, iRowBegin
, iRowEnd
);
2375 REBAR_MinimizeBand (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2378 UINT uBand
= (UINT
) wParam
;
2379 int iPrev
, iRowBegin
, iRowEnd
;
2381 /* A "minimize" band is equivalent to "dragging" the gripper
2382 * of than band to the right till the band is only the size
2387 if ((infoPtr
->uNumBands
== 0) ||
2388 ((INT
)uBand
< 0) || (uBand
>= infoPtr
->uNumBands
)) {
2390 ERR("Illegal MinimizeBand, requested=%d, current band count=%d\n",
2391 (INT
)uBand
, infoPtr
->uNumBands
);
2395 /* compute amount of movement and validate */
2396 lpBand
= &infoPtr
->bands
[uBand
];
2397 iPrev
= prev_band(infoPtr
, uBand
);
2398 /* if first band in row */
2399 if (iPrev
< 0 || infoPtr
->bands
[iPrev
].iRow
!= lpBand
->iRow
) {
2400 int iNext
= next_band(infoPtr
, uBand
);
2401 if (iNext
< infoPtr
->uNumBands
&& infoPtr
->bands
[iNext
].iRow
== lpBand
->iRow
) {
2402 TRACE("(%d): Minimizing the first band in row is by maximizing the second\n", wParam
);
2403 REBAR_MaximizeBand(infoPtr
, iNext
, FALSE
);
2406 TRACE("(%d): Only one band in row - nothing to do\n", wParam
);
2410 infoPtr
->bands
[iPrev
].cxEffective
+= lpBand
->cxEffective
- lpBand
->lcx
;
2411 infoPtr
->bands
[iPrev
].cx
= infoPtr
->bands
[iPrev
].cxEffective
;
2412 lpBand
->cx
= lpBand
->cxEffective
= lpBand
->lcx
;
2414 iRowBegin
= get_row_begin_for_band(infoPtr
, uBand
);
2415 iRowEnd
= get_row_end_for_band(infoPtr
, uBand
);
2416 REBAR_SetRowRectsX(infoPtr
, iRowBegin
, iRowEnd
);
2418 if (infoPtr
->dwStyle
& CCS_VERT
)
2419 REBAR_CalcVertBand(infoPtr
, iRowBegin
, iRowEnd
);
2421 REBAR_CalcHorzBand(infoPtr
, iRowBegin
, iRowEnd
);
2422 REBAR_MoveChildWindows(infoPtr
, iRowBegin
, iRowEnd
);
2428 REBAR_MoveBand (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2430 REBAR_BAND
*oldBands
= infoPtr
->bands
;
2432 UINT uFrom
= (UINT
)wParam
;
2433 UINT uTo
= (UINT
)lParam
;
2436 if ((infoPtr
->uNumBands
== 0) ||
2437 ((INT
)uFrom
< 0) || (uFrom
>= infoPtr
->uNumBands
) ||
2438 ((INT
)uTo
< 0) || (uTo
>= infoPtr
->uNumBands
)) {
2440 ERR("Illegal MoveBand, from=%d, to=%d, current band count=%d\n",
2441 (INT
)uFrom
, (INT
)uTo
, infoPtr
->uNumBands
);
2445 /* save one to be moved */
2446 memcpy (&holder
, &oldBands
[uFrom
], sizeof(REBAR_BAND
));
2448 /* close up rest of bands (pseudo delete) */
2449 if (uFrom
< infoPtr
->uNumBands
- 1) {
2450 memcpy (&oldBands
[uFrom
], &oldBands
[uFrom
+1],
2451 (infoPtr
->uNumBands
- uFrom
- 1) * sizeof(REBAR_BAND
));
2454 /* allocate new space and copy rest of bands into it */
2456 (REBAR_BAND
*)Alloc ((infoPtr
->uNumBands
)*sizeof(REBAR_BAND
));
2458 /* pre insert copy */
2460 memcpy (&infoPtr
->bands
[0], &oldBands
[0],
2461 uTo
* sizeof(REBAR_BAND
));
2464 /* set moved band */
2465 memcpy (&infoPtr
->bands
[uTo
], &holder
, sizeof(REBAR_BAND
));
2468 if (uTo
< infoPtr
->uNumBands
- 1) {
2469 memcpy (&infoPtr
->bands
[uTo
+1], &oldBands
[uTo
],
2470 (infoPtr
->uNumBands
- uTo
- 1) * sizeof(REBAR_BAND
));
2475 TRACE("moved band %d to index %d\n", uFrom
, uTo
);
2476 REBAR_DumpBand (infoPtr
);
2478 infoPtr
->fStatus
|= BAND_NEEDS_LAYOUT
;
2479 /* **************************************************** */
2481 /* We do not do a REBAR_Layout here because the native */
2482 /* control does not do that. The actual layout and */
2483 /* repaint is done by the *next* real action, ex.: */
2484 /* RB_INSERTBAND, RB_DELETEBAND, RB_SIZETORECT, etc. */
2486 /* **************************************************** */
2492 /* return TRUE if two strings are different */
2494 REBAR_strdifW( LPCWSTR a
, LPCWSTR b
)
2496 return ( (a
&& !b
) || (b
&& !a
) || (a
&& b
&& lstrcmpW(a
, b
) ) );
2500 REBAR_SetBandInfoT(REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
, BOOL bUnicode
)
2502 LPREBARBANDINFOW lprbbi
= (LPREBARBANDINFOW
)lParam
;
2508 if (lprbbi
->cbSize
< REBARBANDINFOA_V3_SIZE
)
2510 if ((UINT
)wParam
>= infoPtr
->uNumBands
)
2513 TRACE("index %u\n", (UINT
)wParam
);
2514 REBAR_DumpBandInfo (lprbbi
);
2516 /* set band information */
2517 lpBand
= &infoPtr
->bands
[(UINT
)wParam
];
2519 bChanged
= REBAR_CommonSetupBand (infoPtr
->hwndSelf
, lprbbi
, lpBand
);
2520 if (lprbbi
->fMask
& RBBIM_TEXT
) {
2523 Str_SetPtrW(&wstr
, lprbbi
->lpText
);
2525 Str_SetPtrAtoW(&wstr
, (LPSTR
)lprbbi
->lpText
);
2527 if (REBAR_strdifW(wstr
, lprbbi
->lpText
)) {
2528 Free(lpBand
->lpText
);
2529 lpBand
->lpText
= wstr
;
2536 REBAR_ValidateBand (infoPtr
, lpBand
);
2538 REBAR_DumpBand (infoPtr
);
2540 if (bChanged
&& (lprbbi
->fMask
& (RBBIM_CHILDSIZE
| RBBIM_SIZE
| RBBIM_STYLE
))) {
2541 REBAR_Layout(infoPtr
, NULL
, TRUE
);
2542 InvalidateRect(infoPtr
->hwndSelf
, 0, 1);
2550 REBAR_SetBarInfo (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2552 LPREBARINFO lpInfo
= (LPREBARINFO
)lParam
;
2559 if (lpInfo
->cbSize
< sizeof (REBARINFO
))
2562 TRACE("setting bar info!\n");
2564 if (lpInfo
->fMask
& RBIM_IMAGELIST
) {
2565 infoPtr
->himl
= lpInfo
->himl
;
2566 if (infoPtr
->himl
) {
2568 ImageList_GetIconSize (infoPtr
->himl
, &cx
, &cy
);
2569 infoPtr
->imageSize
.cx
= cx
;
2570 infoPtr
->imageSize
.cy
= cy
;
2573 infoPtr
->imageSize
.cx
= 0;
2574 infoPtr
->imageSize
.cy
= 0;
2576 TRACE("new image cx=%d, cy=%d\n", infoPtr
->imageSize
.cx
,
2577 infoPtr
->imageSize
.cy
);
2580 /* revalidate all bands to reset flags for images in headers of bands */
2581 for (i
=0; i
<infoPtr
->uNumBands
; i
++) {
2582 lpBand
= &infoPtr
->bands
[i
];
2583 REBAR_ValidateBand (infoPtr
, lpBand
);
2591 REBAR_SetBkColor (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2595 clrTemp
= infoPtr
->clrBk
;
2596 infoPtr
->clrBk
= (COLORREF
)lParam
;
2598 TRACE("background color 0x%06x!\n", infoPtr
->clrBk
);
2604 /* << REBAR_SetColorScheme >> */
2605 /* << REBAR_SetPalette >> */
2609 REBAR_SetParent (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2611 HWND hwndTemp
= infoPtr
->hwndNotify
;
2613 infoPtr
->hwndNotify
= (HWND
)wParam
;
2615 return (LRESULT
)hwndTemp
;
2620 REBAR_SetTextColor (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2624 clrTemp
= infoPtr
->clrText
;
2625 infoPtr
->clrText
= (COLORREF
)lParam
;
2627 TRACE("text color 0x%06x!\n", infoPtr
->clrText
);
2633 /* << REBAR_SetTooltips >> */
2636 inline static LRESULT
2637 REBAR_SetUnicodeFormat (REBAR_INFO
*infoPtr
, WPARAM wParam
)
2639 BOOL bTemp
= infoPtr
->bUnicode
;
2641 TRACE("to %s hwnd=%p, was %s\n",
2642 ((BOOL
)wParam
) ? "TRUE" : "FALSE", infoPtr
->hwndSelf
,
2643 (bTemp
) ? "TRUE" : "FALSE");
2645 infoPtr
->bUnicode
= (BOOL
)wParam
;
2652 REBAR_SetVersion (REBAR_INFO
*infoPtr
, INT iVersion
)
2654 INT iOldVersion
= infoPtr
->iVersion
;
2656 if (iVersion
> COMCTL32_VERSION
)
2659 infoPtr
->iVersion
= iVersion
;
2661 TRACE("new version %d\n", iVersion
);
2668 REBAR_ShowBand (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2672 if (((INT
)wParam
< 0) || ((INT
)wParam
> infoPtr
->uNumBands
))
2675 lpBand
= &infoPtr
->bands
[(INT
)wParam
];
2678 TRACE("show band %d\n", (INT
)wParam
);
2679 lpBand
->fStyle
= lpBand
->fStyle
& ~RBBS_HIDDEN
;
2680 if (IsWindow (lpBand
->hwndChild
))
2681 ShowWindow (lpBand
->hwndChild
, SW_SHOW
);
2684 TRACE("hide band %d\n", (INT
)wParam
);
2685 lpBand
->fStyle
= lpBand
->fStyle
| RBBS_HIDDEN
;
2686 if (IsWindow (lpBand
->hwndChild
))
2687 ShowWindow (lpBand
->hwndChild
, SW_HIDE
);
2690 infoPtr
->fStatus
|= BAND_NEEDS_LAYOUT
;
2691 REBAR_Layout(infoPtr
, NULL
, TRUE
);
2692 InvalidateRect(infoPtr
->hwndSelf
, 0, 1);
2699 REBAR_SizeToRect (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2701 LPRECT lpRect
= (LPRECT
)lParam
;
2707 TRACE("[%d %d %d %d]\n",
2708 lpRect
->left
, lpRect
->top
, lpRect
->right
, lpRect
->bottom
);
2710 /* what is going on???? */
2711 GetWindowRect(infoPtr
->hwndSelf
, &t1
);
2712 TRACE("window rect [%d %d %d %d]\n",
2713 t1
.left
, t1
.top
, t1
.right
, t1
.bottom
);
2714 GetClientRect(infoPtr
->hwndSelf
, &t1
);
2715 TRACE("client rect [%d %d %d %d]\n",
2716 t1
.left
, t1
.top
, t1
.right
, t1
.bottom
);
2718 /* force full _Layout processing */
2719 TRACE("setting NEEDS_LAYOUT\n");
2720 infoPtr
->fStatus
|= BAND_NEEDS_LAYOUT
;
2721 REBAR_Layout(infoPtr
, lpRect
, TRUE
);
2722 InvalidateRect (infoPtr
->hwndSelf
, NULL
, TRUE
);
2729 REBAR_Create (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2731 LPCREATESTRUCTW cs
= (LPCREATESTRUCTW
) lParam
;
2735 if (TRACE_ON(rebar
)) {
2736 GetWindowRect(infoPtr
->hwndSelf
, &wnrc1
);
2737 GetClientRect(infoPtr
->hwndSelf
, &clrc1
);
2738 TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n",
2739 wnrc1
.left
, wnrc1
.top
, wnrc1
.right
, wnrc1
.bottom
,
2740 clrc1
.left
, clrc1
.top
, clrc1
.right
, clrc1
.bottom
,
2741 cs
->x
, cs
->y
, cs
->cx
, cs
->cy
);
2744 TRACE("created!\n");
2746 if ((theme
= OpenThemeData (infoPtr
->hwndSelf
, themeClass
)))
2748 /* native seems to clear WS_BORDER when themed */
2749 infoPtr
->dwStyle
&= ~WS_BORDER
;
2757 REBAR_Destroy (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2763 /* free rebar bands */
2764 if ((infoPtr
->uNumBands
> 0) && infoPtr
->bands
) {
2765 /* clean up each band */
2766 for (i
= 0; i
< infoPtr
->uNumBands
; i
++) {
2767 lpBand
= &infoPtr
->bands
[i
];
2769 /* delete text strings */
2770 if (lpBand
->lpText
) {
2771 Free (lpBand
->lpText
);
2772 lpBand
->lpText
= NULL
;
2774 /* destroy child window */
2775 DestroyWindow (lpBand
->hwndChild
);
2778 /* free band array */
2779 Free (infoPtr
->bands
);
2780 infoPtr
->bands
= NULL
;
2783 DestroyCursor (infoPtr
->hcurArrow
);
2784 DestroyCursor (infoPtr
->hcurHorz
);
2785 DestroyCursor (infoPtr
->hcurVert
);
2786 DestroyCursor (infoPtr
->hcurDrag
);
2787 if(infoPtr
->hDefaultFont
) DeleteObject (infoPtr
->hDefaultFont
);
2788 SetWindowLongPtrW (infoPtr
->hwndSelf
, 0, 0);
2790 CloseThemeData (GetWindowTheme (infoPtr
->hwndSelf
));
2792 /* free rebar info data */
2794 TRACE("destroyed!\n");
2800 REBAR_EraseBkGnd (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2804 if (GetClipBox ( (HDC
)wParam
, &cliprect
))
2805 return REBAR_InternalEraseBkGnd (infoPtr
, wParam
, lParam
, &cliprect
);
2811 REBAR_GetFont (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2813 return (LRESULT
)infoPtr
->hFont
;
2817 REBAR_PushChevron(REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2819 if (wParam
>= 0 && (UINT
)wParam
< infoPtr
->uNumBands
)
2821 NMREBARCHEVRON nmrbc
;
2822 REBAR_BAND
*lpBand
= &infoPtr
->bands
[wParam
];
2824 TRACE("Pressed chevron on band %d\n", wParam
);
2826 /* redraw chevron in pushed state */
2827 lpBand
->fDraw
|= DRAW_CHEVRONPUSHED
;
2828 RedrawWindow(infoPtr
->hwndSelf
, &lpBand
->rcChevron
,0,
2829 RDW_ERASE
|RDW_INVALIDATE
|RDW_UPDATENOW
);
2831 /* notify app so it can display a popup menu or whatever */
2832 nmrbc
.uBand
= wParam
;
2833 nmrbc
.wID
= lpBand
->wID
;
2834 nmrbc
.lParam
= lpBand
->lParam
;
2835 nmrbc
.rc
= lpBand
->rcChevron
;
2836 nmrbc
.lParamNM
= lParam
;
2837 REBAR_Notify((NMHDR
*)&nmrbc
, infoPtr
, RBN_CHEVRONPUSHED
);
2839 /* redraw chevron in previous state */
2840 lpBand
->fDraw
&= ~DRAW_CHEVRONPUSHED
;
2841 InvalidateRect(infoPtr
->hwndSelf
, &lpBand
->rcChevron
, TRUE
);
2849 REBAR_LButtonDown (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2855 ptMouseDown
.x
= (short)LOWORD(lParam
);
2856 ptMouseDown
.y
= (short)HIWORD(lParam
);
2858 REBAR_InternalHitTest(infoPtr
, &ptMouseDown
, &htFlags
, &iHitBand
);
2859 lpBand
= &infoPtr
->bands
[iHitBand
];
2861 if (htFlags
== RBHT_CHEVRON
)
2863 REBAR_PushChevron(infoPtr
, iHitBand
, 0);
2865 else if (htFlags
== RBHT_GRABBER
|| htFlags
== RBHT_CAPTION
)
2867 TRACE("Starting drag\n");
2869 SetCapture (infoPtr
->hwndSelf
);
2870 infoPtr
->iGrabbedBand
= iHitBand
;
2872 /* save off the LOWORD and HIWORD of lParam as initial x,y */
2873 infoPtr
->dragStart
.x
= (short)LOWORD(lParam
);
2874 infoPtr
->dragStart
.y
= (short)HIWORD(lParam
);
2875 infoPtr
->dragNow
= infoPtr
->dragStart
;
2876 if (infoPtr
->dwStyle
& CCS_VERT
)
2877 infoPtr
->ihitoffset
= infoPtr
->dragStart
.y
- (lpBand
->rcBand
.left
+ REBAR_PRE_GRIPPER
);
2879 infoPtr
->ihitoffset
= infoPtr
->dragStart
.x
- (lpBand
->rcBand
.left
+ REBAR_PRE_GRIPPER
);
2885 REBAR_LButtonUp (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2887 if (infoPtr
->iGrabbedBand
>= 0)
2892 infoPtr
->dragStart
.x
= 0;
2893 infoPtr
->dragStart
.y
= 0;
2894 infoPtr
->dragNow
= infoPtr
->dragStart
;
2898 if (infoPtr
->fStatus
& BEGIN_DRAG_ISSUED
) {
2899 REBAR_Notify(&layout
, infoPtr
, RBN_LAYOUTCHANGED
);
2900 REBAR_Notify_NMREBAR (infoPtr
, infoPtr
->iGrabbedBand
, RBN_ENDDRAG
);
2901 infoPtr
->fStatus
&= ~BEGIN_DRAG_ISSUED
;
2904 infoPtr
->iGrabbedBand
= -1;
2906 GetClientRect(infoPtr
->hwndSelf
, &rect
);
2907 InvalidateRect(infoPtr
->hwndSelf
, NULL
, TRUE
);
2914 REBAR_MouseLeave (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2916 if (infoPtr
->ichevronhotBand
>= 0)
2918 REBAR_BAND
*lpChevronBand
= &infoPtr
->bands
[infoPtr
->ichevronhotBand
];
2919 if (lpChevronBand
->fDraw
& DRAW_CHEVRONHOT
)
2921 lpChevronBand
->fDraw
&= ~DRAW_CHEVRONHOT
;
2922 InvalidateRect(infoPtr
->hwndSelf
, &lpChevronBand
->rcChevron
, TRUE
);
2925 infoPtr
->iOldBand
= -1;
2926 infoPtr
->ichevronhotBand
= -2;
2932 REBAR_MouseMove (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
2934 REBAR_BAND
*lpChevronBand
;
2937 ptMove
.x
= (short)LOWORD(lParam
);
2938 ptMove
.y
= (short)HIWORD(lParam
);
2940 /* if we are currently dragging a band */
2941 if (infoPtr
->iGrabbedBand
>= 0)
2943 REBAR_BAND
*band1
, *band2
;
2944 int yPtMove
= (infoPtr
->dwStyle
& CCS_VERT
? ptMove
.x
: ptMove
.y
);
2946 if (GetCapture() != infoPtr
->hwndSelf
)
2947 ERR("We are dragging but haven't got capture?!?\n");
2949 band1
= &infoPtr
->bands
[infoPtr
->iGrabbedBand
-1];
2950 band2
= &infoPtr
->bands
[infoPtr
->iGrabbedBand
];
2952 /* if mouse did not move much, exit */
2953 if ((abs(ptMove
.x
- infoPtr
->dragNow
.x
) <= mindragx
) &&
2954 (abs(ptMove
.y
- infoPtr
->dragNow
.y
) <= mindragy
)) return 0;
2956 /* Test for valid drag case - must not be first band in row */
2957 if ((yPtMove
< band2
->rcBand
.top
) ||
2958 (yPtMove
> band2
->rcBand
.bottom
) ||
2959 ((infoPtr
->iGrabbedBand
> 0) && (band1
->iRow
!= band2
->iRow
))) {
2960 FIXME("Cannot drag to other rows yet!!\n");
2963 REBAR_HandleLRDrag (infoPtr
, &ptMove
);
2970 TRACKMOUSEEVENT trackinfo
;
2972 REBAR_InternalHitTest(infoPtr
, &ptMove
, &htFlags
, &iHitBand
);
2974 if (infoPtr
->iOldBand
>= 0 && infoPtr
->iOldBand
== infoPtr
->ichevronhotBand
)
2976 lpChevronBand
= &infoPtr
->bands
[infoPtr
->ichevronhotBand
];
2977 if (lpChevronBand
->fDraw
& DRAW_CHEVRONHOT
)
2979 lpChevronBand
->fDraw
&= ~DRAW_CHEVRONHOT
;
2980 InvalidateRect(infoPtr
->hwndSelf
, &lpChevronBand
->rcChevron
, TRUE
);
2982 infoPtr
->ichevronhotBand
= -2;
2985 if (htFlags
== RBHT_CHEVRON
)
2987 /* fill in the TRACKMOUSEEVENT struct */
2988 trackinfo
.cbSize
= sizeof(TRACKMOUSEEVENT
);
2989 trackinfo
.dwFlags
= TME_QUERY
;
2990 trackinfo
.hwndTrack
= infoPtr
->hwndSelf
;
2991 trackinfo
.dwHoverTime
= 0;
2993 /* call _TrackMouseEvent to see if we are currently tracking for this hwnd */
2994 _TrackMouseEvent(&trackinfo
);
2996 /* Make sure tracking is enabled so we receive a WM_MOUSELEAVE message */
2997 if(!(trackinfo
.dwFlags
& TME_LEAVE
))
2999 trackinfo
.dwFlags
= TME_LEAVE
; /* notify upon leaving */
3001 /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */
3002 /* and can properly deactivate the hot chevron */
3003 _TrackMouseEvent(&trackinfo
);
3006 lpChevronBand
= &infoPtr
->bands
[iHitBand
];
3007 if (!(lpChevronBand
->fDraw
& DRAW_CHEVRONHOT
))
3009 lpChevronBand
->fDraw
|= DRAW_CHEVRONHOT
;
3010 InvalidateRect(infoPtr
->hwndSelf
, &lpChevronBand
->rcChevron
, TRUE
);
3011 infoPtr
->ichevronhotBand
= iHitBand
;
3014 infoPtr
->iOldBand
= iHitBand
;
3021 inline static LRESULT
3022 REBAR_NCCalcSize (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
3025 RECT
*rect
= (RECT
*)lParam
;
3027 if (infoPtr
->dwStyle
& WS_BORDER
) {
3028 rect
->left
= min(rect
->left
+ GetSystemMetrics(SM_CXEDGE
), rect
->right
);
3029 rect
->right
= max(rect
->right
- GetSystemMetrics(SM_CXEDGE
), rect
->left
);
3030 rect
->top
= min(rect
->top
+ GetSystemMetrics(SM_CYEDGE
), rect
->bottom
);
3031 rect
->bottom
= max(rect
->bottom
- GetSystemMetrics(SM_CYEDGE
), rect
->top
);
3033 else if ((theme
= GetWindowTheme (infoPtr
->hwndSelf
)))
3035 /* FIXME: should use GetThemeInt */
3036 rect
->top
= min(rect
->top
+ 1, rect
->bottom
);
3038 TRACE("new client=(%d,%d)-(%d,%d)\n", rect
->left
, rect
->top
, rect
->right
, rect
->bottom
);
3044 REBAR_NCCreate (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
3046 LPCREATESTRUCTW cs
= (LPCREATESTRUCTW
) lParam
;
3047 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
3049 NONCLIENTMETRICSW ncm
;
3052 if (infoPtr
!= NULL
) {
3053 ERR("Strange info structure pointer *not* NULL\n");
3057 if (TRACE_ON(rebar
)) {
3058 GetWindowRect(hwnd
, &wnrc1
);
3059 GetClientRect(hwnd
, &clrc1
);
3060 TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n",
3061 wnrc1
.left
, wnrc1
.top
, wnrc1
.right
, wnrc1
.bottom
,
3062 clrc1
.left
, clrc1
.top
, clrc1
.right
, clrc1
.bottom
,
3063 cs
->x
, cs
->y
, cs
->cx
, cs
->cy
);
3066 /* allocate memory for info structure */
3067 infoPtr
= (REBAR_INFO
*)Alloc (sizeof(REBAR_INFO
));
3068 SetWindowLongPtrW (hwnd
, 0, (DWORD_PTR
)infoPtr
);
3070 /* initialize info structure - initial values are 0 */
3071 infoPtr
->clrBk
= CLR_NONE
;
3072 infoPtr
->clrText
= CLR_NONE
;
3073 infoPtr
->clrBtnText
= GetSysColor (COLOR_BTNTEXT
);
3074 infoPtr
->clrBtnFace
= GetSysColor (COLOR_BTNFACE
);
3075 infoPtr
->iOldBand
= -1;
3076 infoPtr
->ichevronhotBand
= -2;
3077 infoPtr
->iGrabbedBand
= -1;
3078 infoPtr
->hwndSelf
= hwnd
;
3079 infoPtr
->DoRedraw
= TRUE
;
3080 infoPtr
->hcurArrow
= LoadCursorW (0, (LPWSTR
)IDC_ARROW
);
3081 infoPtr
->hcurHorz
= LoadCursorW (0, (LPWSTR
)IDC_SIZEWE
);
3082 infoPtr
->hcurVert
= LoadCursorW (0, (LPWSTR
)IDC_SIZENS
);
3083 infoPtr
->hcurDrag
= LoadCursorW (0, (LPWSTR
)IDC_SIZE
);
3084 infoPtr
->fStatus
= 0;
3085 infoPtr
->hFont
= GetStockObject (SYSTEM_FONT
);
3087 /* issue WM_NOTIFYFORMAT to get unicode status of parent */
3088 REBAR_NotifyFormat(infoPtr
, 0, NF_REQUERY
);
3090 /* Stow away the original style */
3091 infoPtr
->orgStyle
= cs
->style
;
3092 /* add necessary styles to the requested styles */
3093 infoPtr
->dwStyle
= cs
->style
| WS_VISIBLE
;
3094 if ((infoPtr
->dwStyle
& CCS_LAYOUT_MASK
) == 0)
3095 infoPtr
->dwStyle
|= CCS_TOP
;
3096 SetWindowLongW (hwnd
, GWL_STYLE
, infoPtr
->dwStyle
);
3098 /* get font handle for Caption Font */
3099 ncm
.cbSize
= sizeof(ncm
);
3100 SystemParametersInfoW (SPI_GETNONCLIENTMETRICS
, ncm
.cbSize
, &ncm
, 0);
3101 /* if the font is bold, set to normal */
3102 if (ncm
.lfCaptionFont
.lfWeight
> FW_NORMAL
) {
3103 ncm
.lfCaptionFont
.lfWeight
= FW_NORMAL
;
3105 tfont
= CreateFontIndirectW (&ncm
.lfCaptionFont
);
3107 infoPtr
->hFont
= infoPtr
->hDefaultFont
= tfont
;
3111 GetSysColor (numerous);
3112 GetSysColorBrush (numerous) (see WM_SYSCOLORCHANGE);
3113 *GetStockObject (SYSTEM_FONT);
3114 *SetWindowLong (hwnd, 0, info ptr);
3116 *SetWindowLong (hwnd, GWL_STYLE, style+0x10000001);
3117 WS_VISIBLE = 0x10000000;
3118 CCS_TOP = 0x00000001;
3119 *SystemParametersInfo (SPI_GETNONCLIENTMETRICS...);
3120 *CreateFontIndirect (lfCaptionFont from above);
3122 SelectObject (hdc, fontabove);
3123 GetTextMetrics (hdc, ); guessing is tmHeight
3124 SelectObject (hdc, oldfont);
3127 MapWindowPoints (0, parent, rectabove, 2);
3130 ClientToScreen (clientrect);
3131 SetWindowPos (hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER);
3138 REBAR_NCHitTest (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
3144 LRESULT ret
= HTCLIENT
;
3147 * Differences from doc at MSDN (as observed with version 4.71 of
3149 * 1. doc says nmmouse.pt is in screen coord, trace shows client coord.
3150 * 2. if band is not identified .dwItemSpec is 0xffffffff.
3151 * 3. native always seems to return HTCLIENT if notify return is 0.
3154 clpt
.x
= (short)LOWORD(lParam
);
3155 clpt
.y
= (short)HIWORD(lParam
);
3156 ScreenToClient (infoPtr
->hwndSelf
, &clpt
);
3157 REBAR_InternalHitTest (infoPtr
, &clpt
, &scrap
,
3158 (INT
*)&nmmouse
.dwItemSpec
);
3159 nmmouse
.dwItemData
= 0;
3161 nmmouse
.dwHitInfo
= 0;
3162 if ((i
= REBAR_Notify((NMHDR
*) &nmmouse
, infoPtr
, NM_NCHITTEST
))) {
3163 TRACE("notify changed return value from %ld to %d\n",
3167 TRACE("returning %ld, client point (%d,%d)\n", ret
, clpt
.x
, clpt
.y
);
3173 REBAR_NCPaint (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
3179 if (infoPtr
->dwStyle
& WS_MINIMIZE
)
3180 return 0; /* Nothing to do */
3182 if (infoPtr
->dwStyle
& WS_BORDER
) {
3184 /* adjust rectangle and draw the necessary edge */
3185 if (!(hdc
= GetDCEx( infoPtr
->hwndSelf
, 0, DCX_USESTYLE
| DCX_WINDOW
)))
3187 GetWindowRect (infoPtr
->hwndSelf
, &rcWindow
);
3188 OffsetRect (&rcWindow
, -rcWindow
.left
, -rcWindow
.top
);
3189 TRACE("rect (%d,%d)-(%d,%d)\n",
3190 rcWindow
.left
, rcWindow
.top
,
3191 rcWindow
.right
, rcWindow
.bottom
);
3192 DrawEdge (hdc
, &rcWindow
, EDGE_ETCHED
, BF_RECT
);
3193 ReleaseDC( infoPtr
->hwndSelf
, hdc
);
3195 else if ((theme
= GetWindowTheme (infoPtr
->hwndSelf
)))
3197 /* adjust rectangle and draw the necessary edge */
3198 if (!(hdc
= GetDCEx( infoPtr
->hwndSelf
, 0, DCX_USESTYLE
| DCX_WINDOW
)))
3200 GetWindowRect (infoPtr
->hwndSelf
, &rcWindow
);
3201 OffsetRect (&rcWindow
, -rcWindow
.left
, -rcWindow
.top
);
3202 TRACE("rect (%d,%d)-(%d,%d)\n",
3203 rcWindow
.left
, rcWindow
.top
,
3204 rcWindow
.right
, rcWindow
.bottom
);
3205 DrawThemeEdge (theme
, hdc
, 0, 0, &rcWindow
, BDR_RAISEDINNER
, BF_TOP
, NULL
);
3206 ReleaseDC( infoPtr
->hwndSelf
, hdc
);
3214 REBAR_NotifyFormat (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
3218 if (lParam
== NF_REQUERY
) {
3219 i
= SendMessageW(REBAR_GetNotifyParent (infoPtr
),
3220 WM_NOTIFYFORMAT
, (WPARAM
)infoPtr
->hwndSelf
, NF_QUERY
);
3221 if ((i
!= NFR_ANSI
) && (i
!= NFR_UNICODE
)) {
3222 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", i
);
3225 infoPtr
->bUnicode
= (i
== NFR_UNICODE
) ? 1 : 0;
3228 return (LRESULT
)((infoPtr
->bUnicode
) ? NFR_UNICODE
: NFR_ANSI
);
3233 REBAR_Paint (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
3239 GetClientRect(infoPtr
->hwndSelf
, &rc
);
3240 hdc
= wParam
==0 ? BeginPaint (infoPtr
->hwndSelf
, &ps
) : (HDC
)wParam
;
3242 TRACE("painting (%d,%d)-(%d,%d) client (%d,%d)-(%d,%d)\n",
3243 ps
.rcPaint
.left
, ps
.rcPaint
.top
,
3244 ps
.rcPaint
.right
, ps
.rcPaint
.bottom
,
3245 rc
.left
, rc
.top
, rc
.right
, rc
.bottom
);
3248 /* Erase area of paint if requested */
3249 REBAR_InternalEraseBkGnd (infoPtr
, wParam
, lParam
, &ps
.rcPaint
);
3252 REBAR_Refresh (infoPtr
, hdc
);
3254 EndPaint (infoPtr
->hwndSelf
, &ps
);
3260 REBAR_SetCursor (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
3265 TRACE("code=0x%X id=0x%X\n", LOWORD(lParam
), HIWORD(lParam
));
3268 ScreenToClient (infoPtr
->hwndSelf
, &pt
);
3270 REBAR_InternalHitTest (infoPtr
, &pt
, &flags
, NULL
);
3272 if (flags
== RBHT_GRABBER
) {
3273 if ((infoPtr
->dwStyle
& CCS_VERT
) &&
3274 !(infoPtr
->dwStyle
& RBS_VERTICALGRIPPER
))
3275 SetCursor (infoPtr
->hcurVert
);
3277 SetCursor (infoPtr
->hcurHorz
);
3279 else if (flags
!= RBHT_CLIENT
)
3280 SetCursor (infoPtr
->hcurArrow
);
3287 REBAR_SetFont (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
3293 infoPtr
->hFont
= (HFONT
)wParam
;
3295 /* revalidate all bands to change sizes of text in headers of bands */
3296 for (i
=0; i
<infoPtr
->uNumBands
; i
++) {
3297 lpBand
= &infoPtr
->bands
[i
];
3298 REBAR_ValidateBand (infoPtr
, lpBand
);
3302 if (LOWORD(lParam
)) {
3303 GetClientRect (infoPtr
->hwndSelf
, &rcClient
);
3304 REBAR_Layout(infoPtr
, &rcClient
, FALSE
);
3311 inline static LRESULT
3312 REBAR_SetRedraw (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
3313 /*****************************************************
3316 * Handles the WM_SETREDRAW message.
3319 * According to testing V4.71 of COMCTL32 returns the
3320 * *previous* status of the redraw flag (either 0 or -1)
3321 * instead of the MSDN documented value of 0 if handled
3323 *****************************************************/
3325 BOOL oldredraw
= infoPtr
->DoRedraw
;
3327 TRACE("set to %s, fStatus=%08x\n",
3328 (wParam
) ? "TRUE" : "FALSE", infoPtr
->fStatus
);
3329 infoPtr
->DoRedraw
= (BOOL
) wParam
;
3331 if (infoPtr
->fStatus
& BAND_NEEDS_REDRAW
) {
3332 REBAR_MoveChildWindows (infoPtr
, 0, infoPtr
->uNumBands
);
3333 REBAR_ForceResize (infoPtr
);
3334 InvalidateRect (infoPtr
->hwndSelf
, 0, TRUE
);
3336 infoPtr
->fStatus
&= ~BAND_NEEDS_REDRAW
;
3338 return (oldredraw
) ? -1 : 0;
3343 REBAR_Size (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
3345 TRACE("wParam=%x, lParam=%lx\n", wParam
, lParam
);
3347 /* avoid auto resize infinite recursion */
3348 if (infoPtr
->fStatus
& AUTO_RESIZE
) {
3349 infoPtr
->fStatus
&= ~AUTO_RESIZE
;
3350 TRACE("AUTO_RESIZE was set, reset, fStatus=%08x lparam=%08lx\n",
3351 infoPtr
->fStatus
, lParam
);
3356 if (infoPtr
->dwStyle
& RBS_AUTOSIZE
) {
3357 NMRBAUTOSIZE autosize
;
3359 GetClientRect(infoPtr
->hwndSelf
, &autosize
.rcTarget
);
3360 autosize
.fChanged
= 0; /* ??? */
3361 autosize
.rcActual
= autosize
.rcTarget
; /* ??? */
3362 REBAR_Notify((NMHDR
*) &autosize
, infoPtr
, RBN_AUTOSIZE
);
3363 TRACE("RBN_AUTOSIZE client=(%d,%d), lp=%08lx\n",
3364 autosize
.rcTarget
.right
, autosize
.rcTarget
.bottom
, lParam
);
3367 infoPtr
->fStatus
|= BAND_NEEDS_LAYOUT
;
3368 REBAR_Layout(infoPtr
, NULL
, TRUE
);
3375 REBAR_StyleChanged (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
3377 STYLESTRUCT
*ss
= (STYLESTRUCT
*)lParam
;
3379 TRACE("current style=%08x, styleOld=%08x, style being set to=%08x\n",
3380 infoPtr
->dwStyle
, ss
->styleOld
, ss
->styleNew
);
3381 infoPtr
->orgStyle
= infoPtr
->dwStyle
= ss
->styleNew
;
3382 if (GetWindowTheme (infoPtr
->hwndSelf
))
3383 infoPtr
->dwStyle
&= ~WS_BORDER
;
3384 /* maybe it should be COMMON_STYLES like in toolbar */
3385 if ((ss
->styleNew
^ ss
->styleOld
) & CCS_VERT
)
3387 infoPtr
->fStatus
|= BAND_NEEDS_LAYOUT
;
3388 REBAR_Layout(infoPtr
, NULL
, TRUE
);
3394 /* update theme after a WM_THEMECHANGED message */
3395 static LRESULT
theme_changed (REBAR_INFO
* infoPtr
)
3397 HTHEME theme
= GetWindowTheme (infoPtr
->hwndSelf
);
3398 CloseThemeData (theme
);
3399 theme
= OpenThemeData (infoPtr
->hwndSelf
, themeClass
);
3400 /* WS_BORDER disappears when theming is enabled and reappears when
3402 infoPtr
->dwStyle
&= ~WS_BORDER
;
3403 infoPtr
->dwStyle
|= theme
? 0 : (infoPtr
->orgStyle
& WS_BORDER
);
3408 REBAR_WindowPosChanged (REBAR_INFO
*infoPtr
, WPARAM wParam
, LPARAM lParam
)
3413 ret
= DefWindowProcW(infoPtr
->hwndSelf
, WM_WINDOWPOSCHANGED
,
3415 GetWindowRect(infoPtr
->hwndSelf
, &rc
);
3416 TRACE("hwnd %p new pos (%d,%d)-(%d,%d)\n",
3417 infoPtr
->hwndSelf
, rc
.left
, rc
.top
, rc
.right
, rc
.bottom
);
3422 static LRESULT WINAPI
3423 REBAR_WindowProc (HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
3425 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
3427 TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n",
3428 hwnd
, uMsg
, wParam
, lParam
);
3429 if (!infoPtr
&& (uMsg
!= WM_NCCREATE
))
3430 return DefWindowProcW (hwnd
, uMsg
, wParam
, lParam
);
3433 /* case RB_BEGINDRAG: */
3436 return REBAR_DeleteBand (infoPtr
, wParam
, lParam
);
3438 /* case RB_DRAGMOVE: */
3439 /* case RB_ENDDRAG: */
3441 case RB_GETBANDBORDERS
:
3442 return REBAR_GetBandBorders (infoPtr
, wParam
, lParam
);
3444 case RB_GETBANDCOUNT
:
3445 return REBAR_GetBandCount (infoPtr
);
3447 case RB_GETBANDINFO_OLD
:
3448 case RB_GETBANDINFOA
:
3449 return REBAR_GetBandInfoT(infoPtr
, wParam
, lParam
, FALSE
);
3451 case RB_GETBANDINFOW
:
3452 return REBAR_GetBandInfoT(infoPtr
, wParam
, lParam
, TRUE
);
3454 case RB_GETBARHEIGHT
:
3455 return REBAR_GetBarHeight (infoPtr
, wParam
, lParam
);
3458 return REBAR_GetBarInfo (infoPtr
, wParam
, lParam
);
3461 return REBAR_GetBkColor (infoPtr
);
3463 /* case RB_GETCOLORSCHEME: */
3464 /* case RB_GETDROPTARGET: */
3467 return REBAR_GetPalette (infoPtr
, wParam
, lParam
);
3470 return REBAR_GetRect (infoPtr
, wParam
, lParam
);
3472 case RB_GETROWCOUNT
:
3473 return REBAR_GetRowCount (infoPtr
);
3475 case RB_GETROWHEIGHT
:
3476 return REBAR_GetRowHeight (infoPtr
, wParam
, lParam
);
3478 case RB_GETTEXTCOLOR
:
3479 return REBAR_GetTextColor (infoPtr
);
3481 case RB_GETTOOLTIPS
:
3482 return REBAR_GetToolTips (infoPtr
);
3484 case RB_GETUNICODEFORMAT
:
3485 return REBAR_GetUnicodeFormat (infoPtr
);
3487 case CCM_GETVERSION
:
3488 return REBAR_GetVersion (infoPtr
);
3491 return REBAR_HitTest (infoPtr
, wParam
, lParam
);
3494 return REBAR_IdToIndex (infoPtr
, wParam
, lParam
);
3496 case RB_INSERTBANDA
:
3497 return REBAR_InsertBandT(infoPtr
, wParam
, lParam
, FALSE
);
3499 case RB_INSERTBANDW
:
3500 return REBAR_InsertBandT(infoPtr
, wParam
, lParam
, TRUE
);
3502 case RB_MAXIMIZEBAND
:
3503 return REBAR_MaximizeBand (infoPtr
, wParam
, lParam
);
3505 case RB_MINIMIZEBAND
:
3506 return REBAR_MinimizeBand (infoPtr
, wParam
, lParam
);
3509 return REBAR_MoveBand (infoPtr
, wParam
, lParam
);
3511 case RB_PUSHCHEVRON
:
3512 return REBAR_PushChevron (infoPtr
, wParam
, lParam
);
3514 case RB_SETBANDINFOA
:
3515 return REBAR_SetBandInfoT(infoPtr
, wParam
, lParam
, FALSE
);
3517 case RB_SETBANDINFOW
:
3518 return REBAR_SetBandInfoT(infoPtr
, wParam
, lParam
, TRUE
);
3521 return REBAR_SetBarInfo (infoPtr
, wParam
, lParam
);
3524 return REBAR_SetBkColor (infoPtr
, wParam
, lParam
);
3526 /* case RB_SETCOLORSCHEME: */
3527 /* case RB_SETPALETTE: */
3528 /* return REBAR_GetPalette (infoPtr, wParam, lParam); */
3531 return REBAR_SetParent (infoPtr
, wParam
, lParam
);
3533 case RB_SETTEXTCOLOR
:
3534 return REBAR_SetTextColor (infoPtr
, wParam
, lParam
);
3536 /* case RB_SETTOOLTIPS: */
3538 case RB_SETUNICODEFORMAT
:
3539 return REBAR_SetUnicodeFormat (infoPtr
, wParam
);
3541 case CCM_SETVERSION
:
3542 return REBAR_SetVersion (infoPtr
, (INT
)wParam
);
3545 return REBAR_ShowBand (infoPtr
, wParam
, lParam
);
3548 return REBAR_SizeToRect (infoPtr
, wParam
, lParam
);
3551 /* Messages passed to parent */
3555 return SendMessageW(REBAR_GetNotifyParent (infoPtr
), uMsg
, wParam
, lParam
);
3558 /* case WM_CHARTOITEM: supported according to ControlSpy */
3561 return REBAR_Create (infoPtr
, wParam
, lParam
);
3564 return REBAR_Destroy (infoPtr
, wParam
, lParam
);
3567 return REBAR_EraseBkGnd (infoPtr
, wParam
, lParam
);
3570 return REBAR_GetFont (infoPtr
, wParam
, lParam
);
3572 /* case WM_LBUTTONDBLCLK: supported according to ControlSpy */
3574 case WM_LBUTTONDOWN
:
3575 return REBAR_LButtonDown (infoPtr
, wParam
, lParam
);
3578 return REBAR_LButtonUp (infoPtr
, wParam
, lParam
);
3580 /* case WM_MEASUREITEM: supported according to ControlSpy */
3583 return REBAR_MouseMove (infoPtr
, wParam
, lParam
);
3586 return REBAR_MouseLeave (infoPtr
, wParam
, lParam
);
3589 return REBAR_NCCalcSize (infoPtr
, wParam
, lParam
);
3592 return REBAR_NCCreate (hwnd
, wParam
, lParam
);
3595 return REBAR_NCHitTest (infoPtr
, wParam
, lParam
);
3598 return REBAR_NCPaint (infoPtr
, wParam
, lParam
);
3600 case WM_NOTIFYFORMAT
:
3601 return REBAR_NotifyFormat (infoPtr
, wParam
, lParam
);
3603 case WM_PRINTCLIENT
:
3605 return REBAR_Paint (infoPtr
, wParam
, lParam
);
3607 /* case WM_PALETTECHANGED: supported according to ControlSpy */
3608 /* case WM_QUERYNEWPALETTE:supported according to ControlSpy */
3609 /* case WM_RBUTTONDOWN: supported according to ControlSpy */
3610 /* case WM_RBUTTONUP: supported according to ControlSpy */
3613 return REBAR_SetCursor (infoPtr
, wParam
, lParam
);
3616 return REBAR_SetFont (infoPtr
, wParam
, lParam
);
3619 return REBAR_SetRedraw (infoPtr
, wParam
, lParam
);
3622 return REBAR_Size (infoPtr
, wParam
, lParam
);
3624 case WM_STYLECHANGED
:
3625 return REBAR_StyleChanged (infoPtr
, wParam
, lParam
);
3627 case WM_THEMECHANGED
:
3628 return theme_changed (infoPtr
);
3630 /* case WM_SYSCOLORCHANGE: supported according to ControlSpy */
3631 /* "Applications that have brushes using the existing system colors
3632 should delete those brushes and recreate them using the new
3633 system colors." per MSDN */
3635 /* case WM_VKEYTOITEM: supported according to ControlSpy */
3636 /* case WM_WININICHANGE: */
3638 case WM_WINDOWPOSCHANGED
:
3639 return REBAR_WindowPosChanged (infoPtr
, wParam
, lParam
);
3642 if ((uMsg
>= WM_USER
) && (uMsg
< WM_APP
))
3643 ERR("unknown msg %04x wp=%08x lp=%08lx\n",
3644 uMsg
, wParam
, lParam
);
3645 return DefWindowProcW (hwnd
, uMsg
, wParam
, lParam
);
3651 REBAR_Register (void)
3655 ZeroMemory (&wndClass
, sizeof(WNDCLASSW
));
3656 wndClass
.style
= CS_GLOBALCLASS
| CS_DBLCLKS
;
3657 wndClass
.lpfnWndProc
= REBAR_WindowProc
;
3658 wndClass
.cbClsExtra
= 0;
3659 wndClass
.cbWndExtra
= sizeof(REBAR_INFO
*);
3660 wndClass
.hCursor
= 0;
3661 wndClass
.hbrBackground
= (HBRUSH
)(COLOR_BTNFACE
+ 1);
3663 wndClass
.hbrBackground
= CreateSolidBrush(RGB(0,128,0));
3665 wndClass
.lpszClassName
= REBARCLASSNAMEW
;
3667 RegisterClassW (&wndClass
);
3669 mindragx
= GetSystemMetrics (SM_CXDRAG
);
3670 mindragy
= GetSystemMetrics (SM_CYDRAG
);
3676 REBAR_Unregister (void)
3678 UnregisterClassW (REBARCLASSNAMEW
, NULL
);