Fixes for FreeBSD.
[wine] / dlls / comctl32 / rebar.c
1 /*
2  * Rebar control
3  *
4  * Copyright 1998 Eric Kohl
5  *
6  * NOTES
7  *   This is just a dummy control. An author is needed! Any volunteers?
8  *   I will only improve this control once in a while.
9  *     Eric <ekohl@abo.rhein-zeitung.de>
10  *
11  * TODO:
12  *   - All messages.
13  *   - All notifications.
14  */
15
16 #include "windows.h"
17 #include "commctrl.h"
18 #include "rebar.h"
19 #include "win.h"
20 #include "debug.h"
21
22
23 #define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)wndPtr->wExtra[0])
24
25
26
27
28 static VOID
29 REBAR_Refresh (WND *wndPtr, HDC32 hdc)
30 {
31     RECT32 rect;
32     HBRUSH32 hbrBk;
33
34     GetClientRect32 (wndPtr->hwndSelf, &rect);
35
36     hbrBk = CreateSolidBrush32 (RGB (192, 192, 192));
37     FillRect32 (hdc, &rect, hbrBk);
38     DeleteObject32 (hbrBk);
39 }
40
41
42
43
44 // << REBAR_BeginDrag >>
45
46
47 static LRESULT
48 REBAR_DeleteBand (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
49 {
50     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
51     UINT32 uBand = (UINT32)wParam;
52
53     if (uBand >= infoPtr->uNumBands)
54         return FALSE;
55
56     FIXME (rebar, "deleting band %u!\n", uBand);
57
58     return TRUE;
59 }
60
61
62 // << REBAR_DragMove >>
63 // << REBAR_EndDrag >>
64 // << REBAR_GetBandBorders >>
65
66
67 __inline__ static LRESULT
68 REBAR_GetBandCount (WND *wndPtr)
69 {
70     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
71
72     TRACE (rebar, "band count %u!\n", infoPtr->uNumBands);
73
74     return infoPtr->uNumBands;
75 }
76
77
78 static LRESULT
79 REBAR_GetBandInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
80 {
81     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
82     LPREBARBANDINFO32A lprbbi = (LPREBARBANDINFO32A)lParam;
83     REBAR_BAND *lpBand;
84
85     if (lprbbi == NULL)
86         return FALSE;
87     if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32A)
88         return FALSE;
89     if ((UINT32)wParam >= infoPtr->uNumBands)
90         return FALSE;
91
92     TRACE (rebar, "index %u\n", (UINT32)wParam);
93
94     /* copy band information */
95     lpBand = &infoPtr->bands[(UINT32)wParam];
96
97     if (lprbbi->fMask & RBBIM_STYLE)
98         lprbbi->fStyle = lpBand->fStyle;
99
100     if (lprbbi->fMask & RBBIM_COLORS) {
101         lprbbi->clrFore = lpBand->clrFore;
102         lprbbi->clrBack = lpBand->clrBack;
103     }
104
105     if ((lprbbi->fMask & RBBIM_TEXT) && 
106         (lprbbi->lpText) && (lpBand->lpText)) {
107             lstrcpyn32A (lprbbi->lpText, lpBand->lpText, lprbbi->cch);
108     }
109
110     if (lprbbi->fMask & RBBIM_IMAGE)
111         lprbbi->iImage = lpBand->iImage;
112
113     if (lprbbi->fMask & RBBIM_CHILD)
114         lprbbi->hwndChild = lpBand->hwndChild;
115
116     if (lprbbi->fMask & RBBIM_CHILDSIZE) {
117         lprbbi->cxMinChild = lpBand->cxMinChild;
118         lprbbi->cyMinChild = lpBand->cyMinChild;
119         lprbbi->cyMaxChild = lpBand->cyMaxChild;
120         lprbbi->cyChild    = lpBand->cyChild;
121         lprbbi->cyIntegral = lpBand->cyIntegral;
122     }
123
124     if (lprbbi->fMask & RBBIM_SIZE)
125         lprbbi->cx = lpBand->cx;
126
127     if (lprbbi->fMask & RBBIM_BACKGROUND)
128         lprbbi->hbmBack = lpBand->hbmBack;
129
130     if (lprbbi->fMask & RBBIM_ID)
131         lprbbi->wID = lpBand->wID;
132
133     /* check for additional data */
134     if (lprbbi->cbSize >= sizeof (REBARBANDINFO32A)) {
135         if (lprbbi->fMask & RBBIM_IDEALSIZE)
136             lprbbi->cxIdeal = lpBand->cxIdeal;
137
138         if (lprbbi->fMask & RBBIM_LPARAM)
139             lprbbi->lParam = lpBand->lParam;
140
141         if (lprbbi->fMask & RBBIM_HEADERSIZE)
142             lprbbi->cxHeader = lpBand->cxHeader;
143     }
144
145     return TRUE;
146 }
147
148
149 // << REBAR_GetBandInfo32W >>
150
151
152 static LRESULT
153 REBAR_GetBarHeight (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
154 {
155     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
156
157     FIXME (rebar, "returns fixed height of 40 pixels!\n");
158
159     return 40;
160 }
161
162
163 static LRESULT
164 REBAR_GetBarInfo (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
165 {
166     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
167     LPREBARINFO lpInfo = (LPREBARINFO)lParam;
168
169     if (lpInfo == NULL)
170         return FALSE;
171
172     if (lpInfo->cbSize < sizeof (REBARINFO))
173         return FALSE;
174
175     TRACE (rebar, "getting bar info!\n");
176
177     if (infoPtr->himl) {
178         lpInfo->himl = infoPtr->himl;
179         lpInfo->fMask |= RBIM_IMAGELIST;
180     }
181
182     return TRUE;
183 }
184
185
186 __inline__ static LRESULT
187 REBAR_GetBkColor (WND *wndPtr)
188 {
189     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
190
191     TRACE (rebar, "background color 0x%06lx!\n", infoPtr->clrBk);
192
193     return infoPtr->clrBk;
194 }
195
196
197 // << REBAR_GetColorScheme >>
198
199 // << REBAR_GetRowHeight >>
200
201
202 __inline__ static LRESULT
203 REBAR_GetTextColor (WND *wndPtr)
204 {
205     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
206
207     TRACE (rebar, "text color 0x%06lx!\n", infoPtr->clrText);
208
209     return infoPtr->clrText;
210 }
211
212
213 // << REBAR_GetToolTips >>
214 // << REBAR_GetUnicodeFormat >>
215 // << REBAR_HitTest >>
216
217
218 static LRESULT
219 REBAR_IdToIndex (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
220 {
221     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
222     UINT32 i;
223
224     if (infoPtr == NULL)
225         return -1;
226
227     if (infoPtr->uNumBands < 1)
228         return -1;
229
230     TRACE (rebar, "id %u\n", (UINT32)wParam);
231
232     for (i = 0; i < infoPtr->uNumBands; i++) {
233         if (infoPtr->bands[i].wID == (UINT32)wParam) {
234             TRACE (rebar, "band %u found!\n", i);
235             return i;
236         }
237     }
238
239     TRACE (rebar, "no band found!\n");
240     return -1;
241 }
242
243
244 static LRESULT
245 REBAR_InsertBand32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
246 {
247     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
248     LPREBARBANDINFO32A lprbbi = (LPREBARBANDINFO32A)lParam;
249     UINT32 uIndex = (UINT32)wParam;
250     REBAR_BAND *lpBand;
251
252     if (infoPtr == NULL)
253         return FALSE;
254     if (lprbbi == NULL)
255         return FALSE;
256     if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32A)
257         return FALSE;
258
259     TRACE (rebar, "insert band at %u!\n", uIndex);
260
261     if (infoPtr->uNumBands == 0) {
262         infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));
263         uIndex = 0;
264     }
265     else {
266         REBAR_BAND *oldBands = infoPtr->bands;
267         infoPtr->bands =
268             (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
269         if (((INT32)uIndex == -1) || (uIndex > infoPtr->uNumBands))
270             uIndex = infoPtr->uNumBands;
271
272         /* pre insert copy */
273         if (uIndex > 0) {
274             memcpy (&infoPtr->bands[0], &oldBands[0],
275                     uIndex * sizeof(REBAR_BAND));
276         }
277
278         /* post copy */
279         if (uIndex < infoPtr->uNumBands - 1) {
280             memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],
281                     (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));
282         }
283
284         COMCTL32_Free (&oldBands);
285     }
286
287     infoPtr->uNumBands++;
288
289     TRACE (rebar, "index %u!\n", uIndex);
290
291     /* initialize band (infoPtr->bands[uIndex])*/
292     lpBand = &infoPtr->bands[uIndex];
293
294     if (lprbbi->fMask & RBBIM_STYLE)
295         lpBand->fStyle = lprbbi->fStyle;
296
297     if (lprbbi->fMask & RBBIM_COLORS) {
298         lpBand->clrFore = lprbbi->clrFore;
299         lpBand->clrBack = lprbbi->clrBack;
300     }
301
302     if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
303         INT32 len = lstrlen32A (lprbbi->lpText);
304         if (len > 0) {
305             lpBand->lpText = (LPSTR)COMCTL32_Alloc (len + 1);
306             lstrcpy32A (lpBand->lpText, lprbbi->lpText);
307         }
308     }
309
310     if (lprbbi->fMask & RBBIM_IMAGE)
311         lpBand->iImage = lprbbi->iImage;
312
313     if (lprbbi->fMask & RBBIM_CHILD) {
314         lpBand->hwndChild = lprbbi->hwndChild;
315         lpBand->hwndPrevParent =
316             SetParent32 (lpBand->hwndChild, wndPtr->hwndSelf);
317     }
318
319     if (lprbbi->fMask & RBBIM_CHILDSIZE) {
320         lpBand->cxMinChild = lprbbi->cxMinChild;
321         lpBand->cyMinChild = lprbbi->cyMinChild;
322         lpBand->cyMaxChild = lprbbi->cyMaxChild;
323         lpBand->cyChild    = lprbbi->cyChild;
324         lpBand->cyIntegral = lprbbi->cyIntegral;
325     }
326
327     if (lprbbi->fMask & RBBIM_SIZE)
328         lpBand->cx = lprbbi->cx;
329
330     if (lprbbi->fMask & RBBIM_BACKGROUND)
331         lpBand->hbmBack = lprbbi->hbmBack;
332
333     if (lprbbi->fMask & RBBIM_ID)
334         lpBand->wID = lprbbi->wID;
335
336     /* check for additional data */
337     if (lprbbi->cbSize >= sizeof (REBARBANDINFO32A)) {
338         if (lprbbi->fMask & RBBIM_IDEALSIZE)
339             lpBand->cxIdeal = lprbbi->cxIdeal;
340
341         if (lprbbi->fMask & RBBIM_LPARAM)
342             lpBand->lParam = lprbbi->lParam;
343
344         if (lprbbi->fMask & RBBIM_HEADERSIZE)
345             lpBand->cxHeader = lprbbi->cxHeader;
346     }
347
348     return TRUE;
349 }
350
351
352 // << REBAR_InsertBand32W >>
353 // << REBAR_MaximizeBand >>
354 // << REBAR_MinimizeBand >>
355 // << REBAR_MoveBand >>
356
357
358 static LRESULT
359 REBAR_SetBandInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
360 {
361     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
362     LPREBARBANDINFO32A lprbbi = (LPREBARBANDINFO32A)lParam;
363     REBAR_BAND *lpBand;
364
365     if (lprbbi == NULL)
366         return FALSE;
367     if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32A)
368         return FALSE;
369     if ((UINT32)wParam >= infoPtr->uNumBands)
370         return FALSE;
371
372     TRACE (rebar, "index %u\n", (UINT32)wParam);
373
374     /* set band information */
375     lpBand = &infoPtr->bands[(UINT32)wParam];
376
377     if (lprbbi->fMask & RBBIM_STYLE)
378         lpBand->fStyle = lprbbi->fStyle;
379
380     if (lprbbi->fMask & RBBIM_COLORS) {
381         lpBand->clrFore = lprbbi->clrFore;
382         lpBand->clrBack = lprbbi->clrBack;
383     }
384
385     if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
386 /*
387         INT32 len = lstrlen32A (lprbbi->lpText);
388         if (len > 0) {
389             lpBand->lpText = (LPSTR)COMCTL32_Alloc (len + 1);
390             lstrcpy32A (lpBand->lpText, lprbbi->lpText);
391         }
392 */
393     }
394
395     if (lprbbi->fMask & RBBIM_IMAGE)
396         lpBand->iImage = lprbbi->iImage;
397
398     if (lprbbi->fMask & RBBIM_CHILD) {
399         lpBand->hwndChild = lprbbi->hwndChild;
400         lpBand->hwndPrevParent =
401             SetParent32 (lpBand->hwndChild, wndPtr->hwndSelf);
402     }
403
404     if (lprbbi->fMask & RBBIM_CHILDSIZE) {
405         lpBand->cxMinChild = lprbbi->cxMinChild;
406         lpBand->cyMinChild = lprbbi->cyMinChild;
407         lpBand->cyMaxChild = lprbbi->cyMaxChild;
408         lpBand->cyChild    = lprbbi->cyChild;
409         lpBand->cyIntegral = lprbbi->cyIntegral;
410     }
411
412     if (lprbbi->fMask & RBBIM_SIZE)
413         lpBand->cx = lprbbi->cx;
414
415     if (lprbbi->fMask & RBBIM_BACKGROUND)
416         lpBand->hbmBack = lprbbi->hbmBack;
417
418     if (lprbbi->fMask & RBBIM_ID)
419         lpBand->wID = lprbbi->wID;
420
421     /* check for additional data */
422     if (lprbbi->cbSize >= sizeof (REBARBANDINFO32A)) {
423         if (lprbbi->fMask & RBBIM_IDEALSIZE)
424             lpBand->cxIdeal = lprbbi->cxIdeal;
425
426         if (lprbbi->fMask & RBBIM_LPARAM)
427             lpBand->lParam = lprbbi->lParam;
428
429         if (lprbbi->fMask & RBBIM_HEADERSIZE)
430             lpBand->cxHeader = lprbbi->cxHeader;
431     }
432
433     return TRUE;
434 }
435
436
437 // << REBAR_SetBandInfo32W >>
438
439
440 static LRESULT
441 REBAR_SetBarInfo (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
442 {
443     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
444     LPREBARINFO lpInfo = (LPREBARINFO)lParam;
445
446     if (lpInfo == NULL)
447         return FALSE;
448
449     if (lpInfo->cbSize < sizeof (REBARINFO))
450         return FALSE;
451
452     TRACE (rebar, "setting bar info!\n");
453
454     if (lpInfo->fMask & RBIM_IMAGELIST)
455         infoPtr->himl = lpInfo->himl;
456
457     return TRUE;
458 }
459
460
461 static LRESULT
462 REBAR_SetBkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
463 {
464     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
465     COLORREF clrTemp;
466
467     clrTemp = infoPtr->clrBk;
468     infoPtr->clrBk = (COLORREF)lParam;
469
470     TRACE (rebar, "background color 0x%06lx!\n", infoPtr->clrBk);
471
472     return clrTemp;
473 }
474
475
476 // << REBAR_SetColorScheme >>
477 // << REBAR_SetPalette >>
478 // << REBAR_SetParent >>
479
480
481 static LRESULT
482 REBAR_SetTextColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
483 {
484     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
485     COLORREF clrTemp;
486
487     clrTemp = infoPtr->clrText;
488     infoPtr->clrText = (COLORREF)lParam;
489
490     TRACE (rebar, "text color 0x%06lx!\n", infoPtr->clrText);
491
492     return clrTemp;
493 }
494
495
496 // << REBAR_SetTooltips >>
497 // << REBAR_SetUnicodeFormat >>
498
499
500 static LRESULT
501 REBAR_ShowBand (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
502 {
503     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
504
505     if (((INT32)wParam < 0) || ((INT32)wParam > infoPtr->uNumBands))
506         return FALSE;
507
508     if ((BOOL32)lParam)
509         FIXME (rebar, "show band %d\n", (INT32)wParam);
510     else
511         FIXME (rebar, "hide band %d\n", (INT32)wParam);
512
513     return TRUE;
514 }
515
516
517 static LRESULT
518 REBAR_SizeToRect (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
519 {
520     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
521     LPRECT32 lpRect = (LPRECT32)lParam;
522
523     if (lpRect == NULL)
524         return FALSE;
525
526     FIXME (rebar, "layout change not implemented!\n");
527
528     return TRUE;
529 }
530
531
532
533 static LRESULT
534 REBAR_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
535 {
536     REBAR_INFO *infoPtr;
537
538     /* allocate memory for info structure */
539     infoPtr = (REBAR_INFO *)COMCTL32_Alloc (sizeof(REBAR_INFO));
540     wndPtr->wExtra[0] = (DWORD)infoPtr;
541
542     if (infoPtr == NULL) {
543         ERR (rebar, "could not allocate info memory!\n");
544         return 0;
545     }
546
547     if ((REBAR_INFO*)wndPtr->wExtra[0] != infoPtr) {
548         ERR (rebar, "pointer assignment error!\n");
549         return 0;
550     }
551
552     /* initialize info structure */
553     infoPtr->clrText = CLR_NONE;
554     infoPtr->clrText = RGB(0, 0, 0);
555
556     TRACE (rebar, "created!\n");
557     return 0;
558 }
559
560
561 static LRESULT
562 REBAR_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
563 {
564     REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
565     REBAR_BAND *lpBand;
566     INT32 i;
567
568
569     /* free rebar bands */
570     if ((infoPtr->uNumBands > 0) && infoPtr->bands) {
571         /* clean up each band */
572         for (i = 0; i < infoPtr->uNumBands; i++) {
573             lpBand = &infoPtr->bands[i];
574
575             /* delete text strings */
576             if (lpBand->lpText) {
577                 COMCTL32_Free (lpBand->lpText);
578                 lpBand->lpText = NULL;
579             }
580         }
581
582         /* free band array */
583         COMCTL32_Free (infoPtr->bands);
584         infoPtr->bands = NULL;
585     }
586
587     /* free rebar info data */
588     COMCTL32_Free (infoPtr);
589
590     TRACE (rebar, "destroyed!\n");
591     return 0;
592 }
593
594
595
596 static LRESULT
597 REBAR_Paint (WND *wndPtr, WPARAM32 wParam)
598 {
599     HDC32 hdc;
600     PAINTSTRUCT32 ps;
601
602     hdc = wParam==0 ? BeginPaint32 (wndPtr->hwndSelf, &ps) : (HDC32)wParam;
603     REBAR_Refresh (wndPtr, hdc);
604     if (!wParam)
605         EndPaint32 (wndPtr->hwndSelf, &ps);
606     return 0;
607 }
608
609
610
611 LRESULT WINAPI
612 REBAR_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
613 {
614     WND *wndPtr = WIN_FindWndPtr(hwnd);
615
616     switch (uMsg)
617     {
618 //      case RB_BEGINDRAG:
619
620         case RB_DELETEBAND:
621             return REBAR_DeleteBand (wndPtr, wParam, lParam);
622
623 //      case RB_DRAGMOVE:
624 //      case RB_ENDDRAG:
625 //      case RB_GETBANDBORDERS:
626
627         case RB_GETBANDCOUNT:
628             return REBAR_GetBandCount (wndPtr);
629
630 //      case RB_GETBANDINFO32:  /* outdated, just for compatibility */
631
632         case RB_GETBANDINFO32A:
633             return REBAR_GetBandInfo32A (wndPtr, wParam, lParam);
634
635 //      case RB_GETBANDINFO32W:
636
637         case RB_GETBARHEIGHT:
638             return REBAR_GetBarHeight (wndPtr, wParam, lParam);
639
640         case RB_GETBARINFO:
641             return REBAR_GetBarInfo (wndPtr, wParam, lParam);
642
643         case RB_GETBKCOLOR:
644             return REBAR_GetBkColor (wndPtr);
645
646 //      case RB_GETCOLORSCHEME:
647 //      case RB_GETDROPTARGET:
648 //      case RB_GETPALETTE:
649 //      case RB_GETRECT:
650 //      case RB_GETROWCOUNT:
651 //      case RB_GETROWHEIGHT:
652
653         case RB_GETTEXTCOLOR:
654             return REBAR_GetTextColor (wndPtr);
655
656 //      case RB_GETTOOLTIPS:
657 //      case RB_GETUNICODEFORMAT:
658 //      case RB_HITTEST:
659
660         case RB_IDTOINDEX:
661             return REBAR_IdToIndex (wndPtr, wParam, lParam);
662
663         case RB_INSERTBAND32A:
664             return REBAR_InsertBand32A (wndPtr, wParam, lParam);
665
666 //      case RB_INSERTBAND32W:
667 //      case RB_MAXIMIZEBAND:
668 //      case RB_MINIMIZEBAND:
669 //      case RB_MOVEBAND:
670
671         case RB_SETBANDINFO32A:
672             return REBAR_SetBandInfo32A (wndPtr, wParam, lParam);
673
674 //      case RB_SETBANDINFO32W:
675
676         case RB_SETBARINFO:
677             return REBAR_SetBarInfo (wndPtr, wParam, lParam);
678
679         case RB_SETBKCOLOR:
680             return REBAR_SetBkColor (wndPtr, wParam, lParam);
681
682 //      case RB_SETCOLORSCHEME:
683 //      case RB_SETPALETTE:
684 //      case RB_SETPARENT:
685
686         case RB_SETTEXTCOLOR:
687             return REBAR_SetTextColor (wndPtr, wParam, lParam);
688
689 //      case RB_SETTOOLTIPS:
690 //      case RB_SETUNICODEFORMAT:
691
692         case RB_SHOWBAND:
693             return REBAR_ShowBand (wndPtr, wParam, lParam);
694
695         case RB_SIZETORECT:
696             return REBAR_SizeToRect (wndPtr, wParam, lParam);
697
698
699         case WM_CREATE:
700             return REBAR_Create (wndPtr, wParam, lParam);
701
702         case WM_DESTROY:
703             return REBAR_Destroy (wndPtr, wParam, lParam);
704
705 //      case WM_GETFONT:
706
707 //      case WM_MOUSEMOVE:
708 //          return REBAR_MouseMove (wndPtr, wParam, lParam);
709
710         case WM_PAINT:
711             return REBAR_Paint (wndPtr, wParam);
712
713 //      case WM_SETFONT:
714
715 //      case WM_TIMER:
716
717 //      case WM_WININICHANGE:
718
719         default:
720             if (uMsg >= WM_USER)
721                 ERR (rebar, "unknown msg %04x wp=%08x lp=%08lx\n",
722                      uMsg, wParam, lParam);
723             return DefWindowProc32A (hwnd, uMsg, wParam, lParam);
724     }
725     return 0;
726 }
727
728
729 void
730 REBAR_Register (void)
731 {
732     WNDCLASS32A wndClass;
733
734     if (GlobalFindAtom32A (REBARCLASSNAME32A)) return;
735
736     ZeroMemory (&wndClass, sizeof(WNDCLASS32A));
737     wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS;
738     wndClass.lpfnWndProc   = (WNDPROC32)REBAR_WindowProc;
739     wndClass.cbClsExtra    = 0;
740     wndClass.cbWndExtra    = sizeof(REBAR_INFO *);
741     wndClass.hCursor       = 0;
742     wndClass.hbrBackground = (HBRUSH32) COLOR_BTNFACE + 1;
743     wndClass.lpszClassName = REBARCLASSNAME32A;
744  
745     RegisterClass32A (&wndClass);
746 }
747