4 * Copyright 1998, 1999 Eric Kohl
7 * An author is needed! Any volunteers?
8 * I will only improve this control once in a while.
9 * Eric <ekohl@abo.rhein-zeitung.de>
12 * - vertical placement
13 * - ComboBox and ComboBoxEx placement
18 * - All notifications.
29 DEFAULT_DEBUG_CHANNEL(rebar
)
33 #define DRAW_GRIPPER 1
38 #define GRIPPER_WIDTH 13
41 #define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)GetWindowLongA (hwnd, 0))
45 REBAR_DrawBand (HDC hdc
, REBAR_INFO
*infoPtr
, REBAR_BAND
*lpBand
)
48 DrawEdge (hdc
, &lpBand
->rcBand
, BDR_RAISEDINNER
, BF_MIDDLE
);
53 if (lpBand
->fDraw
& DRAW_GRIPPER
)
54 DrawEdge (hdc
, &lpBand
->rcGripper
, BDR_RAISEDINNER
, BF_RECT
| BF_MIDDLE
);
56 /* draw caption image */
57 if (lpBand
->fDraw
& DRAW_IMAGE
) {
58 /* FIXME: center image */
61 pt
.y
= (lpBand
->rcCapImage
.bottom
+ lpBand
->rcCapImage
.top
- infoPtr
->imageSize
.cy
)/2;
62 pt
.x
= (lpBand
->rcCapImage
.right
+ lpBand
->rcCapImage
.left
- infoPtr
->imageSize
.cx
)/2;
64 ImageList_Draw (infoPtr
->himl
, lpBand
->iImage
, hdc
,
65 /* lpBand->rcCapImage.left, lpBand->rcCapImage.top, */
70 /* draw caption text */
71 if (lpBand
->fDraw
& DRAW_TEXT
) {
72 HFONT hOldFont
= SelectObject (hdc
, infoPtr
->hFont
);
73 INT oldBkMode
= SetBkMode (hdc
, TRANSPARENT
);
74 DrawTextW (hdc
, lpBand
->lpText
, -1, &lpBand
->rcCapText
,
75 DT_CENTER
| DT_VCENTER
| DT_SINGLELINE
);
76 if (oldBkMode
!= TRANSPARENT
)
77 SetBkMode (hdc
, oldBkMode
);
78 SelectObject (hdc
, hOldFont
);
84 REBAR_Refresh (HWND hwnd
, HDC hdc
)
86 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
90 for (i
= 0; i
< infoPtr
->uNumBands
; i
++) {
91 lpBand
= &infoPtr
->bands
[i
];
93 if ((lpBand
->fStyle
& RBBS_HIDDEN
) ||
94 ((GetWindowLongA (hwnd
, GWL_STYLE
) & CCS_VERT
) &&
95 (lpBand
->fStyle
& RBBS_NOVERT
)))
98 REBAR_DrawBand (hdc
, infoPtr
, lpBand
);
105 REBAR_CalcHorzBand (REBAR_INFO
*infoPtr
, REBAR_BAND
*lpBand
)
109 /* set initial caption image rectangle */
110 SetRect (&lpBand
->rcCapImage
, 0, 0, 0, 0);
112 /* image is visible */
113 if ((lpBand
->iImage
> -1) && (infoPtr
->himl
)) {
114 lpBand
->fDraw
|= DRAW_IMAGE
;
116 lpBand
->rcCapImage
.right
= lpBand
->rcCapImage
.left
+ infoPtr
->imageSize
.cx
;
117 lpBand
->rcCapImage
.bottom
= lpBand
->rcCapImage
.top
+ infoPtr
->imageSize
.cy
;
119 /* update band height */
120 if (lpBand
->uMinHeight
< infoPtr
->imageSize
.cy
+ 2) {
121 lpBand
->uMinHeight
= infoPtr
->imageSize
.cy
+ 2;
122 lpBand
->rcBand
.bottom
= lpBand
->rcBand
.top
+ lpBand
->uMinHeight
;
126 /* set initial caption text rectangle */
127 lpBand
->rcCapText
.left
= lpBand
->rcCapImage
.right
;
128 lpBand
->rcCapText
.top
= lpBand
->rcBand
.top
+ 1;
129 lpBand
->rcCapText
.right
= lpBand
->rcCapText
.left
;
130 lpBand
->rcCapText
.bottom
= lpBand
->rcBand
.bottom
- 1;
132 /* text is visible */
133 if (lpBand
->lpText
) {
135 HFONT hOldFont
= SelectObject (hdc
, infoPtr
->hFont
);
138 lpBand
->fDraw
|= DRAW_TEXT
;
139 GetTextExtentPoint32W (hdc
, lpBand
->lpText
,
140 lstrlenW (lpBand
->lpText
), &size
);
141 lpBand
->rcCapText
.right
+= size
.cx
;
143 SelectObject (hdc
, hOldFont
);
147 /* set initial child window rectangle */
148 if (lpBand
->fStyle
& RBBS_FIXEDSIZE
) {
149 lpBand
->rcChild
.left
= lpBand
->rcCapText
.right
;
150 lpBand
->rcChild
.top
= lpBand
->rcBand
.top
;
151 lpBand
->rcChild
.right
= lpBand
->rcBand
.right
;
152 lpBand
->rcChild
.bottom
= lpBand
->rcBand
.bottom
;
155 lpBand
->rcChild
.left
= lpBand
->rcCapText
.right
+ 4;
156 lpBand
->rcChild
.top
= lpBand
->rcBand
.top
+ 2;
157 lpBand
->rcChild
.right
= lpBand
->rcBand
.right
- 4;
158 lpBand
->rcChild
.bottom
= lpBand
->rcBand
.bottom
- 2;
161 /* calculate gripper rectangle */
162 if ((!(lpBand
->fStyle
& RBBS_NOGRIPPER
)) &&
163 (!(lpBand
->fStyle
& RBBS_FIXEDSIZE
)) &&
164 ((lpBand
->fStyle
& RBBS_GRIPPERALWAYS
) ||
165 (infoPtr
->uNumBands
> 1))) {
166 lpBand
->fDraw
|= DRAW_GRIPPER
;
167 lpBand
->rcGripper
.left
= lpBand
->rcBand
.left
+ 3;
168 lpBand
->rcGripper
.right
= lpBand
->rcGripper
.left
+ 3;
169 lpBand
->rcGripper
.top
= lpBand
->rcBand
.top
+ 3;
170 lpBand
->rcGripper
.bottom
= lpBand
->rcBand
.bottom
- 3;
172 /* move caption rectangles */
173 OffsetRect (&lpBand
->rcCapImage
, GRIPPER_WIDTH
, 0);
174 OffsetRect (&lpBand
->rcCapText
, GRIPPER_WIDTH
, 0);
176 /* adjust child rectangle */
177 lpBand
->rcChild
.left
+= GRIPPER_WIDTH
;
185 REBAR_CalcVertBand (HWND hwnd
, REBAR_INFO
*infoPtr
, REBAR_BAND
*lpBand
)
189 /* set initial caption image rectangle */
190 SetRect (&lpBand
->rcCapImage
, 0, 0, 0, 0);
192 /* image is visible */
193 if ((lpBand
->iImage
> -1) && (infoPtr
->himl
)) {
194 lpBand
->fDraw
|= DRAW_IMAGE
;
196 lpBand
->rcCapImage
.right
= lpBand
->rcCapImage
.left
+ infoPtr
->imageSize
.cx
;
197 lpBand
->rcCapImage
.bottom
= lpBand
->rcCapImage
.top
+ infoPtr
->imageSize
.cy
;
199 /* update band width */
200 if (lpBand
->uMinHeight
< infoPtr
->imageSize
.cx
+ 2) {
201 lpBand
->uMinHeight
= infoPtr
->imageSize
.cx
+ 2;
202 lpBand
->rcBand
.right
= lpBand
->rcBand
.left
+ lpBand
->uMinHeight
;
206 /* set initial caption text rectangle */
207 lpBand
->rcCapText
.left
= lpBand
->rcBand
.left
+ 1;
208 lpBand
->rcCapText
.top
= lpBand
->rcCapImage
.bottom
;
209 lpBand
->rcCapText
.right
= lpBand
->rcBand
.right
- 1;
210 lpBand
->rcCapText
.bottom
= lpBand
->rcCapText
.top
;
212 /* text is visible */
213 if (lpBand
->lpText
) {
215 HFONT hOldFont
= SelectObject (hdc
, infoPtr
->hFont
);
218 lpBand
->fDraw
|= DRAW_TEXT
;
219 GetTextExtentPoint32W (hdc
, lpBand
->lpText
,
220 lstrlenW (lpBand
->lpText
), &size
);
221 /* lpBand->rcCapText.right += size.cx; */
222 lpBand
->rcCapText
.bottom
+= size
.cy
;
224 SelectObject (hdc
, hOldFont
);
228 /* set initial child window rectangle */
229 if (lpBand
->fStyle
& RBBS_FIXEDSIZE
) {
230 lpBand
->rcChild
.left
= lpBand
->rcBand
.left
;
231 lpBand
->rcChild
.top
= lpBand
->rcCapText
.bottom
;
232 lpBand
->rcChild
.right
= lpBand
->rcBand
.right
;
233 lpBand
->rcChild
.bottom
= lpBand
->rcBand
.bottom
;
236 lpBand
->rcChild
.left
= lpBand
->rcBand
.left
+ 2;
237 lpBand
->rcChild
.top
= lpBand
->rcCapText
.bottom
+ 4;
238 lpBand
->rcChild
.right
= lpBand
->rcBand
.right
- 2;
239 lpBand
->rcChild
.bottom
= lpBand
->rcBand
.bottom
- 4;
242 /* calculate gripper rectangle */
243 if ((!(lpBand
->fStyle
& RBBS_NOGRIPPER
)) &&
244 (!(lpBand
->fStyle
& RBBS_FIXEDSIZE
)) &&
245 ((lpBand
->fStyle
& RBBS_GRIPPERALWAYS
) ||
246 (infoPtr
->uNumBands
> 1))) {
247 lpBand
->fDraw
|= DRAW_GRIPPER
;
249 if (GetWindowLongA (hwnd
, GWL_STYLE
) & RBS_VERTICALGRIPPER
) {
250 /* adjust band width */
251 lpBand
->rcBand
.right
+= GRIPPER_WIDTH
;
252 lpBand
->uMinHeight
+= GRIPPER_WIDTH
;
254 lpBand
->rcGripper
.left
= lpBand
->rcBand
.left
+ 3;
255 lpBand
->rcGripper
.right
= lpBand
->rcGripper
.left
+ 3;
256 lpBand
->rcGripper
.top
= lpBand
->rcBand
.top
+ 3;
257 lpBand
->rcGripper
.bottom
= lpBand
->rcBand
.bottom
- 3;
259 /* move caption rectangles */
260 OffsetRect (&lpBand
->rcCapImage
, GRIPPER_WIDTH
, 0);
261 OffsetRect (&lpBand
->rcCapText
, GRIPPER_WIDTH
, 0);
263 /* adjust child rectangle */
264 lpBand
->rcChild
.left
+= GRIPPER_WIDTH
;
267 lpBand
->rcGripper
.left
= lpBand
->rcBand
.left
+ 3;
268 lpBand
->rcGripper
.right
= lpBand
->rcBand
.right
- 3;
269 lpBand
->rcGripper
.top
= lpBand
->rcBand
.top
+ 3;
270 lpBand
->rcGripper
.bottom
= lpBand
->rcGripper
.top
+ 3;
272 /* move caption rectangles */
273 OffsetRect (&lpBand
->rcCapImage
, 0, GRIPPER_WIDTH
);
274 OffsetRect (&lpBand
->rcCapText
, 0, GRIPPER_WIDTH
);
276 /* adjust child rectangle */
277 lpBand
->rcChild
.top
+= GRIPPER_WIDTH
;
284 REBAR_Layout (HWND hwnd
, LPRECT lpRect
)
286 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
287 DWORD dwStyle
= GetWindowLongA (hwnd
, GWL_STYLE
);
296 GetClientRect (hwnd
, &rcClient
);
301 if (dwStyle
& CCS_VERT
) {
302 cx
= 20; /* FIXME: fixed height */
303 cy
= rcClient
.bottom
- rcClient
.top
;
306 cx
= rcClient
.right
- rcClient
.left
;
307 cy
= 20; /* FIXME: fixed height */
310 for (i
= 0; i
< infoPtr
->uNumBands
; i
++) {
311 lpBand
= &infoPtr
->bands
[i
];
313 if ((lpBand
->fStyle
& RBBS_HIDDEN
) ||
314 ((dwStyle
& CCS_VERT
) && (lpBand
->fStyle
& RBBS_NOVERT
)))
318 if (dwStyle
& CCS_VERT
) {
319 if (lpBand
->fStyle
& RBBS_VARIABLEHEIGHT
)
320 cx
= lpBand
->cyMaxChild
;
321 else if (lpBand
->fStyle
& RBBIM_CHILDSIZE
)
322 cx
= lpBand
->cyMinChild
;
326 lpBand
->rcBand
.left
= x
;
327 lpBand
->rcBand
.right
= x
+ cx
;
328 lpBand
->rcBand
.top
= y
;
329 lpBand
->rcBand
.bottom
= y
+ cy
;
330 lpBand
->uMinHeight
= cx
;
333 if (lpBand
->fStyle
& RBBS_VARIABLEHEIGHT
)
334 cy
= lpBand
->cyMaxChild
;
335 else if (lpBand
->fStyle
& RBBIM_CHILDSIZE
)
336 cy
= lpBand
->cyMinChild
;
340 lpBand
->rcBand
.left
= x
;
341 lpBand
->rcBand
.right
= x
+ cx
;
342 lpBand
->rcBand
.top
= y
;
343 lpBand
->rcBand
.bottom
= y
+ cy
;
344 lpBand
->uMinHeight
= cy
;
347 if (dwStyle
& CCS_VERT
) {
348 REBAR_CalcVertBand (hwnd
, infoPtr
, lpBand
);
349 x
+= lpBand
->uMinHeight
;
352 REBAR_CalcHorzBand (infoPtr
, lpBand
);
353 y
+= lpBand
->uMinHeight
;
357 if (dwStyle
& CCS_VERT
) {
358 infoPtr
->calcSize
.cx
= x
;
359 infoPtr
->calcSize
.cy
= rcClient
.bottom
- rcClient
.top
;
362 infoPtr
->calcSize
.cx
= rcClient
.right
- rcClient
.left
;
363 infoPtr
->calcSize
.cy
= y
;
369 REBAR_ForceResize (HWND hwnd
)
371 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
374 TRACE (rebar
, " to [%d x %d]!\n",
375 infoPtr
->calcSize
.cx
, infoPtr
->calcSize
.cy
);
377 infoPtr
->bAutoResize
= TRUE
;
381 rc
.right
= infoPtr
->calcSize
.cx
;
382 rc
.bottom
= infoPtr
->calcSize
.cy
;
384 if (GetWindowLongA (hwnd
, GWL_STYLE
) & WS_BORDER
) {
385 InflateRect (&rc
, GetSystemMetrics(SM_CXEDGE
), GetSystemMetrics(SM_CYEDGE
));
388 SetWindowPos (hwnd
, 0, 0, 0,
389 rc
.right
- rc
.left
, rc
.bottom
- rc
.top
,
390 SWP_NOMOVE
| SWP_NOZORDER
| SWP_SHOWWINDOW
);
395 REBAR_MoveChildWindows (HWND hwnd
)
397 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
399 CHAR szClassName
[40];
402 for (i
= 0; i
< infoPtr
->uNumBands
; i
++) {
403 lpBand
= &infoPtr
->bands
[i
];
405 if (lpBand
->fStyle
& RBBS_HIDDEN
)
407 if (lpBand
->hwndChild
) {
408 TRACE (rebar
, "hwndChild = %x\n", lpBand
->hwndChild
);
410 GetClassNameA (lpBand
->hwndChild
, szClassName
, 40);
411 if (!lstrcmpA (szClassName
, "ComboBox")) {
412 INT nEditHeight
, yPos
;
415 /* special placement code for combo box */
418 /* get size of edit line */
419 GetWindowRect (lpBand
->hwndChild
, &rc
);
420 nEditHeight
= rc
.bottom
- rc
.top
;
421 yPos
= (lpBand
->rcChild
.bottom
+ lpBand
->rcChild
.top
- nEditHeight
)/2;
423 /* center combo box inside child area */
424 SetWindowPos (lpBand
->hwndChild
, HWND_TOP
,
425 lpBand
->rcChild
.left
, /*lpBand->rcChild.top*/ yPos
,
426 lpBand
->rcChild
.right
- lpBand
->rcChild
.left
,
431 else if (!lstrcmpA (szClassName
, WC_COMBOBOXEXA
)) {
432 /* special placement code for extended combo box */
438 SetWindowPos (lpBand
->hwndChild
, HWND_TOP
,
439 lpBand
->rcChild
.left
, lpBand
->rcChild
.top
,
440 lpBand
->rcChild
.right
- lpBand
->rcChild
.left
,
441 lpBand
->rcChild
.bottom
- lpBand
->rcChild
.top
,
450 REBAR_InternalHitTest (HWND hwnd
, LPPOINT lpPt
, UINT
*pFlags
, INT
*pBand
)
452 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
457 GetClientRect (hwnd
, &rect
);
459 *pFlags
= RBHT_NOWHERE
;
460 if (PtInRect (&rect
, *lpPt
))
462 if (infoPtr
->uNumBands
== 0) {
463 *pFlags
= RBHT_NOWHERE
;
466 TRACE (rebar
, "NOWHERE\n");
470 /* somewhere inside */
471 for (iCount
= 0; iCount
< infoPtr
->uNumBands
; iCount
++) {
472 lpBand
= &infoPtr
->bands
[iCount
];
473 if (PtInRect (&lpBand
->rcBand
, *lpPt
)) {
476 if (PtInRect (&lpBand
->rcGripper
, *lpPt
)) {
477 *pFlags
= RBHT_GRABBER
;
478 TRACE (rebar
, "ON GRABBER %d\n", iCount
);
481 else if (PtInRect (&lpBand
->rcCapImage
, *lpPt
)) {
482 *pFlags
= RBHT_CAPTION
;
483 TRACE (rebar
, "ON CAPTION %d\n", iCount
);
486 else if (PtInRect (&lpBand
->rcCapText
, *lpPt
)) {
487 *pFlags
= RBHT_CAPTION
;
488 TRACE (rebar
, "ON CAPTION %d\n", iCount
);
491 else if (PtInRect (&lpBand
->rcChild
, *lpPt
)) {
492 *pFlags
= RBHT_CLIENT
;
493 TRACE (rebar
, "ON CLIENT %d\n", iCount
);
497 *pFlags
= RBHT_NOWHERE
;
498 TRACE (rebar
, "NOWHERE %d\n", iCount
);
504 *pFlags
= RBHT_NOWHERE
;
508 TRACE (rebar
, "NOWHERE\n");
513 *pFlags
= RBHT_NOWHERE
;
516 TRACE (rebar
, "NOWHERE\n");
520 TRACE (rebar
, "flags=0x%X\n", *pFlags
);
526 /* << REBAR_BeginDrag >> */
530 REBAR_DeleteBand (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
532 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
533 UINT uBand
= (UINT
)wParam
;
535 if (uBand
>= infoPtr
->uNumBands
)
538 TRACE (rebar
, "deleting band %u!\n", uBand
);
540 if (infoPtr
->uNumBands
== 1) {
541 TRACE (rebar
, " simple delete!\n");
542 COMCTL32_Free (infoPtr
->bands
);
543 infoPtr
->bands
= NULL
;
544 infoPtr
->uNumBands
= 0;
547 REBAR_BAND
*oldBands
= infoPtr
->bands
;
548 TRACE(rebar
, "complex delete! [uBand=%u]\n", uBand
);
550 infoPtr
->uNumBands
--;
551 infoPtr
->bands
= COMCTL32_Alloc (sizeof (REBAR_BAND
) * infoPtr
->uNumBands
);
553 memcpy (&infoPtr
->bands
[0], &oldBands
[0],
554 uBand
* sizeof(REBAR_BAND
));
557 if (uBand
< infoPtr
->uNumBands
) {
558 memcpy (&infoPtr
->bands
[uBand
], &oldBands
[uBand
+1],
559 (infoPtr
->uNumBands
- uBand
) * sizeof(REBAR_BAND
));
562 COMCTL32_Free (oldBands
);
565 REBAR_Layout (hwnd
, NULL
);
566 REBAR_ForceResize (hwnd
);
567 REBAR_MoveChildWindows (hwnd
);
573 /* << REBAR_DragMove >> */
574 /* << REBAR_EndDrag >> */
578 REBAR_GetBandBorders (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
580 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
581 /* LPRECT32 lpRect = (LPRECT32)lParam; */
586 if ((UINT
)wParam
>= infoPtr
->uNumBands
)
589 lpBand
= &infoPtr
->bands
[(UINT
)wParam
];
590 if (GetWindowLongA (hwnd
, GWL_STYLE
) & RBS_BANDBORDERS
) {
601 inline static LRESULT
602 REBAR_GetBandCount (HWND hwnd
)
604 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
606 TRACE (rebar
, "band count %u!\n", infoPtr
->uNumBands
);
608 return infoPtr
->uNumBands
;
613 REBAR_GetBandInfoA (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
615 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
616 LPREBARBANDINFOA lprbbi
= (LPREBARBANDINFOA
)lParam
;
621 if (lprbbi
->cbSize
< REBARBANDINFO_V3_SIZEA
)
623 if ((UINT
)wParam
>= infoPtr
->uNumBands
)
626 TRACE (rebar
, "index %u\n", (UINT
)wParam
);
628 /* copy band information */
629 lpBand
= &infoPtr
->bands
[(UINT
)wParam
];
631 if (lprbbi
->fMask
& RBBIM_STYLE
)
632 lprbbi
->fStyle
= lpBand
->fStyle
;
634 if (lprbbi
->fMask
& RBBIM_COLORS
) {
635 lprbbi
->clrFore
= lpBand
->clrFore
;
636 lprbbi
->clrBack
= lpBand
->clrBack
;
639 if ((lprbbi
->fMask
& RBBIM_TEXT
) &&
640 (lprbbi
->lpText
) && (lpBand
->lpText
)) {
641 lstrcpynWtoA (lprbbi
->lpText
, lpBand
->lpText
, lprbbi
->cch
);
644 if (lprbbi
->fMask
& RBBIM_IMAGE
)
645 lprbbi
->iImage
= lpBand
->iImage
;
647 if (lprbbi
->fMask
& RBBIM_CHILD
)
648 lprbbi
->hwndChild
= lpBand
->hwndChild
;
650 if (lprbbi
->fMask
& RBBIM_CHILDSIZE
) {
651 lprbbi
->cxMinChild
= lpBand
->cxMinChild
;
652 lprbbi
->cyMinChild
= lpBand
->cyMinChild
;
653 lprbbi
->cyMaxChild
= lpBand
->cyMaxChild
;
654 lprbbi
->cyChild
= lpBand
->cyChild
;
655 lprbbi
->cyIntegral
= lpBand
->cyIntegral
;
658 if (lprbbi
->fMask
& RBBIM_SIZE
)
659 lprbbi
->cx
= lpBand
->cx
;
661 if (lprbbi
->fMask
& RBBIM_BACKGROUND
)
662 lprbbi
->hbmBack
= lpBand
->hbmBack
;
664 if (lprbbi
->fMask
& RBBIM_ID
)
665 lprbbi
->wID
= lpBand
->wID
;
667 /* check for additional data */
668 if (lprbbi
->cbSize
>= sizeof (REBARBANDINFOA
)) {
669 if (lprbbi
->fMask
& RBBIM_IDEALSIZE
)
670 lprbbi
->cxIdeal
= lpBand
->cxIdeal
;
672 if (lprbbi
->fMask
& RBBIM_LPARAM
)
673 lprbbi
->lParam
= lpBand
->lParam
;
675 if (lprbbi
->fMask
& RBBIM_HEADERSIZE
)
676 lprbbi
->cxHeader
= lpBand
->cxHeader
;
684 REBAR_GetBandInfoW (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
686 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
687 LPREBARBANDINFOW lprbbi
= (LPREBARBANDINFOW
)lParam
;
692 if (lprbbi
->cbSize
< REBARBANDINFO_V3_SIZEW
)
694 if ((UINT
)wParam
>= infoPtr
->uNumBands
)
697 TRACE (rebar
, "index %u\n", (UINT
)wParam
);
699 /* copy band information */
700 lpBand
= &infoPtr
->bands
[(UINT
)wParam
];
702 if (lprbbi
->fMask
& RBBIM_STYLE
)
703 lprbbi
->fStyle
= lpBand
->fStyle
;
705 if (lprbbi
->fMask
& RBBIM_COLORS
) {
706 lprbbi
->clrFore
= lpBand
->clrFore
;
707 lprbbi
->clrBack
= lpBand
->clrBack
;
710 if ((lprbbi
->fMask
& RBBIM_TEXT
) &&
711 (lprbbi
->lpText
) && (lpBand
->lpText
)) {
712 lstrcpynW (lprbbi
->lpText
, lpBand
->lpText
, lprbbi
->cch
);
715 if (lprbbi
->fMask
& RBBIM_IMAGE
)
716 lprbbi
->iImage
= lpBand
->iImage
;
718 if (lprbbi
->fMask
& RBBIM_CHILD
)
719 lprbbi
->hwndChild
= lpBand
->hwndChild
;
721 if (lprbbi
->fMask
& RBBIM_CHILDSIZE
) {
722 lprbbi
->cxMinChild
= lpBand
->cxMinChild
;
723 lprbbi
->cyMinChild
= lpBand
->cyMinChild
;
724 lprbbi
->cyMaxChild
= lpBand
->cyMaxChild
;
725 lprbbi
->cyChild
= lpBand
->cyChild
;
726 lprbbi
->cyIntegral
= lpBand
->cyIntegral
;
729 if (lprbbi
->fMask
& RBBIM_SIZE
)
730 lprbbi
->cx
= lpBand
->cx
;
732 if (lprbbi
->fMask
& RBBIM_BACKGROUND
)
733 lprbbi
->hbmBack
= lpBand
->hbmBack
;
735 if (lprbbi
->fMask
& RBBIM_ID
)
736 lprbbi
->wID
= lpBand
->wID
;
738 /* check for additional data */
739 if (lprbbi
->cbSize
>= sizeof (REBARBANDINFOA
)) {
740 if (lprbbi
->fMask
& RBBIM_IDEALSIZE
)
741 lprbbi
->cxIdeal
= lpBand
->cxIdeal
;
743 if (lprbbi
->fMask
& RBBIM_LPARAM
)
744 lprbbi
->lParam
= lpBand
->lParam
;
746 if (lprbbi
->fMask
& RBBIM_HEADERSIZE
)
747 lprbbi
->cxHeader
= lpBand
->cxHeader
;
755 REBAR_GetBarHeight (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
757 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
760 REBAR_Layout (hwnd
, NULL
);
761 nHeight
= infoPtr
->calcSize
.cy
;
763 if (GetWindowLongA (hwnd
, GWL_STYLE
) & WS_BORDER
)
764 nHeight
+= (2 * GetSystemMetrics(SM_CYEDGE
));
767 FIXME (rebar
, "height = %d\n", nHeight
);
774 REBAR_GetBarInfo (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
776 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
777 LPREBARINFO lpInfo
= (LPREBARINFO
)lParam
;
782 if (lpInfo
->cbSize
< sizeof (REBARINFO
))
785 TRACE (rebar
, "getting bar info!\n");
788 lpInfo
->himl
= infoPtr
->himl
;
789 lpInfo
->fMask
|= RBIM_IMAGELIST
;
796 inline static LRESULT
797 REBAR_GetBkColor (HWND hwnd
)
799 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
801 TRACE (rebar
, "background color 0x%06lx!\n", infoPtr
->clrBk
);
803 return infoPtr
->clrBk
;
807 /* << REBAR_GetColorScheme >> */
808 /* << REBAR_GetDropTarget >> */
812 REBAR_GetPalette (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
814 FIXME (rebar
, "empty stub!\n");
821 REBAR_GetRect (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
823 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
824 INT iBand
= (INT
)wParam
;
825 LPRECT lprc
= (LPRECT
)lParam
;
828 if ((iBand
< 0) && ((UINT
)iBand
>= infoPtr
->uNumBands
))
833 TRACE (rebar
, "band %d\n", iBand
);
835 lpBand
= &infoPtr
->bands
[iBand
];
836 CopyRect (lprc
, &lpBand
->rcBand
);
838 lprc->left = lpBand->rcBand.left;
839 lprc->top = lpBand->rcBand.top;
840 lprc->right = lpBand->rcBand.right;
841 lprc->bottom = lpBand->rcBand.bottom;
848 inline static LRESULT
849 REBAR_GetRowCount (HWND hwnd
)
851 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
853 FIXME (rebar
, "%u : semi stub!\n", infoPtr
->uNumBands
);
855 return infoPtr
->uNumBands
;
860 REBAR_GetRowHeight (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
862 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */
864 FIXME (rebar
, "-- height = 20: semi stub!\n");
870 inline static LRESULT
871 REBAR_GetTextColor (HWND hwnd
)
873 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
875 TRACE (rebar
, "text color 0x%06lx!\n", infoPtr
->clrText
);
877 return infoPtr
->clrText
;
881 inline static LRESULT
882 REBAR_GetToolTips (HWND hwnd
)
884 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
885 return infoPtr
->hwndToolTip
;
889 inline static LRESULT
890 REBAR_GetUnicodeFormat (HWND hwnd
)
892 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
893 return infoPtr
->bUnicode
;
898 REBAR_HitTest (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
900 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */
901 LPRBHITTESTINFO lprbht
= (LPRBHITTESTINFO
)lParam
;
906 REBAR_InternalHitTest (hwnd
, &lprbht
->pt
, &lprbht
->flags
, &lprbht
->iBand
);
908 return lprbht
->iBand
;
913 REBAR_IdToIndex (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
915 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
921 if (infoPtr
->uNumBands
< 1)
924 TRACE (rebar
, "id %u\n", (UINT
)wParam
);
926 for (i
= 0; i
< infoPtr
->uNumBands
; i
++) {
927 if (infoPtr
->bands
[i
].wID
== (UINT
)wParam
) {
928 TRACE (rebar
, "band %u found!\n", i
);
933 TRACE (rebar
, "no band found!\n");
939 REBAR_InsertBandA (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
941 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
942 LPREBARBANDINFOA lprbbi
= (LPREBARBANDINFOA
)lParam
;
943 UINT uIndex
= (UINT
)wParam
;
950 if (lprbbi
->cbSize
< REBARBANDINFO_V3_SIZEA
)
953 TRACE (rebar
, "insert band at %u!\n", uIndex
);
955 if (infoPtr
->uNumBands
== 0) {
956 infoPtr
->bands
= (REBAR_BAND
*)COMCTL32_Alloc (sizeof (REBAR_BAND
));
960 REBAR_BAND
*oldBands
= infoPtr
->bands
;
962 (REBAR_BAND
*)COMCTL32_Alloc ((infoPtr
->uNumBands
+1)*sizeof(REBAR_BAND
));
963 if (((INT
)uIndex
== -1) || (uIndex
> infoPtr
->uNumBands
))
964 uIndex
= infoPtr
->uNumBands
;
966 /* pre insert copy */
968 memcpy (&infoPtr
->bands
[0], &oldBands
[0],
969 uIndex
* sizeof(REBAR_BAND
));
973 if (uIndex
< infoPtr
->uNumBands
- 1) {
974 memcpy (&infoPtr
->bands
[uIndex
+1], &oldBands
[uIndex
],
975 (infoPtr
->uNumBands
- uIndex
- 1) * sizeof(REBAR_BAND
));
978 COMCTL32_Free (oldBands
);
981 infoPtr
->uNumBands
++;
983 TRACE (rebar
, "index %u!\n", uIndex
);
985 /* initialize band (infoPtr->bands[uIndex])*/
986 lpBand
= &infoPtr
->bands
[uIndex
];
988 if (lprbbi
->fMask
& RBBIM_STYLE
)
989 lpBand
->fStyle
= lprbbi
->fStyle
;
991 if (lprbbi
->fMask
& RBBIM_COLORS
) {
992 lpBand
->clrFore
= lprbbi
->clrFore
;
993 lpBand
->clrBack
= lprbbi
->clrBack
;
996 lpBand
->clrFore
= CLR_NONE
;
997 lpBand
->clrBack
= CLR_NONE
;
1000 if ((lprbbi
->fMask
& RBBIM_TEXT
) && (lprbbi
->lpText
)) {
1001 INT len
= lstrlenA (lprbbi
->lpText
);
1003 lpBand
->lpText
= (LPWSTR
)COMCTL32_Alloc ((len
+ 1)*sizeof(WCHAR
));
1004 lstrcpyAtoW (lpBand
->lpText
, lprbbi
->lpText
);
1008 if (lprbbi
->fMask
& RBBIM_IMAGE
)
1009 lpBand
->iImage
= lprbbi
->iImage
;
1011 lpBand
->iImage
= -1;
1013 if (lprbbi
->fMask
& RBBIM_CHILD
) {
1014 TRACE (rebar
, "hwndChild = %x\n", lprbbi
->hwndChild
);
1015 lpBand
->hwndChild
= lprbbi
->hwndChild
;
1016 lpBand
->hwndPrevParent
=
1017 SetParent (lpBand
->hwndChild
, hwnd
);
1020 if (lprbbi
->fMask
& RBBIM_CHILDSIZE
) {
1021 lpBand
->cxMinChild
= lprbbi
->cxMinChild
;
1022 lpBand
->cyMinChild
= lprbbi
->cyMinChild
;
1023 lpBand
->cyMaxChild
= lprbbi
->cyMaxChild
;
1024 lpBand
->cyChild
= lprbbi
->cyChild
;
1025 lpBand
->cyIntegral
= lprbbi
->cyIntegral
;
1028 lpBand
->cxMinChild
= -1;
1029 lpBand
->cyMinChild
= -1;
1030 lpBand
->cyMaxChild
= -1;
1031 lpBand
->cyChild
= -1;
1032 lpBand
->cyIntegral
= -1;
1035 if (lprbbi
->fMask
& RBBIM_SIZE
)
1036 lpBand
->cx
= lprbbi
->cx
;
1040 if (lprbbi
->fMask
& RBBIM_BACKGROUND
)
1041 lpBand
->hbmBack
= lprbbi
->hbmBack
;
1043 if (lprbbi
->fMask
& RBBIM_ID
)
1044 lpBand
->wID
= lprbbi
->wID
;
1046 /* check for additional data */
1047 if (lprbbi
->cbSize
>= sizeof (REBARBANDINFOA
)) {
1048 if (lprbbi
->fMask
& RBBIM_IDEALSIZE
)
1049 lpBand
->cxIdeal
= lprbbi
->cxIdeal
;
1051 if (lprbbi
->fMask
& RBBIM_LPARAM
)
1052 lpBand
->lParam
= lprbbi
->lParam
;
1054 if (lprbbi
->fMask
& RBBIM_HEADERSIZE
)
1055 lpBand
->cxHeader
= lprbbi
->cxHeader
;
1059 REBAR_Layout (hwnd
, NULL
);
1060 REBAR_ForceResize (hwnd
);
1061 REBAR_MoveChildWindows (hwnd
);
1068 REBAR_InsertBandW (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1070 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
1071 LPREBARBANDINFOW lprbbi
= (LPREBARBANDINFOW
)lParam
;
1072 UINT uIndex
= (UINT
)wParam
;
1075 if (infoPtr
== NULL
)
1079 if (lprbbi
->cbSize
< REBARBANDINFO_V3_SIZEW
)
1082 TRACE (rebar
, "insert band at %u!\n", uIndex
);
1084 if (infoPtr
->uNumBands
== 0) {
1085 infoPtr
->bands
= (REBAR_BAND
*)COMCTL32_Alloc (sizeof (REBAR_BAND
));
1089 REBAR_BAND
*oldBands
= infoPtr
->bands
;
1091 (REBAR_BAND
*)COMCTL32_Alloc ((infoPtr
->uNumBands
+1)*sizeof(REBAR_BAND
));
1092 if (((INT
)uIndex
== -1) || (uIndex
> infoPtr
->uNumBands
))
1093 uIndex
= infoPtr
->uNumBands
;
1095 /* pre insert copy */
1097 memcpy (&infoPtr
->bands
[0], &oldBands
[0],
1098 uIndex
* sizeof(REBAR_BAND
));
1102 if (uIndex
< infoPtr
->uNumBands
- 1) {
1103 memcpy (&infoPtr
->bands
[uIndex
+1], &oldBands
[uIndex
],
1104 (infoPtr
->uNumBands
- uIndex
- 1) * sizeof(REBAR_BAND
));
1107 COMCTL32_Free (oldBands
);
1110 infoPtr
->uNumBands
++;
1112 TRACE (rebar
, "index %u!\n", uIndex
);
1114 /* initialize band (infoPtr->bands[uIndex])*/
1115 lpBand
= &infoPtr
->bands
[uIndex
];
1117 if (lprbbi
->fMask
& RBBIM_STYLE
)
1118 lpBand
->fStyle
= lprbbi
->fStyle
;
1120 if (lprbbi
->fMask
& RBBIM_COLORS
) {
1121 lpBand
->clrFore
= lprbbi
->clrFore
;
1122 lpBand
->clrBack
= lprbbi
->clrBack
;
1125 lpBand
->clrFore
= CLR_NONE
;
1126 lpBand
->clrBack
= CLR_NONE
;
1129 if ((lprbbi
->fMask
& RBBIM_TEXT
) && (lprbbi
->lpText
)) {
1130 INT len
= lstrlenW (lprbbi
->lpText
);
1132 lpBand
->lpText
= (LPWSTR
)COMCTL32_Alloc ((len
+ 1)*sizeof(WCHAR
));
1133 lstrcpyW (lpBand
->lpText
, lprbbi
->lpText
);
1137 if (lprbbi
->fMask
& RBBIM_IMAGE
)
1138 lpBand
->iImage
= lprbbi
->iImage
;
1140 lpBand
->iImage
= -1;
1142 if (lprbbi
->fMask
& RBBIM_CHILD
) {
1143 TRACE (rebar
, "hwndChild = %x\n", lprbbi
->hwndChild
);
1144 lpBand
->hwndChild
= lprbbi
->hwndChild
;
1145 lpBand
->hwndPrevParent
=
1146 SetParent (lpBand
->hwndChild
, hwnd
);
1149 if (lprbbi
->fMask
& RBBIM_CHILDSIZE
) {
1150 lpBand
->cxMinChild
= lprbbi
->cxMinChild
;
1151 lpBand
->cyMinChild
= lprbbi
->cyMinChild
;
1152 lpBand
->cyMaxChild
= lprbbi
->cyMaxChild
;
1153 lpBand
->cyChild
= lprbbi
->cyChild
;
1154 lpBand
->cyIntegral
= lprbbi
->cyIntegral
;
1157 lpBand
->cxMinChild
= -1;
1158 lpBand
->cyMinChild
= -1;
1159 lpBand
->cyMaxChild
= -1;
1160 lpBand
->cyChild
= -1;
1161 lpBand
->cyIntegral
= -1;
1164 if (lprbbi
->fMask
& RBBIM_SIZE
)
1165 lpBand
->cx
= lprbbi
->cx
;
1169 if (lprbbi
->fMask
& RBBIM_BACKGROUND
)
1170 lpBand
->hbmBack
= lprbbi
->hbmBack
;
1172 if (lprbbi
->fMask
& RBBIM_ID
)
1173 lpBand
->wID
= lprbbi
->wID
;
1175 /* check for additional data */
1176 if (lprbbi
->cbSize
>= sizeof (REBARBANDINFOW
)) {
1177 if (lprbbi
->fMask
& RBBIM_IDEALSIZE
)
1178 lpBand
->cxIdeal
= lprbbi
->cxIdeal
;
1180 if (lprbbi
->fMask
& RBBIM_LPARAM
)
1181 lpBand
->lParam
= lprbbi
->lParam
;
1183 if (lprbbi
->fMask
& RBBIM_HEADERSIZE
)
1184 lpBand
->cxHeader
= lprbbi
->cxHeader
;
1188 REBAR_Layout (hwnd
, NULL
);
1189 REBAR_ForceResize (hwnd
);
1190 REBAR_MoveChildWindows (hwnd
);
1197 REBAR_MaximizeBand (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1199 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */
1201 FIXME (rebar
, "(uBand = %u fIdeal = %s)\n",
1202 (UINT
)wParam
, lParam
? "TRUE" : "FALSE");
1210 REBAR_MinimizeBand (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1212 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */
1214 FIXME (rebar
, "(uBand = %u)\n", (UINT
)wParam
);
1222 REBAR_MoveBand (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1224 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */
1226 FIXME (rebar
, "(iFrom = %u iTof = %u)\n",
1227 (UINT
)wParam
, (UINT
)lParam
);
1235 REBAR_SetBandInfoA (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1237 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
1238 LPREBARBANDINFOA lprbbi
= (LPREBARBANDINFOA
)lParam
;
1243 if (lprbbi
->cbSize
< REBARBANDINFO_V3_SIZEA
)
1245 if ((UINT
)wParam
>= infoPtr
->uNumBands
)
1248 TRACE (rebar
, "index %u\n", (UINT
)wParam
);
1250 /* set band information */
1251 lpBand
= &infoPtr
->bands
[(UINT
)wParam
];
1253 if (lprbbi
->fMask
& RBBIM_STYLE
)
1254 lpBand
->fStyle
= lprbbi
->fStyle
;
1256 if (lprbbi
->fMask
& RBBIM_COLORS
) {
1257 lpBand
->clrFore
= lprbbi
->clrFore
;
1258 lpBand
->clrBack
= lprbbi
->clrBack
;
1261 if (lprbbi
->fMask
& RBBIM_TEXT
) {
1262 if (lpBand
->lpText
) {
1263 COMCTL32_Free (lpBand
->lpText
);
1264 lpBand
->lpText
= NULL
;
1266 if (lprbbi
->lpText
) {
1267 INT len
= lstrlenA (lprbbi
->lpText
);
1268 lpBand
->lpText
= (LPWSTR
)COMCTL32_Alloc ((len
+ 1)*sizeof(WCHAR
));
1269 lstrcpyAtoW (lpBand
->lpText
, lprbbi
->lpText
);
1273 if (lprbbi
->fMask
& RBBIM_IMAGE
)
1274 lpBand
->iImage
= lprbbi
->iImage
;
1276 if (lprbbi
->fMask
& RBBIM_CHILD
) {
1277 if (lprbbi
->hwndChild
) {
1278 lpBand
->hwndChild
= lprbbi
->hwndChild
;
1279 lpBand
->hwndPrevParent
=
1280 SetParent (lpBand
->hwndChild
, hwnd
);
1283 TRACE (rebar
, "child: 0x%x prev parent: 0x%x\n",
1284 lpBand
->hwndChild
, lpBand
->hwndPrevParent
);
1285 lpBand
->hwndChild
= 0;
1286 lpBand
->hwndPrevParent
= 0;
1290 if (lprbbi
->fMask
& RBBIM_CHILDSIZE
) {
1291 lpBand
->cxMinChild
= lprbbi
->cxMinChild
;
1292 lpBand
->cyMinChild
= lprbbi
->cyMinChild
;
1293 lpBand
->cyMaxChild
= lprbbi
->cyMaxChild
;
1294 lpBand
->cyChild
= lprbbi
->cyChild
;
1295 lpBand
->cyIntegral
= lprbbi
->cyIntegral
;
1298 if (lprbbi
->fMask
& RBBIM_SIZE
)
1299 lpBand
->cx
= lprbbi
->cx
;
1301 if (lprbbi
->fMask
& RBBIM_BACKGROUND
)
1302 lpBand
->hbmBack
= lprbbi
->hbmBack
;
1304 if (lprbbi
->fMask
& RBBIM_ID
)
1305 lpBand
->wID
= lprbbi
->wID
;
1307 /* check for additional data */
1308 if (lprbbi
->cbSize
>= sizeof (REBARBANDINFOA
)) {
1309 if (lprbbi
->fMask
& RBBIM_IDEALSIZE
)
1310 lpBand
->cxIdeal
= lprbbi
->cxIdeal
;
1312 if (lprbbi
->fMask
& RBBIM_LPARAM
)
1313 lpBand
->lParam
= lprbbi
->lParam
;
1315 if (lprbbi
->fMask
& RBBIM_HEADERSIZE
)
1316 lpBand
->cxHeader
= lprbbi
->cxHeader
;
1319 REBAR_Layout (hwnd
, NULL
);
1320 REBAR_ForceResize (hwnd
);
1321 REBAR_MoveChildWindows (hwnd
);
1328 REBAR_SetBandInfoW (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1330 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
1331 LPREBARBANDINFOW lprbbi
= (LPREBARBANDINFOW
)lParam
;
1336 if (lprbbi
->cbSize
< REBARBANDINFO_V3_SIZEW
)
1338 if ((UINT
)wParam
>= infoPtr
->uNumBands
)
1341 TRACE (rebar
, "index %u\n", (UINT
)wParam
);
1343 /* set band information */
1344 lpBand
= &infoPtr
->bands
[(UINT
)wParam
];
1346 if (lprbbi
->fMask
& RBBIM_STYLE
)
1347 lpBand
->fStyle
= lprbbi
->fStyle
;
1349 if (lprbbi
->fMask
& RBBIM_COLORS
) {
1350 lpBand
->clrFore
= lprbbi
->clrFore
;
1351 lpBand
->clrBack
= lprbbi
->clrBack
;
1354 if (lprbbi
->fMask
& RBBIM_TEXT
) {
1355 if (lpBand
->lpText
) {
1356 COMCTL32_Free (lpBand
->lpText
);
1357 lpBand
->lpText
= NULL
;
1359 if (lprbbi
->lpText
) {
1360 INT len
= lstrlenW (lprbbi
->lpText
);
1361 lpBand
->lpText
= (LPWSTR
)COMCTL32_Alloc ((len
+ 1)*sizeof(WCHAR
));
1362 lstrcpyW (lpBand
->lpText
, lprbbi
->lpText
);
1366 if (lprbbi
->fMask
& RBBIM_IMAGE
)
1367 lpBand
->iImage
= lprbbi
->iImage
;
1369 if (lprbbi
->fMask
& RBBIM_CHILD
) {
1370 if (lprbbi
->hwndChild
) {
1371 lpBand
->hwndChild
= lprbbi
->hwndChild
;
1372 lpBand
->hwndPrevParent
=
1373 SetParent (lpBand
->hwndChild
, hwnd
);
1376 TRACE (rebar
, "child: 0x%x prev parent: 0x%x\n",
1377 lpBand
->hwndChild
, lpBand
->hwndPrevParent
);
1378 lpBand
->hwndChild
= 0;
1379 lpBand
->hwndPrevParent
= 0;
1383 if (lprbbi
->fMask
& RBBIM_CHILDSIZE
) {
1384 lpBand
->cxMinChild
= lprbbi
->cxMinChild
;
1385 lpBand
->cyMinChild
= lprbbi
->cyMinChild
;
1386 lpBand
->cyMaxChild
= lprbbi
->cyMaxChild
;
1387 lpBand
->cyChild
= lprbbi
->cyChild
;
1388 lpBand
->cyIntegral
= lprbbi
->cyIntegral
;
1391 if (lprbbi
->fMask
& RBBIM_SIZE
)
1392 lpBand
->cx
= lprbbi
->cx
;
1394 if (lprbbi
->fMask
& RBBIM_BACKGROUND
)
1395 lpBand
->hbmBack
= lprbbi
->hbmBack
;
1397 if (lprbbi
->fMask
& RBBIM_ID
)
1398 lpBand
->wID
= lprbbi
->wID
;
1400 /* check for additional data */
1401 if (lprbbi
->cbSize
>= sizeof (REBARBANDINFOW
)) {
1402 if (lprbbi
->fMask
& RBBIM_IDEALSIZE
)
1403 lpBand
->cxIdeal
= lprbbi
->cxIdeal
;
1405 if (lprbbi
->fMask
& RBBIM_LPARAM
)
1406 lpBand
->lParam
= lprbbi
->lParam
;
1408 if (lprbbi
->fMask
& RBBIM_HEADERSIZE
)
1409 lpBand
->cxHeader
= lprbbi
->cxHeader
;
1412 REBAR_Layout (hwnd
, NULL
);
1413 REBAR_ForceResize (hwnd
);
1414 REBAR_MoveChildWindows (hwnd
);
1421 REBAR_SetBarInfo (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1423 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
1424 LPREBARINFO lpInfo
= (LPREBARINFO
)lParam
;
1429 if (lpInfo
->cbSize
< sizeof (REBARINFO
))
1432 TRACE (rebar
, "setting bar info!\n");
1434 if (lpInfo
->fMask
& RBIM_IMAGELIST
) {
1435 infoPtr
->himl
= lpInfo
->himl
;
1436 if (infoPtr
->himl
) {
1437 ImageList_GetIconSize (infoPtr
->himl
, &infoPtr
->imageSize
.cx
,
1438 &infoPtr
->imageSize
.cy
);
1441 infoPtr
->imageSize
.cx
= 0;
1442 infoPtr
->imageSize
.cy
= 0;
1451 REBAR_SetBkColor (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1453 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
1456 clrTemp
= infoPtr
->clrBk
;
1457 infoPtr
->clrBk
= (COLORREF
)lParam
;
1459 TRACE (rebar
, "background color 0x%06lx!\n", infoPtr
->clrBk
);
1465 /* << REBAR_SetColorScheme >> */
1466 /* << REBAR_SetPalette >> */
1470 REBAR_SetParent (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1472 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
1473 HWND hwndTemp
= infoPtr
->hwndNotify
;
1475 infoPtr
->hwndNotify
= (HWND
)wParam
;
1477 return (LRESULT
)hwndTemp
;
1482 REBAR_SetTextColor (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1484 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
1487 clrTemp
= infoPtr
->clrText
;
1488 infoPtr
->clrText
= (COLORREF
)lParam
;
1490 TRACE (rebar
, "text color 0x%06lx!\n", infoPtr
->clrText
);
1496 /* << REBAR_SetTooltips >> */
1499 inline static LRESULT
1500 REBAR_SetUnicodeFormat (HWND hwnd
, WPARAM wParam
)
1502 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
1503 BOOL bTemp
= infoPtr
->bUnicode
;
1504 infoPtr
->bUnicode
= (BOOL
)wParam
;
1510 REBAR_ShowBand (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1512 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
1515 if (((INT
)wParam
< 0) || ((INT
)wParam
> infoPtr
->uNumBands
))
1518 lpBand
= &infoPtr
->bands
[(INT
)wParam
];
1521 TRACE (rebar
, "show band %d\n", (INT
)wParam
);
1522 lpBand
->fStyle
= lpBand
->fStyle
& ~RBBS_HIDDEN
;
1523 if (IsWindow (lpBand
->hwndChild
))
1524 ShowWindow (lpBand
->hwndChild
, SW_SHOW
);
1527 TRACE (rebar
, "hide band %d\n", (INT
)wParam
);
1528 lpBand
->fStyle
= lpBand
->fStyle
| RBBS_HIDDEN
;
1529 if (IsWindow (lpBand
->hwndChild
))
1530 ShowWindow (lpBand
->hwndChild
, SW_SHOW
);
1533 REBAR_Layout (hwnd
, NULL
);
1534 REBAR_ForceResize (hwnd
);
1535 REBAR_MoveChildWindows (hwnd
);
1542 REBAR_SizeToRect (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1544 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
1545 LPRECT lpRect
= (LPRECT
)lParam
;
1550 FIXME (rebar
, "layout change not implemented!\n");
1551 FIXME (rebar
, "[%d %d %d %d]\n",
1552 lpRect
->left
, lpRect
->top
, lpRect
->right
, lpRect
->bottom
);
1555 SetWindowPos (hwnd
, 0, lpRect
->left
, lpRect
->top
,
1556 lpRect
->right
- lpRect
->left
, lpRect
->bottom
- lpRect
->top
,
1560 infoPtr
->calcSize
.cx
= lpRect
->right
- lpRect
->left
;
1561 infoPtr
->calcSize
.cy
= lpRect
->bottom
- lpRect
->top
;
1563 REBAR_ForceResize (hwnd
);
1570 REBAR_Create (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1572 REBAR_INFO
*infoPtr
;
1574 /* allocate memory for info structure */
1575 infoPtr
= (REBAR_INFO
*)COMCTL32_Alloc (sizeof(REBAR_INFO
));
1576 SetWindowLongA (hwnd
, 0, (DWORD
)infoPtr
);
1578 /* initialize info structure */
1579 infoPtr
->clrBk
= CLR_NONE
;
1580 infoPtr
->clrText
= RGB(0, 0, 0);
1582 infoPtr
->bAutoResize
= FALSE
;
1583 infoPtr
->hcurArrow
= LoadCursorA (0, IDC_ARROWA
);
1584 infoPtr
->hcurHorz
= LoadCursorA (0, IDC_SIZEWEA
);
1585 infoPtr
->hcurVert
= LoadCursorA (0, IDC_SIZENSA
);
1586 infoPtr
->hcurDrag
= LoadCursorA (0, IDC_SIZEA
);
1588 infoPtr
->bUnicode
= IsWindowUnicode (hwnd
);
1590 if (GetWindowLongA (hwnd
, GWL_STYLE
) & RBS_AUTOSIZE
)
1591 FIXME (rebar
, "style RBS_AUTOSIZE set!\n");
1594 SendMessageA (hwnd
, WM_NOTIFYFORMAT
, (WPARAM
)hwnd
, NF_QUERY
);
1597 TRACE (rebar
, "created!\n");
1603 REBAR_Destroy (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1605 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
1610 /* free rebar bands */
1611 if ((infoPtr
->uNumBands
> 0) && infoPtr
->bands
) {
1612 /* clean up each band */
1613 for (i
= 0; i
< infoPtr
->uNumBands
; i
++) {
1614 lpBand
= &infoPtr
->bands
[i
];
1616 /* delete text strings */
1617 if (lpBand
->lpText
) {
1618 COMCTL32_Free (lpBand
->lpText
);
1619 lpBand
->lpText
= NULL
;
1621 /* destroy child window */
1622 DestroyWindow (lpBand
->hwndChild
);
1625 /* free band array */
1626 COMCTL32_Free (infoPtr
->bands
);
1627 infoPtr
->bands
= NULL
;
1633 DeleteObject (infoPtr
->hcurArrow
);
1634 DeleteObject (infoPtr
->hcurHorz
);
1635 DeleteObject (infoPtr
->hcurVert
);
1636 DeleteObject (infoPtr
->hcurDrag
);
1641 /* free rebar info data */
1642 COMCTL32_Free (infoPtr
);
1644 TRACE (rebar
, "destroyed!\n");
1650 REBAR_GetFont (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1652 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
1654 return (LRESULT
)infoPtr
->hFont
;
1660 REBAR_MouseMove (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1662 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
1669 inline static LRESULT
1670 REBAR_NCCalcSize (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1672 if (GetWindowLongA (hwnd
, GWL_STYLE
) & WS_BORDER
) {
1673 ((LPRECT
)lParam
)->left
+= GetSystemMetrics(SM_CXEDGE
);
1674 ((LPRECT
)lParam
)->top
+= GetSystemMetrics(SM_CYEDGE
);
1675 ((LPRECT
)lParam
)->right
-= GetSystemMetrics(SM_CXEDGE
);
1676 ((LPRECT
)lParam
)->bottom
-= GetSystemMetrics(SM_CYEDGE
);
1684 REBAR_NCPaint (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1686 DWORD dwStyle
= GetWindowLongA (hwnd
, GWL_STYLE
);
1690 if (dwStyle
& WS_MINIMIZE
)
1691 return 0; /* Nothing to do */
1693 DefWindowProcA (hwnd
, WM_NCPAINT
, wParam
, lParam
);
1695 if (!(hdc
= GetDCEx( hwnd
, 0, DCX_USESTYLE
| DCX_WINDOW
)))
1698 if (dwStyle
& WS_BORDER
) {
1699 GetWindowRect (hwnd
, &rcWindow
);
1700 OffsetRect (&rcWindow
, -rcWindow
.left
, -rcWindow
.top
);
1701 DrawEdge (hdc
, &rcWindow
, EDGE_ETCHED
, BF_RECT
);
1704 ReleaseDC( hwnd
, hdc
);
1711 REBAR_Paint (HWND hwnd
, WPARAM wParam
)
1716 hdc
= wParam
==0 ? BeginPaint (hwnd
, &ps
) : (HDC
)wParam
;
1717 REBAR_Refresh (hwnd
, hdc
);
1719 EndPaint (hwnd
, &ps
);
1725 REBAR_SetCursor (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1727 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
1728 DWORD dwStyle
= GetWindowLongA (hwnd
, GWL_STYLE
);
1732 TRACE (rebar
, "code=0x%X id=0x%X\n", LOWORD(lParam
), HIWORD(lParam
));
1735 ScreenToClient (hwnd
, &pt
);
1737 REBAR_InternalHitTest (hwnd
, &pt
, &flags
, NULL
);
1739 if (flags
== RBHT_GRABBER
) {
1740 if ((dwStyle
& CCS_VERT
) &&
1741 !(dwStyle
& RBS_VERTICALGRIPPER
))
1742 SetCursor (infoPtr
->hcurVert
);
1744 SetCursor (infoPtr
->hcurHorz
);
1746 else if (flags
!= RBHT_CLIENT
)
1747 SetCursor (infoPtr
->hcurArrow
);
1754 REBAR_SetFont (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1756 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
1758 /* TEXTMETRIC32A tm; */
1759 HFONT hFont
/*, hOldFont */;
1762 infoPtr
->hFont
= (HFONT
)wParam
;
1764 hFont
= infoPtr
->hFont
? infoPtr
->hFont
: GetStockObject (SYSTEM_FONT
);
1767 hOldFont = SelectObject32 (hdc, hFont);
1768 GetTextMetrics32A (hdc, &tm);
1769 infoPtr->nHeight = tm.tmHeight + VERT_BORDER;
1770 SelectObject32 (hdc, hOldFont);
1771 ReleaseDC32 (0, hdc);
1775 REBAR_Layout (hwnd);
1776 hdc = GetDC32 (hwnd);
1777 REBAR_Refresh (hwnd, hdc);
1778 ReleaseDC32 (hwnd, hdc);
1786 REBAR_Size (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
1788 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (hwnd
);
1789 /* DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); */
1791 /* INT32 x, y, cx, cy; */
1793 /* auto resize deadlock check */
1794 if (infoPtr
->bAutoResize
) {
1795 infoPtr
->bAutoResize
= FALSE
;
1799 TRACE (rebar
, "sizing rebar!\n");
1801 /* get parent rectangle */
1802 GetClientRect (GetParent (hwnd
), &rcParent
);
1804 REBAR_Layout (hwnd, &rcParent);
1806 if (dwStyle & CCS_VERT) {
1807 if (dwStyle & CCS_LEFT == CCS_LEFT) {
1810 cx = infoPtr->calcSize.cx;
1811 cy = infoPtr->calcSize.cy;
1814 x = rcParent.right - infoPtr->calcSize.cx;
1816 cx = infoPtr->calcSize.cx;
1817 cy = infoPtr->calcSize.cy;
1821 if (dwStyle & CCS_TOP) {
1824 cx = infoPtr->calcSize.cx;
1825 cy = infoPtr->calcSize.cy;
1829 y = rcParent.bottom - infoPtr->calcSize.cy;
1830 cx = infoPtr->calcSize.cx;
1831 cy = infoPtr->calcSize.cy;
1835 SetWindowPos32 (hwnd, 0, x, y, cx, cy,
1836 SWP_NOZORDER | SWP_SHOWWINDOW);
1838 REBAR_Layout (hwnd
, NULL
);
1839 REBAR_ForceResize (hwnd
);
1840 REBAR_MoveChildWindows (hwnd
);
1847 REBAR_WindowProc (HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
1851 /* case RB_BEGINDRAG: */
1854 return REBAR_DeleteBand (hwnd
, wParam
, lParam
);
1856 /* case RB_DRAGMOVE: */
1857 /* case RB_ENDDRAG: */
1859 case RB_GETBANDBORDERS
:
1860 return REBAR_GetBandBorders (hwnd
, wParam
, lParam
);
1862 case RB_GETBANDCOUNT
:
1863 return REBAR_GetBandCount (hwnd
);
1865 /* case RB_GETBANDINFO32: */ /* outdated, just for compatibility */
1867 case RB_GETBANDINFOA
:
1868 return REBAR_GetBandInfoA (hwnd
, wParam
, lParam
);
1870 case RB_GETBANDINFOW
:
1871 return REBAR_GetBandInfoW (hwnd
, wParam
, lParam
);
1873 case RB_GETBARHEIGHT
:
1874 return REBAR_GetBarHeight (hwnd
, wParam
, lParam
);
1877 return REBAR_GetBarInfo (hwnd
, wParam
, lParam
);
1880 return REBAR_GetBkColor (hwnd
);
1882 /* case RB_GETCOLORSCHEME: */
1883 /* case RB_GETDROPTARGET: */
1886 return REBAR_GetPalette (hwnd
, wParam
, lParam
);
1889 return REBAR_GetRect (hwnd
, wParam
, lParam
);
1891 case RB_GETROWCOUNT
:
1892 return REBAR_GetRowCount (hwnd
);
1894 case RB_GETROWHEIGHT
:
1895 return REBAR_GetRowHeight (hwnd
, wParam
, lParam
);
1897 case RB_GETTEXTCOLOR
:
1898 return REBAR_GetTextColor (hwnd
);
1900 case RB_GETTOOLTIPS
:
1901 return REBAR_GetToolTips (hwnd
);
1903 case RB_GETUNICODEFORMAT
:
1904 return REBAR_GetUnicodeFormat (hwnd
);
1907 return REBAR_HitTest (hwnd
, wParam
, lParam
);
1910 return REBAR_IdToIndex (hwnd
, wParam
, lParam
);
1912 case RB_INSERTBANDA
:
1913 return REBAR_InsertBandA (hwnd
, wParam
, lParam
);
1915 case RB_INSERTBANDW
:
1916 return REBAR_InsertBandW (hwnd
, wParam
, lParam
);
1918 case RB_MAXIMIZEBAND
:
1919 return REBAR_MaximizeBand (hwnd
, wParam
, lParam
);
1921 case RB_MINIMIZEBAND
:
1922 return REBAR_MinimizeBand (hwnd
, wParam
, lParam
);
1925 return REBAR_MoveBand (hwnd
, wParam
, lParam
);
1927 case RB_SETBANDINFOA
:
1928 return REBAR_SetBandInfoA (hwnd
, wParam
, lParam
);
1930 case RB_SETBANDINFOW
:
1931 return REBAR_SetBandInfoW (hwnd
, wParam
, lParam
);
1934 return REBAR_SetBarInfo (hwnd
, wParam
, lParam
);
1937 return REBAR_SetBkColor (hwnd
, wParam
, lParam
);
1939 /* case RB_SETCOLORSCHEME: */
1940 /* case RB_SETPALETTE: */
1941 /* return REBAR_GetPalette (hwnd, wParam, lParam); */
1944 return REBAR_SetParent (hwnd
, wParam
, lParam
);
1946 case RB_SETTEXTCOLOR
:
1947 return REBAR_SetTextColor (hwnd
, wParam
, lParam
);
1949 /* case RB_SETTOOLTIPS: */
1951 case RB_SETUNICODEFORMAT
:
1952 return REBAR_SetUnicodeFormat (hwnd
, wParam
);
1955 return REBAR_ShowBand (hwnd
, wParam
, lParam
);
1958 return REBAR_SizeToRect (hwnd
, wParam
, lParam
);
1962 return SendMessageA (GetParent (hwnd
), uMsg
, wParam
, lParam
);
1965 return REBAR_Create (hwnd
, wParam
, lParam
);
1968 return REBAR_Destroy (hwnd
, wParam
, lParam
);
1971 return REBAR_GetFont (hwnd
, wParam
, lParam
);
1973 /* case WM_MOUSEMOVE: */
1974 /* return REBAR_MouseMove (hwnd, wParam, lParam); */
1977 return REBAR_NCCalcSize (hwnd
, wParam
, lParam
);
1980 return REBAR_NCPaint (hwnd
, wParam
, lParam
);
1983 return SendMessageA (GetParent (hwnd
), uMsg
, wParam
, lParam
);
1986 return REBAR_Paint (hwnd
, wParam
);
1989 return REBAR_SetCursor (hwnd
, wParam
, lParam
);
1992 return REBAR_SetFont (hwnd
, wParam
, lParam
);
1995 return REBAR_Size (hwnd
, wParam
, lParam
);
1997 /* case WM_TIMER: */
1999 /* case WM_WININICHANGE: */
2002 if (uMsg
>= WM_USER
)
2003 ERR (rebar
, "unknown msg %04x wp=%08x lp=%08lx\n",
2004 uMsg
, wParam
, lParam
);
2005 return DefWindowProcA (hwnd
, uMsg
, wParam
, lParam
);
2012 REBAR_Register (void)
2016 if (GlobalFindAtomA (REBARCLASSNAMEA
)) return;
2018 ZeroMemory (&wndClass
, sizeof(WNDCLASSA
));
2019 wndClass
.style
= CS_GLOBALCLASS
| CS_DBLCLKS
;
2020 wndClass
.lpfnWndProc
= (WNDPROC
)REBAR_WindowProc
;
2021 wndClass
.cbClsExtra
= 0;
2022 wndClass
.cbWndExtra
= sizeof(REBAR_INFO
*);
2023 wndClass
.hCursor
= 0;
2024 wndClass
.hbrBackground
= (HBRUSH
)(COLOR_BTNFACE
+ 1);
2025 wndClass
.lpszClassName
= REBARCLASSNAMEA
;
2027 RegisterClassA (&wndClass
);
2032 REBAR_Unregister (void)
2034 if (GlobalFindAtomA (REBARCLASSNAMEA
))
2035 UnregisterClassA (REBARCLASSNAMEA
, (HINSTANCE
)NULL
);