source: trunk/src/comctl32/rebar.c@ 60

Last change on this file since 60 was 60, checked in by achimha, 26 years ago

* empty log message *

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