source: trunk/src/comctl32/rebar.cpp@ 2875

Last change on this file since 2875 was 2875, checked in by cbratschi, 26 years ago

C -> C++, WINE animate, treeview WM_VSCROLL fixed

File size: 54.4 KB
Line 
1/* $Id: rebar.cpp,v 1.1 2000-02-23 17:09:47 cbratschi Exp $ */
2/*
3 * Rebar control
4 *
5 * Copyright 1998, 1999 Eric Kohl
6 * Copyright 1999 Achim Hasenmueller
7 * Copyright 1999 Christoph Bratschi
8 *
9 * NOTES
10 * An author is needed! Any volunteers?
11 * I will only improve this control once in a while.
12 * Eric <ekohl@abo.rhein-zeitung.de>
13 *
14 * TODO:
15 * - vertical placement
16 * - ComboBox and ComboBoxEx placement
17 * - center image
18 * - Layout code.
19 * - Display code.
20 * - Some messages.
21 * - All notifications.
22 */
23
24/* WINE 991212 */
25
26#include <string.h>
27
28#include "winbase.h"
29#include "wingdi.h"
30#include "commctrl.h"
31#include "rebar.h"
32#include "comctl32.h"
33
34
35/* fDraw flags */
36#define DRAW_GRIPPER 1
37#define DRAW_IMAGE 2
38#define DRAW_TEXT 4
39#define DRAW_CHILD 8
40
41#define GRIPPER_WIDTH 13
42
43
44#define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)GetWindowLongA (hwnd, 0))
45
46
47static VOID
48REBAR_DrawBand (HDC hdc, REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
49{
50
51 DrawEdge (hdc, &lpBand->rcBand, BDR_RAISEDINNER, BF_MIDDLE);
52
53 /* draw background */
54
55 /* draw gripper */
56 if (lpBand->fDraw & DRAW_GRIPPER)
57 DrawEdge (hdc, &lpBand->rcGripper, BDR_RAISEDINNER, BF_RECT | BF_MIDDLE);
58
59 /* draw caption image */
60 if (lpBand->fDraw & DRAW_IMAGE) {
61 /* FIXME: center image */
62 POINT pt;
63
64 pt.y = (lpBand->rcCapImage.bottom + lpBand->rcCapImage.top - infoPtr->imageSize.cy)/2;
65 pt.x = (lpBand->rcCapImage.right + lpBand->rcCapImage.left - infoPtr->imageSize.cx)/2;
66
67 ImageList_Draw (infoPtr->himl, lpBand->iImage, hdc,
68/* lpBand->rcCapImage.left, lpBand->rcCapImage.top, */
69 pt.x, pt.y,
70 ILD_TRANSPARENT);
71 }
72
73 /* draw caption text */
74 if (lpBand->fDraw & DRAW_TEXT) {
75 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);
76 INT oldBkMode = SetBkMode (hdc, TRANSPARENT);
77 DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText,
78 DT_CENTER | DT_VCENTER | DT_SINGLELINE);
79 if (oldBkMode != TRANSPARENT)
80 SetBkMode (hdc, oldBkMode);
81 SelectObject (hdc, hOldFont);
82 }
83}
84
85
86static VOID
87REBAR_Refresh (HWND hwnd, HDC hdc)
88{
89 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
90 REBAR_BAND *lpBand;
91 UINT i;
92
93 for (i = 0; i < infoPtr->uNumBands; i++) {
94 lpBand = &infoPtr->bands[i];
95
96 if ((lpBand->fStyle & RBBS_HIDDEN) ||
97 ((GetWindowLongA (hwnd, GWL_STYLE) & CCS_VERT) &&
98 (lpBand->fStyle & RBBS_NOVERT)))
99 continue;
100
101 REBAR_DrawBand (hdc, infoPtr, lpBand);
102
103 }
104}
105
106
107static VOID
108REBAR_CalcHorzBand (REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
109{
110 lpBand->fDraw = 0;
111
112 /* set initial caption image rectangle */
113 SetRect (&lpBand->rcCapImage, 0, 0, 0, 0);
114
115 /* image is visible */
116 if ((lpBand->iImage > -1) && (infoPtr->himl)) {
117 lpBand->fDraw |= DRAW_IMAGE;
118
119 lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx;
120 lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy;
121
122 /* update band height */
123 if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) {
124 lpBand->uMinHeight = infoPtr->imageSize.cy + 2;
125 lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->uMinHeight;
126 }
127 }
128
129 /* set initial caption text rectangle */
130 lpBand->rcCapText.left = lpBand->rcCapImage.right;
131 lpBand->rcCapText.top = lpBand->rcBand.top + 1;
132 lpBand->rcCapText.right = lpBand->rcCapText.left;
133 lpBand->rcCapText.bottom = lpBand->rcBand.bottom - 1;
134
135 /* text is visible */
136 if (lpBand->lpText) {
137 HDC hdc = GetDC (0);
138 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);
139 SIZE size;
140
141 lpBand->fDraw |= DRAW_TEXT;
142 GetTextExtentPoint32W (hdc, lpBand->lpText,
143 lstrlenW (lpBand->lpText), &size);
144 lpBand->rcCapText.right += size.cx;
145
146 SelectObject (hdc, hOldFont);
147 ReleaseDC (0, hdc);
148 }
149
150 /* set initial child window rectangle */
151 if (lpBand->fStyle & RBBS_FIXEDSIZE) {
152 lpBand->rcChild.left = lpBand->rcCapText.right;
153 lpBand->rcChild.top = lpBand->rcBand.top;
154 lpBand->rcChild.right = lpBand->rcBand.right;
155 lpBand->rcChild.bottom = lpBand->rcBand.bottom;
156 }
157 else {
158 lpBand->rcChild.left = lpBand->rcCapText.right + 4;
159 lpBand->rcChild.top = lpBand->rcBand.top + 2;
160 lpBand->rcChild.right = lpBand->rcBand.right - 4;
161 lpBand->rcChild.bottom = lpBand->rcBand.bottom - 2;
162 }
163
164 /* calculate gripper rectangle */
165 if ((!(lpBand->fStyle & RBBS_NOGRIPPER)) &&
166 (!(lpBand->fStyle & RBBS_FIXEDSIZE)) &&
167 ((lpBand->fStyle & RBBS_GRIPPERALWAYS) ||
168 (infoPtr->uNumBands > 1))) {
169 lpBand->fDraw |= DRAW_GRIPPER;
170 lpBand->rcGripper.left = lpBand->rcBand.left + 3;
171 lpBand->rcGripper.right = lpBand->rcGripper.left + 3;
172 lpBand->rcGripper.top = lpBand->rcBand.top + 3;
173 lpBand->rcGripper.bottom = lpBand->rcBand.bottom - 3;
174
175 /* move caption rectangles */
176 OffsetRect (&lpBand->rcCapImage, GRIPPER_WIDTH, 0);
177 OffsetRect (&lpBand->rcCapText, GRIPPER_WIDTH, 0);
178
179 /* adjust child rectangle */
180 lpBand->rcChild.left += GRIPPER_WIDTH;
181 }
182
183
184}
185
186
187static VOID
188REBAR_CalcVertBand (HWND hwnd, REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
189{
190 lpBand->fDraw = 0;
191
192 /* set initial caption image rectangle */
193 SetRect (&lpBand->rcCapImage, 0, 0, 0, 0);
194
195 /* image is visible */
196 if ((lpBand->iImage > -1) && (infoPtr->himl)) {
197 lpBand->fDraw |= DRAW_IMAGE;
198
199 lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx;
200 lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy;
201
202 /* update band width */
203 if (lpBand->uMinHeight < infoPtr->imageSize.cx + 2) {
204 lpBand->uMinHeight = infoPtr->imageSize.cx + 2;
205 lpBand->rcBand.right = lpBand->rcBand.left + lpBand->uMinHeight;
206 }
207 }
208
209 /* set initial caption text rectangle */
210 lpBand->rcCapText.left = lpBand->rcBand.left + 1;
211 lpBand->rcCapText.top = lpBand->rcCapImage.bottom;
212 lpBand->rcCapText.right = lpBand->rcBand.right - 1;
213 lpBand->rcCapText.bottom = lpBand->rcCapText.top;
214
215 /* text is visible */
216 if (lpBand->lpText) {
217 HDC hdc = GetDC (0);
218 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);
219 SIZE size;
220
221 lpBand->fDraw |= DRAW_TEXT;
222 GetTextExtentPoint32W (hdc, lpBand->lpText,
223 lstrlenW (lpBand->lpText), &size);
224/* lpBand->rcCapText.right += size.cx; */
225 lpBand->rcCapText.bottom += size.cy;
226
227 SelectObject (hdc, hOldFont);
228 ReleaseDC (0, hdc);
229 }
230
231 /* set initial child window rectangle */
232 if (lpBand->fStyle & RBBS_FIXEDSIZE) {
233 lpBand->rcChild.left = lpBand->rcBand.left;
234 lpBand->rcChild.top = lpBand->rcCapText.bottom;
235 lpBand->rcChild.right = lpBand->rcBand.right;
236 lpBand->rcChild.bottom = lpBand->rcBand.bottom;
237 }
238 else {
239 lpBand->rcChild.left = lpBand->rcBand.left + 2;
240 lpBand->rcChild.top = lpBand->rcCapText.bottom + 4;
241 lpBand->rcChild.right = lpBand->rcBand.right - 2;
242 lpBand->rcChild.bottom = lpBand->rcBand.bottom - 4;
243 }
244
245 /* calculate gripper rectangle */
246 if ((!(lpBand->fStyle & RBBS_NOGRIPPER)) &&
247 (!(lpBand->fStyle & RBBS_FIXEDSIZE)) &&
248 ((lpBand->fStyle & RBBS_GRIPPERALWAYS) ||
249 (infoPtr->uNumBands > 1))) {
250 lpBand->fDraw |= DRAW_GRIPPER;
251
252 if (GetWindowLongA (hwnd, GWL_STYLE) & RBS_VERTICALGRIPPER) {
253 /* adjust band width */
254 lpBand->rcBand.right += GRIPPER_WIDTH;
255 lpBand->uMinHeight += GRIPPER_WIDTH;
256
257 lpBand->rcGripper.left = lpBand->rcBand.left + 3;
258 lpBand->rcGripper.right = lpBand->rcGripper.left + 3;
259 lpBand->rcGripper.top = lpBand->rcBand.top + 3;
260 lpBand->rcGripper.bottom = lpBand->rcBand.bottom - 3;
261
262 /* move caption rectangles */
263 OffsetRect (&lpBand->rcCapImage, GRIPPER_WIDTH, 0);
264 OffsetRect (&lpBand->rcCapText, GRIPPER_WIDTH, 0);
265
266 /* adjust child rectangle */
267 lpBand->rcChild.left += GRIPPER_WIDTH;
268 }
269 else {
270 lpBand->rcGripper.left = lpBand->rcBand.left + 3;
271 lpBand->rcGripper.right = lpBand->rcBand.right - 3;
272 lpBand->rcGripper.top = lpBand->rcBand.top + 3;
273 lpBand->rcGripper.bottom = lpBand->rcGripper.top + 3;
274
275 /* move caption rectangles */
276 OffsetRect (&lpBand->rcCapImage, 0, GRIPPER_WIDTH);
277 OffsetRect (&lpBand->rcCapText, 0, GRIPPER_WIDTH);
278
279 /* adjust child rectangle */
280 lpBand->rcChild.top += GRIPPER_WIDTH;
281 }
282 }
283}
284
285
286static VOID
287REBAR_Layout (HWND hwnd, LPRECT lpRect)
288{
289 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
290 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
291 REBAR_BAND *lpBand;
292 RECT rcClient;
293 INT x, y, cx, cy;
294 UINT i;
295
296 if (lpRect)
297 rcClient = *lpRect;
298 else
299 GetClientRect (hwnd, &rcClient);
300
301 x = 0;
302 y = 0;
303
304 if (dwStyle & CCS_VERT) {
305 cx = 20; /* FIXME: fixed height */
306 cy = rcClient.bottom - rcClient.top;
307 }
308 else {
309 cx = rcClient.right - rcClient.left;
310 cy = 20; /* FIXME: fixed height */
311 }
312
313 for (i = 0; i < infoPtr->uNumBands; i++) {
314 lpBand = &infoPtr->bands[i];
315
316 if ((lpBand->fStyle & RBBS_HIDDEN) ||
317 ((dwStyle & CCS_VERT) && (lpBand->fStyle & RBBS_NOVERT)))
318 continue;
319
320
321 if (dwStyle & CCS_VERT) {
322 if (lpBand->fStyle & RBBS_VARIABLEHEIGHT)
323 cx = lpBand->cyMaxChild;
324 else if (lpBand->fStyle & RBBIM_CHILDSIZE)
325 cx = lpBand->cyMinChild;
326 else
327 cx = 20; /* FIXME */
328
329 lpBand->rcBand.left = x;
330 lpBand->rcBand.right = x + cx;
331 lpBand->rcBand.top = y;
332 lpBand->rcBand.bottom = y + cy;
333 lpBand->uMinHeight = cx;
334 }
335 else {
336 if (lpBand->fStyle & RBBS_VARIABLEHEIGHT)
337 cy = lpBand->cyMaxChild;
338 else if (lpBand->fStyle & RBBIM_CHILDSIZE)
339 cy = lpBand->cyMinChild;
340 else {
341// cy = 20; /* FIXME */
342 cy = 36; //SvL: Better size of AbiWord (FIXME)
343 }
344
345 lpBand->rcBand.left = x;
346 lpBand->rcBand.right = x + cx;
347 lpBand->rcBand.top = y;
348 lpBand->rcBand.bottom = y + cy;
349 lpBand->uMinHeight = cy;
350 }
351
352 if (dwStyle & CCS_VERT) {
353 REBAR_CalcVertBand (hwnd, infoPtr, lpBand);
354 x += lpBand->uMinHeight;
355 }
356 else {
357 REBAR_CalcHorzBand (infoPtr, lpBand);
358 y += lpBand->uMinHeight;
359 }
360 }
361
362 if (dwStyle & CCS_VERT) {
363 infoPtr->calcSize.cx = x;
364 infoPtr->calcSize.cy = rcClient.bottom - rcClient.top;
365 }
366 else {
367 infoPtr->calcSize.cx = rcClient.right - rcClient.left;
368 infoPtr->calcSize.cy = y;
369 }
370}
371
372
373static VOID
374REBAR_ForceResize (HWND hwnd)
375{
376 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
377 RECT rc;
378
379// TRACE (rebar, " to [%d x %d]!\n",
380// infoPtr->calcSize.cx, infoPtr->calcSize.cy);
381
382 infoPtr->bAutoResize = TRUE;
383
384 rc.left = 0;
385 rc.top = 0;
386 rc.right = infoPtr->calcSize.cx;
387 rc.bottom = infoPtr->calcSize.cy;
388
389 if (GetWindowLongA (hwnd, GWL_STYLE) & WS_BORDER) {
390 InflateRect (&rc, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));
391 }
392
393 SetWindowPos (hwnd, 0, 0, 0,
394 rc.right - rc.left, rc.bottom - rc.top,
395 SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW);
396}
397
398
399static VOID
400REBAR_MoveChildWindows (HWND hwnd)
401{
402 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
403 REBAR_BAND *lpBand;
404 CHAR szClassName[40];
405 UINT i;
406
407 for (i = 0; i < infoPtr->uNumBands; i++) {
408 lpBand = &infoPtr->bands[i];
409
410 if (lpBand->fStyle & RBBS_HIDDEN)
411 continue;
412 if (lpBand->hwndChild) {
413// TRACE (rebar, "hwndChild = %x\n", lpBand->hwndChild);
414
415 GetClassNameA (lpBand->hwndChild, szClassName, 40);
416 if (!lstrcmpA (szClassName, "ComboBox")) {
417 INT nEditHeight, yPos;
418 RECT rc;
419
420 /* special placement code for combo box */
421
422
423 /* get size of edit line */
424 GetWindowRect (lpBand->hwndChild, &rc);
425 nEditHeight = rc.bottom - rc.top;
426 yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2;
427
428 /* center combo box inside child area */
429 SetWindowPos (lpBand->hwndChild, HWND_TOP,
430 lpBand->rcChild.left, /*lpBand->rcChild.top*/ yPos,
431 lpBand->rcChild.right - lpBand->rcChild.left,
432 nEditHeight,
433 SWP_SHOWWINDOW);
434 }
435#if 0
436 else if (!lstrcmpA (szClassName, WC_COMBOBOXEXA)) {
437 INT nEditHeight, yPos;
438 RECT rc;
439 HWND hwndEdit;
440
441 /* special placement code for extended combo box */
442
443 /* get size of edit line */
444 hwndEdit = SendMessageA (lpBand->hwndChild, CBEM_GETEDITCONTROL, 0, 0);
445 GetWindowRect (hwndEdit, &rc);
446 nEditHeight = rc.bottom - rc.top;
447 yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2;
448
449 /* center combo box inside child area */
450 SetWindowPos (lpBand->hwndChild, HWND_TOP,
451 lpBand->rcChild.left, /*lpBand->rcChild.top*/ yPos,
452 lpBand->rcChild.right - lpBand->rcChild.left,
453 nEditHeight,
454 SWP_SHOWWINDOW);
455
456 }
457#endif
458 else {
459 SetWindowPos (lpBand->hwndChild, HWND_TOP,
460 lpBand->rcChild.left, lpBand->rcChild.top,
461 lpBand->rcChild.right - lpBand->rcChild.left,
462 lpBand->rcChild.bottom - lpBand->rcChild.top,
463 SWP_SHOWWINDOW);
464 }
465 }
466 }
467}
468
469
470static void
471REBAR_InternalHitTest (HWND hwnd, LPPOINT lpPt, UINT *pFlags, INT *pBand)
472{
473 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
474 REBAR_BAND *lpBand;
475 RECT rect;
476 INT iCount;
477
478 GetClientRect (hwnd, &rect);
479
480 *pFlags = RBHT_NOWHERE;
481 if (PtInRect (&rect, *lpPt))
482 {
483 if (infoPtr->uNumBands == 0) {
484 *pFlags = RBHT_NOWHERE;
485 if (pBand)
486 *pBand = -1;
487// TRACE (rebar, "NOWHERE\n");
488 return;
489 }
490 else {
491 /* somewhere inside */
492 for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) {
493 lpBand = &infoPtr->bands[iCount];
494 if (PtInRect (&lpBand->rcBand, *lpPt)) {
495 if (pBand)
496 *pBand = iCount;
497 if (PtInRect (&lpBand->rcGripper, *lpPt)) {
498 *pFlags = RBHT_GRABBER;
499// TRACE (rebar, "ON GRABBER %d\n", iCount);
500 return;
501 }
502 else if (PtInRect (&lpBand->rcCapImage, *lpPt)) {
503 *pFlags = RBHT_CAPTION;
504// TRACE (rebar, "ON CAPTION %d\n", iCount);
505 return;
506 }
507 else if (PtInRect (&lpBand->rcCapText, *lpPt)) {
508 *pFlags = RBHT_CAPTION;
509// TRACE (rebar, "ON CAPTION %d\n", iCount);
510 return;
511 }
512 else if (PtInRect (&lpBand->rcChild, *lpPt)) {
513 *pFlags = RBHT_CLIENT;
514// TRACE (rebar, "ON CLIENT %d\n", iCount);
515 return;
516 }
517 else {
518 *pFlags = RBHT_NOWHERE;
519// TRACE (rebar, "NOWHERE %d\n", iCount);
520 return;
521 }
522 }
523 }
524
525 *pFlags = RBHT_NOWHERE;
526 if (pBand)
527 *pBand = -1;
528
529// TRACE (rebar, "NOWHERE\n");
530 return;
531 }
532 }
533 else {
534 *pFlags = RBHT_NOWHERE;
535 if (pBand)
536 *pBand = -1;
537// TRACE (rebar, "NOWHERE\n");
538 return;
539 }
540
541// TRACE (rebar, "flags=0x%X\n", *pFlags);
542 return;
543}
544
545
546
547/* << REBAR_BeginDrag >> */
548
549
550static LRESULT
551REBAR_DeleteBand (HWND hwnd, WPARAM wParam, LPARAM lParam)
552{
553 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
554 UINT uBand = (UINT)wParam;
555
556 if (uBand >= infoPtr->uNumBands)
557 return FALSE;
558
559// TRACE (rebar, "deleting band %u!\n", uBand);
560
561 if (infoPtr->uNumBands == 1) {
562// TRACE (rebar, " simple delete!\n");
563 COMCTL32_Free (infoPtr->bands);
564 infoPtr->bands = NULL;
565 infoPtr->uNumBands = 0;
566 }
567 else {
568 REBAR_BAND *oldBands = infoPtr->bands;
569// TRACE(rebar, "complex delete! [uBand=%u]\n", uBand);
570
571 infoPtr->uNumBands--;
572 infoPtr->bands = (REBAR_BAND*)COMCTL32_Alloc (sizeof (REBAR_BAND) * infoPtr->uNumBands);
573 if (uBand > 0) {
574 memcpy (&infoPtr->bands[0], &oldBands[0],
575 uBand * sizeof(REBAR_BAND));
576 }
577
578 if (uBand < infoPtr->uNumBands) {
579 memcpy (&infoPtr->bands[uBand], &oldBands[uBand+1],
580 (infoPtr->uNumBands - uBand) * sizeof(REBAR_BAND));
581 }
582
583 COMCTL32_Free (oldBands);
584 }
585
586 REBAR_Layout (hwnd, NULL);
587 REBAR_ForceResize (hwnd);
588 REBAR_MoveChildWindows (hwnd);
589
590 return TRUE;
591}
592
593
594/* << REBAR_DragMove >> */
595/* << REBAR_EndDrag >> */
596
597
598static LRESULT
599REBAR_GetBandBorders (HWND hwnd, WPARAM wParam, LPARAM lParam)
600{
601 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
602 /* LPRECT32 lpRect = (LPRECT32)lParam; */
603 REBAR_BAND *lpBand;
604
605 if (!lParam)
606 return 0;
607 if ((UINT)wParam >= infoPtr->uNumBands)
608 return 0;
609
610 lpBand = &infoPtr->bands[(UINT)wParam];
611 if (GetWindowLongA (hwnd, GWL_STYLE) & RBS_BANDBORDERS) {
612
613 }
614 else {
615
616 }
617
618 return 0;
619}
620
621
622static LRESULT
623REBAR_GetBandCount (HWND hwnd)
624{
625 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
626
627// TRACE (rebar, "band count %u!\n", infoPtr->uNumBands);
628
629 return infoPtr->uNumBands;
630}
631
632
633static LRESULT
634REBAR_GetBandInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam)
635{
636 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
637 LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam;
638 REBAR_BAND *lpBand;
639
640 if (lprbbi == NULL)
641 return FALSE;
642 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA)
643 return FALSE;
644 if ((UINT)wParam >= infoPtr->uNumBands)
645 return FALSE;
646
647// TRACE (rebar, "index %u\n", (UINT)wParam);
648
649 /* copy band information */
650 lpBand = &infoPtr->bands[(UINT)wParam];
651
652 if (lprbbi->fMask & RBBIM_STYLE)
653 lprbbi->fStyle = lpBand->fStyle;
654
655 if (lprbbi->fMask & RBBIM_COLORS) {
656 lprbbi->clrFore = lpBand->clrFore;
657 lprbbi->clrBack = lpBand->clrBack;
658 }
659
660 if ((lprbbi->fMask & RBBIM_TEXT) &&
661 (lprbbi->lpText) && (lpBand->lpText)) {
662 lstrcpynWtoA (lprbbi->lpText, lpBand->lpText,lprbbi->cch);
663 }
664
665 if (lprbbi->fMask & RBBIM_IMAGE)
666 lprbbi->iImage = lpBand->iImage;
667
668 if (lprbbi->fMask & RBBIM_CHILD)
669 lprbbi->hwndChild = lpBand->hwndChild;
670
671 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
672 lprbbi->cxMinChild = lpBand->cxMinChild;
673 lprbbi->cyMinChild = lpBand->cyMinChild;
674 lprbbi->cyMaxChild = lpBand->cyMaxChild;
675 lprbbi->cyChild = lpBand->cyChild;
676 lprbbi->cyIntegral = lpBand->cyIntegral;
677 }
678
679 if (lprbbi->fMask & RBBIM_SIZE)
680 lprbbi->cx = lpBand->cx;
681
682 if (lprbbi->fMask & RBBIM_BACKGROUND)
683 lprbbi->hbmBack = lpBand->hbmBack;
684
685 if (lprbbi->fMask & RBBIM_ID)
686 lprbbi->wID = lpBand->wID;
687
688 /* check for additional data */
689 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
690 if (lprbbi->fMask & RBBIM_IDEALSIZE)
691 lprbbi->cxIdeal = lpBand->cxIdeal;
692
693 if (lprbbi->fMask & RBBIM_LPARAM)
694 lprbbi->lParam = lpBand->lParam;
695
696 if (lprbbi->fMask & RBBIM_HEADERSIZE)
697 lprbbi->cxHeader = lpBand->cxHeader;
698 }
699
700 return TRUE;
701}
702
703
704static LRESULT
705REBAR_GetBandInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam)
706{
707 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
708 LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam;
709 REBAR_BAND *lpBand;
710
711 if (lprbbi == NULL)
712 return FALSE;
713 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW)
714 return FALSE;
715 if ((UINT)wParam >= infoPtr->uNumBands)
716 return FALSE;
717
718// TRACE (rebar, "index %u\n", (UINT)wParam);
719
720 /* copy band information */
721 lpBand = &infoPtr->bands[(UINT)wParam];
722
723 if (lprbbi->fMask & RBBIM_STYLE)
724 lprbbi->fStyle = lpBand->fStyle;
725
726 if (lprbbi->fMask & RBBIM_COLORS) {
727 lprbbi->clrFore = lpBand->clrFore;
728 lprbbi->clrBack = lpBand->clrBack;
729 }
730
731 if ((lprbbi->fMask & RBBIM_TEXT) &&
732 (lprbbi->lpText) && (lpBand->lpText)) {
733 lstrcpynW (lprbbi->lpText, lpBand->lpText, lprbbi->cch);
734 }
735
736 if (lprbbi->fMask & RBBIM_IMAGE)
737 lprbbi->iImage = lpBand->iImage;
738
739 if (lprbbi->fMask & RBBIM_CHILD)
740 lprbbi->hwndChild = lpBand->hwndChild;
741
742 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
743 lprbbi->cxMinChild = lpBand->cxMinChild;
744 lprbbi->cyMinChild = lpBand->cyMinChild;
745 lprbbi->cyMaxChild = lpBand->cyMaxChild;
746 lprbbi->cyChild = lpBand->cyChild;
747 lprbbi->cyIntegral = lpBand->cyIntegral;
748 }
749
750 if (lprbbi->fMask & RBBIM_SIZE)
751 lprbbi->cx = lpBand->cx;
752
753 if (lprbbi->fMask & RBBIM_BACKGROUND)
754 lprbbi->hbmBack = lpBand->hbmBack;
755
756 if (lprbbi->fMask & RBBIM_ID)
757 lprbbi->wID = lpBand->wID;
758
759 /* check for additional data */
760 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
761 if (lprbbi->fMask & RBBIM_IDEALSIZE)
762 lprbbi->cxIdeal = lpBand->cxIdeal;
763
764 if (lprbbi->fMask & RBBIM_LPARAM)
765 lprbbi->lParam = lpBand->lParam;
766
767 if (lprbbi->fMask & RBBIM_HEADERSIZE)
768 lprbbi->cxHeader = lpBand->cxHeader;
769 }
770
771 return TRUE;
772}
773
774
775static LRESULT
776REBAR_GetBarHeight (HWND hwnd, WPARAM wParam, LPARAM lParam)
777{
778 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
779 INT nHeight;
780
781 REBAR_Layout (hwnd, NULL);
782 nHeight = infoPtr->calcSize.cy;
783
784 if (GetWindowLongA (hwnd, GWL_STYLE) & WS_BORDER)
785 nHeight += (2 * GetSystemMetrics(SM_CYEDGE));
786
787
788// FIXME (rebar, "height = %d\n", nHeight);
789
790 return nHeight;
791}
792
793
794static LRESULT
795REBAR_GetBarInfo (HWND hwnd, WPARAM wParam, LPARAM lParam)
796{
797 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
798 LPREBARINFO lpInfo = (LPREBARINFO)lParam;
799
800 if (lpInfo == NULL)
801 return FALSE;
802
803 if (lpInfo->cbSize < sizeof (REBARINFO))
804 return FALSE;
805
806// TRACE (rebar, "getting bar info!\n");
807
808 if (infoPtr->himl) {
809 lpInfo->himl = infoPtr->himl;
810 lpInfo->fMask |= RBIM_IMAGELIST;
811 }
812
813 return TRUE;
814}
815
816
817static LRESULT
818REBAR_GetBkColor (HWND hwnd)
819{
820 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
821
822// TRACE (rebar, "background color 0x%06lx!\n", infoPtr->clrBk);
823
824 return infoPtr->clrBk;
825}
826
827
828/* << REBAR_GetColorScheme >> */
829/* << REBAR_GetDropTarget >> */
830
831
832static LRESULT
833REBAR_GetPalette (HWND hwnd, WPARAM wParam, LPARAM lParam)
834{
835// FIXME (rebar, "empty stub!\n");
836
837 return 0;
838}
839
840
841static LRESULT
842REBAR_GetRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
843{
844 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
845 INT iBand = (INT)wParam;
846 LPRECT lprc = (LPRECT)lParam;
847 REBAR_BAND *lpBand;
848
849 if ((iBand < 0) && ((UINT)iBand >= infoPtr->uNumBands))
850 return FALSE;
851 if (!lprc)
852 return FALSE;
853
854// TRACE (rebar, "band %d\n", iBand);
855
856 lpBand = &infoPtr->bands[iBand];
857 CopyRect (lprc, &lpBand->rcBand);
858/*
859 lprc->left = lpBand->rcBand.left;
860 lprc->top = lpBand->rcBand.top;
861 lprc->right = lpBand->rcBand.right;
862 lprc->bottom = lpBand->rcBand.bottom;
863*/
864
865 return TRUE;
866}
867
868
869static LRESULT
870REBAR_GetRowCount (HWND hwnd)
871{
872 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
873
874// FIXME (rebar, "%u : semi stub!\n", infoPtr->uNumBands);
875
876 return infoPtr->uNumBands;
877}
878
879
880static LRESULT
881REBAR_GetRowHeight (HWND hwnd, WPARAM wParam, LPARAM lParam)
882{
883/* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */
884
885// FIXME (rebar, "-- height = 20: semi stub!\n");
886
887 return 20;
888}
889
890
891static LRESULT
892REBAR_GetTextColor (HWND hwnd)
893{
894 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
895
896// TRACE (rebar, "text color 0x%06lx!\n", infoPtr->clrText);
897
898 return infoPtr->clrText;
899}
900
901
902static LRESULT
903REBAR_GetToolTips (HWND hwnd)
904{
905 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
906 return infoPtr->hwndToolTip;
907}
908
909
910static LRESULT
911REBAR_GetUnicodeFormat (HWND hwnd)
912{
913 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
914 return infoPtr->bUnicode;
915}
916
917static LRESULT
918REBAR_GetVersion (HWND hwnd)
919{
920 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
921 return infoPtr->iVersion;
922}
923
924static LRESULT
925REBAR_HitTest (HWND hwnd, WPARAM wParam, LPARAM lParam)
926{
927 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */
928 LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam;
929
930 if (!lprbht)
931 return -1;
932
933 REBAR_InternalHitTest (hwnd, &lprbht->pt, &lprbht->flags, &lprbht->iBand);
934
935 return lprbht->iBand;
936}
937
938
939static LRESULT
940REBAR_IdToIndex (HWND hwnd, WPARAM wParam, LPARAM lParam)
941{
942 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
943 UINT i;
944
945 if (infoPtr == NULL)
946 return -1;
947
948 if (infoPtr->uNumBands < 1)
949 return -1;
950
951// TRACE (rebar, "id %u\n", (UINT)wParam);
952
953 for (i = 0; i < infoPtr->uNumBands; i++) {
954 if (infoPtr->bands[i].wID == (UINT)wParam) {
955// TRACE (rebar, "band %u found!\n", i);
956 return i;
957 }
958 }
959
960// TRACE (rebar, "no band found!\n");
961 return -1;
962}
963
964
965static LRESULT
966REBAR_InsertBandA (HWND hwnd, WPARAM wParam, LPARAM lParam)
967{
968 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
969 LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam;
970 UINT uIndex = (UINT)wParam;
971 REBAR_BAND *lpBand;
972
973 if (infoPtr == NULL)
974 return FALSE;
975 if (lprbbi == NULL)
976 return FALSE;
977 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA)
978 return FALSE;
979
980// TRACE (rebar, "insert band at %u!\n", uIndex);
981
982 if (infoPtr->uNumBands == 0) {
983 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));
984 uIndex = 0;
985 }
986 else {
987 REBAR_BAND *oldBands = infoPtr->bands;
988 infoPtr->bands =
989 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
990 if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))
991 uIndex = infoPtr->uNumBands;
992
993 /* pre insert copy */
994 if (uIndex > 0) {
995 memcpy (&infoPtr->bands[0], &oldBands[0],
996 uIndex * sizeof(REBAR_BAND));
997 }
998
999 /* post copy */
1000 if (uIndex < infoPtr->uNumBands - 1) {
1001 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],
1002 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));
1003 }
1004
1005 COMCTL32_Free (oldBands);
1006 }
1007
1008 infoPtr->uNumBands++;
1009
1010// TRACE (rebar, "index %u!\n", uIndex);
1011
1012 /* initialize band (infoPtr->bands[uIndex])*/
1013 lpBand = &infoPtr->bands[uIndex];
1014
1015 if (lprbbi->fMask & RBBIM_STYLE)
1016 lpBand->fStyle = lprbbi->fStyle;
1017
1018 if (lprbbi->fMask & RBBIM_COLORS) {
1019 lpBand->clrFore = lprbbi->clrFore;
1020 lpBand->clrBack = lprbbi->clrBack;
1021 }
1022 else {
1023 lpBand->clrFore = CLR_NONE;
1024 lpBand->clrBack = CLR_NONE;
1025 }
1026
1027 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
1028 INT len = lstrlenA (lprbbi->lpText);
1029 if (len > 0) {
1030 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
1031 lstrcpyAtoW (lpBand->lpText, lprbbi->lpText);
1032 }
1033 }
1034
1035 if (lprbbi->fMask & RBBIM_IMAGE)
1036 lpBand->iImage = lprbbi->iImage;
1037 else
1038 lpBand->iImage = -1;
1039
1040 if (lprbbi->fMask & RBBIM_CHILD) {
1041// TRACE (rebar, "hwndChild = %x\n", lprbbi->hwndChild);
1042 lpBand->hwndChild = lprbbi->hwndChild;
1043 lpBand->hwndPrevParent =
1044 SetParent (lpBand->hwndChild, hwnd);
1045 }
1046
1047 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
1048 lpBand->cxMinChild = lprbbi->cxMinChild;
1049 lpBand->cyMinChild = lprbbi->cyMinChild;
1050 lpBand->cyMaxChild = lprbbi->cyMaxChild;
1051 lpBand->cyChild = lprbbi->cyChild;
1052 lpBand->cyIntegral = lprbbi->cyIntegral;
1053 }
1054 else {
1055 lpBand->cxMinChild = -1;
1056 lpBand->cyMinChild = -1;
1057 lpBand->cyMaxChild = -1;
1058 lpBand->cyChild = -1;
1059 lpBand->cyIntegral = -1;
1060 }
1061
1062 if (lprbbi->fMask & RBBIM_SIZE)
1063 lpBand->cx = lprbbi->cx;
1064 else
1065 lpBand->cx = -1;
1066
1067 if (lprbbi->fMask & RBBIM_BACKGROUND)
1068 lpBand->hbmBack = lprbbi->hbmBack;
1069
1070 if (lprbbi->fMask & RBBIM_ID)
1071 lpBand->wID = lprbbi->wID;
1072
1073 /* check for additional data */
1074 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
1075 if (lprbbi->fMask & RBBIM_IDEALSIZE)
1076 lpBand->cxIdeal = lprbbi->cxIdeal;
1077
1078 if (lprbbi->fMask & RBBIM_LPARAM)
1079 lpBand->lParam = lprbbi->lParam;
1080
1081 if (lprbbi->fMask & RBBIM_HEADERSIZE)
1082 lpBand->cxHeader = lprbbi->cxHeader;
1083 }
1084
1085
1086 REBAR_Layout (hwnd, NULL);
1087 REBAR_ForceResize (hwnd);
1088 REBAR_MoveChildWindows (hwnd);
1089
1090 return TRUE;
1091}
1092
1093
1094static LRESULT
1095REBAR_InsertBandW (HWND hwnd, WPARAM wParam, LPARAM lParam)
1096{
1097 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1098 LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam;
1099 UINT uIndex = (UINT)wParam;
1100 REBAR_BAND *lpBand;
1101
1102 if (infoPtr == NULL)
1103 return FALSE;
1104 if (lprbbi == NULL)
1105 return FALSE;
1106 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW)
1107 return FALSE;
1108
1109// TRACE (rebar, "insert band at %u!\n", uIndex);
1110
1111 if (infoPtr->uNumBands == 0) {
1112 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));
1113 uIndex = 0;
1114 }
1115 else {
1116 REBAR_BAND *oldBands = infoPtr->bands;
1117 infoPtr->bands =
1118 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
1119 if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))
1120 uIndex = infoPtr->uNumBands;
1121
1122 /* pre insert copy */
1123 if (uIndex > 0) {
1124 memcpy (&infoPtr->bands[0], &oldBands[0],
1125 uIndex * sizeof(REBAR_BAND));
1126 }
1127
1128 /* post copy */
1129 if (uIndex < infoPtr->uNumBands - 1) {
1130 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],
1131 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));
1132 }
1133
1134 COMCTL32_Free (oldBands);
1135 }
1136
1137 infoPtr->uNumBands++;
1138
1139// TRACE (rebar, "index %u!\n", uIndex);
1140
1141 /* initialize band (infoPtr->bands[uIndex])*/
1142 lpBand = &infoPtr->bands[uIndex];
1143
1144 if (lprbbi->fMask & RBBIM_STYLE)
1145 lpBand->fStyle = lprbbi->fStyle;
1146
1147 if (lprbbi->fMask & RBBIM_COLORS) {
1148 lpBand->clrFore = lprbbi->clrFore;
1149 lpBand->clrBack = lprbbi->clrBack;
1150 }
1151 else {
1152 lpBand->clrFore = CLR_NONE;
1153 lpBand->clrBack = CLR_NONE;
1154 }
1155
1156 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
1157 INT len = lstrlenW (lprbbi->lpText);
1158 if (len > 0) {
1159 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
1160 lstrcpyW (lpBand->lpText, lprbbi->lpText);
1161 }
1162 }
1163
1164 if (lprbbi->fMask & RBBIM_IMAGE)
1165 lpBand->iImage = lprbbi->iImage;
1166 else
1167 lpBand->iImage = -1;
1168
1169 if (lprbbi->fMask & RBBIM_CHILD) {
1170// TRACE (rebar, "hwndChild = %x\n", lprbbi->hwndChild);
1171 lpBand->hwndChild = lprbbi->hwndChild;
1172 lpBand->hwndPrevParent =
1173 SetParent (lpBand->hwndChild, hwnd);
1174 }
1175
1176 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
1177 lpBand->cxMinChild = lprbbi->cxMinChild;
1178 lpBand->cyMinChild = lprbbi->cyMinChild;
1179 lpBand->cyMaxChild = lprbbi->cyMaxChild;
1180 lpBand->cyChild = lprbbi->cyChild;
1181 lpBand->cyIntegral = lprbbi->cyIntegral;
1182 }
1183 else {
1184 lpBand->cxMinChild = -1;
1185 lpBand->cyMinChild = -1;
1186 lpBand->cyMaxChild = -1;
1187 lpBand->cyChild = -1;
1188 lpBand->cyIntegral = -1;
1189 }
1190
1191 if (lprbbi->fMask & RBBIM_SIZE)
1192 lpBand->cx = lprbbi->cx;
1193 else
1194 lpBand->cx = -1;
1195
1196 if (lprbbi->fMask & RBBIM_BACKGROUND)
1197 lpBand->hbmBack = lprbbi->hbmBack;
1198
1199 if (lprbbi->fMask & RBBIM_ID)
1200 lpBand->wID = lprbbi->wID;
1201
1202 /* check for additional data */
1203 if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) {
1204 if (lprbbi->fMask & RBBIM_IDEALSIZE)
1205 lpBand->cxIdeal = lprbbi->cxIdeal;
1206
1207 if (lprbbi->fMask & RBBIM_LPARAM)
1208 lpBand->lParam = lprbbi->lParam;
1209
1210 if (lprbbi->fMask & RBBIM_HEADERSIZE)
1211 lpBand->cxHeader = lprbbi->cxHeader;
1212 }
1213
1214
1215 REBAR_Layout (hwnd, NULL);
1216 REBAR_ForceResize (hwnd);
1217 REBAR_MoveChildWindows (hwnd);
1218
1219 return TRUE;
1220}
1221
1222
1223static LRESULT
1224REBAR_MaximizeBand (HWND hwnd, WPARAM wParam, LPARAM lParam)
1225{
1226/* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */
1227
1228// FIXME (rebar, "(uBand = %u fIdeal = %s)\n",
1229// (UINT)wParam, lParam ? "TRUE" : "FALSE");
1230
1231
1232 return 0;
1233}
1234
1235
1236static LRESULT
1237REBAR_MinimizeBand (HWND hwnd, WPARAM wParam, LPARAM lParam)
1238{
1239/* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */
1240
1241// FIXME (rebar, "(uBand = %u)\n", (UINT)wParam);
1242
1243
1244 return 0;
1245}
1246
1247
1248static LRESULT
1249REBAR_MoveBand (HWND hwnd, WPARAM wParam, LPARAM lParam)
1250{
1251/* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */
1252
1253// FIXME (rebar, "(iFrom = %u iTof = %u)\n",
1254// (UINT)wParam, (UINT)lParam);
1255
1256
1257 return FALSE;
1258}
1259
1260
1261static LRESULT
1262REBAR_SetBandInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam)
1263{
1264 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1265 LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam;
1266 REBAR_BAND *lpBand;
1267
1268 if (lprbbi == NULL)
1269 return FALSE;
1270 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA)
1271 return FALSE;
1272 if ((UINT)wParam >= infoPtr->uNumBands)
1273 return FALSE;
1274
1275// TRACE (rebar, "index %u\n", (UINT)wParam);
1276
1277 /* set band information */
1278 lpBand = &infoPtr->bands[(UINT)wParam];
1279
1280 if (lprbbi->fMask & RBBIM_STYLE)
1281 lpBand->fStyle = lprbbi->fStyle;
1282
1283 if (lprbbi->fMask & RBBIM_COLORS) {
1284 lpBand->clrFore = lprbbi->clrFore;
1285 lpBand->clrBack = lprbbi->clrBack;
1286 }
1287
1288 if (lprbbi->fMask & RBBIM_TEXT) {
1289 if (lpBand->lpText) {
1290 COMCTL32_Free (lpBand->lpText);
1291 lpBand->lpText = NULL;
1292 }
1293 if (lprbbi->lpText) {
1294 INT len = lstrlenA (lprbbi->lpText);
1295 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
1296 lstrcpyAtoW (lpBand->lpText, lprbbi->lpText);
1297 }
1298 }
1299
1300 if (lprbbi->fMask & RBBIM_IMAGE)
1301 lpBand->iImage = lprbbi->iImage;
1302
1303 if (lprbbi->fMask & RBBIM_CHILD) {
1304 if (lprbbi->hwndChild) {
1305 lpBand->hwndChild = lprbbi->hwndChild;
1306 lpBand->hwndPrevParent =
1307 SetParent (lpBand->hwndChild, hwnd);
1308 }
1309 else {
1310// TRACE (rebar, "child: 0x%x prev parent: 0x%x\n",
1311// lpBand->hwndChild, lpBand->hwndPrevParent);
1312 lpBand->hwndChild = 0;
1313 lpBand->hwndPrevParent = 0;
1314 }
1315 }
1316
1317 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
1318 lpBand->cxMinChild = lprbbi->cxMinChild;
1319 lpBand->cyMinChild = lprbbi->cyMinChild;
1320 lpBand->cyMaxChild = lprbbi->cyMaxChild;
1321 lpBand->cyChild = lprbbi->cyChild;
1322 lpBand->cyIntegral = lprbbi->cyIntegral;
1323 }
1324
1325 if (lprbbi->fMask & RBBIM_SIZE)
1326 lpBand->cx = lprbbi->cx;
1327
1328 if (lprbbi->fMask & RBBIM_BACKGROUND)
1329 lpBand->hbmBack = lprbbi->hbmBack;
1330
1331 if (lprbbi->fMask & RBBIM_ID)
1332 lpBand->wID = lprbbi->wID;
1333
1334 /* check for additional data */
1335 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
1336 if (lprbbi->fMask & RBBIM_IDEALSIZE)
1337 lpBand->cxIdeal = lprbbi->cxIdeal;
1338
1339 if (lprbbi->fMask & RBBIM_LPARAM)
1340 lpBand->lParam = lprbbi->lParam;
1341
1342 if (lprbbi->fMask & RBBIM_HEADERSIZE)
1343 lpBand->cxHeader = lprbbi->cxHeader;
1344 }
1345
1346 REBAR_Layout (hwnd, NULL);
1347 REBAR_ForceResize (hwnd);
1348 REBAR_MoveChildWindows (hwnd);
1349
1350 return TRUE;
1351}
1352
1353
1354static LRESULT
1355REBAR_SetBandInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam)
1356{
1357 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1358 LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam;
1359 REBAR_BAND *lpBand;
1360
1361 if (lprbbi == NULL)
1362 return FALSE;
1363 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW)
1364 return FALSE;
1365 if ((UINT)wParam >= infoPtr->uNumBands)
1366 return FALSE;
1367
1368// TRACE (rebar, "index %u\n", (UINT)wParam);
1369
1370 /* set band information */
1371 lpBand = &infoPtr->bands[(UINT)wParam];
1372
1373 if (lprbbi->fMask & RBBIM_STYLE)
1374 lpBand->fStyle = lprbbi->fStyle;
1375
1376 if (lprbbi->fMask & RBBIM_COLORS) {
1377 lpBand->clrFore = lprbbi->clrFore;
1378 lpBand->clrBack = lprbbi->clrBack;
1379 }
1380
1381 if (lprbbi->fMask & RBBIM_TEXT) {
1382 if (lpBand->lpText) {
1383 COMCTL32_Free (lpBand->lpText);
1384 lpBand->lpText = NULL;
1385 }
1386 if (lprbbi->lpText) {
1387 INT len = lstrlenW (lprbbi->lpText);
1388 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
1389 lstrcpyW (lpBand->lpText, lprbbi->lpText);
1390 }
1391 }
1392
1393 if (lprbbi->fMask & RBBIM_IMAGE)
1394 lpBand->iImage = lprbbi->iImage;
1395
1396 if (lprbbi->fMask & RBBIM_CHILD) {
1397 if (lprbbi->hwndChild) {
1398 lpBand->hwndChild = lprbbi->hwndChild;
1399 lpBand->hwndPrevParent =
1400 SetParent (lpBand->hwndChild, hwnd);
1401 }
1402 else {
1403// TRACE (rebar, "child: 0x%x prev parent: 0x%x\n",
1404// lpBand->hwndChild, lpBand->hwndPrevParent);
1405 lpBand->hwndChild = 0;
1406 lpBand->hwndPrevParent = 0;
1407 }
1408 }
1409
1410 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
1411 lpBand->cxMinChild = lprbbi->cxMinChild;
1412 lpBand->cyMinChild = lprbbi->cyMinChild;
1413 lpBand->cyMaxChild = lprbbi->cyMaxChild;
1414 lpBand->cyChild = lprbbi->cyChild;
1415 lpBand->cyIntegral = lprbbi->cyIntegral;
1416 }
1417
1418 if (lprbbi->fMask & RBBIM_SIZE)
1419 lpBand->cx = lprbbi->cx;
1420
1421 if (lprbbi->fMask & RBBIM_BACKGROUND)
1422 lpBand->hbmBack = lprbbi->hbmBack;
1423
1424 if (lprbbi->fMask & RBBIM_ID)
1425 lpBand->wID = lprbbi->wID;
1426
1427 /* check for additional data */
1428 if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) {
1429 if (lprbbi->fMask & RBBIM_IDEALSIZE)
1430 lpBand->cxIdeal = lprbbi->cxIdeal;
1431
1432 if (lprbbi->fMask & RBBIM_LPARAM)
1433 lpBand->lParam = lprbbi->lParam;
1434
1435 if (lprbbi->fMask & RBBIM_HEADERSIZE)
1436 lpBand->cxHeader = lprbbi->cxHeader;
1437 }
1438
1439 REBAR_Layout (hwnd, NULL);
1440 REBAR_ForceResize (hwnd);
1441 REBAR_MoveChildWindows (hwnd);
1442
1443 return TRUE;
1444}
1445
1446
1447static LRESULT
1448REBAR_SetBarInfo (HWND hwnd, WPARAM wParam, LPARAM lParam)
1449{
1450 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1451 LPREBARINFO lpInfo = (LPREBARINFO)lParam;
1452
1453 if (lpInfo == NULL)
1454 return FALSE;
1455
1456 if (lpInfo->cbSize < sizeof (REBARINFO))
1457 return FALSE;
1458
1459// TRACE (rebar, "setting bar info!\n");
1460
1461 if (lpInfo->fMask & RBIM_IMAGELIST) {
1462 infoPtr->himl = lpInfo->himl;
1463 if (infoPtr->himl) {
1464 ImageList_GetIconSize (infoPtr->himl, &infoPtr->imageSize.cx,
1465 &infoPtr->imageSize.cy);
1466 }
1467 else {
1468 infoPtr->imageSize.cx = 0;
1469 infoPtr->imageSize.cy = 0;
1470 }
1471 }
1472
1473 return TRUE;
1474}
1475
1476
1477static LRESULT
1478REBAR_SetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
1479{
1480 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1481 COLORREF clrTemp;
1482
1483 clrTemp = infoPtr->clrBk;
1484 infoPtr->clrBk = (COLORREF)lParam;
1485
1486// TRACE (rebar, "background color 0x%06lx!\n", infoPtr->clrBk);
1487
1488 return clrTemp;
1489}
1490
1491
1492/* << REBAR_SetColorScheme >> */
1493/* << REBAR_SetPalette >> */
1494
1495
1496static LRESULT
1497REBAR_SetParent (HWND hwnd, WPARAM wParam, LPARAM lParam)
1498{
1499 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1500 HWND hwndTemp = infoPtr->hwndNotify;
1501
1502 infoPtr->hwndNotify = (HWND)wParam;
1503
1504 return (LRESULT)hwndTemp;
1505}
1506
1507
1508static LRESULT
1509REBAR_SetTextColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
1510{
1511 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1512 COLORREF clrTemp;
1513
1514 clrTemp = infoPtr->clrText;
1515 infoPtr->clrText = (COLORREF)lParam;
1516
1517// TRACE (rebar, "text color 0x%06lx!\n", infoPtr->clrText);
1518
1519 return clrTemp;
1520}
1521
1522
1523/* << REBAR_SetTooltips >> */
1524
1525
1526static LRESULT
1527REBAR_SetUnicodeFormat (HWND hwnd, WPARAM wParam)
1528{
1529 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1530 BOOL bTemp = infoPtr->bUnicode;
1531 infoPtr->bUnicode = (BOOL)wParam;
1532 return bTemp;
1533}
1534
1535static LRESULT
1536REBAR_SetVersion (HWND hwnd, INT iVersion)
1537{
1538 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1539 INT iOldVersion = infoPtr->iVersion;
1540
1541 if (iVersion > COMCTL32_VERSION)
1542 return -1;
1543
1544 infoPtr->iVersion = iVersion;
1545
1546 return iOldVersion;
1547}
1548
1549static LRESULT
1550REBAR_ShowBand (HWND hwnd, WPARAM wParam, LPARAM lParam)
1551{
1552 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1553 REBAR_BAND *lpBand;
1554
1555 if (((INT)wParam < 0) || ((INT)wParam > infoPtr->uNumBands))
1556 return FALSE;
1557
1558 lpBand = &infoPtr->bands[(INT)wParam];
1559
1560 if ((BOOL)lParam) {
1561// TRACE (rebar, "show band %d\n", (INT)wParam);
1562 lpBand->fStyle = lpBand->fStyle & ~RBBS_HIDDEN;
1563 if (IsWindow (lpBand->hwndChild))
1564 ShowWindow (lpBand->hwndChild, SW_SHOW);
1565 }
1566 else {
1567// TRACE (rebar, "hide band %d\n", (INT)wParam);
1568 lpBand->fStyle = lpBand->fStyle | RBBS_HIDDEN;
1569 if (IsWindow (lpBand->hwndChild))
1570 ShowWindow (lpBand->hwndChild, SW_SHOW);
1571 }
1572
1573 REBAR_Layout (hwnd, NULL);
1574 REBAR_ForceResize (hwnd);
1575 REBAR_MoveChildWindows (hwnd);
1576
1577 return TRUE;
1578}
1579
1580
1581static LRESULT
1582REBAR_SizeToRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
1583{
1584 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1585 LPRECT lpRect = (LPRECT)lParam;
1586
1587 if (lpRect == NULL)
1588 return FALSE;
1589
1590// FIXME (rebar, "layout change not implemented!\n");
1591// FIXME (rebar, "[%d %d %d %d]\n",
1592// lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
1593
1594#if 0
1595 SetWindowPos (hwnd, 0, lpRect->left, lpRect->top,
1596 lpRect->right - lpRect->left, lpRect->bottom - lpRect->top,
1597 SWP_NOZORDER);
1598#endif
1599
1600 infoPtr->calcSize.cx = lpRect->right - lpRect->left;
1601 infoPtr->calcSize.cy = lpRect->bottom - lpRect->top;
1602
1603 REBAR_ForceResize (hwnd);
1604 return TRUE;
1605}
1606
1607
1608
1609static LRESULT
1610REBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
1611{
1612 REBAR_INFO *infoPtr;
1613
1614 /* allocate memory for info structure */
1615 infoPtr = (REBAR_INFO *)COMCTL32_Alloc (sizeof(REBAR_INFO));
1616 SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
1617
1618 /* initialize info structure */
1619 infoPtr->iVersion = 0;
1620 infoPtr->clrBk = CLR_NONE;
1621 infoPtr->clrText = RGB(0, 0, 0);
1622
1623 infoPtr->bAutoResize = FALSE;
1624 infoPtr->hcurArrow = LoadCursorA (0, IDC_ARROWA);
1625 infoPtr->hcurHorz = LoadCursorA (0, IDC_SIZEWEA);
1626 infoPtr->hcurVert = LoadCursorA (0, IDC_SIZENSA);
1627 infoPtr->hcurDrag = LoadCursorA (0, IDC_SIZEA);
1628
1629 infoPtr->bUnicode = IsWindowUnicode (hwnd);
1630
1631// if (GetWindowLongA (hwnd, GWL_STYLE) & RBS_AUTOSIZE)
1632// FIXME (rebar, "style RBS_AUTOSIZE set!\n");
1633
1634#if 0
1635 SendMessageA (hwnd, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
1636#endif
1637
1638// TRACE (rebar, "created!\n");
1639 return 0;
1640}
1641
1642
1643static LRESULT
1644REBAR_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
1645{
1646 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1647 REBAR_BAND *lpBand;
1648 INT i;
1649
1650
1651 /* free rebar bands */
1652 if ((infoPtr->uNumBands > 0) && infoPtr->bands) {
1653 /* clean up each band */
1654 for (i = 0; i < infoPtr->uNumBands; i++) {
1655 lpBand = &infoPtr->bands[i];
1656
1657 /* delete text strings */
1658 if (lpBand->lpText) {
1659 COMCTL32_Free (lpBand->lpText);
1660 lpBand->lpText = NULL;
1661 }
1662 /* destroy child window */
1663 DestroyWindow (lpBand->hwndChild);
1664 }
1665
1666 /* free band array */
1667 COMCTL32_Free (infoPtr->bands);
1668 infoPtr->bands = NULL;
1669 }
1670
1671
1672
1673
1674 DeleteObject (infoPtr->hcurArrow);
1675 DeleteObject (infoPtr->hcurHorz);
1676 DeleteObject (infoPtr->hcurVert);
1677 DeleteObject (infoPtr->hcurDrag);
1678
1679
1680
1681
1682 /* free rebar info data */
1683 COMCTL32_Free (infoPtr);
1684
1685// TRACE (rebar, "destroyed!\n");
1686 return 0;
1687}
1688
1689
1690static LRESULT
1691REBAR_GetFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
1692{
1693 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1694
1695 return (LRESULT)infoPtr->hFont;
1696}
1697
1698
1699#if 0
1700static LRESULT
1701REBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
1702{
1703 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1704
1705 return 0;
1706}
1707#endif
1708
1709
1710static LRESULT
1711REBAR_NCCalcSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
1712{
1713 if (GetWindowLongA (hwnd, GWL_STYLE) & WS_BORDER) {
1714 ((LPRECT)lParam)->left += GetSystemMetrics(SM_CXEDGE);
1715 ((LPRECT)lParam)->top += GetSystemMetrics(SM_CYEDGE);
1716 ((LPRECT)lParam)->right -= GetSystemMetrics(SM_CXEDGE);
1717 ((LPRECT)lParam)->bottom -= GetSystemMetrics(SM_CYEDGE);
1718 }
1719
1720 return 0;
1721}
1722
1723
1724static LRESULT
1725REBAR_NCPaint (HWND hwnd, WPARAM wParam, LPARAM lParam)
1726{
1727 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
1728 RECT rcWindow;
1729 HDC hdc;
1730
1731 if (dwStyle & WS_MINIMIZE)
1732 return 0; /* Nothing to do */
1733
1734 DefWindowProcA (hwnd, WM_NCPAINT, wParam, lParam);
1735
1736 if (!(hdc = GetDCEx( hwnd, 0, DCX_USESTYLE | DCX_WINDOW )))
1737 return 0;
1738
1739 if (dwStyle & WS_BORDER) {
1740 GetWindowRect (hwnd, &rcWindow);
1741 OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);
1742 DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_RECT);
1743 }
1744
1745 ReleaseDC( hwnd, hdc );
1746
1747 return 0;
1748}
1749
1750
1751static LRESULT
1752REBAR_Paint (HWND hwnd, WPARAM wParam)
1753{
1754 HDC hdc;
1755 PAINTSTRUCT ps;
1756
1757 hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam;
1758 REBAR_Refresh (hwnd, hdc);
1759 if (!wParam)
1760 EndPaint (hwnd, &ps);
1761 return 0;
1762}
1763
1764
1765static LRESULT
1766REBAR_SetCursor (HWND hwnd, WPARAM wParam, LPARAM lParam)
1767{
1768 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1769 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
1770 POINT pt;
1771 UINT flags;
1772
1773// TRACE (rebar, "code=0x%X id=0x%X\n", LOWORD(lParam), HIWORD(lParam));
1774
1775 GetCursorPos (&pt);
1776 ScreenToClient (hwnd, &pt);
1777
1778 REBAR_InternalHitTest (hwnd, &pt, &flags, NULL);
1779
1780 if (flags == RBHT_GRABBER) {
1781 if ((dwStyle & CCS_VERT) &&
1782 !(dwStyle & RBS_VERTICALGRIPPER))
1783 SetCursor (infoPtr->hcurVert);
1784 else
1785 SetCursor (infoPtr->hcurHorz);
1786 }
1787 else if (flags != RBHT_CLIENT)
1788 SetCursor (infoPtr->hcurArrow);
1789 //CB: else not handled -> cursor not changed
1790
1791 return TRUE;
1792}
1793
1794
1795static LRESULT
1796REBAR_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
1797{
1798 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1799
1800 /* TEXTMETRIC32A tm; */
1801 HFONT hFont /*, hOldFont */;
1802 /* HDC32 hdc; */
1803
1804 infoPtr->hFont = (HFONT)wParam;
1805
1806 hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject (SYSTEM_FONT);
1807/*
1808 hdc = GetDC32 (0);
1809 hOldFont = SelectObject32 (hdc, hFont);
1810 GetTextMetrics32A (hdc, &tm);
1811 infoPtr->nHeight = tm.tmHeight + VERT_BORDER;
1812 SelectObject32 (hdc, hOldFont);
1813 ReleaseDC32 (0, hdc);
1814*/
1815 if (lParam) {
1816/*
1817 REBAR_Layout (hwnd);
1818 hdc = GetDC32 (hwnd);
1819 REBAR_Refresh (hwnd, hdc);
1820 ReleaseDC32 (hwnd, hdc);
1821*/
1822 }
1823
1824 return 0;
1825}
1826
1827static LRESULT
1828REBAR_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
1829{
1830 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1831 /* DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); */
1832 RECT rcParent;
1833 /* INT32 x, y, cx, cy; */
1834
1835 /* auto resize deadlock check */
1836 if (infoPtr->bAutoResize) {
1837 infoPtr->bAutoResize = FALSE;
1838 return 0;
1839 }
1840
1841// TRACE (rebar, "sizing rebar!\n");
1842
1843 /* get parent rectangle */
1844 GetClientRect (GetParent (hwnd), &rcParent);
1845/*
1846 REBAR_Layout (hwnd, &rcParent);
1847
1848 if (dwStyle & CCS_VERT) {
1849 if (dwStyle & CCS_LEFT == CCS_LEFT) {
1850 x = rcParent.left;
1851 y = rcParent.top;
1852 cx = infoPtr->calcSize.cx;
1853 cy = infoPtr->calcSize.cy;
1854 }
1855 else {
1856 x = rcParent.right - infoPtr->calcSize.cx;
1857 y = rcParent.top;
1858 cx = infoPtr->calcSize.cx;
1859 cy = infoPtr->calcSize.cy;
1860 }
1861 }
1862 else {
1863 if (dwStyle & CCS_TOP) {
1864 x = rcParent.left;
1865 y = rcParent.top;
1866 cx = infoPtr->calcSize.cx;
1867 cy = infoPtr->calcSize.cy;
1868 }
1869 else {
1870 x = rcParent.left;
1871 y = rcParent.bottom - infoPtr->calcSize.cy;
1872 cx = infoPtr->calcSize.cx;
1873 cy = infoPtr->calcSize.cy;
1874 }
1875 }
1876
1877 SetWindowPos32 (hwnd, 0, x, y, cx, cy,
1878 SWP_NOZORDER | SWP_SHOWWINDOW);
1879*/
1880 REBAR_Layout (hwnd, NULL);
1881 REBAR_ForceResize (hwnd);
1882 REBAR_MoveChildWindows (hwnd);
1883
1884 return 0;
1885}
1886
1887
1888static LRESULT WINAPI
1889REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
1890{
1891 switch (uMsg)
1892 {
1893/* case RB_BEGINDRAG: */
1894
1895 case RB_DELETEBAND:
1896 return REBAR_DeleteBand (hwnd, wParam, lParam);
1897
1898/* case RB_DRAGMOVE: */
1899/* case RB_ENDDRAG: */
1900
1901 case RB_GETBANDBORDERS:
1902 return REBAR_GetBandBorders (hwnd, wParam, lParam);
1903
1904 case RB_GETBANDCOUNT:
1905 return REBAR_GetBandCount (hwnd);
1906
1907/* case RB_GETBANDINFO32: */ /* outdated, just for compatibility */
1908
1909 case RB_GETBANDINFOA:
1910 return REBAR_GetBandInfoA (hwnd, wParam, lParam);
1911
1912 case RB_GETBANDINFOW:
1913 return REBAR_GetBandInfoW (hwnd, wParam, lParam);
1914
1915 case RB_GETBARHEIGHT:
1916 return REBAR_GetBarHeight (hwnd, wParam, lParam);
1917
1918 case RB_GETBARINFO:
1919 return REBAR_GetBarInfo (hwnd, wParam, lParam);
1920
1921 case RB_GETBKCOLOR:
1922 return REBAR_GetBkColor (hwnd);
1923
1924/* case RB_GETCOLORSCHEME: */
1925/* case RB_GETDROPTARGET: */
1926
1927 case RB_GETPALETTE:
1928 return REBAR_GetPalette (hwnd, wParam, lParam);
1929
1930 case RB_GETRECT:
1931 return REBAR_GetRect (hwnd, wParam, lParam);
1932
1933 case RB_GETROWCOUNT:
1934 return REBAR_GetRowCount (hwnd);
1935
1936 case RB_GETROWHEIGHT:
1937 return REBAR_GetRowHeight (hwnd, wParam, lParam);
1938
1939 case RB_GETTEXTCOLOR:
1940 return REBAR_GetTextColor (hwnd);
1941
1942 case RB_GETTOOLTIPS:
1943 return REBAR_GetToolTips (hwnd);
1944
1945 case RB_GETUNICODEFORMAT:
1946 return REBAR_GetUnicodeFormat (hwnd);
1947
1948 case CCM_GETVERSION:
1949 return REBAR_GetVersion (hwnd);
1950
1951 case RB_HITTEST:
1952 return REBAR_HitTest (hwnd, wParam, lParam);
1953
1954 case RB_IDTOINDEX:
1955 return REBAR_IdToIndex (hwnd, wParam, lParam);
1956
1957 case RB_INSERTBANDA:
1958 return REBAR_InsertBandA (hwnd, wParam, lParam);
1959
1960 case RB_INSERTBANDW:
1961 return REBAR_InsertBandW (hwnd, wParam, lParam);
1962
1963 case RB_MAXIMIZEBAND:
1964 return REBAR_MaximizeBand (hwnd, wParam, lParam);
1965
1966 case RB_MINIMIZEBAND:
1967 return REBAR_MinimizeBand (hwnd, wParam, lParam);
1968
1969 case RB_MOVEBAND:
1970 return REBAR_MoveBand (hwnd, wParam, lParam);
1971
1972 case RB_SETBANDINFOA:
1973 return REBAR_SetBandInfoA (hwnd, wParam, lParam);
1974
1975 case RB_SETBANDINFOW:
1976 return REBAR_SetBandInfoW (hwnd, wParam, lParam);
1977
1978 case RB_SETBARINFO:
1979 return REBAR_SetBarInfo (hwnd, wParam, lParam);
1980
1981 case RB_SETBKCOLOR:
1982 return REBAR_SetBkColor (hwnd, wParam, lParam);
1983
1984/* case RB_SETCOLORSCHEME: */
1985/* case RB_SETPALETTE: */
1986/* return REBAR_GetPalette (hwnd, wParam, lParam); */
1987
1988 case RB_SETPARENT:
1989 return REBAR_SetParent (hwnd, wParam, lParam);
1990
1991 case RB_SETTEXTCOLOR:
1992 return REBAR_SetTextColor (hwnd, wParam, lParam);
1993
1994/* case RB_SETTOOLTIPS: */
1995
1996 case RB_SETUNICODEFORMAT:
1997 return REBAR_SetUnicodeFormat (hwnd, wParam);
1998
1999 case CCM_SETVERSION:
2000 return REBAR_SetVersion (hwnd, (INT)wParam);
2001
2002 case RB_SHOWBAND:
2003 return REBAR_ShowBand (hwnd, wParam, lParam);
2004
2005 case RB_SIZETORECT:
2006 return REBAR_SizeToRect (hwnd, wParam, lParam);
2007
2008
2009 case WM_COMMAND:
2010 return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam);
2011
2012 case WM_CREATE:
2013 return REBAR_Create (hwnd, wParam, lParam);
2014
2015 case WM_DESTROY:
2016 return REBAR_Destroy (hwnd, wParam, lParam);
2017
2018 case WM_GETFONT:
2019 return REBAR_GetFont (hwnd, wParam, lParam);
2020
2021/* case WM_MOUSEMOVE: */
2022/* return REBAR_MouseMove (hwnd, wParam, lParam); */
2023
2024 case WM_NCCALCSIZE:
2025 return REBAR_NCCalcSize (hwnd, wParam, lParam);
2026
2027 case WM_NCPAINT:
2028 return REBAR_NCPaint (hwnd, wParam, lParam);
2029
2030 case WM_NOTIFY:
2031 return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam);
2032
2033 case WM_PAINT:
2034 return REBAR_Paint (hwnd, wParam);
2035
2036 case WM_SETCURSOR:
2037 return REBAR_SetCursor (hwnd, wParam, lParam);
2038
2039 case WM_SETFONT:
2040 return REBAR_SetFont (hwnd, wParam, lParam);
2041
2042 case WM_SIZE:
2043 return REBAR_Size (hwnd, wParam, lParam);
2044
2045/* case WM_TIMER: */
2046
2047/* case WM_WININICHANGE: */
2048
2049 default:
2050// if (uMsg >= WM_USER)
2051// ERR (rebar, "unknown msg %04x wp=%08x lp=%08lx\n",
2052// uMsg, wParam, lParam);
2053 return DefWindowProcA (hwnd, uMsg, wParam, lParam);
2054 }
2055 return 0;
2056}
2057
2058
2059VOID
2060REBAR_Register (VOID)
2061{
2062 WNDCLASSA wndClass;
2063
2064//SvL: Don't check this now
2065// if (GlobalFindAtomA (REBARCLASSNAMEA)) return;
2066
2067 ZeroMemory (&wndClass, sizeof(WNDCLASSA));
2068 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
2069 wndClass.lpfnWndProc = (WNDPROC)REBAR_WindowProc;
2070 wndClass.cbClsExtra = 0;
2071 wndClass.cbWndExtra = sizeof(REBAR_INFO *);
2072 wndClass.hCursor = 0;
2073 wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
2074 wndClass.lpszClassName = REBARCLASSNAMEA;
2075
2076 RegisterClassA (&wndClass);
2077}
2078
2079
2080VOID
2081REBAR_Unregister (VOID)
2082{
2083 if (GlobalFindAtomA (REBARCLASSNAMEA))
2084 UnregisterClassA (REBARCLASSNAMEA, (HINSTANCE)NULL);
2085}
2086
Note: See TracBrowser for help on using the repository browser.