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.
24 #include "sysmetrics.h"
29 #define DRAW_GRIPPER 1
34 #define GRIPPER_WIDTH 13
37 #define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)wndPtr->wExtra[0])
41 REBAR_DrawBand (HDC32 hdc, REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
44 DrawEdge32 (hdc, &lpBand->rcBand, BDR_RAISEDINNER, BF_MIDDLE);
49 if (lpBand->fDraw & DRAW_GRIPPER)
50 DrawEdge32 (hdc, &lpBand->rcGripper, BDR_RAISEDINNER, BF_RECT | BF_MIDDLE);
52 /* draw caption image */
53 if (lpBand->fDraw & DRAW_IMAGE) {
54 /* FIXME: center image */
57 pt.y = (lpBand->rcCapImage.bottom + lpBand->rcCapImage.top - infoPtr->imageSize.cy)/2;
58 pt.x = (lpBand->rcCapImage.right + lpBand->rcCapImage.left - infoPtr->imageSize.cx)/2;
60 ImageList_Draw (infoPtr->himl, lpBand->iImage, hdc,
61 /* lpBand->rcCapImage.left, lpBand->rcCapImage.top, */
66 /* draw caption text */
67 if (lpBand->fDraw & DRAW_TEXT) {
68 HFONT32 hOldFont = SelectObject32 (hdc, infoPtr->hFont);
69 INT32 oldBkMode = SetBkMode32 (hdc, TRANSPARENT);
70 DrawText32W (hdc, lpBand->lpText, -1, &lpBand->rcCapText,
71 DT_CENTER | DT_VCENTER | DT_SINGLELINE);
72 if (oldBkMode != TRANSPARENT)
73 SetBkMode32 (hdc, oldBkMode);
74 SelectObject32 (hdc, hOldFont);
80 REBAR_Refresh (WND *wndPtr, HDC32 hdc)
82 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
86 for (i = 0; i < infoPtr->uNumBands; i++) {
87 lpBand = &infoPtr->bands[i];
89 if ((lpBand->fStyle & RBBS_HIDDEN) ||
90 ((wndPtr->dwStyle & CCS_VERT) && (lpBand->fStyle & RBBS_NOVERT)))
93 REBAR_DrawBand (hdc, infoPtr, lpBand);
100 REBAR_CalcHorzBand (REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
104 /* set initial caption image rectangle */
105 SetRect32 (&lpBand->rcCapImage, 0, 0, 0, 0);
107 /* image is visible */
108 if ((lpBand->iImage > -1) && (infoPtr->himl)) {
109 lpBand->fDraw |= DRAW_IMAGE;
111 lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx;
112 lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy;
114 /* update band height */
115 if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) {
116 lpBand->uMinHeight = infoPtr->imageSize.cy + 2;
117 lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->uMinHeight;
121 /* set initial caption text rectangle */
122 lpBand->rcCapText.left = lpBand->rcCapImage.right;
123 lpBand->rcCapText.top = lpBand->rcBand.top + 1;
124 lpBand->rcCapText.right = lpBand->rcCapText.left;
125 lpBand->rcCapText.bottom = lpBand->rcBand.bottom - 1;
127 /* text is visible */
128 if (lpBand->lpText) {
129 HDC32 hdc = GetDC32 (0);
130 HFONT32 hOldFont = SelectObject32 (hdc, infoPtr->hFont);
133 lpBand->fDraw |= DRAW_TEXT;
134 GetTextExtentPoint32W (hdc, lpBand->lpText,
135 lstrlen32W (lpBand->lpText), &size);
136 lpBand->rcCapText.right += size.cx;
138 SelectObject32 (hdc, hOldFont);
139 ReleaseDC32 (0, hdc);
142 /* set initial child window rectangle */
143 if (lpBand->fStyle & RBBS_FIXEDSIZE) {
144 lpBand->rcChild.left = lpBand->rcCapText.right;
145 lpBand->rcChild.top = lpBand->rcBand.top;
146 lpBand->rcChild.right = lpBand->rcBand.right;
147 lpBand->rcChild.bottom = lpBand->rcBand.bottom;
150 lpBand->rcChild.left = lpBand->rcCapText.right + 4;
151 lpBand->rcChild.top = lpBand->rcBand.top + 2;
152 lpBand->rcChild.right = lpBand->rcBand.right - 4;
153 lpBand->rcChild.bottom = lpBand->rcBand.bottom - 2;
156 /* calculate gripper rectangle */
157 if ((!(lpBand->fStyle & RBBS_NOGRIPPER)) &&
158 (!(lpBand->fStyle & RBBS_FIXEDSIZE)) &&
159 ((lpBand->fStyle & RBBS_GRIPPERALWAYS) ||
160 (infoPtr->uNumBands > 1))) {
161 lpBand->fDraw |= DRAW_GRIPPER;
162 lpBand->rcGripper.left = lpBand->rcBand.left + 3;
163 lpBand->rcGripper.right = lpBand->rcGripper.left + 3;
164 lpBand->rcGripper.top = lpBand->rcBand.top + 3;
165 lpBand->rcGripper.bottom = lpBand->rcBand.bottom - 3;
167 /* move caption rectangles */
168 OffsetRect32 (&lpBand->rcCapImage, GRIPPER_WIDTH, 0);
169 OffsetRect32 (&lpBand->rcCapText, GRIPPER_WIDTH, 0);
171 /* adjust child rectangle */
172 lpBand->rcChild.left += GRIPPER_WIDTH;
180 REBAR_CalcVertBand (WND *wndPtr, REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
184 /* set initial caption image rectangle */
185 SetRect32 (&lpBand->rcCapImage, 0, 0, 0, 0);
187 /* image is visible */
188 if ((lpBand->iImage > -1) && (infoPtr->himl)) {
189 lpBand->fDraw |= DRAW_IMAGE;
191 lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx;
192 lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy;
194 /* update band width */
195 if (lpBand->uMinHeight < infoPtr->imageSize.cx + 2) {
196 lpBand->uMinHeight = infoPtr->imageSize.cx + 2;
197 lpBand->rcBand.right = lpBand->rcBand.left + lpBand->uMinHeight;
201 /* set initial caption text rectangle */
202 lpBand->rcCapText.left = lpBand->rcBand.left + 1;
203 lpBand->rcCapText.top = lpBand->rcCapImage.bottom;
204 lpBand->rcCapText.right = lpBand->rcBand.right - 1;
205 lpBand->rcCapText.bottom = lpBand->rcCapText.top;
207 /* text is visible */
208 if (lpBand->lpText) {
209 HDC32 hdc = GetDC32 (0);
210 HFONT32 hOldFont = SelectObject32 (hdc, infoPtr->hFont);
213 lpBand->fDraw |= DRAW_TEXT;
214 GetTextExtentPoint32W (hdc, lpBand->lpText,
215 lstrlen32W (lpBand->lpText), &size);
216 /* lpBand->rcCapText.right += size.cx; */
217 lpBand->rcCapText.bottom += size.cy;
219 SelectObject32 (hdc, hOldFont);
220 ReleaseDC32 (0, hdc);
223 /* set initial child window rectangle */
224 if (lpBand->fStyle & RBBS_FIXEDSIZE) {
225 lpBand->rcChild.left = lpBand->rcBand.left;
226 lpBand->rcChild.top = lpBand->rcCapText.bottom;
227 lpBand->rcChild.right = lpBand->rcBand.right;
228 lpBand->rcChild.bottom = lpBand->rcBand.bottom;
231 lpBand->rcChild.left = lpBand->rcBand.left + 2;
232 lpBand->rcChild.top = lpBand->rcCapText.bottom + 4;
233 lpBand->rcChild.right = lpBand->rcBand.right - 2;
234 lpBand->rcChild.bottom = lpBand->rcBand.bottom - 4;
237 /* calculate gripper rectangle */
238 if ((!(lpBand->fStyle & RBBS_NOGRIPPER)) &&
239 (!(lpBand->fStyle & RBBS_FIXEDSIZE)) &&
240 ((lpBand->fStyle & RBBS_GRIPPERALWAYS) ||
241 (infoPtr->uNumBands > 1))) {
242 lpBand->fDraw |= DRAW_GRIPPER;
244 if (wndPtr->dwStyle & RBS_VERTICALGRIPPER) {
245 /* adjust band width */
246 lpBand->rcBand.right += GRIPPER_WIDTH;
247 lpBand->uMinHeight += GRIPPER_WIDTH;
249 lpBand->rcGripper.left = lpBand->rcBand.left + 3;
250 lpBand->rcGripper.right = lpBand->rcGripper.left + 3;
251 lpBand->rcGripper.top = lpBand->rcBand.top + 3;
252 lpBand->rcGripper.bottom = lpBand->rcBand.bottom - 3;
254 /* move caption rectangles */
255 OffsetRect32 (&lpBand->rcCapImage, GRIPPER_WIDTH, 0);
256 OffsetRect32 (&lpBand->rcCapText, GRIPPER_WIDTH, 0);
258 /* adjust child rectangle */
259 lpBand->rcChild.left += GRIPPER_WIDTH;
262 lpBand->rcGripper.left = lpBand->rcBand.left + 3;
263 lpBand->rcGripper.right = lpBand->rcBand.right - 3;
264 lpBand->rcGripper.top = lpBand->rcBand.top + 3;
265 lpBand->rcGripper.bottom = lpBand->rcGripper.top + 3;
267 /* move caption rectangles */
268 OffsetRect32 (&lpBand->rcCapImage, 0, GRIPPER_WIDTH);
269 OffsetRect32 (&lpBand->rcCapText, 0, GRIPPER_WIDTH);
271 /* adjust child rectangle */
272 lpBand->rcChild.top += GRIPPER_WIDTH;
279 REBAR_Layout (WND *wndPtr, LPRECT32 lpRect)
281 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
290 GetClientRect32 (wndPtr->hwndSelf, &rcClient);
295 if (wndPtr->dwStyle & CCS_VERT) {
296 cx = 20; /* FIXME: fixed height */
297 cy = rcClient.bottom - rcClient.top;
300 cx = rcClient.right - rcClient.left;
301 cy = 20; /* FIXME: fixed height */
304 for (i = 0; i < infoPtr->uNumBands; i++) {
305 lpBand = &infoPtr->bands[i];
307 if ((lpBand->fStyle & RBBS_HIDDEN) ||
308 ((wndPtr->dwStyle & CCS_VERT) && (lpBand->fStyle & RBBS_NOVERT)))
312 if (wndPtr->dwStyle & CCS_VERT) {
313 if (lpBand->fStyle & RBBS_VARIABLEHEIGHT)
314 cx = lpBand->cyMaxChild;
315 else if (lpBand->fStyle & RBBIM_CHILDSIZE)
316 cx = lpBand->cyMinChild;
320 lpBand->rcBand.left = x;
321 lpBand->rcBand.right = x + cx;
322 lpBand->rcBand.top = y;
323 lpBand->rcBand.bottom = y + cy;
324 lpBand->uMinHeight = cx;
327 if (lpBand->fStyle & RBBS_VARIABLEHEIGHT)
328 cy = lpBand->cyMaxChild;
329 else if (lpBand->fStyle & RBBIM_CHILDSIZE)
330 cy = lpBand->cyMinChild;
334 lpBand->rcBand.left = x;
335 lpBand->rcBand.right = x + cx;
336 lpBand->rcBand.top = y;
337 lpBand->rcBand.bottom = y + cy;
338 lpBand->uMinHeight = cy;
341 if (wndPtr->dwStyle & CCS_VERT) {
342 REBAR_CalcVertBand (wndPtr, infoPtr, lpBand);
343 x += lpBand->uMinHeight;
346 REBAR_CalcHorzBand (infoPtr, lpBand);
347 y += lpBand->uMinHeight;
351 if (wndPtr->dwStyle & CCS_VERT) {
352 infoPtr->calcSize.cx = x;
353 infoPtr->calcSize.cy = rcClient.bottom - rcClient.top;
356 infoPtr->calcSize.cx = rcClient.right - rcClient.left;
357 infoPtr->calcSize.cy = y;
363 REBAR_ForceResize (WND *wndPtr)
365 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
368 TRACE (rebar, " to [%d x %d]!\n",
369 infoPtr->calcSize.cx, infoPtr->calcSize.cy);
371 infoPtr->bAutoResize = TRUE;
375 rc.right = infoPtr->calcSize.cx;
376 rc.bottom = infoPtr->calcSize.cy;
378 if (wndPtr->dwStyle & WS_BORDER) {
379 InflateRect32 (&rc, sysMetrics[SM_CXEDGE], sysMetrics[SM_CYEDGE]);
382 SetWindowPos32 (wndPtr->hwndSelf, 0, 0, 0,
383 rc.right - rc.left, rc.bottom - rc.top,
384 SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW);
389 REBAR_MoveChildWindows (WND *wndPtr)
391 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
395 for (i = 0; i < infoPtr->uNumBands; i++) {
396 lpBand = &infoPtr->bands[i];
398 if (lpBand->fStyle & RBBS_HIDDEN)
400 if (lpBand->hwndChild) {
401 TRACE (rebar, "hwndChild = %x\n", lpBand->hwndChild);
403 if (WIDGETS_IsControl32 (WIN_FindWndPtr(lpBand->hwndChild), BIC32_COMBO)) {
404 INT32 nEditHeight, yPos;
407 /* special placement code for combo box */
410 /* get size of edit line */
411 GetWindowRect32 (lpBand->hwndChild, &rc);
412 nEditHeight = rc.bottom - rc.top;
413 yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2;
415 /* center combo box inside child area */
416 SetWindowPos32 (lpBand->hwndChild, HWND_TOP,
417 lpBand->rcChild.left, /*lpBand->rcChild.top*/ yPos,
418 lpBand->rcChild.right - lpBand->rcChild.left,
424 /* special placement code for extended combo box */
430 SetWindowPos32 (lpBand->hwndChild, HWND_TOP,
431 lpBand->rcChild.left, lpBand->rcChild.top,
432 lpBand->rcChild.right - lpBand->rcChild.left,
433 lpBand->rcChild.bottom - lpBand->rcChild.top,
442 REBAR_InternalHitTest (WND *wndPtr, LPPOINT32 lpPt, UINT32 *pFlags, INT32 *pBand)
444 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
449 GetClientRect32 (wndPtr->hwndSelf, &rect);
451 *pFlags = RBHT_NOWHERE;
452 if (PtInRect32 (&rect, *lpPt))
454 if (infoPtr->uNumBands == 0) {
455 *pFlags = RBHT_NOWHERE;
458 TRACE (rebar, "NOWHERE\n");
462 /* somewhere inside */
463 for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) {
464 lpBand = &infoPtr->bands[iCount];
465 if (PtInRect32 (&lpBand->rcBand, *lpPt)) {
468 if (PtInRect32 (&lpBand->rcGripper, *lpPt)) {
469 *pFlags = RBHT_GRABBER;
470 TRACE (rebar, "ON GRABBER %d\n", iCount);
473 else if (PtInRect32 (&lpBand->rcCapImage, *lpPt)) {
474 *pFlags = RBHT_CAPTION;
475 TRACE (rebar, "ON CAPTION %d\n", iCount);
478 else if (PtInRect32 (&lpBand->rcCapText, *lpPt)) {
479 *pFlags = RBHT_CAPTION;
480 TRACE (rebar, "ON CAPTION %d\n", iCount);
483 else if (PtInRect32 (&lpBand->rcChild, *lpPt)) {
484 *pFlags = RBHT_CLIENT;
485 TRACE (rebar, "ON CLIENT %d\n", iCount);
489 *pFlags = RBHT_NOWHERE;
490 TRACE (rebar, "NOWHERE %d\n", iCount);
496 *pFlags = RBHT_NOWHERE;
500 TRACE (rebar, "NOWHERE\n");
505 *pFlags = RBHT_NOWHERE;
508 TRACE (rebar, "NOWHERE\n");
512 TRACE (rebar, "flags=0x%X\n", *pFlags);
518 /* << REBAR_BeginDrag >> */
522 REBAR_DeleteBand (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
524 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
525 UINT32 uBand = (UINT32)wParam;
527 if (uBand >= infoPtr->uNumBands)
530 TRACE (rebar, "deleting band %u!\n", uBand);
532 if (infoPtr->uNumBands == 1) {
533 TRACE (rebar, " simple delete!\n");
534 COMCTL32_Free (infoPtr->bands);
535 infoPtr->bands = NULL;
536 infoPtr->uNumBands = 0;
539 REBAR_BAND *oldBands = infoPtr->bands;
540 TRACE(rebar, "complex delete! [uBand=%u]\n", uBand);
542 infoPtr->uNumBands--;
543 infoPtr->bands = COMCTL32_Alloc (sizeof (REBAR_BAND) * infoPtr->uNumBands);
545 memcpy (&infoPtr->bands[0], &oldBands[0],
546 uBand * sizeof(REBAR_BAND));
549 if (uBand < infoPtr->uNumBands) {
550 memcpy (&infoPtr->bands[uBand], &oldBands[uBand+1],
551 (infoPtr->uNumBands - uBand) * sizeof(REBAR_BAND));
554 COMCTL32_Free (oldBands);
557 REBAR_Layout (wndPtr, NULL);
558 REBAR_ForceResize (wndPtr);
559 REBAR_MoveChildWindows (wndPtr);
565 /* << REBAR_DragMove >> */
566 /* << REBAR_EndDrag >> */
570 REBAR_GetBandBorders (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
572 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
573 /* LPRECT32 lpRect = (LPRECT32)lParam; */
578 if ((UINT32)wParam >= infoPtr->uNumBands)
581 lpBand = &infoPtr->bands[(UINT32)wParam];
582 if (wndPtr->dwStyle & RBS_BANDBORDERS) {
593 __inline__ static LRESULT
594 REBAR_GetBandCount (WND *wndPtr)
596 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
598 TRACE (rebar, "band count %u!\n", infoPtr->uNumBands);
600 return infoPtr->uNumBands;
605 REBAR_GetBandInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
607 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
608 LPREBARBANDINFO32A lprbbi = (LPREBARBANDINFO32A)lParam;
613 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32A)
615 if ((UINT32)wParam >= infoPtr->uNumBands)
618 TRACE (rebar, "index %u\n", (UINT32)wParam);
620 /* copy band information */
621 lpBand = &infoPtr->bands[(UINT32)wParam];
623 if (lprbbi->fMask & RBBIM_STYLE)
624 lprbbi->fStyle = lpBand->fStyle;
626 if (lprbbi->fMask & RBBIM_COLORS) {
627 lprbbi->clrFore = lpBand->clrFore;
628 lprbbi->clrBack = lpBand->clrBack;
631 if ((lprbbi->fMask & RBBIM_TEXT) &&
632 (lprbbi->lpText) && (lpBand->lpText)) {
633 lstrcpynWtoA (lprbbi->lpText, lpBand->lpText, lprbbi->cch);
636 if (lprbbi->fMask & RBBIM_IMAGE)
637 lprbbi->iImage = lpBand->iImage;
639 if (lprbbi->fMask & RBBIM_CHILD)
640 lprbbi->hwndChild = lpBand->hwndChild;
642 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
643 lprbbi->cxMinChild = lpBand->cxMinChild;
644 lprbbi->cyMinChild = lpBand->cyMinChild;
645 lprbbi->cyMaxChild = lpBand->cyMaxChild;
646 lprbbi->cyChild = lpBand->cyChild;
647 lprbbi->cyIntegral = lpBand->cyIntegral;
650 if (lprbbi->fMask & RBBIM_SIZE)
651 lprbbi->cx = lpBand->cx;
653 if (lprbbi->fMask & RBBIM_BACKGROUND)
654 lprbbi->hbmBack = lpBand->hbmBack;
656 if (lprbbi->fMask & RBBIM_ID)
657 lprbbi->wID = lpBand->wID;
659 /* check for additional data */
660 if (lprbbi->cbSize >= sizeof (REBARBANDINFO32A)) {
661 if (lprbbi->fMask & RBBIM_IDEALSIZE)
662 lprbbi->cxIdeal = lpBand->cxIdeal;
664 if (lprbbi->fMask & RBBIM_LPARAM)
665 lprbbi->lParam = lpBand->lParam;
667 if (lprbbi->fMask & RBBIM_HEADERSIZE)
668 lprbbi->cxHeader = lpBand->cxHeader;
676 REBAR_GetBandInfo32W (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
678 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
679 LPREBARBANDINFO32W lprbbi = (LPREBARBANDINFO32W)lParam;
684 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32W)
686 if ((UINT32)wParam >= infoPtr->uNumBands)
689 TRACE (rebar, "index %u\n", (UINT32)wParam);
691 /* copy band information */
692 lpBand = &infoPtr->bands[(UINT32)wParam];
694 if (lprbbi->fMask & RBBIM_STYLE)
695 lprbbi->fStyle = lpBand->fStyle;
697 if (lprbbi->fMask & RBBIM_COLORS) {
698 lprbbi->clrFore = lpBand->clrFore;
699 lprbbi->clrBack = lpBand->clrBack;
702 if ((lprbbi->fMask & RBBIM_TEXT) &&
703 (lprbbi->lpText) && (lpBand->lpText)) {
704 lstrcpyn32W (lprbbi->lpText, lpBand->lpText, lprbbi->cch);
707 if (lprbbi->fMask & RBBIM_IMAGE)
708 lprbbi->iImage = lpBand->iImage;
710 if (lprbbi->fMask & RBBIM_CHILD)
711 lprbbi->hwndChild = lpBand->hwndChild;
713 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
714 lprbbi->cxMinChild = lpBand->cxMinChild;
715 lprbbi->cyMinChild = lpBand->cyMinChild;
716 lprbbi->cyMaxChild = lpBand->cyMaxChild;
717 lprbbi->cyChild = lpBand->cyChild;
718 lprbbi->cyIntegral = lpBand->cyIntegral;
721 if (lprbbi->fMask & RBBIM_SIZE)
722 lprbbi->cx = lpBand->cx;
724 if (lprbbi->fMask & RBBIM_BACKGROUND)
725 lprbbi->hbmBack = lpBand->hbmBack;
727 if (lprbbi->fMask & RBBIM_ID)
728 lprbbi->wID = lpBand->wID;
730 /* check for additional data */
731 if (lprbbi->cbSize >= sizeof (REBARBANDINFO32A)) {
732 if (lprbbi->fMask & RBBIM_IDEALSIZE)
733 lprbbi->cxIdeal = lpBand->cxIdeal;
735 if (lprbbi->fMask & RBBIM_LPARAM)
736 lprbbi->lParam = lpBand->lParam;
738 if (lprbbi->fMask & RBBIM_HEADERSIZE)
739 lprbbi->cxHeader = lpBand->cxHeader;
747 REBAR_GetBarHeight (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
749 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
752 REBAR_Layout (wndPtr, NULL);
753 nHeight = infoPtr->calcSize.cy;
755 if (wndPtr->dwStyle & WS_BORDER)
756 nHeight += (2 * sysMetrics[SM_CYEDGE]);
758 FIXME (rebar, "height = %d\n", nHeight);
765 REBAR_GetBarInfo (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
767 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
768 LPREBARINFO lpInfo = (LPREBARINFO)lParam;
773 if (lpInfo->cbSize < sizeof (REBARINFO))
776 TRACE (rebar, "getting bar info!\n");
779 lpInfo->himl = infoPtr->himl;
780 lpInfo->fMask |= RBIM_IMAGELIST;
787 __inline__ static LRESULT
788 REBAR_GetBkColor (WND *wndPtr)
790 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
792 TRACE (rebar, "background color 0x%06lx!\n", infoPtr->clrBk);
794 return infoPtr->clrBk;
798 /* << REBAR_GetColorScheme >> */
799 /* << REBAR_GetDropTarget >> */
803 REBAR_GetPalette (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
805 FIXME (rebar, "empty stub!\n");
812 REBAR_GetRect (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
814 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
815 INT32 iBand = (INT32)wParam;
816 LPRECT32 lprc = (LPRECT32)lParam;
819 if ((iBand < 0) && ((UINT32)iBand >= infoPtr->uNumBands))
824 TRACE (rebar, "band %d\n", iBand);
826 lpBand = &infoPtr->bands[iBand];
827 CopyRect32 (lprc, &lpBand->rcBand);
829 lprc->left = lpBand->rcBand.left;
830 lprc->top = lpBand->rcBand.top;
831 lprc->right = lpBand->rcBand.right;
832 lprc->bottom = lpBand->rcBand.bottom;
839 __inline__ static LRESULT
840 REBAR_GetRowCount (WND *wndPtr)
842 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
844 FIXME (rebar, "%u : semi stub!\n", infoPtr->uNumBands);
846 return infoPtr->uNumBands;
851 REBAR_GetRowHeight (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
853 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); */
855 FIXME (rebar, "-- height = 20: semi stub!\n");
861 __inline__ static LRESULT
862 REBAR_GetTextColor (WND *wndPtr)
864 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
866 TRACE (rebar, "text color 0x%06lx!\n", infoPtr->clrText);
868 return infoPtr->clrText;
872 __inline__ static LRESULT
873 REBAR_GetToolTips (WND *wndPtr)
875 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
876 return infoPtr->hwndToolTip;
880 __inline__ static LRESULT
881 REBAR_GetUnicodeFormat (WND *wndPtr)
883 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
884 return infoPtr->bUnicode;
889 REBAR_HitTest (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
891 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); */
892 LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam;
897 REBAR_InternalHitTest (wndPtr, &lprbht->pt,
898 &lprbht->flags, &lprbht->iBand);
900 return lprbht->iBand;
905 REBAR_IdToIndex (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
907 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
913 if (infoPtr->uNumBands < 1)
916 TRACE (rebar, "id %u\n", (UINT32)wParam);
918 for (i = 0; i < infoPtr->uNumBands; i++) {
919 if (infoPtr->bands[i].wID == (UINT32)wParam) {
920 TRACE (rebar, "band %u found!\n", i);
925 TRACE (rebar, "no band found!\n");
931 REBAR_InsertBand32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
933 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
934 LPREBARBANDINFO32A lprbbi = (LPREBARBANDINFO32A)lParam;
935 UINT32 uIndex = (UINT32)wParam;
942 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32A)
945 TRACE (rebar, "insert band at %u!\n", uIndex);
947 if (infoPtr->uNumBands == 0) {
948 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));
952 REBAR_BAND *oldBands = infoPtr->bands;
954 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
955 if (((INT32)uIndex == -1) || (uIndex > infoPtr->uNumBands))
956 uIndex = infoPtr->uNumBands;
958 /* pre insert copy */
960 memcpy (&infoPtr->bands[0], &oldBands[0],
961 uIndex * sizeof(REBAR_BAND));
965 if (uIndex < infoPtr->uNumBands - 1) {
966 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],
967 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));
970 COMCTL32_Free (oldBands);
973 infoPtr->uNumBands++;
975 TRACE (rebar, "index %u!\n", uIndex);
977 /* initialize band (infoPtr->bands[uIndex])*/
978 lpBand = &infoPtr->bands[uIndex];
980 if (lprbbi->fMask & RBBIM_STYLE)
981 lpBand->fStyle = lprbbi->fStyle;
983 if (lprbbi->fMask & RBBIM_COLORS) {
984 lpBand->clrFore = lprbbi->clrFore;
985 lpBand->clrBack = lprbbi->clrBack;
988 lpBand->clrFore = CLR_NONE;
989 lpBand->clrBack = CLR_NONE;
992 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
993 INT32 len = lstrlen32A (lprbbi->lpText);
995 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
996 lstrcpyAtoW (lpBand->lpText, lprbbi->lpText);
1000 if (lprbbi->fMask & RBBIM_IMAGE)
1001 lpBand->iImage = lprbbi->iImage;
1003 lpBand->iImage = -1;
1005 if (lprbbi->fMask & RBBIM_CHILD) {
1006 TRACE (rebar, "hwndChild = %x\n", lprbbi->hwndChild);
1007 lpBand->hwndChild = lprbbi->hwndChild;
1008 lpBand->hwndPrevParent =
1009 SetParent32 (lpBand->hwndChild, wndPtr->hwndSelf);
1012 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
1013 lpBand->cxMinChild = lprbbi->cxMinChild;
1014 lpBand->cyMinChild = lprbbi->cyMinChild;
1015 lpBand->cyMaxChild = lprbbi->cyMaxChild;
1016 lpBand->cyChild = lprbbi->cyChild;
1017 lpBand->cyIntegral = lprbbi->cyIntegral;
1020 lpBand->cxMinChild = -1;
1021 lpBand->cyMinChild = -1;
1022 lpBand->cyMaxChild = -1;
1023 lpBand->cyChild = -1;
1024 lpBand->cyIntegral = -1;
1027 if (lprbbi->fMask & RBBIM_SIZE)
1028 lpBand->cx = lprbbi->cx;
1032 if (lprbbi->fMask & RBBIM_BACKGROUND)
1033 lpBand->hbmBack = lprbbi->hbmBack;
1035 if (lprbbi->fMask & RBBIM_ID)
1036 lpBand->wID = lprbbi->wID;
1038 /* check for additional data */
1039 if (lprbbi->cbSize >= sizeof (REBARBANDINFO32A)) {
1040 if (lprbbi->fMask & RBBIM_IDEALSIZE)
1041 lpBand->cxIdeal = lprbbi->cxIdeal;
1043 if (lprbbi->fMask & RBBIM_LPARAM)
1044 lpBand->lParam = lprbbi->lParam;
1046 if (lprbbi->fMask & RBBIM_HEADERSIZE)
1047 lpBand->cxHeader = lprbbi->cxHeader;
1051 REBAR_Layout (wndPtr, NULL);
1052 REBAR_ForceResize (wndPtr);
1053 REBAR_MoveChildWindows (wndPtr);
1060 REBAR_InsertBand32W (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1062 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1063 LPREBARBANDINFO32W lprbbi = (LPREBARBANDINFO32W)lParam;
1064 UINT32 uIndex = (UINT32)wParam;
1067 if (infoPtr == NULL)
1071 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32W)
1074 TRACE (rebar, "insert band at %u!\n", uIndex);
1076 if (infoPtr->uNumBands == 0) {
1077 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));
1081 REBAR_BAND *oldBands = infoPtr->bands;
1083 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
1084 if (((INT32)uIndex == -1) || (uIndex > infoPtr->uNumBands))
1085 uIndex = infoPtr->uNumBands;
1087 /* pre insert copy */
1089 memcpy (&infoPtr->bands[0], &oldBands[0],
1090 uIndex * sizeof(REBAR_BAND));
1094 if (uIndex < infoPtr->uNumBands - 1) {
1095 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],
1096 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));
1099 COMCTL32_Free (oldBands);
1102 infoPtr->uNumBands++;
1104 TRACE (rebar, "index %u!\n", uIndex);
1106 /* initialize band (infoPtr->bands[uIndex])*/
1107 lpBand = &infoPtr->bands[uIndex];
1109 if (lprbbi->fMask & RBBIM_STYLE)
1110 lpBand->fStyle = lprbbi->fStyle;
1112 if (lprbbi->fMask & RBBIM_COLORS) {
1113 lpBand->clrFore = lprbbi->clrFore;
1114 lpBand->clrBack = lprbbi->clrBack;
1117 lpBand->clrFore = CLR_NONE;
1118 lpBand->clrBack = CLR_NONE;
1121 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
1122 INT32 len = lstrlen32W (lprbbi->lpText);
1124 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
1125 lstrcpy32W (lpBand->lpText, lprbbi->lpText);
1129 if (lprbbi->fMask & RBBIM_IMAGE)
1130 lpBand->iImage = lprbbi->iImage;
1132 lpBand->iImage = -1;
1134 if (lprbbi->fMask & RBBIM_CHILD) {
1135 TRACE (rebar, "hwndChild = %x\n", lprbbi->hwndChild);
1136 lpBand->hwndChild = lprbbi->hwndChild;
1137 lpBand->hwndPrevParent =
1138 SetParent32 (lpBand->hwndChild, wndPtr->hwndSelf);
1141 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
1142 lpBand->cxMinChild = lprbbi->cxMinChild;
1143 lpBand->cyMinChild = lprbbi->cyMinChild;
1144 lpBand->cyMaxChild = lprbbi->cyMaxChild;
1145 lpBand->cyChild = lprbbi->cyChild;
1146 lpBand->cyIntegral = lprbbi->cyIntegral;
1149 lpBand->cxMinChild = -1;
1150 lpBand->cyMinChild = -1;
1151 lpBand->cyMaxChild = -1;
1152 lpBand->cyChild = -1;
1153 lpBand->cyIntegral = -1;
1156 if (lprbbi->fMask & RBBIM_SIZE)
1157 lpBand->cx = lprbbi->cx;
1161 if (lprbbi->fMask & RBBIM_BACKGROUND)
1162 lpBand->hbmBack = lprbbi->hbmBack;
1164 if (lprbbi->fMask & RBBIM_ID)
1165 lpBand->wID = lprbbi->wID;
1167 /* check for additional data */
1168 if (lprbbi->cbSize >= sizeof (REBARBANDINFO32W)) {
1169 if (lprbbi->fMask & RBBIM_IDEALSIZE)
1170 lpBand->cxIdeal = lprbbi->cxIdeal;
1172 if (lprbbi->fMask & RBBIM_LPARAM)
1173 lpBand->lParam = lprbbi->lParam;
1175 if (lprbbi->fMask & RBBIM_HEADERSIZE)
1176 lpBand->cxHeader = lprbbi->cxHeader;
1180 REBAR_Layout (wndPtr, NULL);
1181 REBAR_ForceResize (wndPtr);
1182 REBAR_MoveChildWindows (wndPtr);
1189 REBAR_MaximizeBand (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1191 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); */
1193 FIXME (rebar, "(uBand = %u fIdeal = %s)\n",
1194 (UINT32)wParam, lParam ? "TRUE" : "FALSE");
1202 REBAR_MinimizeBand (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1204 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); */
1206 FIXME (rebar, "(uBand = %u)\n", (UINT32)wParam);
1214 REBAR_MoveBand (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1216 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); */
1218 FIXME (rebar, "(iFrom = %u iTof = %u)\n",
1219 (UINT32)wParam, (UINT32)lParam);
1227 REBAR_SetBandInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1229 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1230 LPREBARBANDINFO32A lprbbi = (LPREBARBANDINFO32A)lParam;
1235 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32A)
1237 if ((UINT32)wParam >= infoPtr->uNumBands)
1240 TRACE (rebar, "index %u\n", (UINT32)wParam);
1242 /* set band information */
1243 lpBand = &infoPtr->bands[(UINT32)wParam];
1245 if (lprbbi->fMask & RBBIM_STYLE)
1246 lpBand->fStyle = lprbbi->fStyle;
1248 if (lprbbi->fMask & RBBIM_COLORS) {
1249 lpBand->clrFore = lprbbi->clrFore;
1250 lpBand->clrBack = lprbbi->clrBack;
1253 if (lprbbi->fMask & RBBIM_TEXT) {
1254 if (lpBand->lpText) {
1255 COMCTL32_Free (lpBand->lpText);
1256 lpBand->lpText = NULL;
1258 if (lprbbi->lpText) {
1259 INT32 len = lstrlen32A (lprbbi->lpText);
1260 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
1261 lstrcpyAtoW (lpBand->lpText, lprbbi->lpText);
1265 if (lprbbi->fMask & RBBIM_IMAGE)
1266 lpBand->iImage = lprbbi->iImage;
1268 if (lprbbi->fMask & RBBIM_CHILD) {
1269 if (lprbbi->hwndChild) {
1270 lpBand->hwndChild = lprbbi->hwndChild;
1271 lpBand->hwndPrevParent =
1272 SetParent32 (lpBand->hwndChild, wndPtr->hwndSelf);
1275 TRACE (rebar, "child: 0x%x prev parent: 0x%x\n",
1276 lpBand->hwndChild, lpBand->hwndPrevParent);
1277 lpBand->hwndChild = 0;
1278 lpBand->hwndPrevParent = 0;
1282 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
1283 lpBand->cxMinChild = lprbbi->cxMinChild;
1284 lpBand->cyMinChild = lprbbi->cyMinChild;
1285 lpBand->cyMaxChild = lprbbi->cyMaxChild;
1286 lpBand->cyChild = lprbbi->cyChild;
1287 lpBand->cyIntegral = lprbbi->cyIntegral;
1290 if (lprbbi->fMask & RBBIM_SIZE)
1291 lpBand->cx = lprbbi->cx;
1293 if (lprbbi->fMask & RBBIM_BACKGROUND)
1294 lpBand->hbmBack = lprbbi->hbmBack;
1296 if (lprbbi->fMask & RBBIM_ID)
1297 lpBand->wID = lprbbi->wID;
1299 /* check for additional data */
1300 if (lprbbi->cbSize >= sizeof (REBARBANDINFO32A)) {
1301 if (lprbbi->fMask & RBBIM_IDEALSIZE)
1302 lpBand->cxIdeal = lprbbi->cxIdeal;
1304 if (lprbbi->fMask & RBBIM_LPARAM)
1305 lpBand->lParam = lprbbi->lParam;
1307 if (lprbbi->fMask & RBBIM_HEADERSIZE)
1308 lpBand->cxHeader = lprbbi->cxHeader;
1311 REBAR_Layout (wndPtr, NULL);
1312 REBAR_ForceResize (wndPtr);
1313 REBAR_MoveChildWindows (wndPtr);
1320 REBAR_SetBandInfo32W (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1322 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1323 LPREBARBANDINFO32W lprbbi = (LPREBARBANDINFO32W)lParam;
1328 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32W)
1330 if ((UINT32)wParam >= infoPtr->uNumBands)
1333 TRACE (rebar, "index %u\n", (UINT32)wParam);
1335 /* set band information */
1336 lpBand = &infoPtr->bands[(UINT32)wParam];
1338 if (lprbbi->fMask & RBBIM_STYLE)
1339 lpBand->fStyle = lprbbi->fStyle;
1341 if (lprbbi->fMask & RBBIM_COLORS) {
1342 lpBand->clrFore = lprbbi->clrFore;
1343 lpBand->clrBack = lprbbi->clrBack;
1346 if (lprbbi->fMask & RBBIM_TEXT) {
1347 if (lpBand->lpText) {
1348 COMCTL32_Free (lpBand->lpText);
1349 lpBand->lpText = NULL;
1351 if (lprbbi->lpText) {
1352 INT32 len = lstrlen32W (lprbbi->lpText);
1353 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
1354 lstrcpy32W (lpBand->lpText, lprbbi->lpText);
1358 if (lprbbi->fMask & RBBIM_IMAGE)
1359 lpBand->iImage = lprbbi->iImage;
1361 if (lprbbi->fMask & RBBIM_CHILD) {
1362 if (lprbbi->hwndChild) {
1363 lpBand->hwndChild = lprbbi->hwndChild;
1364 lpBand->hwndPrevParent =
1365 SetParent32 (lpBand->hwndChild, wndPtr->hwndSelf);
1368 TRACE (rebar, "child: 0x%x prev parent: 0x%x\n",
1369 lpBand->hwndChild, lpBand->hwndPrevParent);
1370 lpBand->hwndChild = 0;
1371 lpBand->hwndPrevParent = 0;
1375 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
1376 lpBand->cxMinChild = lprbbi->cxMinChild;
1377 lpBand->cyMinChild = lprbbi->cyMinChild;
1378 lpBand->cyMaxChild = lprbbi->cyMaxChild;
1379 lpBand->cyChild = lprbbi->cyChild;
1380 lpBand->cyIntegral = lprbbi->cyIntegral;
1383 if (lprbbi->fMask & RBBIM_SIZE)
1384 lpBand->cx = lprbbi->cx;
1386 if (lprbbi->fMask & RBBIM_BACKGROUND)
1387 lpBand->hbmBack = lprbbi->hbmBack;
1389 if (lprbbi->fMask & RBBIM_ID)
1390 lpBand->wID = lprbbi->wID;
1392 /* check for additional data */
1393 if (lprbbi->cbSize >= sizeof (REBARBANDINFO32W)) {
1394 if (lprbbi->fMask & RBBIM_IDEALSIZE)
1395 lpBand->cxIdeal = lprbbi->cxIdeal;
1397 if (lprbbi->fMask & RBBIM_LPARAM)
1398 lpBand->lParam = lprbbi->lParam;
1400 if (lprbbi->fMask & RBBIM_HEADERSIZE)
1401 lpBand->cxHeader = lprbbi->cxHeader;
1404 REBAR_Layout (wndPtr, NULL);
1405 REBAR_ForceResize (wndPtr);
1406 REBAR_MoveChildWindows (wndPtr);
1413 REBAR_SetBarInfo (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1415 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1416 LPREBARINFO lpInfo = (LPREBARINFO)lParam;
1421 if (lpInfo->cbSize < sizeof (REBARINFO))
1424 TRACE (rebar, "setting bar info!\n");
1426 if (lpInfo->fMask & RBIM_IMAGELIST) {
1427 infoPtr->himl = lpInfo->himl;
1428 if (infoPtr->himl) {
1429 ImageList_GetIconSize (infoPtr->himl, &infoPtr->imageSize.cx,
1430 &infoPtr->imageSize.cy);
1433 infoPtr->imageSize.cx = 0;
1434 infoPtr->imageSize.cy = 0;
1443 REBAR_SetBkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1445 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1448 clrTemp = infoPtr->clrBk;
1449 infoPtr->clrBk = (COLORREF)lParam;
1451 TRACE (rebar, "background color 0x%06lx!\n", infoPtr->clrBk);
1457 /* << REBAR_SetColorScheme >> */
1458 /* << REBAR_SetPalette >> */
1462 REBAR_SetParent (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1464 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1465 HWND32 hwndTemp = infoPtr->hwndNotify;
1467 infoPtr->hwndNotify = (HWND32)wParam;
1469 return (LRESULT)hwndTemp;
1474 REBAR_SetTextColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1476 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1479 clrTemp = infoPtr->clrText;
1480 infoPtr->clrText = (COLORREF)lParam;
1482 TRACE (rebar, "text color 0x%06lx!\n", infoPtr->clrText);
1488 /* << REBAR_SetTooltips >> */
1491 __inline__ static LRESULT
1492 REBAR_SetUnicodeFormat (WND *wndPtr, WPARAM32 wParam)
1494 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1495 BOOL32 bTemp = infoPtr->bUnicode;
1496 infoPtr->bUnicode = (BOOL32)wParam;
1502 REBAR_ShowBand (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1504 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1507 if (((INT32)wParam < 0) || ((INT32)wParam > infoPtr->uNumBands))
1510 lpBand = &infoPtr->bands[(INT32)wParam];
1512 if ((BOOL32)lParam) {
1513 TRACE (rebar, "show band %d\n", (INT32)wParam);
1514 lpBand->fStyle = lpBand->fStyle & ~RBBS_HIDDEN;
1515 if (IsWindow32 (lpBand->hwndChild))
1516 ShowWindow32 (lpBand->hwndChild, SW_SHOW);
1519 TRACE (rebar, "hide band %d\n", (INT32)wParam);
1520 lpBand->fStyle = lpBand->fStyle | RBBS_HIDDEN;
1521 if (IsWindow32 (lpBand->hwndChild))
1522 ShowWindow32 (lpBand->hwndChild, SW_SHOW);
1525 REBAR_Layout (wndPtr, NULL);
1526 REBAR_ForceResize (wndPtr);
1527 REBAR_MoveChildWindows (wndPtr);
1534 REBAR_SizeToRect (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1536 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1537 LPRECT32 lpRect = (LPRECT32)lParam;
1542 FIXME (rebar, "layout change not implemented!\n");
1543 FIXME (rebar, "[%d %d %d %d]\n",
1544 lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
1547 SetWindowPos32 (wndPtr->hwndSelf, 0, lpRect->left, lpRect->top,
1548 lpRect->right - lpRect->left, lpRect->bottom - lpRect->top,
1552 infoPtr->calcSize.cx = lpRect->right - lpRect->left;
1553 infoPtr->calcSize.cy = lpRect->bottom - lpRect->top;
1555 REBAR_ForceResize (wndPtr);
1562 REBAR_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1564 REBAR_INFO *infoPtr;
1566 /* allocate memory for info structure */
1567 infoPtr = (REBAR_INFO *)COMCTL32_Alloc (sizeof(REBAR_INFO));
1568 wndPtr->wExtra[0] = (DWORD)infoPtr;
1570 if (infoPtr == NULL) {
1571 ERR (rebar, "could not allocate info memory!\n");
1575 if ((REBAR_INFO*)wndPtr->wExtra[0] != infoPtr) {
1576 ERR (rebar, "pointer assignment error!\n");
1580 /* initialize info structure */
1581 infoPtr->clrBk = CLR_NONE;
1582 infoPtr->clrText = RGB(0, 0, 0);
1584 infoPtr->bAutoResize = FALSE;
1585 infoPtr->hcurArrow = LoadCursor32A (0, IDC_ARROW32A);
1586 infoPtr->hcurHorz = LoadCursor32A (0, IDC_SIZEWE32A);
1587 infoPtr->hcurVert = LoadCursor32A (0, IDC_SIZENS32A);
1588 infoPtr->hcurDrag = LoadCursor32A (0, IDC_SIZE32A);
1590 infoPtr->bUnicode = IsWindowUnicode (wndPtr->hwndSelf);
1592 if (wndPtr->dwStyle & RBS_AUTOSIZE)
1593 FIXME (rebar, "style RBS_AUTOSIZE set!\n");
1596 SendMessage32A (wndPtr->parent->hwndSelf, WM_NOTIFYFORMAT,
1597 (WPARAM32)wndPtr->hwndSelf, NF_QUERY);
1600 TRACE (rebar, "created!\n");
1606 REBAR_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1608 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
1613 /* free rebar bands */
1614 if ((infoPtr->uNumBands > 0) && infoPtr->bands) {
1615 /* clean up each band */
1616 for (i = 0; i < infoPtr->uNumBands; i++) {
1617 lpBand = &infoPtr->bands[i];
1619 /* delete text strings */
1620 if (lpBand->lpText) {
1621 COMCTL32_Free (lpBand->lpText);
1622 lpBand->lpText = NULL;
1624 /* destroy child window */
1625 DestroyWindow32 (lpBand->hwndChild);
1628 /* free band array */
1629 COMCTL32_Free (infoPtr->bands);
1630 infoPtr->bands = NULL;
1636 DeleteObject32 (infoPtr->hcurArrow);
1637 DeleteObject32 (infoPtr->hcurHorz);
1638 DeleteObject32 (infoPtr->hcurVert);
1639 DeleteObject32 (infoPtr->hcurDrag);
1644 /* free rebar info data */
1645 COMCTL32_Free (infoPtr);
1647 TRACE (rebar, "destroyed!\n");
1653 REBAR_GetFont (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1655 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
1657 return (LRESULT)infoPtr->hFont;
1663 REBAR_MouseMove (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1665 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
1672 __inline__ static LRESULT
1673 REBAR_NCCalcSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1675 if (wndPtr->dwStyle & WS_BORDER) {
1676 ((LPRECT32)lParam)->left += sysMetrics[SM_CXEDGE];
1677 ((LPRECT32)lParam)->top += sysMetrics[SM_CYEDGE];
1678 ((LPRECT32)lParam)->right -= sysMetrics[SM_CXEDGE];
1679 ((LPRECT32)lParam)->bottom -= sysMetrics[SM_CYEDGE];
1687 REBAR_NCPaint (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1689 HWND32 hwnd = wndPtr->hwndSelf;
1692 if ( wndPtr->dwStyle & WS_MINIMIZE ||
1693 !WIN_IsWindowDrawable( wndPtr, 0 )) return 0; /* Nothing to do */
1695 DefWindowProc32A (hwnd, WM_NCPAINT, wParam, lParam);
1697 if (!(hdc = GetDCEx32( hwnd, 0, DCX_USESTYLE | DCX_WINDOW ))) return 0;
1699 if (ExcludeVisRect( hdc, wndPtr->rectClient.left-wndPtr->rectWindow.left,
1700 wndPtr->rectClient.top-wndPtr->rectWindow.top,
1701 wndPtr->rectClient.right-wndPtr->rectWindow.left,
1702 wndPtr->rectClient.bottom-wndPtr->rectWindow.top )
1704 ReleaseDC32( hwnd, hdc );
1708 if (!(wndPtr->flags & WIN_MANAGED) && (wndPtr->dwStyle & WS_BORDER))
1709 DrawEdge32 (hdc, &wndPtr->rectWindow, EDGE_ETCHED, BF_RECT);
1711 ReleaseDC32( hwnd, hdc );
1718 REBAR_Paint (WND *wndPtr, WPARAM32 wParam)
1723 hdc = wParam==0 ? BeginPaint32 (wndPtr->hwndSelf, &ps) : (HDC32)wParam;
1724 REBAR_Refresh (wndPtr, hdc);
1726 EndPaint32 (wndPtr->hwndSelf, &ps);
1732 REBAR_SetCursor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1734 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
1738 TRACE (rebar, "code=0x%X id=0x%X\n", LOWORD(lParam), HIWORD(lParam));
1740 GetCursorPos32 (&pt);
1741 ScreenToClient32 (wndPtr->hwndSelf, &pt);
1743 REBAR_InternalHitTest (wndPtr, &pt, &flags, NULL);
1745 if (flags == RBHT_GRABBER) {
1746 if ((wndPtr->dwStyle & CCS_VERT) &&
1747 !(wndPtr->dwStyle & RBS_VERTICALGRIPPER))
1748 SetCursor32 (infoPtr->hcurVert);
1750 SetCursor32 (infoPtr->hcurHorz);
1752 else if (flags != RBHT_CLIENT)
1753 SetCursor32 (infoPtr->hcurArrow);
1760 REBAR_SetFont (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1762 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
1764 /* TEXTMETRIC32A tm; */
1765 HFONT32 hFont /*, hOldFont */;
1768 infoPtr->hFont = (HFONT32)wParam;
1770 hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject32 (SYSTEM_FONT);
1773 hOldFont = SelectObject32 (hdc, hFont);
1774 GetTextMetrics32A (hdc, &tm);
1775 infoPtr->nHeight = tm.tmHeight + VERT_BORDER;
1776 SelectObject32 (hdc, hOldFont);
1777 ReleaseDC32 (0, hdc);
1781 REBAR_Layout (wndPtr);
1782 hdc = GetDC32 (wndPtr->hwndSelf);
1783 REBAR_Refresh (wndPtr, hdc);
1784 ReleaseDC32 (wndPtr->hwndSelf, hdc);
1792 REBAR_Size (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1794 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
1796 /* INT32 x, y, cx, cy; */
1798 /* auto resize deadlock check */
1799 if (infoPtr->bAutoResize) {
1800 infoPtr->bAutoResize = FALSE;
1804 TRACE (rebar, "sizing rebar!\n");
1806 /* get parent rectangle */
1807 GetClientRect32 (GetParent32 (wndPtr->hwndSelf), &rcParent);
1809 REBAR_Layout (wndPtr, &rcParent);
1811 if (wndPtr->dwStyle & CCS_VERT) {
1812 if (wndPtr->dwStyle & CCS_LEFT == CCS_LEFT) {
1815 cx = infoPtr->calcSize.cx;
1816 cy = infoPtr->calcSize.cy;
1819 x = rcParent.right - infoPtr->calcSize.cx;
1821 cx = infoPtr->calcSize.cx;
1822 cy = infoPtr->calcSize.cy;
1826 if (wndPtr->dwStyle & CCS_TOP) {
1829 cx = infoPtr->calcSize.cx;
1830 cy = infoPtr->calcSize.cy;
1834 y = rcParent.bottom - infoPtr->calcSize.cy;
1835 cx = infoPtr->calcSize.cx;
1836 cy = infoPtr->calcSize.cy;
1840 SetWindowPos32 (wndPtr->hwndSelf, 0, x, y, cx, cy,
1841 SWP_NOZORDER | SWP_SHOWWINDOW);
1843 REBAR_Layout (wndPtr, NULL);
1844 REBAR_ForceResize (wndPtr);
1845 REBAR_MoveChildWindows (wndPtr);
1852 REBAR_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
1854 WND *wndPtr = WIN_FindWndPtr(hwnd);
1858 /* case RB_BEGINDRAG: */
1861 return REBAR_DeleteBand (wndPtr, wParam, lParam);
1863 /* case RB_DRAGMOVE: */
1864 /* case RB_ENDDRAG: */
1866 case RB_GETBANDBORDERS:
1867 return REBAR_GetBandBorders (wndPtr, wParam, lParam);
1869 case RB_GETBANDCOUNT:
1870 return REBAR_GetBandCount (wndPtr);
1872 /* case RB_GETBANDINFO32: */ /* outdated, just for compatibility */
1874 case RB_GETBANDINFO32A:
1875 return REBAR_GetBandInfo32A (wndPtr, wParam, lParam);
1877 case RB_GETBANDINFO32W:
1878 return REBAR_GetBandInfo32W (wndPtr, wParam, lParam);
1880 case RB_GETBARHEIGHT:
1881 return REBAR_GetBarHeight (wndPtr, wParam, lParam);
1884 return REBAR_GetBarInfo (wndPtr, wParam, lParam);
1887 return REBAR_GetBkColor (wndPtr);
1889 /* case RB_GETCOLORSCHEME: */
1890 /* case RB_GETDROPTARGET: */
1893 return REBAR_GetPalette (wndPtr, wParam, lParam);
1896 return REBAR_GetRect (wndPtr, wParam, lParam);
1898 case RB_GETROWCOUNT:
1899 return REBAR_GetRowCount (wndPtr);
1901 case RB_GETROWHEIGHT:
1902 return REBAR_GetRowHeight (wndPtr, wParam, lParam);
1904 case RB_GETTEXTCOLOR:
1905 return REBAR_GetTextColor (wndPtr);
1907 case RB_GETTOOLTIPS:
1908 return REBAR_GetToolTips (wndPtr);
1910 case RB_GETUNICODEFORMAT:
1911 return REBAR_GetUnicodeFormat (wndPtr);
1914 return REBAR_HitTest (wndPtr, wParam, lParam);
1917 return REBAR_IdToIndex (wndPtr, wParam, lParam);
1919 case RB_INSERTBAND32A:
1920 return REBAR_InsertBand32A (wndPtr, wParam, lParam);
1922 case RB_INSERTBAND32W:
1923 return REBAR_InsertBand32W (wndPtr, wParam, lParam);
1925 case RB_MAXIMIZEBAND:
1926 return REBAR_MaximizeBand (wndPtr, wParam, lParam);
1928 case RB_MINIMIZEBAND:
1929 return REBAR_MinimizeBand (wndPtr, wParam, lParam);
1932 return REBAR_MoveBand (wndPtr, wParam, lParam);
1934 case RB_SETBANDINFO32A:
1935 return REBAR_SetBandInfo32A (wndPtr, wParam, lParam);
1937 case RB_SETBANDINFO32W:
1938 return REBAR_SetBandInfo32W (wndPtr, wParam, lParam);
1941 return REBAR_SetBarInfo (wndPtr, wParam, lParam);
1944 return REBAR_SetBkColor (wndPtr, wParam, lParam);
1946 /* case RB_SETCOLORSCHEME: */
1947 /* case RB_SETPALETTE: */
1948 /* return REBAR_GetPalette (wndPtr, wParam, lParam); */
1951 return REBAR_SetParent (wndPtr, wParam, lParam);
1953 case RB_SETTEXTCOLOR:
1954 return REBAR_SetTextColor (wndPtr, wParam, lParam);
1956 /* case RB_SETTOOLTIPS: */
1958 case RB_SETUNICODEFORMAT:
1959 return REBAR_SetUnicodeFormat (wndPtr, wParam);
1962 return REBAR_ShowBand (wndPtr, wParam, lParam);
1965 return REBAR_SizeToRect (wndPtr, wParam, lParam);
1969 return SendMessage32A (wndPtr->parent->hwndSelf, uMsg, wParam, lParam);
1972 return REBAR_Create (wndPtr, wParam, lParam);
1975 return REBAR_Destroy (wndPtr, wParam, lParam);
1978 return REBAR_GetFont (wndPtr, wParam, lParam);
1980 /* case WM_MOUSEMOVE: */
1981 /* return REBAR_MouseMove (wndPtr, wParam, lParam); */
1984 return REBAR_NCCalcSize (wndPtr, wParam, lParam);
1987 return REBAR_NCPaint (wndPtr, wParam, lParam);
1990 return SendMessage32A (wndPtr->parent->hwndSelf, uMsg, wParam, lParam);
1993 return REBAR_Paint (wndPtr, wParam);
1996 return REBAR_SetCursor (wndPtr, wParam, lParam);
1999 return REBAR_SetFont (wndPtr, wParam, lParam);
2002 return REBAR_Size (wndPtr, wParam, lParam);
2004 /* case WM_TIMER: */
2006 /* case WM_WININICHANGE: */
2009 if (uMsg >= WM_USER)
2010 ERR (rebar, "unknown msg %04x wp=%08x lp=%08lx\n",
2011 uMsg, wParam, lParam);
2012 return DefWindowProc32A (hwnd, uMsg, wParam, lParam);
2019 REBAR_Register (VOID)
2021 WNDCLASS32A wndClass;
2023 if (GlobalFindAtom32A (REBARCLASSNAME32A)) return;
2025 ZeroMemory (&wndClass, sizeof(WNDCLASS32A));
2026 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
2027 wndClass.lpfnWndProc = (WNDPROC32)REBAR_WindowProc;
2028 wndClass.cbClsExtra = 0;
2029 wndClass.cbWndExtra = sizeof(REBAR_INFO *);
2030 wndClass.hCursor = 0;
2031 wndClass.hbrBackground = (HBRUSH32)(COLOR_BTNFACE + 1);
2032 wndClass.lpszClassName = REBARCLASSNAME32A;
2034 RegisterClass32A (&wndClass);
2039 REBAR_Unregister (VOID)
2041 if (GlobalFindAtom32A (REBARCLASSNAME32A))
2042 UnregisterClass32A (REBARCLASSNAME32A, (HINSTANCE32)NULL);