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.
25 #include "sysmetrics.h"
30 #define DRAW_GRIPPER 1
35 #define GRIPPER_WIDTH 13
38 #define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)wndPtr->wExtra[0])
42 REBAR_DrawBand (HDC32 hdc, REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
45 DrawEdge32 (hdc, &lpBand->rcBand, BDR_RAISEDINNER, BF_MIDDLE);
50 if (lpBand->fDraw & DRAW_GRIPPER)
51 DrawEdge32 (hdc, &lpBand->rcGripper, BDR_RAISEDINNER, BF_RECT | BF_MIDDLE);
53 /* draw caption image */
54 if (lpBand->fDraw & DRAW_IMAGE) {
55 /* FIXME: center image */
58 pt.y = (lpBand->rcCapImage.bottom + lpBand->rcCapImage.top - infoPtr->imageSize.cy)/2;
59 pt.x = (lpBand->rcCapImage.right + lpBand->rcCapImage.left - infoPtr->imageSize.cx)/2;
61 ImageList_Draw (infoPtr->himl, lpBand->iImage, hdc,
62 /* lpBand->rcCapImage.left, lpBand->rcCapImage.top, */
67 /* draw caption text */
68 if (lpBand->fDraw & DRAW_TEXT) {
69 HFONT32 hOldFont = SelectObject32 (hdc, infoPtr->hFont);
70 INT32 oldBkMode = SetBkMode32 (hdc, TRANSPARENT);
71 DrawText32W (hdc, lpBand->lpText, -1, &lpBand->rcCapText,
72 DT_CENTER | DT_VCENTER | DT_SINGLELINE);
73 if (oldBkMode != TRANSPARENT)
74 SetBkMode32 (hdc, oldBkMode);
75 SelectObject32 (hdc, hOldFont);
81 REBAR_Refresh (WND *wndPtr, HDC32 hdc)
83 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
87 for (i = 0; i < infoPtr->uNumBands; i++) {
88 lpBand = &infoPtr->bands[i];
90 if ((lpBand->fStyle & RBBS_HIDDEN) ||
91 ((wndPtr->dwStyle & CCS_VERT) && (lpBand->fStyle & RBBS_NOVERT)))
94 REBAR_DrawBand (hdc, infoPtr, lpBand);
101 REBAR_CalcHorzBand (REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
105 /* set initial caption image rectangle */
106 SetRect32 (&lpBand->rcCapImage, 0, 0, 0, 0);
108 /* image is visible */
109 if ((lpBand->iImage > -1) && (infoPtr->himl)) {
110 lpBand->fDraw |= DRAW_IMAGE;
112 lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx;
113 lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy;
115 /* update band height */
116 if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) {
117 lpBand->uMinHeight = infoPtr->imageSize.cy + 2;
118 lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->uMinHeight;
122 /* set initial caption text rectangle */
123 lpBand->rcCapText.left = lpBand->rcCapImage.right;
124 lpBand->rcCapText.top = lpBand->rcBand.top + 1;
125 lpBand->rcCapText.right = lpBand->rcCapText.left;
126 lpBand->rcCapText.bottom = lpBand->rcBand.bottom - 1;
128 /* text is visible */
129 if (lpBand->lpText) {
130 HDC32 hdc = GetDC32 (0);
131 HFONT32 hOldFont = SelectObject32 (hdc, infoPtr->hFont);
134 lpBand->fDraw |= DRAW_TEXT;
135 GetTextExtentPoint32W (hdc, lpBand->lpText,
136 lstrlen32W (lpBand->lpText), &size);
137 lpBand->rcCapText.right += size.cx;
139 SelectObject32 (hdc, hOldFont);
140 ReleaseDC32 (0, hdc);
143 /* set initial child window rectangle */
144 if (lpBand->fStyle & RBBS_FIXEDSIZE) {
145 lpBand->rcChild.left = lpBand->rcCapText.right;
146 lpBand->rcChild.top = lpBand->rcBand.top;
147 lpBand->rcChild.right = lpBand->rcBand.right;
148 lpBand->rcChild.bottom = lpBand->rcBand.bottom;
151 lpBand->rcChild.left = lpBand->rcCapText.right + 4;
152 lpBand->rcChild.top = lpBand->rcBand.top + 2;
153 lpBand->rcChild.right = lpBand->rcBand.right - 4;
154 lpBand->rcChild.bottom = lpBand->rcBand.bottom - 2;
157 /* calculate gripper rectangle */
158 if ((!(lpBand->fStyle & RBBS_NOGRIPPER)) &&
159 (!(lpBand->fStyle & RBBS_FIXEDSIZE)) &&
160 ((lpBand->fStyle & RBBS_GRIPPERALWAYS) ||
161 (infoPtr->uNumBands > 1))) {
162 lpBand->fDraw |= DRAW_GRIPPER;
163 lpBand->rcGripper.left = lpBand->rcBand.left + 3;
164 lpBand->rcGripper.right = lpBand->rcGripper.left + 3;
165 lpBand->rcGripper.top = lpBand->rcBand.top + 3;
166 lpBand->rcGripper.bottom = lpBand->rcBand.bottom - 3;
168 /* move caption rectangles */
169 OffsetRect32 (&lpBand->rcCapImage, GRIPPER_WIDTH, 0);
170 OffsetRect32 (&lpBand->rcCapText, GRIPPER_WIDTH, 0);
172 /* adjust child rectangle */
173 lpBand->rcChild.left += GRIPPER_WIDTH;
181 REBAR_CalcVertBand (WND *wndPtr, REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
185 /* set initial caption image rectangle */
186 SetRect32 (&lpBand->rcCapImage, 0, 0, 0, 0);
188 /* image is visible */
189 if ((lpBand->iImage > -1) && (infoPtr->himl)) {
190 lpBand->fDraw |= DRAW_IMAGE;
192 lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx;
193 lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy;
195 /* update band width */
196 if (lpBand->uMinHeight < infoPtr->imageSize.cx + 2) {
197 lpBand->uMinHeight = infoPtr->imageSize.cx + 2;
198 lpBand->rcBand.right = lpBand->rcBand.left + lpBand->uMinHeight;
202 /* set initial caption text rectangle */
203 lpBand->rcCapText.left = lpBand->rcBand.left + 1;
204 lpBand->rcCapText.top = lpBand->rcCapImage.bottom;
205 lpBand->rcCapText.right = lpBand->rcBand.right - 1;
206 lpBand->rcCapText.bottom = lpBand->rcCapText.top;
208 /* text is visible */
209 if (lpBand->lpText) {
210 HDC32 hdc = GetDC32 (0);
211 HFONT32 hOldFont = SelectObject32 (hdc, infoPtr->hFont);
214 lpBand->fDraw |= DRAW_TEXT;
215 GetTextExtentPoint32W (hdc, lpBand->lpText,
216 lstrlen32W (lpBand->lpText), &size);
217 /* lpBand->rcCapText.right += size.cx; */
218 lpBand->rcCapText.bottom += size.cy;
220 SelectObject32 (hdc, hOldFont);
221 ReleaseDC32 (0, hdc);
224 /* set initial child window rectangle */
225 if (lpBand->fStyle & RBBS_FIXEDSIZE) {
226 lpBand->rcChild.left = lpBand->rcBand.left;
227 lpBand->rcChild.top = lpBand->rcCapText.bottom;
228 lpBand->rcChild.right = lpBand->rcBand.right;
229 lpBand->rcChild.bottom = lpBand->rcBand.bottom;
232 lpBand->rcChild.left = lpBand->rcBand.left + 2;
233 lpBand->rcChild.top = lpBand->rcCapText.bottom + 4;
234 lpBand->rcChild.right = lpBand->rcBand.right - 2;
235 lpBand->rcChild.bottom = lpBand->rcBand.bottom - 4;
238 /* calculate gripper rectangle */
239 if ((!(lpBand->fStyle & RBBS_NOGRIPPER)) &&
240 (!(lpBand->fStyle & RBBS_FIXEDSIZE)) &&
241 ((lpBand->fStyle & RBBS_GRIPPERALWAYS) ||
242 (infoPtr->uNumBands > 1))) {
243 lpBand->fDraw |= DRAW_GRIPPER;
245 if (wndPtr->dwStyle & RBS_VERTICALGRIPPER) {
246 /* adjust band width */
247 lpBand->rcBand.right += GRIPPER_WIDTH;
248 lpBand->uMinHeight += GRIPPER_WIDTH;
250 lpBand->rcGripper.left = lpBand->rcBand.left + 3;
251 lpBand->rcGripper.right = lpBand->rcGripper.left + 3;
252 lpBand->rcGripper.top = lpBand->rcBand.top + 3;
253 lpBand->rcGripper.bottom = lpBand->rcBand.bottom - 3;
255 /* move caption rectangles */
256 OffsetRect32 (&lpBand->rcCapImage, GRIPPER_WIDTH, 0);
257 OffsetRect32 (&lpBand->rcCapText, GRIPPER_WIDTH, 0);
259 /* adjust child rectangle */
260 lpBand->rcChild.left += GRIPPER_WIDTH;
263 lpBand->rcGripper.left = lpBand->rcBand.left + 3;
264 lpBand->rcGripper.right = lpBand->rcBand.right - 3;
265 lpBand->rcGripper.top = lpBand->rcBand.top + 3;
266 lpBand->rcGripper.bottom = lpBand->rcGripper.top + 3;
268 /* move caption rectangles */
269 OffsetRect32 (&lpBand->rcCapImage, 0, GRIPPER_WIDTH);
270 OffsetRect32 (&lpBand->rcCapText, 0, GRIPPER_WIDTH);
272 /* adjust child rectangle */
273 lpBand->rcChild.top += GRIPPER_WIDTH;
280 REBAR_Layout (WND *wndPtr, LPRECT32 lpRect)
282 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
291 GetClientRect32 (wndPtr->hwndSelf, &rcClient);
296 if (wndPtr->dwStyle & CCS_VERT) {
297 cx = 20; /* FIXME: fixed height */
298 cy = rcClient.bottom - rcClient.top;
301 cx = rcClient.right - rcClient.left;
302 cy = 20; /* FIXME: fixed height */
305 for (i = 0; i < infoPtr->uNumBands; i++) {
306 lpBand = &infoPtr->bands[i];
308 if ((lpBand->fStyle & RBBS_HIDDEN) ||
309 ((wndPtr->dwStyle & CCS_VERT) && (lpBand->fStyle & RBBS_NOVERT)))
313 if (wndPtr->dwStyle & CCS_VERT) {
314 if (lpBand->fStyle & RBBS_VARIABLEHEIGHT)
315 cx = lpBand->cyMaxChild;
316 else if (lpBand->fStyle & RBBIM_CHILDSIZE)
317 cx = lpBand->cyMinChild;
321 lpBand->rcBand.left = x;
322 lpBand->rcBand.right = x + cx;
323 lpBand->rcBand.top = y;
324 lpBand->rcBand.bottom = y + cy;
325 lpBand->uMinHeight = cx;
328 if (lpBand->fStyle & RBBS_VARIABLEHEIGHT)
329 cy = lpBand->cyMaxChild;
330 else if (lpBand->fStyle & RBBIM_CHILDSIZE)
331 cy = lpBand->cyMinChild;
335 lpBand->rcBand.left = x;
336 lpBand->rcBand.right = x + cx;
337 lpBand->rcBand.top = y;
338 lpBand->rcBand.bottom = y + cy;
339 lpBand->uMinHeight = cy;
342 if (wndPtr->dwStyle & CCS_VERT) {
343 REBAR_CalcVertBand (wndPtr, infoPtr, lpBand);
344 x += lpBand->uMinHeight;
347 REBAR_CalcHorzBand (infoPtr, lpBand);
348 y += lpBand->uMinHeight;
352 if (wndPtr->dwStyle & CCS_VERT) {
353 infoPtr->calcSize.cx = x;
354 infoPtr->calcSize.cy = rcClient.bottom - rcClient.top;
357 infoPtr->calcSize.cx = rcClient.right - rcClient.left;
358 infoPtr->calcSize.cy = y;
364 REBAR_ForceResize (WND *wndPtr)
366 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
369 TRACE (rebar, " to [%d x %d]!\n",
370 infoPtr->calcSize.cx, infoPtr->calcSize.cy);
372 infoPtr->bAutoResize = TRUE;
376 rc.right = infoPtr->calcSize.cx;
377 rc.bottom = infoPtr->calcSize.cy;
379 if (wndPtr->dwStyle & WS_BORDER) {
380 InflateRect32 (&rc, sysMetrics[SM_CXEDGE], sysMetrics[SM_CYEDGE]);
383 SetWindowPos32 (wndPtr->hwndSelf, 0, 0, 0,
384 rc.right - rc.left, rc.bottom - rc.top,
385 SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW);
390 REBAR_MoveChildWindows (WND *wndPtr)
392 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
396 for (i = 0; i < infoPtr->uNumBands; i++) {
397 lpBand = &infoPtr->bands[i];
399 if (lpBand->fStyle & RBBS_HIDDEN)
401 if (lpBand->hwndChild) {
402 TRACE (rebar, "hwndChild = %x\n", lpBand->hwndChild);
404 if (WIDGETS_IsControl32 (WIN_FindWndPtr(lpBand->hwndChild), BIC32_COMBO)) {
405 INT32 nEditHeight, yPos;
408 /* special placement code for combo box */
411 /* get size of edit line */
412 GetWindowRect32 (lpBand->hwndChild, &rc);
413 nEditHeight = rc.bottom - rc.top;
414 yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2;
416 /* center combo box inside child area */
417 SetWindowPos32 (lpBand->hwndChild, HWND_TOP,
418 lpBand->rcChild.left, /*lpBand->rcChild.top*/ yPos,
419 lpBand->rcChild.right - lpBand->rcChild.left,
425 /* special placement code for extended combo box */
431 SetWindowPos32 (lpBand->hwndChild, HWND_TOP,
432 lpBand->rcChild.left, lpBand->rcChild.top,
433 lpBand->rcChild.right - lpBand->rcChild.left,
434 lpBand->rcChild.bottom - lpBand->rcChild.top,
443 REBAR_InternalHitTest (WND *wndPtr, LPPOINT32 lpPt, UINT32 *pFlags, INT32 *pBand)
445 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
450 GetClientRect32 (wndPtr->hwndSelf, &rect);
452 *pFlags = RBHT_NOWHERE;
453 if (PtInRect32 (&rect, *lpPt))
455 if (infoPtr->uNumBands == 0) {
456 *pFlags = RBHT_NOWHERE;
459 TRACE (rebar, "NOWHERE\n");
463 /* somewhere inside */
464 for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) {
465 lpBand = &infoPtr->bands[iCount];
466 if (PtInRect32 (&lpBand->rcBand, *lpPt)) {
469 if (PtInRect32 (&lpBand->rcGripper, *lpPt)) {
470 *pFlags = RBHT_GRABBER;
471 TRACE (rebar, "ON GRABBER %d\n", iCount);
474 else if (PtInRect32 (&lpBand->rcCapImage, *lpPt)) {
475 *pFlags = RBHT_CAPTION;
476 TRACE (rebar, "ON CAPTION %d\n", iCount);
479 else if (PtInRect32 (&lpBand->rcCapText, *lpPt)) {
480 *pFlags = RBHT_CAPTION;
481 TRACE (rebar, "ON CAPTION %d\n", iCount);
484 else if (PtInRect32 (&lpBand->rcChild, *lpPt)) {
485 *pFlags = RBHT_CLIENT;
486 TRACE (rebar, "ON CLIENT %d\n", iCount);
490 *pFlags = RBHT_NOWHERE;
491 TRACE (rebar, "NOWHERE %d\n", iCount);
497 *pFlags = RBHT_NOWHERE;
501 TRACE (rebar, "NOWHERE\n");
506 *pFlags = RBHT_NOWHERE;
509 TRACE (rebar, "NOWHERE\n");
513 TRACE (rebar, "flags=0x%X\n", *pFlags);
519 /* << REBAR_BeginDrag >> */
523 REBAR_DeleteBand (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
525 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
526 UINT32 uBand = (UINT32)wParam;
528 if (uBand >= infoPtr->uNumBands)
531 TRACE (rebar, "deleting band %u!\n", uBand);
533 if (infoPtr->uNumBands == 1) {
534 TRACE (rebar, " simple delete!\n");
535 COMCTL32_Free (infoPtr->bands);
536 infoPtr->bands = NULL;
537 infoPtr->uNumBands = 0;
540 REBAR_BAND *oldBands = infoPtr->bands;
541 TRACE(rebar, "complex delete! [uBand=%u]\n", uBand);
543 infoPtr->uNumBands--;
544 infoPtr->bands = COMCTL32_Alloc (sizeof (REBAR_BAND) * infoPtr->uNumBands);
546 memcpy (&infoPtr->bands[0], &oldBands[0],
547 uBand * sizeof(REBAR_BAND));
550 if (uBand < infoPtr->uNumBands) {
551 memcpy (&infoPtr->bands[uBand], &oldBands[uBand+1],
552 (infoPtr->uNumBands - uBand) * sizeof(REBAR_BAND));
555 COMCTL32_Free (oldBands);
558 REBAR_Layout (wndPtr, NULL);
559 REBAR_ForceResize (wndPtr);
560 REBAR_MoveChildWindows (wndPtr);
566 /* << REBAR_DragMove >> */
567 /* << REBAR_EndDrag >> */
571 REBAR_GetBandBorders (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
573 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
574 LPRECT32 lpRect = (LPRECT32)lParam;
579 if ((UINT32)wParam >= infoPtr->uNumBands)
582 lpBand = &infoPtr->bands[(UINT32)wParam];
583 if (wndPtr->dwStyle & RBS_BANDBORDERS) {
594 __inline__ static LRESULT
595 REBAR_GetBandCount (WND *wndPtr)
597 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
599 TRACE (rebar, "band count %u!\n", infoPtr->uNumBands);
601 return infoPtr->uNumBands;
606 REBAR_GetBandInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
608 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
609 LPREBARBANDINFO32A lprbbi = (LPREBARBANDINFO32A)lParam;
614 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32A)
616 if ((UINT32)wParam >= infoPtr->uNumBands)
619 TRACE (rebar, "index %u\n", (UINT32)wParam);
621 /* copy band information */
622 lpBand = &infoPtr->bands[(UINT32)wParam];
624 if (lprbbi->fMask & RBBIM_STYLE)
625 lprbbi->fStyle = lpBand->fStyle;
627 if (lprbbi->fMask & RBBIM_COLORS) {
628 lprbbi->clrFore = lpBand->clrFore;
629 lprbbi->clrBack = lpBand->clrBack;
632 if ((lprbbi->fMask & RBBIM_TEXT) &&
633 (lprbbi->lpText) && (lpBand->lpText)) {
634 lstrcpynWtoA (lprbbi->lpText, lpBand->lpText, lprbbi->cch);
637 if (lprbbi->fMask & RBBIM_IMAGE)
638 lprbbi->iImage = lpBand->iImage;
640 if (lprbbi->fMask & RBBIM_CHILD)
641 lprbbi->hwndChild = lpBand->hwndChild;
643 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
644 lprbbi->cxMinChild = lpBand->cxMinChild;
645 lprbbi->cyMinChild = lpBand->cyMinChild;
646 lprbbi->cyMaxChild = lpBand->cyMaxChild;
647 lprbbi->cyChild = lpBand->cyChild;
648 lprbbi->cyIntegral = lpBand->cyIntegral;
651 if (lprbbi->fMask & RBBIM_SIZE)
652 lprbbi->cx = lpBand->cx;
654 if (lprbbi->fMask & RBBIM_BACKGROUND)
655 lprbbi->hbmBack = lpBand->hbmBack;
657 if (lprbbi->fMask & RBBIM_ID)
658 lprbbi->wID = lpBand->wID;
660 /* check for additional data */
661 if (lprbbi->cbSize >= sizeof (REBARBANDINFO32A)) {
662 if (lprbbi->fMask & RBBIM_IDEALSIZE)
663 lprbbi->cxIdeal = lpBand->cxIdeal;
665 if (lprbbi->fMask & RBBIM_LPARAM)
666 lprbbi->lParam = lpBand->lParam;
668 if (lprbbi->fMask & RBBIM_HEADERSIZE)
669 lprbbi->cxHeader = lpBand->cxHeader;
677 REBAR_GetBandInfo32W (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
679 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
680 LPREBARBANDINFO32W lprbbi = (LPREBARBANDINFO32W)lParam;
685 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32W)
687 if ((UINT32)wParam >= infoPtr->uNumBands)
690 TRACE (rebar, "index %u\n", (UINT32)wParam);
692 /* copy band information */
693 lpBand = &infoPtr->bands[(UINT32)wParam];
695 if (lprbbi->fMask & RBBIM_STYLE)
696 lprbbi->fStyle = lpBand->fStyle;
698 if (lprbbi->fMask & RBBIM_COLORS) {
699 lprbbi->clrFore = lpBand->clrFore;
700 lprbbi->clrBack = lpBand->clrBack;
703 if ((lprbbi->fMask & RBBIM_TEXT) &&
704 (lprbbi->lpText) && (lpBand->lpText)) {
705 lstrcpyn32W (lprbbi->lpText, lpBand->lpText, lprbbi->cch);
708 if (lprbbi->fMask & RBBIM_IMAGE)
709 lprbbi->iImage = lpBand->iImage;
711 if (lprbbi->fMask & RBBIM_CHILD)
712 lprbbi->hwndChild = lpBand->hwndChild;
714 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
715 lprbbi->cxMinChild = lpBand->cxMinChild;
716 lprbbi->cyMinChild = lpBand->cyMinChild;
717 lprbbi->cyMaxChild = lpBand->cyMaxChild;
718 lprbbi->cyChild = lpBand->cyChild;
719 lprbbi->cyIntegral = lpBand->cyIntegral;
722 if (lprbbi->fMask & RBBIM_SIZE)
723 lprbbi->cx = lpBand->cx;
725 if (lprbbi->fMask & RBBIM_BACKGROUND)
726 lprbbi->hbmBack = lpBand->hbmBack;
728 if (lprbbi->fMask & RBBIM_ID)
729 lprbbi->wID = lpBand->wID;
731 /* check for additional data */
732 if (lprbbi->cbSize >= sizeof (REBARBANDINFO32A)) {
733 if (lprbbi->fMask & RBBIM_IDEALSIZE)
734 lprbbi->cxIdeal = lpBand->cxIdeal;
736 if (lprbbi->fMask & RBBIM_LPARAM)
737 lprbbi->lParam = lpBand->lParam;
739 if (lprbbi->fMask & RBBIM_HEADERSIZE)
740 lprbbi->cxHeader = lpBand->cxHeader;
748 REBAR_GetBarHeight (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
750 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
753 REBAR_Layout (wndPtr, NULL);
754 nHeight = infoPtr->calcSize.cy;
756 if (wndPtr->dwStyle & WS_BORDER)
757 nHeight += (2 * sysMetrics[SM_CYEDGE]);
759 FIXME (rebar, "height = %d\n", nHeight);
766 REBAR_GetBarInfo (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
768 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
769 LPREBARINFO lpInfo = (LPREBARINFO)lParam;
774 if (lpInfo->cbSize < sizeof (REBARINFO))
777 TRACE (rebar, "getting bar info!\n");
780 lpInfo->himl = infoPtr->himl;
781 lpInfo->fMask |= RBIM_IMAGELIST;
788 __inline__ static LRESULT
789 REBAR_GetBkColor (WND *wndPtr)
791 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
793 TRACE (rebar, "background color 0x%06lx!\n", infoPtr->clrBk);
795 return infoPtr->clrBk;
799 /* << REBAR_GetColorScheme >> */
800 /* << REBAR_GetDropTarget >> */
804 REBAR_GetPalette (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
806 FIXME (rebar, "empty stub!\n");
813 REBAR_GetRect (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
815 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
816 INT32 iBand = (INT32)wParam;
817 LPRECT32 lprc = (LPRECT32)lParam;
820 if ((iBand < 0) && ((UINT32)iBand >= infoPtr->uNumBands))
825 TRACE (rebar, "band %d\n", iBand);
827 lpBand = &infoPtr->bands[iBand];
828 CopyRect32 (lprc, &lpBand->rcBand);
830 lprc->left = lpBand->rcBand.left;
831 lprc->top = lpBand->rcBand.top;
832 lprc->right = lpBand->rcBand.right;
833 lprc->bottom = lpBand->rcBand.bottom;
840 __inline__ static LRESULT
841 REBAR_GetRowCount (WND *wndPtr)
843 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
845 FIXME (rebar, "%u : semi stub!\n", infoPtr->uNumBands);
847 return infoPtr->uNumBands;
852 REBAR_GetRowHeight (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
854 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); */
856 FIXME (rebar, "-- height = 20: semi stub!\n");
862 __inline__ static LRESULT
863 REBAR_GetTextColor (WND *wndPtr)
865 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
867 TRACE (rebar, "text color 0x%06lx!\n", infoPtr->clrText);
869 return infoPtr->clrText;
873 __inline__ static LRESULT
874 REBAR_GetToolTips (WND *wndPtr)
876 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
877 return infoPtr->hwndToolTip;
881 __inline__ static LRESULT
882 REBAR_GetUnicodeFormat (WND *wndPtr)
884 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
885 return infoPtr->bUnicode;
890 REBAR_HitTest (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
892 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
893 LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam;
898 REBAR_InternalHitTest (wndPtr, &lprbht->pt,
899 &lprbht->flags, &lprbht->iBand);
901 return lprbht->iBand;
906 REBAR_IdToIndex (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
908 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
914 if (infoPtr->uNumBands < 1)
917 TRACE (rebar, "id %u\n", (UINT32)wParam);
919 for (i = 0; i < infoPtr->uNumBands; i++) {
920 if (infoPtr->bands[i].wID == (UINT32)wParam) {
921 TRACE (rebar, "band %u found!\n", i);
926 TRACE (rebar, "no band found!\n");
932 REBAR_InsertBand32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
934 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
935 LPREBARBANDINFO32A lprbbi = (LPREBARBANDINFO32A)lParam;
936 UINT32 uIndex = (UINT32)wParam;
943 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32A)
946 TRACE (rebar, "insert band at %u!\n", uIndex);
948 if (infoPtr->uNumBands == 0) {
949 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));
953 REBAR_BAND *oldBands = infoPtr->bands;
955 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
956 if (((INT32)uIndex == -1) || (uIndex > infoPtr->uNumBands))
957 uIndex = infoPtr->uNumBands;
959 /* pre insert copy */
961 memcpy (&infoPtr->bands[0], &oldBands[0],
962 uIndex * sizeof(REBAR_BAND));
966 if (uIndex < infoPtr->uNumBands - 1) {
967 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],
968 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));
971 COMCTL32_Free (oldBands);
974 infoPtr->uNumBands++;
976 TRACE (rebar, "index %u!\n", uIndex);
978 /* initialize band (infoPtr->bands[uIndex])*/
979 lpBand = &infoPtr->bands[uIndex];
981 if (lprbbi->fMask & RBBIM_STYLE)
982 lpBand->fStyle = lprbbi->fStyle;
984 if (lprbbi->fMask & RBBIM_COLORS) {
985 lpBand->clrFore = lprbbi->clrFore;
986 lpBand->clrBack = lprbbi->clrBack;
989 lpBand->clrFore = CLR_NONE;
990 lpBand->clrBack = CLR_NONE;
993 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
994 INT32 len = lstrlen32A (lprbbi->lpText);
996 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
997 lstrcpyAtoW (lpBand->lpText, lprbbi->lpText);
1001 if (lprbbi->fMask & RBBIM_IMAGE)
1002 lpBand->iImage = lprbbi->iImage;
1004 lpBand->iImage = -1;
1006 if (lprbbi->fMask & RBBIM_CHILD) {
1007 TRACE (rebar, "hwndChild = %x\n", lprbbi->hwndChild);
1008 lpBand->hwndChild = lprbbi->hwndChild;
1009 lpBand->hwndPrevParent =
1010 SetParent32 (lpBand->hwndChild, wndPtr->hwndSelf);
1013 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
1014 lpBand->cxMinChild = lprbbi->cxMinChild;
1015 lpBand->cyMinChild = lprbbi->cyMinChild;
1016 lpBand->cyMaxChild = lprbbi->cyMaxChild;
1017 lpBand->cyChild = lprbbi->cyChild;
1018 lpBand->cyIntegral = lprbbi->cyIntegral;
1021 lpBand->cxMinChild = -1;
1022 lpBand->cyMinChild = -1;
1023 lpBand->cyMaxChild = -1;
1024 lpBand->cyChild = -1;
1025 lpBand->cyIntegral = -1;
1028 if (lprbbi->fMask & RBBIM_SIZE)
1029 lpBand->cx = lprbbi->cx;
1033 if (lprbbi->fMask & RBBIM_BACKGROUND)
1034 lpBand->hbmBack = lprbbi->hbmBack;
1036 if (lprbbi->fMask & RBBIM_ID)
1037 lpBand->wID = lprbbi->wID;
1039 /* check for additional data */
1040 if (lprbbi->cbSize >= sizeof (REBARBANDINFO32A)) {
1041 if (lprbbi->fMask & RBBIM_IDEALSIZE)
1042 lpBand->cxIdeal = lprbbi->cxIdeal;
1044 if (lprbbi->fMask & RBBIM_LPARAM)
1045 lpBand->lParam = lprbbi->lParam;
1047 if (lprbbi->fMask & RBBIM_HEADERSIZE)
1048 lpBand->cxHeader = lprbbi->cxHeader;
1052 REBAR_Layout (wndPtr, NULL);
1053 REBAR_ForceResize (wndPtr);
1054 REBAR_MoveChildWindows (wndPtr);
1061 REBAR_InsertBand32W (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1063 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1064 LPREBARBANDINFO32W lprbbi = (LPREBARBANDINFO32W)lParam;
1065 UINT32 uIndex = (UINT32)wParam;
1068 if (infoPtr == NULL)
1072 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32W)
1075 TRACE (rebar, "insert band at %u!\n", uIndex);
1077 if (infoPtr->uNumBands == 0) {
1078 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));
1082 REBAR_BAND *oldBands = infoPtr->bands;
1084 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
1085 if (((INT32)uIndex == -1) || (uIndex > infoPtr->uNumBands))
1086 uIndex = infoPtr->uNumBands;
1088 /* pre insert copy */
1090 memcpy (&infoPtr->bands[0], &oldBands[0],
1091 uIndex * sizeof(REBAR_BAND));
1095 if (uIndex < infoPtr->uNumBands - 1) {
1096 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],
1097 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));
1100 COMCTL32_Free (oldBands);
1103 infoPtr->uNumBands++;
1105 TRACE (rebar, "index %u!\n", uIndex);
1107 /* initialize band (infoPtr->bands[uIndex])*/
1108 lpBand = &infoPtr->bands[uIndex];
1110 if (lprbbi->fMask & RBBIM_STYLE)
1111 lpBand->fStyle = lprbbi->fStyle;
1113 if (lprbbi->fMask & RBBIM_COLORS) {
1114 lpBand->clrFore = lprbbi->clrFore;
1115 lpBand->clrBack = lprbbi->clrBack;
1118 lpBand->clrFore = CLR_NONE;
1119 lpBand->clrBack = CLR_NONE;
1122 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
1123 INT32 len = lstrlen32W (lprbbi->lpText);
1125 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
1126 lstrcpy32W (lpBand->lpText, lprbbi->lpText);
1130 if (lprbbi->fMask & RBBIM_IMAGE)
1131 lpBand->iImage = lprbbi->iImage;
1133 lpBand->iImage = -1;
1135 if (lprbbi->fMask & RBBIM_CHILD) {
1136 TRACE (rebar, "hwndChild = %x\n", lprbbi->hwndChild);
1137 lpBand->hwndChild = lprbbi->hwndChild;
1138 lpBand->hwndPrevParent =
1139 SetParent32 (lpBand->hwndChild, wndPtr->hwndSelf);
1142 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
1143 lpBand->cxMinChild = lprbbi->cxMinChild;
1144 lpBand->cyMinChild = lprbbi->cyMinChild;
1145 lpBand->cyMaxChild = lprbbi->cyMaxChild;
1146 lpBand->cyChild = lprbbi->cyChild;
1147 lpBand->cyIntegral = lprbbi->cyIntegral;
1150 lpBand->cxMinChild = -1;
1151 lpBand->cyMinChild = -1;
1152 lpBand->cyMaxChild = -1;
1153 lpBand->cyChild = -1;
1154 lpBand->cyIntegral = -1;
1157 if (lprbbi->fMask & RBBIM_SIZE)
1158 lpBand->cx = lprbbi->cx;
1162 if (lprbbi->fMask & RBBIM_BACKGROUND)
1163 lpBand->hbmBack = lprbbi->hbmBack;
1165 if (lprbbi->fMask & RBBIM_ID)
1166 lpBand->wID = lprbbi->wID;
1168 /* check for additional data */
1169 if (lprbbi->cbSize >= sizeof (REBARBANDINFO32W)) {
1170 if (lprbbi->fMask & RBBIM_IDEALSIZE)
1171 lpBand->cxIdeal = lprbbi->cxIdeal;
1173 if (lprbbi->fMask & RBBIM_LPARAM)
1174 lpBand->lParam = lprbbi->lParam;
1176 if (lprbbi->fMask & RBBIM_HEADERSIZE)
1177 lpBand->cxHeader = lprbbi->cxHeader;
1181 REBAR_Layout (wndPtr, NULL);
1182 REBAR_ForceResize (wndPtr);
1183 REBAR_MoveChildWindows (wndPtr);
1190 REBAR_MaximizeBand (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1192 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); */
1194 FIXME (rebar, "(uBand = %u fIdeal = %s)\n",
1195 (UINT32)wParam, lParam ? "TRUE" : "FALSE");
1203 REBAR_MinimizeBand (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1205 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); */
1207 FIXME (rebar, "(uBand = %u)\n", (UINT32)wParam);
1215 REBAR_MoveBand (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1217 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); */
1219 FIXME (rebar, "(iFrom = %u iTof = %u)\n",
1220 (UINT32)wParam, (UINT32)lParam);
1228 REBAR_SetBandInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1230 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1231 LPREBARBANDINFO32A lprbbi = (LPREBARBANDINFO32A)lParam;
1236 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32A)
1238 if ((UINT32)wParam >= infoPtr->uNumBands)
1241 TRACE (rebar, "index %u\n", (UINT32)wParam);
1243 /* set band information */
1244 lpBand = &infoPtr->bands[(UINT32)wParam];
1246 if (lprbbi->fMask & RBBIM_STYLE)
1247 lpBand->fStyle = lprbbi->fStyle;
1249 if (lprbbi->fMask & RBBIM_COLORS) {
1250 lpBand->clrFore = lprbbi->clrFore;
1251 lpBand->clrBack = lprbbi->clrBack;
1254 if (lprbbi->fMask & RBBIM_TEXT) {
1255 if (lpBand->lpText) {
1256 COMCTL32_Free (lpBand->lpText);
1257 lpBand->lpText = NULL;
1259 if (lprbbi->lpText) {
1260 INT32 len = lstrlen32A (lprbbi->lpText);
1261 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
1262 lstrcpyAtoW (lpBand->lpText, lprbbi->lpText);
1266 if (lprbbi->fMask & RBBIM_IMAGE)
1267 lpBand->iImage = lprbbi->iImage;
1269 if (lprbbi->fMask & RBBIM_CHILD) {
1270 if (lprbbi->hwndChild) {
1271 lpBand->hwndChild = lprbbi->hwndChild;
1272 lpBand->hwndPrevParent =
1273 SetParent32 (lpBand->hwndChild, wndPtr->hwndSelf);
1276 TRACE (rebar, "child: 0x%x prev parent: 0x%x\n",
1277 lpBand->hwndChild, lpBand->hwndPrevParent);
1278 lpBand->hwndChild = 0;
1279 lpBand->hwndPrevParent = 0;
1283 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
1284 lpBand->cxMinChild = lprbbi->cxMinChild;
1285 lpBand->cyMinChild = lprbbi->cyMinChild;
1286 lpBand->cyMaxChild = lprbbi->cyMaxChild;
1287 lpBand->cyChild = lprbbi->cyChild;
1288 lpBand->cyIntegral = lprbbi->cyIntegral;
1291 if (lprbbi->fMask & RBBIM_SIZE)
1292 lpBand->cx = lprbbi->cx;
1294 if (lprbbi->fMask & RBBIM_BACKGROUND)
1295 lpBand->hbmBack = lprbbi->hbmBack;
1297 if (lprbbi->fMask & RBBIM_ID)
1298 lpBand->wID = lprbbi->wID;
1300 /* check for additional data */
1301 if (lprbbi->cbSize >= sizeof (REBARBANDINFO32A)) {
1302 if (lprbbi->fMask & RBBIM_IDEALSIZE)
1303 lpBand->cxIdeal = lprbbi->cxIdeal;
1305 if (lprbbi->fMask & RBBIM_LPARAM)
1306 lpBand->lParam = lprbbi->lParam;
1308 if (lprbbi->fMask & RBBIM_HEADERSIZE)
1309 lpBand->cxHeader = lprbbi->cxHeader;
1312 REBAR_Layout (wndPtr, NULL);
1313 REBAR_ForceResize (wndPtr);
1314 REBAR_MoveChildWindows (wndPtr);
1321 REBAR_SetBandInfo32W (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1323 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1324 LPREBARBANDINFO32W lprbbi = (LPREBARBANDINFO32W)lParam;
1329 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32W)
1331 if ((UINT32)wParam >= infoPtr->uNumBands)
1334 TRACE (rebar, "index %u\n", (UINT32)wParam);
1336 /* set band information */
1337 lpBand = &infoPtr->bands[(UINT32)wParam];
1339 if (lprbbi->fMask & RBBIM_STYLE)
1340 lpBand->fStyle = lprbbi->fStyle;
1342 if (lprbbi->fMask & RBBIM_COLORS) {
1343 lpBand->clrFore = lprbbi->clrFore;
1344 lpBand->clrBack = lprbbi->clrBack;
1347 if (lprbbi->fMask & RBBIM_TEXT) {
1348 if (lpBand->lpText) {
1349 COMCTL32_Free (lpBand->lpText);
1350 lpBand->lpText = NULL;
1352 if (lprbbi->lpText) {
1353 INT32 len = lstrlen32W (lprbbi->lpText);
1354 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
1355 lstrcpy32W (lpBand->lpText, lprbbi->lpText);
1359 if (lprbbi->fMask & RBBIM_IMAGE)
1360 lpBand->iImage = lprbbi->iImage;
1362 if (lprbbi->fMask & RBBIM_CHILD) {
1363 if (lprbbi->hwndChild) {
1364 lpBand->hwndChild = lprbbi->hwndChild;
1365 lpBand->hwndPrevParent =
1366 SetParent32 (lpBand->hwndChild, wndPtr->hwndSelf);
1369 TRACE (rebar, "child: 0x%x prev parent: 0x%x\n",
1370 lpBand->hwndChild, lpBand->hwndPrevParent);
1371 lpBand->hwndChild = 0;
1372 lpBand->hwndPrevParent = 0;
1376 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
1377 lpBand->cxMinChild = lprbbi->cxMinChild;
1378 lpBand->cyMinChild = lprbbi->cyMinChild;
1379 lpBand->cyMaxChild = lprbbi->cyMaxChild;
1380 lpBand->cyChild = lprbbi->cyChild;
1381 lpBand->cyIntegral = lprbbi->cyIntegral;
1384 if (lprbbi->fMask & RBBIM_SIZE)
1385 lpBand->cx = lprbbi->cx;
1387 if (lprbbi->fMask & RBBIM_BACKGROUND)
1388 lpBand->hbmBack = lprbbi->hbmBack;
1390 if (lprbbi->fMask & RBBIM_ID)
1391 lpBand->wID = lprbbi->wID;
1393 /* check for additional data */
1394 if (lprbbi->cbSize >= sizeof (REBARBANDINFO32W)) {
1395 if (lprbbi->fMask & RBBIM_IDEALSIZE)
1396 lpBand->cxIdeal = lprbbi->cxIdeal;
1398 if (lprbbi->fMask & RBBIM_LPARAM)
1399 lpBand->lParam = lprbbi->lParam;
1401 if (lprbbi->fMask & RBBIM_HEADERSIZE)
1402 lpBand->cxHeader = lprbbi->cxHeader;
1405 REBAR_Layout (wndPtr, NULL);
1406 REBAR_ForceResize (wndPtr);
1407 REBAR_MoveChildWindows (wndPtr);
1414 REBAR_SetBarInfo (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1416 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1417 LPREBARINFO lpInfo = (LPREBARINFO)lParam;
1422 if (lpInfo->cbSize < sizeof (REBARINFO))
1425 TRACE (rebar, "setting bar info!\n");
1427 if (lpInfo->fMask & RBIM_IMAGELIST) {
1428 infoPtr->himl = lpInfo->himl;
1429 if (infoPtr->himl) {
1430 ImageList_GetIconSize (infoPtr->himl, &infoPtr->imageSize.cx,
1431 &infoPtr->imageSize.cy);
1434 infoPtr->imageSize.cx = 0;
1435 infoPtr->imageSize.cy = 0;
1444 REBAR_SetBkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1446 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1449 clrTemp = infoPtr->clrBk;
1450 infoPtr->clrBk = (COLORREF)lParam;
1452 TRACE (rebar, "background color 0x%06lx!\n", infoPtr->clrBk);
1458 /* << REBAR_SetColorScheme >> */
1459 /* << REBAR_SetPalette >> */
1463 REBAR_SetParent (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1465 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1466 HWND32 hwndTemp = infoPtr->hwndNotify;
1468 infoPtr->hwndNotify = (HWND32)wParam;
1470 return (LRESULT)hwndTemp;
1475 REBAR_SetTextColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1477 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1480 clrTemp = infoPtr->clrText;
1481 infoPtr->clrText = (COLORREF)lParam;
1483 TRACE (rebar, "text color 0x%06lx!\n", infoPtr->clrText);
1489 /* << REBAR_SetTooltips >> */
1492 __inline__ static LRESULT
1493 REBAR_SetUnicodeFormat (WND *wndPtr, WPARAM32 wParam)
1495 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1496 BOOL32 bTemp = infoPtr->bUnicode;
1497 infoPtr->bUnicode = (BOOL32)wParam;
1503 REBAR_ShowBand (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1505 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1508 if (((INT32)wParam < 0) || ((INT32)wParam > infoPtr->uNumBands))
1511 lpBand = &infoPtr->bands[(INT32)wParam];
1513 if ((BOOL32)lParam) {
1514 TRACE (rebar, "show band %d\n", (INT32)wParam);
1515 lpBand->fStyle = lpBand->fStyle & ~RBBS_HIDDEN;
1516 if (IsWindow32 (lpBand->hwndChild))
1517 ShowWindow32 (lpBand->hwndChild, SW_SHOW);
1520 TRACE (rebar, "hide band %d\n", (INT32)wParam);
1521 lpBand->fStyle = lpBand->fStyle | RBBS_HIDDEN;
1522 if (IsWindow32 (lpBand->hwndChild))
1523 ShowWindow32 (lpBand->hwndChild, SW_SHOW);
1526 REBAR_Layout (wndPtr, NULL);
1527 REBAR_ForceResize (wndPtr);
1528 REBAR_MoveChildWindows (wndPtr);
1535 REBAR_SizeToRect (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1537 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1538 LPRECT32 lpRect = (LPRECT32)lParam;
1543 FIXME (rebar, "layout change not implemented!\n");
1544 FIXME (rebar, "[%d %d %d %d]\n",
1545 lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
1548 SetWindowPos32 (wndPtr->hwndSelf, 0, lpRect->left, lpRect->top,
1549 lpRect->right - lpRect->left, lpRect->bottom - lpRect->top,
1553 infoPtr->calcSize.cx = lpRect->right - lpRect->left;
1554 infoPtr->calcSize.cy = lpRect->bottom - lpRect->top;
1556 REBAR_ForceResize (wndPtr);
1563 REBAR_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1565 REBAR_INFO *infoPtr;
1567 /* allocate memory for info structure */
1568 infoPtr = (REBAR_INFO *)COMCTL32_Alloc (sizeof(REBAR_INFO));
1569 wndPtr->wExtra[0] = (DWORD)infoPtr;
1571 if (infoPtr == NULL) {
1572 ERR (rebar, "could not allocate info memory!\n");
1576 if ((REBAR_INFO*)wndPtr->wExtra[0] != infoPtr) {
1577 ERR (rebar, "pointer assignment error!\n");
1581 /* initialize info structure */
1582 infoPtr->clrBk = CLR_NONE;
1583 infoPtr->clrText = RGB(0, 0, 0);
1585 infoPtr->bAutoResize = FALSE;
1586 infoPtr->hcurArrow = LoadCursor32A (0, IDC_ARROW32A);
1587 infoPtr->hcurHorz = LoadCursor32A (0, IDC_SIZEWE32A);
1588 infoPtr->hcurVert = LoadCursor32A (0, IDC_SIZENS32A);
1589 infoPtr->hcurDrag = LoadCursor32A (0, IDC_SIZE32A);
1591 infoPtr->bUnicode = IsWindowUnicode (wndPtr->hwndSelf);
1593 if (wndPtr->dwStyle & RBS_AUTOSIZE)
1594 FIXME (rebar, "style RBS_AUTOSIZE set!\n");
1597 SendMessage32A (wndPtr->parent->hwndSelf, WM_NOTIFYFORMAT,
1598 (WPARAM32)wndPtr->hwndSelf, NF_QUERY);
1601 TRACE (rebar, "created!\n");
1607 REBAR_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1609 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
1614 /* free rebar bands */
1615 if ((infoPtr->uNumBands > 0) && infoPtr->bands) {
1616 /* clean up each band */
1617 for (i = 0; i < infoPtr->uNumBands; i++) {
1618 lpBand = &infoPtr->bands[i];
1620 /* delete text strings */
1621 if (lpBand->lpText) {
1622 COMCTL32_Free (lpBand->lpText);
1623 lpBand->lpText = NULL;
1625 /* destroy child window */
1626 DestroyWindow32 (lpBand->hwndChild);
1629 /* free band array */
1630 COMCTL32_Free (infoPtr->bands);
1631 infoPtr->bands = NULL;
1637 DeleteObject32 (infoPtr->hcurArrow);
1638 DeleteObject32 (infoPtr->hcurHorz);
1639 DeleteObject32 (infoPtr->hcurVert);
1640 DeleteObject32 (infoPtr->hcurDrag);
1645 /* free rebar info data */
1646 COMCTL32_Free (infoPtr);
1648 TRACE (rebar, "destroyed!\n");
1654 REBAR_GetFont (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1656 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
1658 return (LRESULT)infoPtr->hFont;
1664 REBAR_MouseMove (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1666 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
1673 __inline__ static LRESULT
1674 REBAR_NCCalcSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1676 if (wndPtr->dwStyle & WS_BORDER) {
1677 ((LPRECT32)lParam)->left += sysMetrics[SM_CXEDGE];
1678 ((LPRECT32)lParam)->top += sysMetrics[SM_CYEDGE];
1679 ((LPRECT32)lParam)->right -= sysMetrics[SM_CXEDGE];
1680 ((LPRECT32)lParam)->bottom -= sysMetrics[SM_CYEDGE];
1688 REBAR_NCPaint (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1690 HWND32 hwnd = wndPtr->hwndSelf;
1693 if ( wndPtr->dwStyle & WS_MINIMIZE ||
1694 !WIN_IsWindowDrawable( wndPtr, 0 )) return 0; /* Nothing to do */
1696 DefWindowProc32A (hwnd, WM_NCPAINT, wParam, lParam);
1698 if (!(hdc = GetDCEx32( hwnd, 0, DCX_USESTYLE | DCX_WINDOW ))) return 0;
1700 if (ExcludeVisRect( hdc, wndPtr->rectClient.left-wndPtr->rectWindow.left,
1701 wndPtr->rectClient.top-wndPtr->rectWindow.top,
1702 wndPtr->rectClient.right-wndPtr->rectWindow.left,
1703 wndPtr->rectClient.bottom-wndPtr->rectWindow.top )
1705 ReleaseDC32( hwnd, hdc );
1709 if (!(wndPtr->flags & WIN_MANAGED) && (wndPtr->dwStyle & WS_BORDER))
1710 DrawEdge32 (hdc, &wndPtr->rectWindow, EDGE_ETCHED, BF_RECT);
1712 ReleaseDC32( hwnd, hdc );
1719 REBAR_Paint (WND *wndPtr, WPARAM32 wParam)
1724 hdc = wParam==0 ? BeginPaint32 (wndPtr->hwndSelf, &ps) : (HDC32)wParam;
1725 REBAR_Refresh (wndPtr, hdc);
1727 EndPaint32 (wndPtr->hwndSelf, &ps);
1733 REBAR_SetCursor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1735 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
1739 TRACE (rebar, "code=0x%X id=0x%X\n", LOWORD(lParam), HIWORD(lParam));
1741 GetCursorPos32 (&pt);
1742 ScreenToClient32 (wndPtr->hwndSelf, &pt);
1744 REBAR_InternalHitTest (wndPtr, &pt, &flags, NULL);
1746 if (flags == RBHT_GRABBER) {
1747 if ((wndPtr->dwStyle & CCS_VERT) &&
1748 !(wndPtr->dwStyle & RBS_VERTICALGRIPPER))
1749 SetCursor32 (infoPtr->hcurVert);
1751 SetCursor32 (infoPtr->hcurHorz);
1753 else if (flags != RBHT_CLIENT)
1754 SetCursor32 (infoPtr->hcurArrow);
1761 REBAR_SetFont (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1763 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
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);
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);