4 * Copyright 1998 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.
26 #include "sysmetrics.h"
31 #define DRAW_GRIPPER 1
36 #define GRIPPER_WIDTH 13
39 #define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)wndPtr->wExtra[0])
43 REBAR_DrawBand (HDC hdc
, REBAR_INFO
*infoPtr
, REBAR_BAND
*lpBand
)
46 DrawEdge (hdc
, &lpBand
->rcBand
, BDR_RAISEDINNER
, BF_MIDDLE
);
51 if (lpBand
->fDraw
& DRAW_GRIPPER
)
52 DrawEdge (hdc
, &lpBand
->rcGripper
, BDR_RAISEDINNER
, BF_RECT
| BF_MIDDLE
);
54 /* draw caption image */
55 if (lpBand
->fDraw
& DRAW_IMAGE
) {
56 /* FIXME: center image */
59 pt
.y
= (lpBand
->rcCapImage
.bottom
+ lpBand
->rcCapImage
.top
- infoPtr
->imageSize
.cy
)/2;
60 pt
.x
= (lpBand
->rcCapImage
.right
+ lpBand
->rcCapImage
.left
- infoPtr
->imageSize
.cx
)/2;
62 ImageList_Draw (infoPtr
->himl
, lpBand
->iImage
, hdc
,
63 /* lpBand->rcCapImage.left, lpBand->rcCapImage.top, */
68 /* draw caption text */
69 if (lpBand
->fDraw
& DRAW_TEXT
) {
70 HFONT hOldFont
= SelectObject (hdc
, infoPtr
->hFont
);
71 INT oldBkMode
= SetBkMode (hdc
, TRANSPARENT
);
72 DrawTextW (hdc
, lpBand
->lpText
, -1, &lpBand
->rcCapText
,
73 DT_CENTER
| DT_VCENTER
| DT_SINGLELINE
);
74 if (oldBkMode
!= TRANSPARENT
)
75 SetBkMode (hdc
, oldBkMode
);
76 SelectObject (hdc
, hOldFont
);
82 REBAR_Refresh (WND
*wndPtr
, HDC hdc
)
84 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
88 for (i
= 0; i
< infoPtr
->uNumBands
; i
++) {
89 lpBand
= &infoPtr
->bands
[i
];
91 if ((lpBand
->fStyle
& RBBS_HIDDEN
) ||
92 ((wndPtr
->dwStyle
& CCS_VERT
) && (lpBand
->fStyle
& RBBS_NOVERT
)))
95 REBAR_DrawBand (hdc
, infoPtr
, lpBand
);
102 REBAR_CalcHorzBand (REBAR_INFO
*infoPtr
, REBAR_BAND
*lpBand
)
106 /* set initial caption image rectangle */
107 SetRect (&lpBand
->rcCapImage
, 0, 0, 0, 0);
109 /* image is visible */
110 if ((lpBand
->iImage
> -1) && (infoPtr
->himl
)) {
111 lpBand
->fDraw
|= DRAW_IMAGE
;
113 lpBand
->rcCapImage
.right
= lpBand
->rcCapImage
.left
+ infoPtr
->imageSize
.cx
;
114 lpBand
->rcCapImage
.bottom
= lpBand
->rcCapImage
.top
+ infoPtr
->imageSize
.cy
;
116 /* update band height */
117 if (lpBand
->uMinHeight
< infoPtr
->imageSize
.cy
+ 2) {
118 lpBand
->uMinHeight
= infoPtr
->imageSize
.cy
+ 2;
119 lpBand
->rcBand
.bottom
= lpBand
->rcBand
.top
+ lpBand
->uMinHeight
;
123 /* set initial caption text rectangle */
124 lpBand
->rcCapText
.left
= lpBand
->rcCapImage
.right
;
125 lpBand
->rcCapText
.top
= lpBand
->rcBand
.top
+ 1;
126 lpBand
->rcCapText
.right
= lpBand
->rcCapText
.left
;
127 lpBand
->rcCapText
.bottom
= lpBand
->rcBand
.bottom
- 1;
129 /* text is visible */
130 if (lpBand
->lpText
) {
132 HFONT hOldFont
= SelectObject (hdc
, infoPtr
->hFont
);
135 lpBand
->fDraw
|= DRAW_TEXT
;
136 GetTextExtentPoint32W (hdc
, lpBand
->lpText
,
137 lstrlenW (lpBand
->lpText
), &size
);
138 lpBand
->rcCapText
.right
+= size
.cx
;
140 SelectObject (hdc
, hOldFont
);
144 /* set initial child window rectangle */
145 if (lpBand
->fStyle
& RBBS_FIXEDSIZE
) {
146 lpBand
->rcChild
.left
= lpBand
->rcCapText
.right
;
147 lpBand
->rcChild
.top
= lpBand
->rcBand
.top
;
148 lpBand
->rcChild
.right
= lpBand
->rcBand
.right
;
149 lpBand
->rcChild
.bottom
= lpBand
->rcBand
.bottom
;
152 lpBand
->rcChild
.left
= lpBand
->rcCapText
.right
+ 4;
153 lpBand
->rcChild
.top
= lpBand
->rcBand
.top
+ 2;
154 lpBand
->rcChild
.right
= lpBand
->rcBand
.right
- 4;
155 lpBand
->rcChild
.bottom
= lpBand
->rcBand
.bottom
- 2;
158 /* calculate gripper rectangle */
159 if ((!(lpBand
->fStyle
& RBBS_NOGRIPPER
)) &&
160 (!(lpBand
->fStyle
& RBBS_FIXEDSIZE
)) &&
161 ((lpBand
->fStyle
& RBBS_GRIPPERALWAYS
) ||
162 (infoPtr
->uNumBands
> 1))) {
163 lpBand
->fDraw
|= DRAW_GRIPPER
;
164 lpBand
->rcGripper
.left
= lpBand
->rcBand
.left
+ 3;
165 lpBand
->rcGripper
.right
= lpBand
->rcGripper
.left
+ 3;
166 lpBand
->rcGripper
.top
= lpBand
->rcBand
.top
+ 3;
167 lpBand
->rcGripper
.bottom
= lpBand
->rcBand
.bottom
- 3;
169 /* move caption rectangles */
170 OffsetRect (&lpBand
->rcCapImage
, GRIPPER_WIDTH
, 0);
171 OffsetRect (&lpBand
->rcCapText
, GRIPPER_WIDTH
, 0);
173 /* adjust child rectangle */
174 lpBand
->rcChild
.left
+= GRIPPER_WIDTH
;
182 REBAR_CalcVertBand (WND
*wndPtr
, REBAR_INFO
*infoPtr
, REBAR_BAND
*lpBand
)
186 /* set initial caption image rectangle */
187 SetRect (&lpBand
->rcCapImage
, 0, 0, 0, 0);
189 /* image is visible */
190 if ((lpBand
->iImage
> -1) && (infoPtr
->himl
)) {
191 lpBand
->fDraw
|= DRAW_IMAGE
;
193 lpBand
->rcCapImage
.right
= lpBand
->rcCapImage
.left
+ infoPtr
->imageSize
.cx
;
194 lpBand
->rcCapImage
.bottom
= lpBand
->rcCapImage
.top
+ infoPtr
->imageSize
.cy
;
196 /* update band width */
197 if (lpBand
->uMinHeight
< infoPtr
->imageSize
.cx
+ 2) {
198 lpBand
->uMinHeight
= infoPtr
->imageSize
.cx
+ 2;
199 lpBand
->rcBand
.right
= lpBand
->rcBand
.left
+ lpBand
->uMinHeight
;
203 /* set initial caption text rectangle */
204 lpBand
->rcCapText
.left
= lpBand
->rcBand
.left
+ 1;
205 lpBand
->rcCapText
.top
= lpBand
->rcCapImage
.bottom
;
206 lpBand
->rcCapText
.right
= lpBand
->rcBand
.right
- 1;
207 lpBand
->rcCapText
.bottom
= lpBand
->rcCapText
.top
;
209 /* text is visible */
210 if (lpBand
->lpText
) {
212 HFONT hOldFont
= SelectObject (hdc
, infoPtr
->hFont
);
215 lpBand
->fDraw
|= DRAW_TEXT
;
216 GetTextExtentPoint32W (hdc
, lpBand
->lpText
,
217 lstrlenW (lpBand
->lpText
), &size
);
218 /* lpBand->rcCapText.right += size.cx; */
219 lpBand
->rcCapText
.bottom
+= size
.cy
;
221 SelectObject (hdc
, hOldFont
);
225 /* set initial child window rectangle */
226 if (lpBand
->fStyle
& RBBS_FIXEDSIZE
) {
227 lpBand
->rcChild
.left
= lpBand
->rcBand
.left
;
228 lpBand
->rcChild
.top
= lpBand
->rcCapText
.bottom
;
229 lpBand
->rcChild
.right
= lpBand
->rcBand
.right
;
230 lpBand
->rcChild
.bottom
= lpBand
->rcBand
.bottom
;
233 lpBand
->rcChild
.left
= lpBand
->rcBand
.left
+ 2;
234 lpBand
->rcChild
.top
= lpBand
->rcCapText
.bottom
+ 4;
235 lpBand
->rcChild
.right
= lpBand
->rcBand
.right
- 2;
236 lpBand
->rcChild
.bottom
= lpBand
->rcBand
.bottom
- 4;
239 /* calculate gripper rectangle */
240 if ((!(lpBand
->fStyle
& RBBS_NOGRIPPER
)) &&
241 (!(lpBand
->fStyle
& RBBS_FIXEDSIZE
)) &&
242 ((lpBand
->fStyle
& RBBS_GRIPPERALWAYS
) ||
243 (infoPtr
->uNumBands
> 1))) {
244 lpBand
->fDraw
|= DRAW_GRIPPER
;
246 if (wndPtr
->dwStyle
& RBS_VERTICALGRIPPER
) {
247 /* adjust band width */
248 lpBand
->rcBand
.right
+= GRIPPER_WIDTH
;
249 lpBand
->uMinHeight
+= GRIPPER_WIDTH
;
251 lpBand
->rcGripper
.left
= lpBand
->rcBand
.left
+ 3;
252 lpBand
->rcGripper
.right
= lpBand
->rcGripper
.left
+ 3;
253 lpBand
->rcGripper
.top
= lpBand
->rcBand
.top
+ 3;
254 lpBand
->rcGripper
.bottom
= lpBand
->rcBand
.bottom
- 3;
256 /* move caption rectangles */
257 OffsetRect (&lpBand
->rcCapImage
, GRIPPER_WIDTH
, 0);
258 OffsetRect (&lpBand
->rcCapText
, GRIPPER_WIDTH
, 0);
260 /* adjust child rectangle */
261 lpBand
->rcChild
.left
+= GRIPPER_WIDTH
;
264 lpBand
->rcGripper
.left
= lpBand
->rcBand
.left
+ 3;
265 lpBand
->rcGripper
.right
= lpBand
->rcBand
.right
- 3;
266 lpBand
->rcGripper
.top
= lpBand
->rcBand
.top
+ 3;
267 lpBand
->rcGripper
.bottom
= lpBand
->rcGripper
.top
+ 3;
269 /* move caption rectangles */
270 OffsetRect (&lpBand
->rcCapImage
, 0, GRIPPER_WIDTH
);
271 OffsetRect (&lpBand
->rcCapText
, 0, GRIPPER_WIDTH
);
273 /* adjust child rectangle */
274 lpBand
->rcChild
.top
+= GRIPPER_WIDTH
;
281 REBAR_Layout (WND
*wndPtr
, LPRECT lpRect
)
283 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
292 GetClientRect (wndPtr
->hwndSelf
, &rcClient
);
297 if (wndPtr
->dwStyle
& CCS_VERT
) {
298 cx
= 20; /* FIXME: fixed height */
299 cy
= rcClient
.bottom
- rcClient
.top
;
302 cx
= rcClient
.right
- rcClient
.left
;
303 cy
= 20; /* FIXME: fixed height */
306 for (i
= 0; i
< infoPtr
->uNumBands
; i
++) {
307 lpBand
= &infoPtr
->bands
[i
];
309 if ((lpBand
->fStyle
& RBBS_HIDDEN
) ||
310 ((wndPtr
->dwStyle
& CCS_VERT
) && (lpBand
->fStyle
& RBBS_NOVERT
)))
314 if (wndPtr
->dwStyle
& CCS_VERT
) {
315 if (lpBand
->fStyle
& RBBS_VARIABLEHEIGHT
)
316 cx
= lpBand
->cyMaxChild
;
317 else if (lpBand
->fStyle
& RBBIM_CHILDSIZE
)
318 cx
= lpBand
->cyMinChild
;
322 lpBand
->rcBand
.left
= x
;
323 lpBand
->rcBand
.right
= x
+ cx
;
324 lpBand
->rcBand
.top
= y
;
325 lpBand
->rcBand
.bottom
= y
+ cy
;
326 lpBand
->uMinHeight
= cx
;
329 if (lpBand
->fStyle
& RBBS_VARIABLEHEIGHT
)
330 cy
= lpBand
->cyMaxChild
;
331 else if (lpBand
->fStyle
& RBBIM_CHILDSIZE
)
332 cy
= lpBand
->cyMinChild
;
336 lpBand
->rcBand
.left
= x
;
337 lpBand
->rcBand
.right
= x
+ cx
;
338 lpBand
->rcBand
.top
= y
;
339 lpBand
->rcBand
.bottom
= y
+ cy
;
340 lpBand
->uMinHeight
= cy
;
343 if (wndPtr
->dwStyle
& CCS_VERT
) {
344 REBAR_CalcVertBand (wndPtr
, infoPtr
, lpBand
);
345 x
+= lpBand
->uMinHeight
;
348 REBAR_CalcHorzBand (infoPtr
, lpBand
);
349 y
+= lpBand
->uMinHeight
;
353 if (wndPtr
->dwStyle
& CCS_VERT
) {
354 infoPtr
->calcSize
.cx
= x
;
355 infoPtr
->calcSize
.cy
= rcClient
.bottom
- rcClient
.top
;
358 infoPtr
->calcSize
.cx
= rcClient
.right
- rcClient
.left
;
359 infoPtr
->calcSize
.cy
= y
;
365 REBAR_ForceResize (WND
*wndPtr
)
367 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
370 TRACE (rebar
, " to [%d x %d]!\n",
371 infoPtr
->calcSize
.cx
, infoPtr
->calcSize
.cy
);
373 infoPtr
->bAutoResize
= TRUE
;
377 rc
.right
= infoPtr
->calcSize
.cx
;
378 rc
.bottom
= infoPtr
->calcSize
.cy
;
380 if (wndPtr
->dwStyle
& WS_BORDER
) {
381 InflateRect (&rc
, sysMetrics
[SM_CXEDGE
], sysMetrics
[SM_CYEDGE
]);
384 SetWindowPos (wndPtr
->hwndSelf
, 0, 0, 0,
385 rc
.right
- rc
.left
, rc
.bottom
- rc
.top
,
386 SWP_NOMOVE
| SWP_NOZORDER
| SWP_SHOWWINDOW
);
391 REBAR_MoveChildWindows (WND
*wndPtr
)
393 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
397 for (i
= 0; i
< infoPtr
->uNumBands
; i
++) {
398 lpBand
= &infoPtr
->bands
[i
];
400 if (lpBand
->fStyle
& RBBS_HIDDEN
)
402 if (lpBand
->hwndChild
) {
403 TRACE (rebar
, "hwndChild = %x\n", lpBand
->hwndChild
);
405 if (WIDGETS_IsControl (WIN_FindWndPtr(lpBand
->hwndChild
), BIC32_COMBO
)) {
406 INT nEditHeight
, yPos
;
409 /* special placement code for combo box */
412 /* get size of edit line */
413 GetWindowRect (lpBand
->hwndChild
, &rc
);
414 nEditHeight
= rc
.bottom
- rc
.top
;
415 yPos
= (lpBand
->rcChild
.bottom
+ lpBand
->rcChild
.top
- nEditHeight
)/2;
417 /* center combo box inside child area */
418 SetWindowPos (lpBand
->hwndChild
, HWND_TOP
,
419 lpBand
->rcChild
.left
, /*lpBand->rcChild.top*/ yPos
,
420 lpBand
->rcChild
.right
- lpBand
->rcChild
.left
,
426 /* special placement code for extended combo box */
432 SetWindowPos (lpBand
->hwndChild
, HWND_TOP
,
433 lpBand
->rcChild
.left
, lpBand
->rcChild
.top
,
434 lpBand
->rcChild
.right
- lpBand
->rcChild
.left
,
435 lpBand
->rcChild
.bottom
- lpBand
->rcChild
.top
,
444 REBAR_InternalHitTest (WND
*wndPtr
, LPPOINT lpPt
, UINT
*pFlags
, INT
*pBand
)
446 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr(wndPtr
);
451 GetClientRect (wndPtr
->hwndSelf
, &rect
);
453 *pFlags
= RBHT_NOWHERE
;
454 if (PtInRect (&rect
, *lpPt
))
456 if (infoPtr
->uNumBands
== 0) {
457 *pFlags
= RBHT_NOWHERE
;
460 TRACE (rebar
, "NOWHERE\n");
464 /* somewhere inside */
465 for (iCount
= 0; iCount
< infoPtr
->uNumBands
; iCount
++) {
466 lpBand
= &infoPtr
->bands
[iCount
];
467 if (PtInRect (&lpBand
->rcBand
, *lpPt
)) {
470 if (PtInRect (&lpBand
->rcGripper
, *lpPt
)) {
471 *pFlags
= RBHT_GRABBER
;
472 TRACE (rebar
, "ON GRABBER %d\n", iCount
);
475 else if (PtInRect (&lpBand
->rcCapImage
, *lpPt
)) {
476 *pFlags
= RBHT_CAPTION
;
477 TRACE (rebar
, "ON CAPTION %d\n", iCount
);
480 else if (PtInRect (&lpBand
->rcCapText
, *lpPt
)) {
481 *pFlags
= RBHT_CAPTION
;
482 TRACE (rebar
, "ON CAPTION %d\n", iCount
);
485 else if (PtInRect (&lpBand
->rcChild
, *lpPt
)) {
486 *pFlags
= RBHT_CLIENT
;
487 TRACE (rebar
, "ON CLIENT %d\n", iCount
);
491 *pFlags
= RBHT_NOWHERE
;
492 TRACE (rebar
, "NOWHERE %d\n", iCount
);
498 *pFlags
= RBHT_NOWHERE
;
502 TRACE (rebar
, "NOWHERE\n");
507 *pFlags
= RBHT_NOWHERE
;
510 TRACE (rebar
, "NOWHERE\n");
514 TRACE (rebar
, "flags=0x%X\n", *pFlags
);
520 /* << REBAR_BeginDrag >> */
524 REBAR_DeleteBand (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
526 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
527 UINT uBand
= (UINT
)wParam
;
529 if (uBand
>= infoPtr
->uNumBands
)
532 TRACE (rebar
, "deleting band %u!\n", uBand
);
534 if (infoPtr
->uNumBands
== 1) {
535 TRACE (rebar
, " simple delete!\n");
536 COMCTL32_Free (infoPtr
->bands
);
537 infoPtr
->bands
= NULL
;
538 infoPtr
->uNumBands
= 0;
541 REBAR_BAND
*oldBands
= infoPtr
->bands
;
542 TRACE(rebar
, "complex delete! [uBand=%u]\n", uBand
);
544 infoPtr
->uNumBands
--;
545 infoPtr
->bands
= COMCTL32_Alloc (sizeof (REBAR_BAND
) * infoPtr
->uNumBands
);
547 memcpy (&infoPtr
->bands
[0], &oldBands
[0],
548 uBand
* sizeof(REBAR_BAND
));
551 if (uBand
< infoPtr
->uNumBands
) {
552 memcpy (&infoPtr
->bands
[uBand
], &oldBands
[uBand
+1],
553 (infoPtr
->uNumBands
- uBand
) * sizeof(REBAR_BAND
));
556 COMCTL32_Free (oldBands
);
559 REBAR_Layout (wndPtr
, NULL
);
560 REBAR_ForceResize (wndPtr
);
561 REBAR_MoveChildWindows (wndPtr
);
567 /* << REBAR_DragMove >> */
568 /* << REBAR_EndDrag >> */
572 REBAR_GetBandBorders (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
574 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
575 /* LPRECT32 lpRect = (LPRECT32)lParam; */
580 if ((UINT
)wParam
>= infoPtr
->uNumBands
)
583 lpBand
= &infoPtr
->bands
[(UINT
)wParam
];
584 if (wndPtr
->dwStyle
& RBS_BANDBORDERS
) {
595 __inline__
static LRESULT
596 REBAR_GetBandCount (WND
*wndPtr
)
598 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
600 TRACE (rebar
, "band count %u!\n", infoPtr
->uNumBands
);
602 return infoPtr
->uNumBands
;
607 REBAR_GetBandInfoA (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
609 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
610 LPREBARBANDINFOA lprbbi
= (LPREBARBANDINFOA
)lParam
;
615 if (lprbbi
->cbSize
< REBARBANDINFO_V3_SIZEA
)
617 if ((UINT
)wParam
>= infoPtr
->uNumBands
)
620 TRACE (rebar
, "index %u\n", (UINT
)wParam
);
622 /* copy band information */
623 lpBand
= &infoPtr
->bands
[(UINT
)wParam
];
625 if (lprbbi
->fMask
& RBBIM_STYLE
)
626 lprbbi
->fStyle
= lpBand
->fStyle
;
628 if (lprbbi
->fMask
& RBBIM_COLORS
) {
629 lprbbi
->clrFore
= lpBand
->clrFore
;
630 lprbbi
->clrBack
= lpBand
->clrBack
;
633 if ((lprbbi
->fMask
& RBBIM_TEXT
) &&
634 (lprbbi
->lpText
) && (lpBand
->lpText
)) {
635 lstrcpynWtoA (lprbbi
->lpText
, lpBand
->lpText
, lprbbi
->cch
);
638 if (lprbbi
->fMask
& RBBIM_IMAGE
)
639 lprbbi
->iImage
= lpBand
->iImage
;
641 if (lprbbi
->fMask
& RBBIM_CHILD
)
642 lprbbi
->hwndChild
= lpBand
->hwndChild
;
644 if (lprbbi
->fMask
& RBBIM_CHILDSIZE
) {
645 lprbbi
->cxMinChild
= lpBand
->cxMinChild
;
646 lprbbi
->cyMinChild
= lpBand
->cyMinChild
;
647 lprbbi
->cyMaxChild
= lpBand
->cyMaxChild
;
648 lprbbi
->cyChild
= lpBand
->cyChild
;
649 lprbbi
->cyIntegral
= lpBand
->cyIntegral
;
652 if (lprbbi
->fMask
& RBBIM_SIZE
)
653 lprbbi
->cx
= lpBand
->cx
;
655 if (lprbbi
->fMask
& RBBIM_BACKGROUND
)
656 lprbbi
->hbmBack
= lpBand
->hbmBack
;
658 if (lprbbi
->fMask
& RBBIM_ID
)
659 lprbbi
->wID
= lpBand
->wID
;
661 /* check for additional data */
662 if (lprbbi
->cbSize
>= sizeof (REBARBANDINFOA
)) {
663 if (lprbbi
->fMask
& RBBIM_IDEALSIZE
)
664 lprbbi
->cxIdeal
= lpBand
->cxIdeal
;
666 if (lprbbi
->fMask
& RBBIM_LPARAM
)
667 lprbbi
->lParam
= lpBand
->lParam
;
669 if (lprbbi
->fMask
& RBBIM_HEADERSIZE
)
670 lprbbi
->cxHeader
= lpBand
->cxHeader
;
678 REBAR_GetBandInfoW (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
680 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
681 LPREBARBANDINFOW lprbbi
= (LPREBARBANDINFOW
)lParam
;
686 if (lprbbi
->cbSize
< REBARBANDINFO_V3_SIZEW
)
688 if ((UINT
)wParam
>= infoPtr
->uNumBands
)
691 TRACE (rebar
, "index %u\n", (UINT
)wParam
);
693 /* copy band information */
694 lpBand
= &infoPtr
->bands
[(UINT
)wParam
];
696 if (lprbbi
->fMask
& RBBIM_STYLE
)
697 lprbbi
->fStyle
= lpBand
->fStyle
;
699 if (lprbbi
->fMask
& RBBIM_COLORS
) {
700 lprbbi
->clrFore
= lpBand
->clrFore
;
701 lprbbi
->clrBack
= lpBand
->clrBack
;
704 if ((lprbbi
->fMask
& RBBIM_TEXT
) &&
705 (lprbbi
->lpText
) && (lpBand
->lpText
)) {
706 lstrcpynW (lprbbi
->lpText
, lpBand
->lpText
, lprbbi
->cch
);
709 if (lprbbi
->fMask
& RBBIM_IMAGE
)
710 lprbbi
->iImage
= lpBand
->iImage
;
712 if (lprbbi
->fMask
& RBBIM_CHILD
)
713 lprbbi
->hwndChild
= lpBand
->hwndChild
;
715 if (lprbbi
->fMask
& RBBIM_CHILDSIZE
) {
716 lprbbi
->cxMinChild
= lpBand
->cxMinChild
;
717 lprbbi
->cyMinChild
= lpBand
->cyMinChild
;
718 lprbbi
->cyMaxChild
= lpBand
->cyMaxChild
;
719 lprbbi
->cyChild
= lpBand
->cyChild
;
720 lprbbi
->cyIntegral
= lpBand
->cyIntegral
;
723 if (lprbbi
->fMask
& RBBIM_SIZE
)
724 lprbbi
->cx
= lpBand
->cx
;
726 if (lprbbi
->fMask
& RBBIM_BACKGROUND
)
727 lprbbi
->hbmBack
= lpBand
->hbmBack
;
729 if (lprbbi
->fMask
& RBBIM_ID
)
730 lprbbi
->wID
= lpBand
->wID
;
732 /* check for additional data */
733 if (lprbbi
->cbSize
>= sizeof (REBARBANDINFOA
)) {
734 if (lprbbi
->fMask
& RBBIM_IDEALSIZE
)
735 lprbbi
->cxIdeal
= lpBand
->cxIdeal
;
737 if (lprbbi
->fMask
& RBBIM_LPARAM
)
738 lprbbi
->lParam
= lpBand
->lParam
;
740 if (lprbbi
->fMask
& RBBIM_HEADERSIZE
)
741 lprbbi
->cxHeader
= lpBand
->cxHeader
;
749 REBAR_GetBarHeight (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
751 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
754 REBAR_Layout (wndPtr
, NULL
);
755 nHeight
= infoPtr
->calcSize
.cy
;
757 if (wndPtr
->dwStyle
& WS_BORDER
)
758 nHeight
+= (2 * sysMetrics
[SM_CYEDGE
]);
760 FIXME (rebar
, "height = %d\n", nHeight
);
767 REBAR_GetBarInfo (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
769 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
770 LPREBARINFO lpInfo
= (LPREBARINFO
)lParam
;
775 if (lpInfo
->cbSize
< sizeof (REBARINFO
))
778 TRACE (rebar
, "getting bar info!\n");
781 lpInfo
->himl
= infoPtr
->himl
;
782 lpInfo
->fMask
|= RBIM_IMAGELIST
;
789 __inline__
static LRESULT
790 REBAR_GetBkColor (WND
*wndPtr
)
792 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
794 TRACE (rebar
, "background color 0x%06lx!\n", infoPtr
->clrBk
);
796 return infoPtr
->clrBk
;
800 /* << REBAR_GetColorScheme >> */
801 /* << REBAR_GetDropTarget >> */
805 REBAR_GetPalette (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
807 FIXME (rebar
, "empty stub!\n");
814 REBAR_GetRect (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
816 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
817 INT iBand
= (INT
)wParam
;
818 LPRECT lprc
= (LPRECT
)lParam
;
821 if ((iBand
< 0) && ((UINT
)iBand
>= infoPtr
->uNumBands
))
826 TRACE (rebar
, "band %d\n", iBand
);
828 lpBand
= &infoPtr
->bands
[iBand
];
829 CopyRect (lprc
, &lpBand
->rcBand
);
831 lprc->left = lpBand->rcBand.left;
832 lprc->top = lpBand->rcBand.top;
833 lprc->right = lpBand->rcBand.right;
834 lprc->bottom = lpBand->rcBand.bottom;
841 __inline__
static LRESULT
842 REBAR_GetRowCount (WND
*wndPtr
)
844 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
846 FIXME (rebar
, "%u : semi stub!\n", infoPtr
->uNumBands
);
848 return infoPtr
->uNumBands
;
853 REBAR_GetRowHeight (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
855 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); */
857 FIXME (rebar
, "-- height = 20: semi stub!\n");
863 __inline__
static LRESULT
864 REBAR_GetTextColor (WND
*wndPtr
)
866 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
868 TRACE (rebar
, "text color 0x%06lx!\n", infoPtr
->clrText
);
870 return infoPtr
->clrText
;
874 __inline__
static LRESULT
875 REBAR_GetToolTips (WND
*wndPtr
)
877 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
878 return infoPtr
->hwndToolTip
;
882 __inline__
static LRESULT
883 REBAR_GetUnicodeFormat (WND
*wndPtr
)
885 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
886 return infoPtr
->bUnicode
;
891 REBAR_HitTest (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
893 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); */
894 LPRBHITTESTINFO lprbht
= (LPRBHITTESTINFO
)lParam
;
899 REBAR_InternalHitTest (wndPtr
, &lprbht
->pt
,
900 &lprbht
->flags
, &lprbht
->iBand
);
902 return lprbht
->iBand
;
907 REBAR_IdToIndex (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
909 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
915 if (infoPtr
->uNumBands
< 1)
918 TRACE (rebar
, "id %u\n", (UINT
)wParam
);
920 for (i
= 0; i
< infoPtr
->uNumBands
; i
++) {
921 if (infoPtr
->bands
[i
].wID
== (UINT
)wParam
) {
922 TRACE (rebar
, "band %u found!\n", i
);
927 TRACE (rebar
, "no band found!\n");
933 REBAR_InsertBandA (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
935 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
936 LPREBARBANDINFOA lprbbi
= (LPREBARBANDINFOA
)lParam
;
937 UINT uIndex
= (UINT
)wParam
;
944 if (lprbbi
->cbSize
< REBARBANDINFO_V3_SIZEA
)
947 TRACE (rebar
, "insert band at %u!\n", uIndex
);
949 if (infoPtr
->uNumBands
== 0) {
950 infoPtr
->bands
= (REBAR_BAND
*)COMCTL32_Alloc (sizeof (REBAR_BAND
));
954 REBAR_BAND
*oldBands
= infoPtr
->bands
;
956 (REBAR_BAND
*)COMCTL32_Alloc ((infoPtr
->uNumBands
+1)*sizeof(REBAR_BAND
));
957 if (((INT
)uIndex
== -1) || (uIndex
> infoPtr
->uNumBands
))
958 uIndex
= infoPtr
->uNumBands
;
960 /* pre insert copy */
962 memcpy (&infoPtr
->bands
[0], &oldBands
[0],
963 uIndex
* sizeof(REBAR_BAND
));
967 if (uIndex
< infoPtr
->uNumBands
- 1) {
968 memcpy (&infoPtr
->bands
[uIndex
+1], &oldBands
[uIndex
],
969 (infoPtr
->uNumBands
- uIndex
- 1) * sizeof(REBAR_BAND
));
972 COMCTL32_Free (oldBands
);
975 infoPtr
->uNumBands
++;
977 TRACE (rebar
, "index %u!\n", uIndex
);
979 /* initialize band (infoPtr->bands[uIndex])*/
980 lpBand
= &infoPtr
->bands
[uIndex
];
982 if (lprbbi
->fMask
& RBBIM_STYLE
)
983 lpBand
->fStyle
= lprbbi
->fStyle
;
985 if (lprbbi
->fMask
& RBBIM_COLORS
) {
986 lpBand
->clrFore
= lprbbi
->clrFore
;
987 lpBand
->clrBack
= lprbbi
->clrBack
;
990 lpBand
->clrFore
= CLR_NONE
;
991 lpBand
->clrBack
= CLR_NONE
;
994 if ((lprbbi
->fMask
& RBBIM_TEXT
) && (lprbbi
->lpText
)) {
995 INT len
= lstrlenA (lprbbi
->lpText
);
997 lpBand
->lpText
= (LPWSTR
)COMCTL32_Alloc ((len
+ 1)*sizeof(WCHAR
));
998 lstrcpyAtoW (lpBand
->lpText
, lprbbi
->lpText
);
1002 if (lprbbi
->fMask
& RBBIM_IMAGE
)
1003 lpBand
->iImage
= lprbbi
->iImage
;
1005 lpBand
->iImage
= -1;
1007 if (lprbbi
->fMask
& RBBIM_CHILD
) {
1008 TRACE (rebar
, "hwndChild = %x\n", lprbbi
->hwndChild
);
1009 lpBand
->hwndChild
= lprbbi
->hwndChild
;
1010 lpBand
->hwndPrevParent
=
1011 SetParent (lpBand
->hwndChild
, wndPtr
->hwndSelf
);
1014 if (lprbbi
->fMask
& RBBIM_CHILDSIZE
) {
1015 lpBand
->cxMinChild
= lprbbi
->cxMinChild
;
1016 lpBand
->cyMinChild
= lprbbi
->cyMinChild
;
1017 lpBand
->cyMaxChild
= lprbbi
->cyMaxChild
;
1018 lpBand
->cyChild
= lprbbi
->cyChild
;
1019 lpBand
->cyIntegral
= lprbbi
->cyIntegral
;
1022 lpBand
->cxMinChild
= -1;
1023 lpBand
->cyMinChild
= -1;
1024 lpBand
->cyMaxChild
= -1;
1025 lpBand
->cyChild
= -1;
1026 lpBand
->cyIntegral
= -1;
1029 if (lprbbi
->fMask
& RBBIM_SIZE
)
1030 lpBand
->cx
= lprbbi
->cx
;
1034 if (lprbbi
->fMask
& RBBIM_BACKGROUND
)
1035 lpBand
->hbmBack
= lprbbi
->hbmBack
;
1037 if (lprbbi
->fMask
& RBBIM_ID
)
1038 lpBand
->wID
= lprbbi
->wID
;
1040 /* check for additional data */
1041 if (lprbbi
->cbSize
>= sizeof (REBARBANDINFOA
)) {
1042 if (lprbbi
->fMask
& RBBIM_IDEALSIZE
)
1043 lpBand
->cxIdeal
= lprbbi
->cxIdeal
;
1045 if (lprbbi
->fMask
& RBBIM_LPARAM
)
1046 lpBand
->lParam
= lprbbi
->lParam
;
1048 if (lprbbi
->fMask
& RBBIM_HEADERSIZE
)
1049 lpBand
->cxHeader
= lprbbi
->cxHeader
;
1053 REBAR_Layout (wndPtr
, NULL
);
1054 REBAR_ForceResize (wndPtr
);
1055 REBAR_MoveChildWindows (wndPtr
);
1062 REBAR_InsertBandW (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1064 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
1065 LPREBARBANDINFOW lprbbi
= (LPREBARBANDINFOW
)lParam
;
1066 UINT uIndex
= (UINT
)wParam
;
1069 if (infoPtr
== NULL
)
1073 if (lprbbi
->cbSize
< REBARBANDINFO_V3_SIZEW
)
1076 TRACE (rebar
, "insert band at %u!\n", uIndex
);
1078 if (infoPtr
->uNumBands
== 0) {
1079 infoPtr
->bands
= (REBAR_BAND
*)COMCTL32_Alloc (sizeof (REBAR_BAND
));
1083 REBAR_BAND
*oldBands
= infoPtr
->bands
;
1085 (REBAR_BAND
*)COMCTL32_Alloc ((infoPtr
->uNumBands
+1)*sizeof(REBAR_BAND
));
1086 if (((INT
)uIndex
== -1) || (uIndex
> infoPtr
->uNumBands
))
1087 uIndex
= infoPtr
->uNumBands
;
1089 /* pre insert copy */
1091 memcpy (&infoPtr
->bands
[0], &oldBands
[0],
1092 uIndex
* sizeof(REBAR_BAND
));
1096 if (uIndex
< infoPtr
->uNumBands
- 1) {
1097 memcpy (&infoPtr
->bands
[uIndex
+1], &oldBands
[uIndex
],
1098 (infoPtr
->uNumBands
- uIndex
- 1) * sizeof(REBAR_BAND
));
1101 COMCTL32_Free (oldBands
);
1104 infoPtr
->uNumBands
++;
1106 TRACE (rebar
, "index %u!\n", uIndex
);
1108 /* initialize band (infoPtr->bands[uIndex])*/
1109 lpBand
= &infoPtr
->bands
[uIndex
];
1111 if (lprbbi
->fMask
& RBBIM_STYLE
)
1112 lpBand
->fStyle
= lprbbi
->fStyle
;
1114 if (lprbbi
->fMask
& RBBIM_COLORS
) {
1115 lpBand
->clrFore
= lprbbi
->clrFore
;
1116 lpBand
->clrBack
= lprbbi
->clrBack
;
1119 lpBand
->clrFore
= CLR_NONE
;
1120 lpBand
->clrBack
= CLR_NONE
;
1123 if ((lprbbi
->fMask
& RBBIM_TEXT
) && (lprbbi
->lpText
)) {
1124 INT len
= lstrlenW (lprbbi
->lpText
);
1126 lpBand
->lpText
= (LPWSTR
)COMCTL32_Alloc ((len
+ 1)*sizeof(WCHAR
));
1127 lstrcpyW (lpBand
->lpText
, lprbbi
->lpText
);
1131 if (lprbbi
->fMask
& RBBIM_IMAGE
)
1132 lpBand
->iImage
= lprbbi
->iImage
;
1134 lpBand
->iImage
= -1;
1136 if (lprbbi
->fMask
& RBBIM_CHILD
) {
1137 TRACE (rebar
, "hwndChild = %x\n", lprbbi
->hwndChild
);
1138 lpBand
->hwndChild
= lprbbi
->hwndChild
;
1139 lpBand
->hwndPrevParent
=
1140 SetParent (lpBand
->hwndChild
, wndPtr
->hwndSelf
);
1143 if (lprbbi
->fMask
& RBBIM_CHILDSIZE
) {
1144 lpBand
->cxMinChild
= lprbbi
->cxMinChild
;
1145 lpBand
->cyMinChild
= lprbbi
->cyMinChild
;
1146 lpBand
->cyMaxChild
= lprbbi
->cyMaxChild
;
1147 lpBand
->cyChild
= lprbbi
->cyChild
;
1148 lpBand
->cyIntegral
= lprbbi
->cyIntegral
;
1151 lpBand
->cxMinChild
= -1;
1152 lpBand
->cyMinChild
= -1;
1153 lpBand
->cyMaxChild
= -1;
1154 lpBand
->cyChild
= -1;
1155 lpBand
->cyIntegral
= -1;
1158 if (lprbbi
->fMask
& RBBIM_SIZE
)
1159 lpBand
->cx
= lprbbi
->cx
;
1163 if (lprbbi
->fMask
& RBBIM_BACKGROUND
)
1164 lpBand
->hbmBack
= lprbbi
->hbmBack
;
1166 if (lprbbi
->fMask
& RBBIM_ID
)
1167 lpBand
->wID
= lprbbi
->wID
;
1169 /* check for additional data */
1170 if (lprbbi
->cbSize
>= sizeof (REBARBANDINFOW
)) {
1171 if (lprbbi
->fMask
& RBBIM_IDEALSIZE
)
1172 lpBand
->cxIdeal
= lprbbi
->cxIdeal
;
1174 if (lprbbi
->fMask
& RBBIM_LPARAM
)
1175 lpBand
->lParam
= lprbbi
->lParam
;
1177 if (lprbbi
->fMask
& RBBIM_HEADERSIZE
)
1178 lpBand
->cxHeader
= lprbbi
->cxHeader
;
1182 REBAR_Layout (wndPtr
, NULL
);
1183 REBAR_ForceResize (wndPtr
);
1184 REBAR_MoveChildWindows (wndPtr
);
1191 REBAR_MaximizeBand (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1193 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); */
1195 FIXME (rebar
, "(uBand = %u fIdeal = %s)\n",
1196 (UINT
)wParam
, lParam
? "TRUE" : "FALSE");
1204 REBAR_MinimizeBand (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1206 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); */
1208 FIXME (rebar
, "(uBand = %u)\n", (UINT
)wParam
);
1216 REBAR_MoveBand (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1218 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); */
1220 FIXME (rebar
, "(iFrom = %u iTof = %u)\n",
1221 (UINT
)wParam
, (UINT
)lParam
);
1229 REBAR_SetBandInfoA (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1231 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
1232 LPREBARBANDINFOA lprbbi
= (LPREBARBANDINFOA
)lParam
;
1237 if (lprbbi
->cbSize
< REBARBANDINFO_V3_SIZEA
)
1239 if ((UINT
)wParam
>= infoPtr
->uNumBands
)
1242 TRACE (rebar
, "index %u\n", (UINT
)wParam
);
1244 /* set band information */
1245 lpBand
= &infoPtr
->bands
[(UINT
)wParam
];
1247 if (lprbbi
->fMask
& RBBIM_STYLE
)
1248 lpBand
->fStyle
= lprbbi
->fStyle
;
1250 if (lprbbi
->fMask
& RBBIM_COLORS
) {
1251 lpBand
->clrFore
= lprbbi
->clrFore
;
1252 lpBand
->clrBack
= lprbbi
->clrBack
;
1255 if (lprbbi
->fMask
& RBBIM_TEXT
) {
1256 if (lpBand
->lpText
) {
1257 COMCTL32_Free (lpBand
->lpText
);
1258 lpBand
->lpText
= NULL
;
1260 if (lprbbi
->lpText
) {
1261 INT len
= lstrlenA (lprbbi
->lpText
);
1262 lpBand
->lpText
= (LPWSTR
)COMCTL32_Alloc ((len
+ 1)*sizeof(WCHAR
));
1263 lstrcpyAtoW (lpBand
->lpText
, lprbbi
->lpText
);
1267 if (lprbbi
->fMask
& RBBIM_IMAGE
)
1268 lpBand
->iImage
= lprbbi
->iImage
;
1270 if (lprbbi
->fMask
& RBBIM_CHILD
) {
1271 if (lprbbi
->hwndChild
) {
1272 lpBand
->hwndChild
= lprbbi
->hwndChild
;
1273 lpBand
->hwndPrevParent
=
1274 SetParent (lpBand
->hwndChild
, wndPtr
->hwndSelf
);
1277 TRACE (rebar
, "child: 0x%x prev parent: 0x%x\n",
1278 lpBand
->hwndChild
, lpBand
->hwndPrevParent
);
1279 lpBand
->hwndChild
= 0;
1280 lpBand
->hwndPrevParent
= 0;
1284 if (lprbbi
->fMask
& RBBIM_CHILDSIZE
) {
1285 lpBand
->cxMinChild
= lprbbi
->cxMinChild
;
1286 lpBand
->cyMinChild
= lprbbi
->cyMinChild
;
1287 lpBand
->cyMaxChild
= lprbbi
->cyMaxChild
;
1288 lpBand
->cyChild
= lprbbi
->cyChild
;
1289 lpBand
->cyIntegral
= lprbbi
->cyIntegral
;
1292 if (lprbbi
->fMask
& RBBIM_SIZE
)
1293 lpBand
->cx
= lprbbi
->cx
;
1295 if (lprbbi
->fMask
& RBBIM_BACKGROUND
)
1296 lpBand
->hbmBack
= lprbbi
->hbmBack
;
1298 if (lprbbi
->fMask
& RBBIM_ID
)
1299 lpBand
->wID
= lprbbi
->wID
;
1301 /* check for additional data */
1302 if (lprbbi
->cbSize
>= sizeof (REBARBANDINFOA
)) {
1303 if (lprbbi
->fMask
& RBBIM_IDEALSIZE
)
1304 lpBand
->cxIdeal
= lprbbi
->cxIdeal
;
1306 if (lprbbi
->fMask
& RBBIM_LPARAM
)
1307 lpBand
->lParam
= lprbbi
->lParam
;
1309 if (lprbbi
->fMask
& RBBIM_HEADERSIZE
)
1310 lpBand
->cxHeader
= lprbbi
->cxHeader
;
1313 REBAR_Layout (wndPtr
, NULL
);
1314 REBAR_ForceResize (wndPtr
);
1315 REBAR_MoveChildWindows (wndPtr
);
1322 REBAR_SetBandInfoW (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1324 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
1325 LPREBARBANDINFOW lprbbi
= (LPREBARBANDINFOW
)lParam
;
1330 if (lprbbi
->cbSize
< REBARBANDINFO_V3_SIZEW
)
1332 if ((UINT
)wParam
>= infoPtr
->uNumBands
)
1335 TRACE (rebar
, "index %u\n", (UINT
)wParam
);
1337 /* set band information */
1338 lpBand
= &infoPtr
->bands
[(UINT
)wParam
];
1340 if (lprbbi
->fMask
& RBBIM_STYLE
)
1341 lpBand
->fStyle
= lprbbi
->fStyle
;
1343 if (lprbbi
->fMask
& RBBIM_COLORS
) {
1344 lpBand
->clrFore
= lprbbi
->clrFore
;
1345 lpBand
->clrBack
= lprbbi
->clrBack
;
1348 if (lprbbi
->fMask
& RBBIM_TEXT
) {
1349 if (lpBand
->lpText
) {
1350 COMCTL32_Free (lpBand
->lpText
);
1351 lpBand
->lpText
= NULL
;
1353 if (lprbbi
->lpText
) {
1354 INT len
= lstrlenW (lprbbi
->lpText
);
1355 lpBand
->lpText
= (LPWSTR
)COMCTL32_Alloc ((len
+ 1)*sizeof(WCHAR
));
1356 lstrcpyW (lpBand
->lpText
, lprbbi
->lpText
);
1360 if (lprbbi
->fMask
& RBBIM_IMAGE
)
1361 lpBand
->iImage
= lprbbi
->iImage
;
1363 if (lprbbi
->fMask
& RBBIM_CHILD
) {
1364 if (lprbbi
->hwndChild
) {
1365 lpBand
->hwndChild
= lprbbi
->hwndChild
;
1366 lpBand
->hwndPrevParent
=
1367 SetParent (lpBand
->hwndChild
, wndPtr
->hwndSelf
);
1370 TRACE (rebar
, "child: 0x%x prev parent: 0x%x\n",
1371 lpBand
->hwndChild
, lpBand
->hwndPrevParent
);
1372 lpBand
->hwndChild
= 0;
1373 lpBand
->hwndPrevParent
= 0;
1377 if (lprbbi
->fMask
& RBBIM_CHILDSIZE
) {
1378 lpBand
->cxMinChild
= lprbbi
->cxMinChild
;
1379 lpBand
->cyMinChild
= lprbbi
->cyMinChild
;
1380 lpBand
->cyMaxChild
= lprbbi
->cyMaxChild
;
1381 lpBand
->cyChild
= lprbbi
->cyChild
;
1382 lpBand
->cyIntegral
= lprbbi
->cyIntegral
;
1385 if (lprbbi
->fMask
& RBBIM_SIZE
)
1386 lpBand
->cx
= lprbbi
->cx
;
1388 if (lprbbi
->fMask
& RBBIM_BACKGROUND
)
1389 lpBand
->hbmBack
= lprbbi
->hbmBack
;
1391 if (lprbbi
->fMask
& RBBIM_ID
)
1392 lpBand
->wID
= lprbbi
->wID
;
1394 /* check for additional data */
1395 if (lprbbi
->cbSize
>= sizeof (REBARBANDINFOW
)) {
1396 if (lprbbi
->fMask
& RBBIM_IDEALSIZE
)
1397 lpBand
->cxIdeal
= lprbbi
->cxIdeal
;
1399 if (lprbbi
->fMask
& RBBIM_LPARAM
)
1400 lpBand
->lParam
= lprbbi
->lParam
;
1402 if (lprbbi
->fMask
& RBBIM_HEADERSIZE
)
1403 lpBand
->cxHeader
= lprbbi
->cxHeader
;
1406 REBAR_Layout (wndPtr
, NULL
);
1407 REBAR_ForceResize (wndPtr
);
1408 REBAR_MoveChildWindows (wndPtr
);
1415 REBAR_SetBarInfo (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1417 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
1418 LPREBARINFO lpInfo
= (LPREBARINFO
)lParam
;
1423 if (lpInfo
->cbSize
< sizeof (REBARINFO
))
1426 TRACE (rebar
, "setting bar info!\n");
1428 if (lpInfo
->fMask
& RBIM_IMAGELIST
) {
1429 infoPtr
->himl
= lpInfo
->himl
;
1430 if (infoPtr
->himl
) {
1431 ImageList_GetIconSize (infoPtr
->himl
, &infoPtr
->imageSize
.cx
,
1432 &infoPtr
->imageSize
.cy
);
1435 infoPtr
->imageSize
.cx
= 0;
1436 infoPtr
->imageSize
.cy
= 0;
1445 REBAR_SetBkColor (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1447 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
1450 clrTemp
= infoPtr
->clrBk
;
1451 infoPtr
->clrBk
= (COLORREF
)lParam
;
1453 TRACE (rebar
, "background color 0x%06lx!\n", infoPtr
->clrBk
);
1459 /* << REBAR_SetColorScheme >> */
1460 /* << REBAR_SetPalette >> */
1464 REBAR_SetParent (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1466 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
1467 HWND hwndTemp
= infoPtr
->hwndNotify
;
1469 infoPtr
->hwndNotify
= (HWND
)wParam
;
1471 return (LRESULT
)hwndTemp
;
1476 REBAR_SetTextColor (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1478 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
1481 clrTemp
= infoPtr
->clrText
;
1482 infoPtr
->clrText
= (COLORREF
)lParam
;
1484 TRACE (rebar
, "text color 0x%06lx!\n", infoPtr
->clrText
);
1490 /* << REBAR_SetTooltips >> */
1493 __inline__
static LRESULT
1494 REBAR_SetUnicodeFormat (WND
*wndPtr
, WPARAM wParam
)
1496 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
1497 BOOL bTemp
= infoPtr
->bUnicode
;
1498 infoPtr
->bUnicode
= (BOOL
)wParam
;
1504 REBAR_ShowBand (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1506 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
1509 if (((INT
)wParam
< 0) || ((INT
)wParam
> infoPtr
->uNumBands
))
1512 lpBand
= &infoPtr
->bands
[(INT
)wParam
];
1515 TRACE (rebar
, "show band %d\n", (INT
)wParam
);
1516 lpBand
->fStyle
= lpBand
->fStyle
& ~RBBS_HIDDEN
;
1517 if (IsWindow (lpBand
->hwndChild
))
1518 ShowWindow (lpBand
->hwndChild
, SW_SHOW
);
1521 TRACE (rebar
, "hide band %d\n", (INT
)wParam
);
1522 lpBand
->fStyle
= lpBand
->fStyle
| RBBS_HIDDEN
;
1523 if (IsWindow (lpBand
->hwndChild
))
1524 ShowWindow (lpBand
->hwndChild
, SW_SHOW
);
1527 REBAR_Layout (wndPtr
, NULL
);
1528 REBAR_ForceResize (wndPtr
);
1529 REBAR_MoveChildWindows (wndPtr
);
1536 REBAR_SizeToRect (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1538 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr (wndPtr
);
1539 LPRECT lpRect
= (LPRECT
)lParam
;
1544 FIXME (rebar
, "layout change not implemented!\n");
1545 FIXME (rebar
, "[%d %d %d %d]\n",
1546 lpRect
->left
, lpRect
->top
, lpRect
->right
, lpRect
->bottom
);
1549 SetWindowPos (wndPtr
->hwndSelf
, 0, lpRect
->left
, lpRect
->top
,
1550 lpRect
->right
- lpRect
->left
, lpRect
->bottom
- lpRect
->top
,
1554 infoPtr
->calcSize
.cx
= lpRect
->right
- lpRect
->left
;
1555 infoPtr
->calcSize
.cy
= lpRect
->bottom
- lpRect
->top
;
1557 REBAR_ForceResize (wndPtr
);
1564 REBAR_Create (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1566 REBAR_INFO
*infoPtr
;
1568 /* allocate memory for info structure */
1569 infoPtr
= (REBAR_INFO
*)COMCTL32_Alloc (sizeof(REBAR_INFO
));
1570 wndPtr
->wExtra
[0] = (DWORD
)infoPtr
;
1572 if (infoPtr
== NULL
) {
1573 ERR (rebar
, "could not allocate info memory!\n");
1577 if ((REBAR_INFO
*)wndPtr
->wExtra
[0] != infoPtr
) {
1578 ERR (rebar
, "pointer assignment error!\n");
1582 /* initialize info structure */
1583 infoPtr
->clrBk
= CLR_NONE
;
1584 infoPtr
->clrText
= RGB(0, 0, 0);
1586 infoPtr
->bAutoResize
= FALSE
;
1587 infoPtr
->hcurArrow
= LoadCursorA (0, IDC_ARROWA
);
1588 infoPtr
->hcurHorz
= LoadCursorA (0, IDC_SIZEWEA
);
1589 infoPtr
->hcurVert
= LoadCursorA (0, IDC_SIZENSA
);
1590 infoPtr
->hcurDrag
= LoadCursorA (0, IDC_SIZEA
);
1592 infoPtr
->bUnicode
= IsWindowUnicode (wndPtr
->hwndSelf
);
1594 if (wndPtr
->dwStyle
& RBS_AUTOSIZE
)
1595 FIXME (rebar
, "style RBS_AUTOSIZE set!\n");
1598 SendMessageA (wndPtr
->parent
->hwndSelf
, WM_NOTIFYFORMAT
,
1599 (WPARAM
)wndPtr
->hwndSelf
, NF_QUERY
);
1602 TRACE (rebar
, "created!\n");
1608 REBAR_Destroy (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1610 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr(wndPtr
);
1615 /* free rebar bands */
1616 if ((infoPtr
->uNumBands
> 0) && infoPtr
->bands
) {
1617 /* clean up each band */
1618 for (i
= 0; i
< infoPtr
->uNumBands
; i
++) {
1619 lpBand
= &infoPtr
->bands
[i
];
1621 /* delete text strings */
1622 if (lpBand
->lpText
) {
1623 COMCTL32_Free (lpBand
->lpText
);
1624 lpBand
->lpText
= NULL
;
1626 /* destroy child window */
1627 DestroyWindow (lpBand
->hwndChild
);
1630 /* free band array */
1631 COMCTL32_Free (infoPtr
->bands
);
1632 infoPtr
->bands
= NULL
;
1638 DeleteObject (infoPtr
->hcurArrow
);
1639 DeleteObject (infoPtr
->hcurHorz
);
1640 DeleteObject (infoPtr
->hcurVert
);
1641 DeleteObject (infoPtr
->hcurDrag
);
1646 /* free rebar info data */
1647 COMCTL32_Free (infoPtr
);
1649 TRACE (rebar
, "destroyed!\n");
1655 REBAR_GetFont (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1657 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr(wndPtr
);
1659 return (LRESULT
)infoPtr
->hFont
;
1665 REBAR_MouseMove (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1667 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr(wndPtr
);
1674 __inline__
static LRESULT
1675 REBAR_NCCalcSize (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1677 if (wndPtr
->dwStyle
& WS_BORDER
) {
1678 ((LPRECT
)lParam
)->left
+= sysMetrics
[SM_CXEDGE
];
1679 ((LPRECT
)lParam
)->top
+= sysMetrics
[SM_CYEDGE
];
1680 ((LPRECT
)lParam
)->right
-= sysMetrics
[SM_CXEDGE
];
1681 ((LPRECT
)lParam
)->bottom
-= sysMetrics
[SM_CYEDGE
];
1689 REBAR_NCPaint (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1691 HWND hwnd
= wndPtr
->hwndSelf
;
1694 if ( wndPtr
->dwStyle
& WS_MINIMIZE
||
1695 !WIN_IsWindowDrawable( wndPtr
, 0 )) return 0; /* Nothing to do */
1697 DefWindowProcA (hwnd
, WM_NCPAINT
, wParam
, lParam
);
1699 if (!(hdc
= GetDCEx( hwnd
, 0, DCX_USESTYLE
| DCX_WINDOW
))) return 0;
1701 if (ExcludeVisRect16( hdc
, wndPtr
->rectClient
.left
-wndPtr
->rectWindow
.left
,
1702 wndPtr
->rectClient
.top
-wndPtr
->rectWindow
.top
,
1703 wndPtr
->rectClient
.right
-wndPtr
->rectWindow
.left
,
1704 wndPtr
->rectClient
.bottom
-wndPtr
->rectWindow
.top
)
1706 ReleaseDC( hwnd
, hdc
);
1710 if (!(wndPtr
->flags
& WIN_MANAGED
) && (wndPtr
->dwStyle
& WS_BORDER
))
1711 DrawEdge (hdc
, &wndPtr
->rectWindow
, EDGE_ETCHED
, BF_RECT
);
1713 ReleaseDC( hwnd
, hdc
);
1720 REBAR_Paint (WND
*wndPtr
, WPARAM wParam
)
1725 hdc
= wParam
==0 ? BeginPaint (wndPtr
->hwndSelf
, &ps
) : (HDC
)wParam
;
1726 REBAR_Refresh (wndPtr
, hdc
);
1728 EndPaint (wndPtr
->hwndSelf
, &ps
);
1734 REBAR_SetCursor (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1736 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr(wndPtr
);
1740 TRACE (rebar
, "code=0x%X id=0x%X\n", LOWORD(lParam
), HIWORD(lParam
));
1743 ScreenToClient (wndPtr
->hwndSelf
, &pt
);
1745 REBAR_InternalHitTest (wndPtr
, &pt
, &flags
, NULL
);
1747 if (flags
== RBHT_GRABBER
) {
1748 if ((wndPtr
->dwStyle
& CCS_VERT
) &&
1749 !(wndPtr
->dwStyle
& RBS_VERTICALGRIPPER
))
1750 SetCursor (infoPtr
->hcurVert
);
1752 SetCursor (infoPtr
->hcurHorz
);
1754 else if (flags
!= RBHT_CLIENT
)
1755 SetCursor (infoPtr
->hcurArrow
);
1762 REBAR_SetFont (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1764 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr(wndPtr
);
1766 /* TEXTMETRIC32A tm; */
1767 HFONT hFont
/*, hOldFont */;
1770 infoPtr
->hFont
= (HFONT
)wParam
;
1772 hFont
= infoPtr
->hFont
? infoPtr
->hFont
: GetStockObject (SYSTEM_FONT
);
1775 hOldFont = SelectObject32 (hdc, hFont);
1776 GetTextMetrics32A (hdc, &tm);
1777 infoPtr->nHeight = tm.tmHeight + VERT_BORDER;
1778 SelectObject32 (hdc, hOldFont);
1779 ReleaseDC32 (0, hdc);
1783 REBAR_Layout (wndPtr);
1784 hdc = GetDC32 (wndPtr->hwndSelf);
1785 REBAR_Refresh (wndPtr, hdc);
1786 ReleaseDC32 (wndPtr->hwndSelf, hdc);
1794 REBAR_Size (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
1796 REBAR_INFO
*infoPtr
= REBAR_GetInfoPtr(wndPtr
);
1798 /* INT32 x, y, cx, cy; */
1800 /* auto resize deadlock check */
1801 if (infoPtr
->bAutoResize
) {
1802 infoPtr
->bAutoResize
= FALSE
;
1806 TRACE (rebar
, "sizing rebar!\n");
1808 /* get parent rectangle */
1809 GetClientRect (GetParent (wndPtr
->hwndSelf
), &rcParent
);
1811 REBAR_Layout (wndPtr, &rcParent);
1813 if (wndPtr->dwStyle & CCS_VERT) {
1814 if (wndPtr->dwStyle & CCS_LEFT == CCS_LEFT) {
1817 cx = infoPtr->calcSize.cx;
1818 cy = infoPtr->calcSize.cy;
1821 x = rcParent.right - infoPtr->calcSize.cx;
1823 cx = infoPtr->calcSize.cx;
1824 cy = infoPtr->calcSize.cy;
1828 if (wndPtr->dwStyle & CCS_TOP) {
1831 cx = infoPtr->calcSize.cx;
1832 cy = infoPtr->calcSize.cy;
1836 y = rcParent.bottom - infoPtr->calcSize.cy;
1837 cx = infoPtr->calcSize.cx;
1838 cy = infoPtr->calcSize.cy;
1842 SetWindowPos32 (wndPtr->hwndSelf, 0, x, y, cx, cy,
1843 SWP_NOZORDER | SWP_SHOWWINDOW);
1845 REBAR_Layout (wndPtr
, NULL
);
1846 REBAR_ForceResize (wndPtr
);
1847 REBAR_MoveChildWindows (wndPtr
);
1854 REBAR_WindowProc (HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
1856 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
1860 /* case RB_BEGINDRAG: */
1863 return REBAR_DeleteBand (wndPtr
, wParam
, lParam
);
1865 /* case RB_DRAGMOVE: */
1866 /* case RB_ENDDRAG: */
1868 case RB_GETBANDBORDERS
:
1869 return REBAR_GetBandBorders (wndPtr
, wParam
, lParam
);
1871 case RB_GETBANDCOUNT
:
1872 return REBAR_GetBandCount (wndPtr
);
1874 /* case RB_GETBANDINFO32: */ /* outdated, just for compatibility */
1876 case RB_GETBANDINFOA
:
1877 return REBAR_GetBandInfoA (wndPtr
, wParam
, lParam
);
1879 case RB_GETBANDINFOW
:
1880 return REBAR_GetBandInfoW (wndPtr
, wParam
, lParam
);
1882 case RB_GETBARHEIGHT
:
1883 return REBAR_GetBarHeight (wndPtr
, wParam
, lParam
);
1886 return REBAR_GetBarInfo (wndPtr
, wParam
, lParam
);
1889 return REBAR_GetBkColor (wndPtr
);
1891 /* case RB_GETCOLORSCHEME: */
1892 /* case RB_GETDROPTARGET: */
1895 return REBAR_GetPalette (wndPtr
, wParam
, lParam
);
1898 return REBAR_GetRect (wndPtr
, wParam
, lParam
);
1900 case RB_GETROWCOUNT
:
1901 return REBAR_GetRowCount (wndPtr
);
1903 case RB_GETROWHEIGHT
:
1904 return REBAR_GetRowHeight (wndPtr
, wParam
, lParam
);
1906 case RB_GETTEXTCOLOR
:
1907 return REBAR_GetTextColor (wndPtr
);
1909 case RB_GETTOOLTIPS
:
1910 return REBAR_GetToolTips (wndPtr
);
1912 case RB_GETUNICODEFORMAT
:
1913 return REBAR_GetUnicodeFormat (wndPtr
);
1916 return REBAR_HitTest (wndPtr
, wParam
, lParam
);
1919 return REBAR_IdToIndex (wndPtr
, wParam
, lParam
);
1921 case RB_INSERTBANDA
:
1922 return REBAR_InsertBandA (wndPtr
, wParam
, lParam
);
1924 case RB_INSERTBANDW
:
1925 return REBAR_InsertBandW (wndPtr
, wParam
, lParam
);
1927 case RB_MAXIMIZEBAND
:
1928 return REBAR_MaximizeBand (wndPtr
, wParam
, lParam
);
1930 case RB_MINIMIZEBAND
:
1931 return REBAR_MinimizeBand (wndPtr
, wParam
, lParam
);
1934 return REBAR_MoveBand (wndPtr
, wParam
, lParam
);
1936 case RB_SETBANDINFOA
:
1937 return REBAR_SetBandInfoA (wndPtr
, wParam
, lParam
);
1939 case RB_SETBANDINFOW
:
1940 return REBAR_SetBandInfoW (wndPtr
, wParam
, lParam
);
1943 return REBAR_SetBarInfo (wndPtr
, wParam
, lParam
);
1946 return REBAR_SetBkColor (wndPtr
, wParam
, lParam
);
1948 /* case RB_SETCOLORSCHEME: */
1949 /* case RB_SETPALETTE: */
1950 /* return REBAR_GetPalette (wndPtr, wParam, lParam); */
1953 return REBAR_SetParent (wndPtr
, wParam
, lParam
);
1955 case RB_SETTEXTCOLOR
:
1956 return REBAR_SetTextColor (wndPtr
, wParam
, lParam
);
1958 /* case RB_SETTOOLTIPS: */
1960 case RB_SETUNICODEFORMAT
:
1961 return REBAR_SetUnicodeFormat (wndPtr
, wParam
);
1964 return REBAR_ShowBand (wndPtr
, wParam
, lParam
);
1967 return REBAR_SizeToRect (wndPtr
, wParam
, lParam
);
1971 return SendMessageA (wndPtr
->parent
->hwndSelf
, uMsg
, wParam
, lParam
);
1974 return REBAR_Create (wndPtr
, wParam
, lParam
);
1977 return REBAR_Destroy (wndPtr
, wParam
, lParam
);
1980 return REBAR_GetFont (wndPtr
, wParam
, lParam
);
1982 /* case WM_MOUSEMOVE: */
1983 /* return REBAR_MouseMove (wndPtr, wParam, lParam); */
1986 return REBAR_NCCalcSize (wndPtr
, wParam
, lParam
);
1989 return REBAR_NCPaint (wndPtr
, wParam
, lParam
);
1992 return SendMessageA (wndPtr
->parent
->hwndSelf
, uMsg
, wParam
, lParam
);
1995 return REBAR_Paint (wndPtr
, wParam
);
1998 return REBAR_SetCursor (wndPtr
, wParam
, lParam
);
2001 return REBAR_SetFont (wndPtr
, wParam
, lParam
);
2004 return REBAR_Size (wndPtr
, wParam
, lParam
);
2006 /* case WM_TIMER: */
2008 /* case WM_WININICHANGE: */
2011 if (uMsg
>= WM_USER
)
2012 ERR (rebar
, "unknown msg %04x wp=%08x lp=%08lx\n",
2013 uMsg
, wParam
, lParam
);
2014 return DefWindowProcA (hwnd
, uMsg
, wParam
, lParam
);
2021 REBAR_Register (VOID
)
2025 if (GlobalFindAtomA (REBARCLASSNAMEA
)) return;
2027 ZeroMemory (&wndClass
, sizeof(WNDCLASSA
));
2028 wndClass
.style
= CS_GLOBALCLASS
| CS_DBLCLKS
;
2029 wndClass
.lpfnWndProc
= (WNDPROC
)REBAR_WindowProc
;
2030 wndClass
.cbClsExtra
= 0;
2031 wndClass
.cbWndExtra
= sizeof(REBAR_INFO
*);
2032 wndClass
.hCursor
= 0;
2033 wndClass
.hbrBackground
= (HBRUSH
)(COLOR_BTNFACE
+ 1);
2034 wndClass
.lpszClassName
= REBARCLASSNAMEA
;
2036 RegisterClassA (&wndClass
);
2041 REBAR_Unregister (VOID
)
2043 if (GlobalFindAtomA (REBARCLASSNAMEA
))
2044 UnregisterClassA (REBARCLASSNAMEA
, (HINSTANCE
)NULL
);