Commented out unused variables to prevent needless compiler warnings.
[wine.git] / dlls / comctl32 / rebar.c
blob006f92c8c70d146b43c96354bb4d9f3041e443cb
1 /*
2 * Rebar control
4 * Copyright 1998 Eric Kohl
6 * NOTES
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>
11 * TODO:
12 * - vertical placement
13 * - ComboBox and ComboBoxEx placement
14 * - center image
15 * - Layout code.
16 * - Display code.
17 * - Some messages.
18 * - All notifications.
21 #include "windows.h"
22 #include "commctrl.h"
23 #include "rebar.h"
24 #include "win.h"
25 #include "sysmetrics.h"
26 #include "debug.h"
29 /* fDraw flags */
30 #define DRAW_GRIPPER 1
31 #define DRAW_IMAGE 2
32 #define DRAW_TEXT 4
33 #define DRAW_CHILD 8
35 #define GRIPPER_WIDTH 13
38 #define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)wndPtr->wExtra[0])
41 static VOID
42 REBAR_DrawBand (HDC32 hdc, REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
45 DrawEdge32 (hdc, &lpBand->rcBand, BDR_RAISEDINNER, BF_MIDDLE);
47 /* draw background */
49 /* draw gripper */
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 */
56 POINT32 pt;
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, */
63 pt.x, pt.y,
64 ILD_TRANSPARENT);
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);
80 static VOID
81 REBAR_Refresh (WND *wndPtr, HDC32 hdc)
83 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
84 REBAR_BAND *lpBand;
85 UINT32 i;
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)))
92 continue;
94 REBAR_DrawBand (hdc, infoPtr, lpBand);
100 static VOID
101 REBAR_CalcHorzBand (REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
103 lpBand->fDraw = 0;
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);
132 SIZE32 size;
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;
150 else {
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;
180 static VOID
181 REBAR_CalcVertBand (WND *wndPtr, REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
183 lpBand->fDraw = 0;
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);
212 SIZE32 size;
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;
231 else {
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;
262 else {
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;
279 static VOID
280 REBAR_Layout (WND *wndPtr, LPRECT32 lpRect)
282 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
283 REBAR_BAND *lpBand;
284 RECT32 rcClient;
285 INT32 x, y, cx, cy;
286 UINT32 i;
288 if (lpRect)
289 rcClient = *lpRect;
290 else
291 GetClientRect32 (wndPtr->hwndSelf, &rcClient);
293 x = 0;
294 y = 0;
296 if (wndPtr->dwStyle & CCS_VERT) {
297 cx = 20; /* FIXME: fixed height */
298 cy = rcClient.bottom - rcClient.top;
300 else {
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)))
310 continue;
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;
318 else
319 cx = 20; /* FIXME */
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;
327 else {
328 if (lpBand->fStyle & RBBS_VARIABLEHEIGHT)
329 cy = lpBand->cyMaxChild;
330 else if (lpBand->fStyle & RBBIM_CHILDSIZE)
331 cy = lpBand->cyMinChild;
332 else
333 cy = 20; /* FIXME */
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;
346 else {
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;
356 else {
357 infoPtr->calcSize.cx = rcClient.right - rcClient.left;
358 infoPtr->calcSize.cy = y;
363 static VOID
364 REBAR_ForceResize (WND *wndPtr)
366 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
367 RECT32 rc;
369 TRACE (rebar, " to [%d x %d]!\n",
370 infoPtr->calcSize.cx, infoPtr->calcSize.cy);
372 infoPtr->bAutoResize = TRUE;
374 rc.left = 0;
375 rc.top = 0;
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);
389 static VOID
390 REBAR_MoveChildWindows (WND *wndPtr)
392 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
393 REBAR_BAND *lpBand;
394 UINT32 i;
396 for (i = 0; i < infoPtr->uNumBands; i++) {
397 lpBand = &infoPtr->bands[i];
399 if (lpBand->fStyle & RBBS_HIDDEN)
400 continue;
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;
406 RECT32 rc;
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,
420 nEditHeight,
421 SWP_SHOWWINDOW);
423 #if 0
424 else if () {
425 /* special placement code for extended combo box */
429 #endif
430 else {
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,
435 SWP_SHOWWINDOW);
442 static void
443 REBAR_InternalHitTest (WND *wndPtr, LPPOINT32 lpPt, UINT32 *pFlags, INT32 *pBand)
445 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
446 REBAR_BAND *lpBand;
447 RECT32 rect;
448 INT32 iCount;
450 GetClientRect32 (wndPtr->hwndSelf, &rect);
452 *pFlags = RBHT_NOWHERE;
453 if (PtInRect32 (&rect, *lpPt))
455 if (infoPtr->uNumBands == 0) {
456 *pFlags = RBHT_NOWHERE;
457 if (pBand)
458 *pBand = -1;
459 TRACE (rebar, "NOWHERE\n");
460 return;
462 else {
463 /* somewhere inside */
464 for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) {
465 lpBand = &infoPtr->bands[iCount];
466 if (PtInRect32 (&lpBand->rcBand, *lpPt)) {
467 if (pBand)
468 *pBand = iCount;
469 if (PtInRect32 (&lpBand->rcGripper, *lpPt)) {
470 *pFlags = RBHT_GRABBER;
471 TRACE (rebar, "ON GRABBER %d\n", iCount);
472 return;
474 else if (PtInRect32 (&lpBand->rcCapImage, *lpPt)) {
475 *pFlags = RBHT_CAPTION;
476 TRACE (rebar, "ON CAPTION %d\n", iCount);
477 return;
479 else if (PtInRect32 (&lpBand->rcCapText, *lpPt)) {
480 *pFlags = RBHT_CAPTION;
481 TRACE (rebar, "ON CAPTION %d\n", iCount);
482 return;
484 else if (PtInRect32 (&lpBand->rcChild, *lpPt)) {
485 *pFlags = RBHT_CLIENT;
486 TRACE (rebar, "ON CLIENT %d\n", iCount);
487 return;
489 else {
490 *pFlags = RBHT_NOWHERE;
491 TRACE (rebar, "NOWHERE %d\n", iCount);
492 return;
497 *pFlags = RBHT_NOWHERE;
498 if (pBand)
499 *pBand = -1;
501 TRACE (rebar, "NOWHERE\n");
502 return;
505 else {
506 *pFlags = RBHT_NOWHERE;
507 if (pBand)
508 *pBand = -1;
509 TRACE (rebar, "NOWHERE\n");
510 return;
513 TRACE (rebar, "flags=0x%X\n", *pFlags);
514 return;
519 /* << REBAR_BeginDrag >> */
522 static LRESULT
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)
529 return FALSE;
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;
539 else {
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);
545 if (uBand > 0) {
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);
562 return TRUE;
566 /* << REBAR_DragMove >> */
567 /* << REBAR_EndDrag >> */
570 static LRESULT
571 REBAR_GetBandBorders (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
573 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
574 /* LPRECT32 lpRect = (LPRECT32)lParam; */
575 REBAR_BAND *lpBand;
577 if (!lParam)
578 return 0;
579 if ((UINT32)wParam >= infoPtr->uNumBands)
580 return 0;
582 lpBand = &infoPtr->bands[(UINT32)wParam];
583 if (wndPtr->dwStyle & RBS_BANDBORDERS) {
586 else {
590 return 0;
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;
605 static LRESULT
606 REBAR_GetBandInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
608 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
609 LPREBARBANDINFO32A lprbbi = (LPREBARBANDINFO32A)lParam;
610 REBAR_BAND *lpBand;
612 if (lprbbi == NULL)
613 return FALSE;
614 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32A)
615 return FALSE;
616 if ((UINT32)wParam >= infoPtr->uNumBands)
617 return FALSE;
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;
672 return TRUE;
676 static LRESULT
677 REBAR_GetBandInfo32W (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
679 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
680 LPREBARBANDINFO32W lprbbi = (LPREBARBANDINFO32W)lParam;
681 REBAR_BAND *lpBand;
683 if (lprbbi == NULL)
684 return FALSE;
685 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32W)
686 return FALSE;
687 if ((UINT32)wParam >= infoPtr->uNumBands)
688 return FALSE;
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;
743 return TRUE;
747 static LRESULT
748 REBAR_GetBarHeight (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
750 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
751 INT32 nHeight;
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);
761 return nHeight;
765 static LRESULT
766 REBAR_GetBarInfo (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
768 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
769 LPREBARINFO lpInfo = (LPREBARINFO)lParam;
771 if (lpInfo == NULL)
772 return FALSE;
774 if (lpInfo->cbSize < sizeof (REBARINFO))
775 return FALSE;
777 TRACE (rebar, "getting bar info!\n");
779 if (infoPtr->himl) {
780 lpInfo->himl = infoPtr->himl;
781 lpInfo->fMask |= RBIM_IMAGELIST;
784 return TRUE;
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 >> */
803 static LRESULT
804 REBAR_GetPalette (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
806 FIXME (rebar, "empty stub!\n");
808 return 0;
812 static LRESULT
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;
818 REBAR_BAND *lpBand;
820 if ((iBand < 0) && ((UINT32)iBand >= infoPtr->uNumBands))
821 return FALSE;
822 if (!lprc)
823 return FALSE;
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;
836 return TRUE;
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;
851 static LRESULT
852 REBAR_GetRowHeight (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
854 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); */
856 FIXME (rebar, "-- height = 20: semi stub!\n");
858 return 20;
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;
889 static LRESULT
890 REBAR_HitTest (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
892 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); */
893 LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam;
895 if (!lprbht)
896 return -1;
898 REBAR_InternalHitTest (wndPtr, &lprbht->pt,
899 &lprbht->flags, &lprbht->iBand);
901 return lprbht->iBand;
905 static LRESULT
906 REBAR_IdToIndex (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
908 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
909 UINT32 i;
911 if (infoPtr == NULL)
912 return -1;
914 if (infoPtr->uNumBands < 1)
915 return -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);
922 return i;
926 TRACE (rebar, "no band found!\n");
927 return -1;
931 static LRESULT
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;
937 REBAR_BAND *lpBand;
939 if (infoPtr == NULL)
940 return FALSE;
941 if (lprbbi == NULL)
942 return FALSE;
943 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32A)
944 return FALSE;
946 TRACE (rebar, "insert band at %u!\n", uIndex);
948 if (infoPtr->uNumBands == 0) {
949 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));
950 uIndex = 0;
952 else {
953 REBAR_BAND *oldBands = infoPtr->bands;
954 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 */
960 if (uIndex > 0) {
961 memcpy (&infoPtr->bands[0], &oldBands[0],
962 uIndex * sizeof(REBAR_BAND));
965 /* post copy */
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;
988 else {
989 lpBand->clrFore = CLR_NONE;
990 lpBand->clrBack = CLR_NONE;
993 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
994 INT32 len = lstrlen32A (lprbbi->lpText);
995 if (len > 0) {
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;
1003 else
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;
1020 else {
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;
1030 else
1031 lpBand->cx = -1;
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);
1056 return TRUE;
1060 static LRESULT
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;
1066 REBAR_BAND *lpBand;
1068 if (infoPtr == NULL)
1069 return FALSE;
1070 if (lprbbi == NULL)
1071 return FALSE;
1072 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32W)
1073 return FALSE;
1075 TRACE (rebar, "insert band at %u!\n", uIndex);
1077 if (infoPtr->uNumBands == 0) {
1078 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));
1079 uIndex = 0;
1081 else {
1082 REBAR_BAND *oldBands = infoPtr->bands;
1083 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 */
1089 if (uIndex > 0) {
1090 memcpy (&infoPtr->bands[0], &oldBands[0],
1091 uIndex * sizeof(REBAR_BAND));
1094 /* post copy */
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;
1117 else {
1118 lpBand->clrFore = CLR_NONE;
1119 lpBand->clrBack = CLR_NONE;
1122 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
1123 INT32 len = lstrlen32W (lprbbi->lpText);
1124 if (len > 0) {
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;
1132 else
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;
1149 else {
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;
1159 else
1160 lpBand->cx = -1;
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);
1185 return TRUE;
1189 static LRESULT
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");
1198 return 0;
1202 static LRESULT
1203 REBAR_MinimizeBand (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1205 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); */
1207 FIXME (rebar, "(uBand = %u)\n", (UINT32)wParam);
1210 return 0;
1214 static LRESULT
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);
1223 return FALSE;
1227 static LRESULT
1228 REBAR_SetBandInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1230 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1231 LPREBARBANDINFO32A lprbbi = (LPREBARBANDINFO32A)lParam;
1232 REBAR_BAND *lpBand;
1234 if (lprbbi == NULL)
1235 return FALSE;
1236 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32A)
1237 return FALSE;
1238 if ((UINT32)wParam >= infoPtr->uNumBands)
1239 return FALSE;
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);
1275 else {
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);
1316 return TRUE;
1320 static LRESULT
1321 REBAR_SetBandInfo32W (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1323 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1324 LPREBARBANDINFO32W lprbbi = (LPREBARBANDINFO32W)lParam;
1325 REBAR_BAND *lpBand;
1327 if (lprbbi == NULL)
1328 return FALSE;
1329 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32W)
1330 return FALSE;
1331 if ((UINT32)wParam >= infoPtr->uNumBands)
1332 return FALSE;
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);
1368 else {
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);
1409 return TRUE;
1413 static LRESULT
1414 REBAR_SetBarInfo (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1416 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1417 LPREBARINFO lpInfo = (LPREBARINFO)lParam;
1419 if (lpInfo == NULL)
1420 return FALSE;
1422 if (lpInfo->cbSize < sizeof (REBARINFO))
1423 return FALSE;
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);
1433 else {
1434 infoPtr->imageSize.cx = 0;
1435 infoPtr->imageSize.cy = 0;
1439 return TRUE;
1443 static LRESULT
1444 REBAR_SetBkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1446 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1447 COLORREF clrTemp;
1449 clrTemp = infoPtr->clrBk;
1450 infoPtr->clrBk = (COLORREF)lParam;
1452 TRACE (rebar, "background color 0x%06lx!\n", infoPtr->clrBk);
1454 return clrTemp;
1458 /* << REBAR_SetColorScheme >> */
1459 /* << REBAR_SetPalette >> */
1462 static LRESULT
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;
1474 static LRESULT
1475 REBAR_SetTextColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1477 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1478 COLORREF clrTemp;
1480 clrTemp = infoPtr->clrText;
1481 infoPtr->clrText = (COLORREF)lParam;
1483 TRACE (rebar, "text color 0x%06lx!\n", infoPtr->clrText);
1485 return clrTemp;
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;
1498 return bTemp;
1502 static LRESULT
1503 REBAR_ShowBand (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1505 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1506 REBAR_BAND *lpBand;
1508 if (((INT32)wParam < 0) || ((INT32)wParam > infoPtr->uNumBands))
1509 return FALSE;
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);
1519 else {
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);
1530 return TRUE;
1534 static LRESULT
1535 REBAR_SizeToRect (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1537 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
1538 LPRECT32 lpRect = (LPRECT32)lParam;
1540 if (lpRect == NULL)
1541 return FALSE;
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);
1547 #if 0
1548 SetWindowPos32 (wndPtr->hwndSelf, 0, lpRect->left, lpRect->top,
1549 lpRect->right - lpRect->left, lpRect->bottom - lpRect->top,
1550 SWP_NOZORDER);
1551 #endif
1553 infoPtr->calcSize.cx = lpRect->right - lpRect->left;
1554 infoPtr->calcSize.cy = lpRect->bottom - lpRect->top;
1556 REBAR_ForceResize (wndPtr);
1557 return TRUE;
1562 static LRESULT
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");
1573 return 0;
1576 if ((REBAR_INFO*)wndPtr->wExtra[0] != infoPtr) {
1577 ERR (rebar, "pointer assignment error!\n");
1578 return 0;
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");
1596 #if 0
1597 SendMessage32A (wndPtr->parent->hwndSelf, WM_NOTIFYFORMAT,
1598 (WPARAM32)wndPtr->hwndSelf, NF_QUERY);
1599 #endif
1601 TRACE (rebar, "created!\n");
1602 return 0;
1606 static LRESULT
1607 REBAR_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1609 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
1610 REBAR_BAND *lpBand;
1611 INT32 i;
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");
1649 return 0;
1653 static LRESULT
1654 REBAR_GetFont (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1656 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
1658 return (LRESULT)infoPtr->hFont;
1662 #if 0
1663 static LRESULT
1664 REBAR_MouseMove (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1666 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
1668 return 0;
1670 #endif
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];
1683 return 0;
1687 static LRESULT
1688 REBAR_NCPaint (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1690 HWND32 hwnd = wndPtr->hwndSelf;
1691 HDC32 hdc;
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 )
1704 == NULLREGION){
1705 ReleaseDC32( hwnd, hdc );
1706 return 0;
1709 if (!(wndPtr->flags & WIN_MANAGED) && (wndPtr->dwStyle & WS_BORDER))
1710 DrawEdge32 (hdc, &wndPtr->rectWindow, EDGE_ETCHED, BF_RECT);
1712 ReleaseDC32( hwnd, hdc );
1714 return 0;
1718 static LRESULT
1719 REBAR_Paint (WND *wndPtr, WPARAM32 wParam)
1721 HDC32 hdc;
1722 PAINTSTRUCT32 ps;
1724 hdc = wParam==0 ? BeginPaint32 (wndPtr->hwndSelf, &ps) : (HDC32)wParam;
1725 REBAR_Refresh (wndPtr, hdc);
1726 if (!wParam)
1727 EndPaint32 (wndPtr->hwndSelf, &ps);
1728 return 0;
1732 static LRESULT
1733 REBAR_SetCursor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1735 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
1736 POINT32 pt;
1737 UINT32 flags;
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);
1750 else
1751 SetCursor32 (infoPtr->hcurHorz);
1753 else if (flags != RBHT_CLIENT)
1754 SetCursor32 (infoPtr->hcurArrow);
1756 return 0;
1760 static LRESULT
1761 REBAR_SetFont (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1763 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
1765 /* TEXTMETRIC32A tm; */
1766 HFONT32 hFont /*, hOldFont */;
1767 /* HDC32 hdc; */
1769 infoPtr->hFont = (HFONT32)wParam;
1771 hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject32 (SYSTEM_FONT);
1773 hdc = GetDC32 (0);
1774 hOldFont = SelectObject32 (hdc, hFont);
1775 GetTextMetrics32A (hdc, &tm);
1776 infoPtr->nHeight = tm.tmHeight + VERT_BORDER;
1777 SelectObject32 (hdc, hOldFont);
1778 ReleaseDC32 (0, hdc);
1780 if (lParam) {
1782 REBAR_Layout (wndPtr);
1783 hdc = GetDC32 (wndPtr->hwndSelf);
1784 REBAR_Refresh (wndPtr, hdc);
1785 ReleaseDC32 (wndPtr->hwndSelf, hdc);
1789 return 0;
1792 static LRESULT
1793 REBAR_Size (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
1795 REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
1796 RECT32 rcParent;
1797 /* INT32 x, y, cx, cy; */
1799 /* auto resize deadlock check */
1800 if (infoPtr->bAutoResize) {
1801 infoPtr->bAutoResize = FALSE;
1802 return 0;
1805 TRACE (rebar, "sizing rebar!\n");
1807 /* get parent rectangle */
1808 GetClientRect32 (GetParent32 (wndPtr->hwndSelf), &rcParent);
1810 REBAR_Layout (wndPtr, &rcParent);
1812 if (wndPtr->dwStyle & CCS_VERT) {
1813 if (wndPtr->dwStyle & CCS_LEFT == CCS_LEFT) {
1814 x = rcParent.left;
1815 y = rcParent.top;
1816 cx = infoPtr->calcSize.cx;
1817 cy = infoPtr->calcSize.cy;
1819 else {
1820 x = rcParent.right - infoPtr->calcSize.cx;
1821 y = rcParent.top;
1822 cx = infoPtr->calcSize.cx;
1823 cy = infoPtr->calcSize.cy;
1826 else {
1827 if (wndPtr->dwStyle & CCS_TOP) {
1828 x = rcParent.left;
1829 y = rcParent.top;
1830 cx = infoPtr->calcSize.cx;
1831 cy = infoPtr->calcSize.cy;
1833 else {
1834 x = rcParent.left;
1835 y = rcParent.bottom - infoPtr->calcSize.cy;
1836 cx = infoPtr->calcSize.cx;
1837 cy = infoPtr->calcSize.cy;
1841 SetWindowPos32 (wndPtr->hwndSelf, 0, x, y, cx, cy,
1842 SWP_NOZORDER | SWP_SHOWWINDOW);
1844 REBAR_Layout (wndPtr, NULL);
1845 REBAR_ForceResize (wndPtr);
1846 REBAR_MoveChildWindows (wndPtr);
1848 return 0;
1852 LRESULT WINAPI
1853 REBAR_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
1855 WND *wndPtr = WIN_FindWndPtr(hwnd);
1857 switch (uMsg)
1859 /* case RB_BEGINDRAG: */
1861 case RB_DELETEBAND:
1862 return REBAR_DeleteBand (wndPtr, wParam, lParam);
1864 /* case RB_DRAGMOVE: */
1865 /* case RB_ENDDRAG: */
1867 case RB_GETBANDBORDERS:
1868 return REBAR_GetBandBorders (wndPtr, wParam, lParam);
1870 case RB_GETBANDCOUNT:
1871 return REBAR_GetBandCount (wndPtr);
1873 /* case RB_GETBANDINFO32: */ /* outdated, just for compatibility */
1875 case RB_GETBANDINFO32A:
1876 return REBAR_GetBandInfo32A (wndPtr, wParam, lParam);
1878 case RB_GETBANDINFO32W:
1879 return REBAR_GetBandInfo32W (wndPtr, wParam, lParam);
1881 case RB_GETBARHEIGHT:
1882 return REBAR_GetBarHeight (wndPtr, wParam, lParam);
1884 case RB_GETBARINFO:
1885 return REBAR_GetBarInfo (wndPtr, wParam, lParam);
1887 case RB_GETBKCOLOR:
1888 return REBAR_GetBkColor (wndPtr);
1890 /* case RB_GETCOLORSCHEME: */
1891 /* case RB_GETDROPTARGET: */
1893 case RB_GETPALETTE:
1894 return REBAR_GetPalette (wndPtr, wParam, lParam);
1896 case RB_GETRECT:
1897 return REBAR_GetRect (wndPtr, wParam, lParam);
1899 case RB_GETROWCOUNT:
1900 return REBAR_GetRowCount (wndPtr);
1902 case RB_GETROWHEIGHT:
1903 return REBAR_GetRowHeight (wndPtr, wParam, lParam);
1905 case RB_GETTEXTCOLOR:
1906 return REBAR_GetTextColor (wndPtr);
1908 case RB_GETTOOLTIPS:
1909 return REBAR_GetToolTips (wndPtr);
1911 case RB_GETUNICODEFORMAT:
1912 return REBAR_GetUnicodeFormat (wndPtr);
1914 case RB_HITTEST:
1915 return REBAR_HitTest (wndPtr, wParam, lParam);
1917 case RB_IDTOINDEX:
1918 return REBAR_IdToIndex (wndPtr, wParam, lParam);
1920 case RB_INSERTBAND32A:
1921 return REBAR_InsertBand32A (wndPtr, wParam, lParam);
1923 case RB_INSERTBAND32W:
1924 return REBAR_InsertBand32W (wndPtr, wParam, lParam);
1926 case RB_MAXIMIZEBAND:
1927 return REBAR_MaximizeBand (wndPtr, wParam, lParam);
1929 case RB_MINIMIZEBAND:
1930 return REBAR_MinimizeBand (wndPtr, wParam, lParam);
1932 case RB_MOVEBAND:
1933 return REBAR_MoveBand (wndPtr, wParam, lParam);
1935 case RB_SETBANDINFO32A:
1936 return REBAR_SetBandInfo32A (wndPtr, wParam, lParam);
1938 case RB_SETBANDINFO32W:
1939 return REBAR_SetBandInfo32W (wndPtr, wParam, lParam);
1941 case RB_SETBARINFO:
1942 return REBAR_SetBarInfo (wndPtr, wParam, lParam);
1944 case RB_SETBKCOLOR:
1945 return REBAR_SetBkColor (wndPtr, wParam, lParam);
1947 /* case RB_SETCOLORSCHEME: */
1948 /* case RB_SETPALETTE: */
1949 /* return REBAR_GetPalette (wndPtr, wParam, lParam); */
1951 case RB_SETPARENT:
1952 return REBAR_SetParent (wndPtr, wParam, lParam);
1954 case RB_SETTEXTCOLOR:
1955 return REBAR_SetTextColor (wndPtr, wParam, lParam);
1957 /* case RB_SETTOOLTIPS: */
1959 case RB_SETUNICODEFORMAT:
1960 return REBAR_SetUnicodeFormat (wndPtr, wParam);
1962 case RB_SHOWBAND:
1963 return REBAR_ShowBand (wndPtr, wParam, lParam);
1965 case RB_SIZETORECT:
1966 return REBAR_SizeToRect (wndPtr, wParam, lParam);
1969 case WM_COMMAND:
1970 return SendMessage32A (wndPtr->parent->hwndSelf, uMsg, wParam, lParam);
1972 case WM_CREATE:
1973 return REBAR_Create (wndPtr, wParam, lParam);
1975 case WM_DESTROY:
1976 return REBAR_Destroy (wndPtr, wParam, lParam);
1978 case WM_GETFONT:
1979 return REBAR_GetFont (wndPtr, wParam, lParam);
1981 /* case WM_MOUSEMOVE: */
1982 /* return REBAR_MouseMove (wndPtr, wParam, lParam); */
1984 case WM_NCCALCSIZE:
1985 return REBAR_NCCalcSize (wndPtr, wParam, lParam);
1987 case WM_NCPAINT:
1988 return REBAR_NCPaint (wndPtr, wParam, lParam);
1990 case WM_NOTIFY:
1991 return SendMessage32A (wndPtr->parent->hwndSelf, uMsg, wParam, lParam);
1993 case WM_PAINT:
1994 return REBAR_Paint (wndPtr, wParam);
1996 case WM_SETCURSOR:
1997 return REBAR_SetCursor (wndPtr, wParam, lParam);
1999 case WM_SETFONT:
2000 return REBAR_SetFont (wndPtr, wParam, lParam);
2002 case WM_SIZE:
2003 return REBAR_Size (wndPtr, wParam, lParam);
2005 /* case WM_TIMER: */
2007 /* case WM_WININICHANGE: */
2009 default:
2010 if (uMsg >= WM_USER)
2011 ERR (rebar, "unknown msg %04x wp=%08x lp=%08lx\n",
2012 uMsg, wParam, lParam);
2013 return DefWindowProc32A (hwnd, uMsg, wParam, lParam);
2015 return 0;
2019 VOID
2020 REBAR_Register (VOID)
2022 WNDCLASS32A wndClass;
2024 if (GlobalFindAtom32A (REBARCLASSNAME32A)) return;
2026 ZeroMemory (&wndClass, sizeof(WNDCLASS32A));
2027 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
2028 wndClass.lpfnWndProc = (WNDPROC32)REBAR_WindowProc;
2029 wndClass.cbClsExtra = 0;
2030 wndClass.cbWndExtra = sizeof(REBAR_INFO *);
2031 wndClass.hCursor = 0;
2032 wndClass.hbrBackground = (HBRUSH32)(COLOR_BTNFACE + 1);
2033 wndClass.lpszClassName = REBARCLASSNAME32A;
2035 RegisterClass32A (&wndClass);
2039 VOID
2040 REBAR_Unregister (VOID)
2042 if (GlobalFindAtom32A (REBARCLASSNAME32A))
2043 UnregisterClass32A (REBARCLASSNAME32A, (HINSTANCE32)NULL);