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

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

Added CVS tag to many files (comctl32 and headers) .

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