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

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

bug fixes (unicode) and improvements

File size: 52.9 KB
Line 
1/* $Id: rebar.c,v 1.5 1999-06-28 15:46:26 cbratschi Exp $ */
2/*
3 * Rebar control
4 *
5 * Copyright 1998, 1999 Eric Kohl
6 * Copyright 1999 Achim Hasenmueller
7 * Copyright 1999 Christoph Bratschi
8 *
9 * NOTES
10 * An author is needed! Any volunteers?
11 * I will only improve this control once in a while.
12 * Eric <ekohl@abo.rhein-zeitung.de>
13 *
14 * TODO:
15 * - vertical placement
16 * - ComboBox and ComboBoxEx placement
17 * - center image
18 * - Layout code.
19 * - Display code.
20 * - Some messages.
21 * - All notifications.
22 */
23
24#include <string.h>
25
26#include "winbase.h"
27#include "wingdi.h"
28#include "commctrl.h"
29#include "rebar.h"
30#include "comctl32.h"
31
32
33/* fDraw flags */
34#define DRAW_GRIPPER 1
35#define DRAW_IMAGE 2
36#define DRAW_TEXT 4
37#define DRAW_CHILD 8
38
39#define GRIPPER_WIDTH 13
40
41
42#define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)GetWindowLongA (hwnd, 0))
43
44
45static VOID
46REBAR_DrawBand (HDC hdc, REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
47{
48
49 DrawEdge (hdc, &lpBand->rcBand, BDR_RAISEDINNER, BF_MIDDLE);
50
51 /* draw background */
52
53 /* draw gripper */
54 if (lpBand->fDraw & DRAW_GRIPPER)
55 DrawEdge (hdc, &lpBand->rcGripper, BDR_RAISEDINNER, BF_RECT | BF_MIDDLE);
56
57 /* draw caption image */
58 if (lpBand->fDraw & DRAW_IMAGE) {
59 /* FIXME: center image */
60 POINT pt;
61
62 pt.y = (lpBand->rcCapImage.bottom + lpBand->rcCapImage.top - infoPtr->imageSize.cy)/2;
63 pt.x = (lpBand->rcCapImage.right + lpBand->rcCapImage.left - infoPtr->imageSize.cx)/2;
64
65 ImageList_Draw (infoPtr->himl, lpBand->iImage, hdc,
66/* lpBand->rcCapImage.left, lpBand->rcCapImage.top, */
67 pt.x, pt.y,
68 ILD_TRANSPARENT);
69 }
70
71 /* draw caption text */
72 if (lpBand->fDraw & DRAW_TEXT) {
73 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);
74 INT oldBkMode = SetBkMode (hdc, TRANSPARENT);
75 DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText,
76 DT_CENTER | DT_VCENTER | DT_SINGLELINE);
77 if (oldBkMode != TRANSPARENT)
78 SetBkMode (hdc, oldBkMode);
79 SelectObject (hdc, hOldFont);
80 }
81}
82
83
84static VOID
85REBAR_Refresh (HWND hwnd, HDC hdc)
86{
87 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
88 REBAR_BAND *lpBand;
89 UINT i;
90
91 for (i = 0; i < infoPtr->uNumBands; i++) {
92 lpBand = &infoPtr->bands[i];
93
94 if ((lpBand->fStyle & RBBS_HIDDEN) ||
95 ((GetWindowLongA (hwnd, GWL_STYLE) & CCS_VERT) &&
96 (lpBand->fStyle & RBBS_NOVERT)))
97 continue;
98
99 REBAR_DrawBand (hdc, infoPtr, lpBand);
100
101 }
102}
103
104
105static VOID
106REBAR_CalcHorzBand (REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
107{
108 lpBand->fDraw = 0;
109
110 /* set initial caption image rectangle */
111 SetRect (&lpBand->rcCapImage, 0, 0, 0, 0);
112
113 /* image is visible */
114 if ((lpBand->iImage > -1) && (infoPtr->himl)) {
115 lpBand->fDraw |= DRAW_IMAGE;
116
117 lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx;
118 lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy;
119
120 /* update band height */
121 if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) {
122 lpBand->uMinHeight = infoPtr->imageSize.cy + 2;
123 lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->uMinHeight;
124 }
125 }
126
127 /* set initial caption text rectangle */
128 lpBand->rcCapText.left = lpBand->rcCapImage.right;
129 lpBand->rcCapText.top = lpBand->rcBand.top + 1;
130 lpBand->rcCapText.right = lpBand->rcCapText.left;
131 lpBand->rcCapText.bottom = lpBand->rcBand.bottom - 1;
132
133 /* text is visible */
134 if (lpBand->lpText) {
135 HDC hdc = GetDC (0);
136 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);
137 SIZE size;
138
139 lpBand->fDraw |= DRAW_TEXT;
140 GetTextExtentPoint32W (hdc, lpBand->lpText,
141 lstrlenW (lpBand->lpText), &size);
142 lpBand->rcCapText.right += size.cx;
143
144 SelectObject (hdc, hOldFont);
145 ReleaseDC (0, hdc);
146 }
147
148 /* set initial child window rectangle */
149 if (lpBand->fStyle & RBBS_FIXEDSIZE) {
150 lpBand->rcChild.left = lpBand->rcCapText.right;
151 lpBand->rcChild.top = lpBand->rcBand.top;
152 lpBand->rcChild.right = lpBand->rcBand.right;
153 lpBand->rcChild.bottom = lpBand->rcBand.bottom;
154 }
155 else {
156 lpBand->rcChild.left = lpBand->rcCapText.right + 4;
157 lpBand->rcChild.top = lpBand->rcBand.top + 2;
158 lpBand->rcChild.right = lpBand->rcBand.right - 4;
159 lpBand->rcChild.bottom = lpBand->rcBand.bottom - 2;
160 }
161
162 /* calculate gripper rectangle */
163 if ((!(lpBand->fStyle & RBBS_NOGRIPPER)) &&
164 (!(lpBand->fStyle & RBBS_FIXEDSIZE)) &&
165 ((lpBand->fStyle & RBBS_GRIPPERALWAYS) ||
166 (infoPtr->uNumBands > 1))) {
167 lpBand->fDraw |= DRAW_GRIPPER;
168 lpBand->rcGripper.left = lpBand->rcBand.left + 3;
169 lpBand->rcGripper.right = lpBand->rcGripper.left + 3;
170 lpBand->rcGripper.top = lpBand->rcBand.top + 3;
171 lpBand->rcGripper.bottom = lpBand->rcBand.bottom - 3;
172
173 /* move caption rectangles */
174 OffsetRect (&lpBand->rcCapImage, GRIPPER_WIDTH, 0);
175 OffsetRect (&lpBand->rcCapText, GRIPPER_WIDTH, 0);
176
177 /* adjust child rectangle */
178 lpBand->rcChild.left += GRIPPER_WIDTH;
179 }
180
181
182}
183
184
185static VOID
186REBAR_CalcVertBand (HWND hwnd, REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
187{
188 lpBand->fDraw = 0;
189
190 /* set initial caption image rectangle */
191 SetRect (&lpBand->rcCapImage, 0, 0, 0, 0);
192
193 /* image is visible */
194 if ((lpBand->iImage > -1) && (infoPtr->himl)) {
195 lpBand->fDraw |= DRAW_IMAGE;
196
197 lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx;
198 lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy;
199
200 /* update band width */
201 if (lpBand->uMinHeight < infoPtr->imageSize.cx + 2) {
202 lpBand->uMinHeight = infoPtr->imageSize.cx + 2;
203 lpBand->rcBand.right = lpBand->rcBand.left + lpBand->uMinHeight;
204 }
205 }
206
207 /* set initial caption text rectangle */
208 lpBand->rcCapText.left = lpBand->rcBand.left + 1;
209 lpBand->rcCapText.top = lpBand->rcCapImage.bottom;
210 lpBand->rcCapText.right = lpBand->rcBand.right - 1;
211 lpBand->rcCapText.bottom = lpBand->rcCapText.top;
212
213 /* text is visible */
214 if (lpBand->lpText) {
215 HDC hdc = GetDC (0);
216 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);
217 SIZE size;
218
219 lpBand->fDraw |= DRAW_TEXT;
220 GetTextExtentPoint32W (hdc, lpBand->lpText,
221 lstrlenW (lpBand->lpText), &size);
222/* lpBand->rcCapText.right += size.cx; */
223 lpBand->rcCapText.bottom += size.cy;
224
225 SelectObject (hdc, hOldFont);
226 ReleaseDC (0, hdc);
227 }
228
229 /* set initial child window rectangle */
230 if (lpBand->fStyle & RBBS_FIXEDSIZE) {
231 lpBand->rcChild.left = lpBand->rcBand.left;
232 lpBand->rcChild.top = lpBand->rcCapText.bottom;
233 lpBand->rcChild.right = lpBand->rcBand.right;
234 lpBand->rcChild.bottom = lpBand->rcBand.bottom;
235 }
236 else {
237 lpBand->rcChild.left = lpBand->rcBand.left + 2;
238 lpBand->rcChild.top = lpBand->rcCapText.bottom + 4;
239 lpBand->rcChild.right = lpBand->rcBand.right - 2;
240 lpBand->rcChild.bottom = lpBand->rcBand.bottom - 4;
241 }
242
243 /* calculate gripper rectangle */
244 if ((!(lpBand->fStyle & RBBS_NOGRIPPER)) &&
245 (!(lpBand->fStyle & RBBS_FIXEDSIZE)) &&
246 ((lpBand->fStyle & RBBS_GRIPPERALWAYS) ||
247 (infoPtr->uNumBands > 1))) {
248 lpBand->fDraw |= DRAW_GRIPPER;
249
250 if (GetWindowLongA (hwnd, GWL_STYLE) & RBS_VERTICALGRIPPER) {
251 /* adjust band width */
252 lpBand->rcBand.right += GRIPPER_WIDTH;
253 lpBand->uMinHeight += GRIPPER_WIDTH;
254
255 lpBand->rcGripper.left = lpBand->rcBand.left + 3;
256 lpBand->rcGripper.right = lpBand->rcGripper.left + 3;
257 lpBand->rcGripper.top = lpBand->rcBand.top + 3;
258 lpBand->rcGripper.bottom = lpBand->rcBand.bottom - 3;
259
260 /* move caption rectangles */
261 OffsetRect (&lpBand->rcCapImage, GRIPPER_WIDTH, 0);
262 OffsetRect (&lpBand->rcCapText, GRIPPER_WIDTH, 0);
263
264 /* adjust child rectangle */
265 lpBand->rcChild.left += GRIPPER_WIDTH;
266 }
267 else {
268 lpBand->rcGripper.left = lpBand->rcBand.left + 3;
269 lpBand->rcGripper.right = lpBand->rcBand.right - 3;
270 lpBand->rcGripper.top = lpBand->rcBand.top + 3;
271 lpBand->rcGripper.bottom = lpBand->rcGripper.top + 3;
272
273 /* move caption rectangles */
274 OffsetRect (&lpBand->rcCapImage, 0, GRIPPER_WIDTH);
275 OffsetRect (&lpBand->rcCapText, 0, GRIPPER_WIDTH);
276
277 /* adjust child rectangle */
278 lpBand->rcChild.top += GRIPPER_WIDTH;
279 }
280 }
281}
282
283
284static VOID
285REBAR_Layout (HWND hwnd, LPRECT lpRect)
286{
287 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
288 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
289 REBAR_BAND *lpBand;
290 RECT rcClient;
291 INT x, y, cx, cy;
292 UINT i;
293
294 if (lpRect)
295 rcClient = *lpRect;
296 else
297 GetClientRect (hwnd, &rcClient);
298
299 x = 0;
300 y = 0;
301
302 if (dwStyle & CCS_VERT) {
303 cx = 20; /* FIXME: fixed height */
304 cy = rcClient.bottom - rcClient.top;
305 }
306 else {
307 cx = rcClient.right - rcClient.left;
308 cy = 20; /* FIXME: fixed height */
309 }
310
311 for (i = 0; i < infoPtr->uNumBands; i++) {
312 lpBand = &infoPtr->bands[i];
313
314 if ((lpBand->fStyle & RBBS_HIDDEN) ||
315 ((dwStyle & CCS_VERT) && (lpBand->fStyle & RBBS_NOVERT)))
316 continue;
317
318
319 if (dwStyle & CCS_VERT) {
320 if (lpBand->fStyle & RBBS_VARIABLEHEIGHT)
321 cx = lpBand->cyMaxChild;
322 else if (lpBand->fStyle & RBBIM_CHILDSIZE)
323 cx = lpBand->cyMinChild;
324 else
325 cx = 20; /* FIXME */
326
327 lpBand->rcBand.left = x;
328 lpBand->rcBand.right = x + cx;
329 lpBand->rcBand.top = y;
330 lpBand->rcBand.bottom = y + cy;
331 lpBand->uMinHeight = cx;
332 }
333 else {
334 if (lpBand->fStyle & RBBS_VARIABLEHEIGHT)
335 cy = lpBand->cyMaxChild;
336 else if (lpBand->fStyle & RBBIM_CHILDSIZE)
337 cy = lpBand->cyMinChild;
338 else
339 cy = 20; /* FIXME */
340
341 lpBand->rcBand.left = x;
342 lpBand->rcBand.right = x + cx;
343 lpBand->rcBand.top = y;
344 lpBand->rcBand.bottom = y + cy;
345 lpBand->uMinHeight = cy;
346 }
347
348 if (dwStyle & CCS_VERT) {
349 REBAR_CalcVertBand (hwnd, infoPtr, lpBand);
350 x += lpBand->uMinHeight;
351 }
352 else {
353 REBAR_CalcHorzBand (infoPtr, lpBand);
354 y += lpBand->uMinHeight;
355 }
356 }
357
358 if (dwStyle & CCS_VERT) {
359 infoPtr->calcSize.cx = x;
360 infoPtr->calcSize.cy = rcClient.bottom - rcClient.top;
361 }
362 else {
363 infoPtr->calcSize.cx = rcClient.right - rcClient.left;
364 infoPtr->calcSize.cy = y;
365 }
366}
367
368
369static VOID
370REBAR_ForceResize (HWND hwnd)
371{
372 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
373 RECT rc;
374
375// TRACE (rebar, " to [%d x %d]!\n",
376// infoPtr->calcSize.cx, infoPtr->calcSize.cy);
377
378 infoPtr->bAutoResize = TRUE;
379
380 rc.left = 0;
381 rc.top = 0;
382 rc.right = infoPtr->calcSize.cx;
383 rc.bottom = infoPtr->calcSize.cy;
384
385 if (GetWindowLongA (hwnd, GWL_STYLE) & WS_BORDER) {
386 InflateRect (&rc, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));
387 }
388
389 SetWindowPos (hwnd, 0, 0, 0,
390 rc.right - rc.left, rc.bottom - rc.top,
391 SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW);
392}
393
394
395static VOID
396REBAR_MoveChildWindows (HWND hwnd)
397{
398 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
399 REBAR_BAND *lpBand;
400 CHAR szClassName[40];
401 UINT i;
402
403 for (i = 0; i < infoPtr->uNumBands; i++) {
404 lpBand = &infoPtr->bands[i];
405
406 if (lpBand->fStyle & RBBS_HIDDEN)
407 continue;
408 if (lpBand->hwndChild) {
409// TRACE (rebar, "hwndChild = %x\n", lpBand->hwndChild);
410
411 GetClassNameA (lpBand->hwndChild, szClassName, 40);
412 if (!lstrcmpA (szClassName, "ComboBox")) {
413 INT nEditHeight, yPos;
414 RECT rc;
415
416 /* special placement code for combo box */
417
418
419 /* get size of edit line */
420 GetWindowRect (lpBand->hwndChild, &rc);
421 nEditHeight = rc.bottom - rc.top;
422 yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2;
423
424 /* center combo box inside child area */
425 SetWindowPos (lpBand->hwndChild, HWND_TOP,
426 lpBand->rcChild.left, /*lpBand->rcChild.top*/ yPos,
427 lpBand->rcChild.right - lpBand->rcChild.left,
428 nEditHeight,
429 SWP_SHOWWINDOW);
430 }
431#if 0
432 else if (!lstrcmpA (szClassName, WC_COMBOBOXEXA)) {
433 /* special placement code for extended combo box */
434
435
436 }
437#endif
438 else {
439 SetWindowPos (lpBand->hwndChild, HWND_TOP,
440 lpBand->rcChild.left, lpBand->rcChild.top,
441 lpBand->rcChild.right - lpBand->rcChild.left,
442 lpBand->rcChild.bottom - lpBand->rcChild.top,
443 SWP_SHOWWINDOW);
444 }
445 }
446 }
447}
448
449
450static void
451REBAR_InternalHitTest (HWND hwnd, LPPOINT lpPt, UINT *pFlags, INT *pBand)
452{
453 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
454 REBAR_BAND *lpBand;
455 RECT rect;
456 INT iCount;
457
458 GetClientRect (hwnd, &rect);
459
460 *pFlags = RBHT_NOWHERE;
461 if (PtInRect (&rect, *lpPt))
462 {
463 if (infoPtr->uNumBands == 0) {
464 *pFlags = RBHT_NOWHERE;
465 if (pBand)
466 *pBand = -1;
467// TRACE (rebar, "NOWHERE\n");
468 return;
469 }
470 else {
471 /* somewhere inside */
472 for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) {
473 lpBand = &infoPtr->bands[iCount];
474 if (PtInRect (&lpBand->rcBand, *lpPt)) {
475 if (pBand)
476 *pBand = iCount;
477 if (PtInRect (&lpBand->rcGripper, *lpPt)) {
478 *pFlags = RBHT_GRABBER;
479// TRACE (rebar, "ON GRABBER %d\n", iCount);
480 return;
481 }
482 else if (PtInRect (&lpBand->rcCapImage, *lpPt)) {
483 *pFlags = RBHT_CAPTION;
484// TRACE (rebar, "ON CAPTION %d\n", iCount);
485 return;
486 }
487 else if (PtInRect (&lpBand->rcCapText, *lpPt)) {
488 *pFlags = RBHT_CAPTION;
489// TRACE (rebar, "ON CAPTION %d\n", iCount);
490 return;
491 }
492 else if (PtInRect (&lpBand->rcChild, *lpPt)) {
493 *pFlags = RBHT_CLIENT;
494// TRACE (rebar, "ON CLIENT %d\n", iCount);
495 return;
496 }
497 else {
498 *pFlags = RBHT_NOWHERE;
499// TRACE (rebar, "NOWHERE %d\n", iCount);
500 return;
501 }
502 }
503 }
504
505 *pFlags = RBHT_NOWHERE;
506 if (pBand)
507 *pBand = -1;
508
509// TRACE (rebar, "NOWHERE\n");
510 return;
511 }
512 }
513 else {
514 *pFlags = RBHT_NOWHERE;
515 if (pBand)
516 *pBand = -1;
517// TRACE (rebar, "NOWHERE\n");
518 return;
519 }
520
521// TRACE (rebar, "flags=0x%X\n", *pFlags);
522 return;
523}
524
525
526
527/* << REBAR_BeginDrag >> */
528
529
530static LRESULT
531REBAR_DeleteBand (HWND hwnd, WPARAM wParam, LPARAM lParam)
532{
533 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
534 UINT uBand = (UINT)wParam;
535
536 if (uBand >= infoPtr->uNumBands)
537 return FALSE;
538
539// TRACE (rebar, "deleting band %u!\n", uBand);
540
541 if (infoPtr->uNumBands == 1) {
542// TRACE (rebar, " simple delete!\n");
543 COMCTL32_Free (infoPtr->bands);
544 infoPtr->bands = NULL;
545 infoPtr->uNumBands = 0;
546 }
547 else {
548 REBAR_BAND *oldBands = infoPtr->bands;
549// TRACE(rebar, "complex delete! [uBand=%u]\n", uBand);
550
551 infoPtr->uNumBands--;
552 infoPtr->bands = COMCTL32_Alloc (sizeof (REBAR_BAND) * infoPtr->uNumBands);
553 if (uBand > 0) {
554 memcpy (&infoPtr->bands[0], &oldBands[0],
555 uBand * sizeof(REBAR_BAND));
556 }
557
558 if (uBand < infoPtr->uNumBands) {
559 memcpy (&infoPtr->bands[uBand], &oldBands[uBand+1],
560 (infoPtr->uNumBands - uBand) * sizeof(REBAR_BAND));
561 }
562
563 COMCTL32_Free (oldBands);
564 }
565
566 REBAR_Layout (hwnd, NULL);
567 REBAR_ForceResize (hwnd);
568 REBAR_MoveChildWindows (hwnd);
569
570 return TRUE;
571}
572
573
574/* << REBAR_DragMove >> */
575/* << REBAR_EndDrag >> */
576
577
578static LRESULT
579REBAR_GetBandBorders (HWND hwnd, WPARAM wParam, LPARAM lParam)
580{
581 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
582 /* LPRECT32 lpRect = (LPRECT32)lParam; */
583 REBAR_BAND *lpBand;
584
585 if (!lParam)
586 return 0;
587 if ((UINT)wParam >= infoPtr->uNumBands)
588 return 0;
589
590 lpBand = &infoPtr->bands[(UINT)wParam];
591 if (GetWindowLongA (hwnd, GWL_STYLE) & RBS_BANDBORDERS) {
592
593 }
594 else {
595
596 }
597
598 return 0;
599}
600
601
602static LRESULT
603REBAR_GetBandCount (HWND hwnd)
604{
605 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
606
607// TRACE (rebar, "band count %u!\n", infoPtr->uNumBands);
608
609 return infoPtr->uNumBands;
610}
611
612
613static LRESULT
614REBAR_GetBandInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam)
615{
616 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
617 LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam;
618 REBAR_BAND *lpBand;
619
620 if (lprbbi == NULL)
621 return FALSE;
622 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA)
623 return FALSE;
624 if ((UINT)wParam >= infoPtr->uNumBands)
625 return FALSE;
626
627// TRACE (rebar, "index %u\n", (UINT)wParam);
628
629 /* copy band information */
630 lpBand = &infoPtr->bands[(UINT)wParam];
631
632 if (lprbbi->fMask & RBBIM_STYLE)
633 lprbbi->fStyle = lpBand->fStyle;
634
635 if (lprbbi->fMask & RBBIM_COLORS) {
636 lprbbi->clrFore = lpBand->clrFore;
637 lprbbi->clrBack = lpBand->clrBack;
638 }
639
640 if ((lprbbi->fMask & RBBIM_TEXT) &&
641 (lprbbi->lpText) && (lpBand->lpText)) {
642 lstrcpynWtoA (lprbbi->lpText, lpBand->lpText, MIN(lprbbi->cch,lstrlenW(lpBand->lpText)));
643 }
644
645 if (lprbbi->fMask & RBBIM_IMAGE)
646 lprbbi->iImage = lpBand->iImage;
647
648 if (lprbbi->fMask & RBBIM_CHILD)
649 lprbbi->hwndChild = lpBand->hwndChild;
650
651 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
652 lprbbi->cxMinChild = lpBand->cxMinChild;
653 lprbbi->cyMinChild = lpBand->cyMinChild;
654 lprbbi->cyMaxChild = lpBand->cyMaxChild;
655 lprbbi->cyChild = lpBand->cyChild;
656 lprbbi->cyIntegral = lpBand->cyIntegral;
657 }
658
659 if (lprbbi->fMask & RBBIM_SIZE)
660 lprbbi->cx = lpBand->cx;
661
662 if (lprbbi->fMask & RBBIM_BACKGROUND)
663 lprbbi->hbmBack = lpBand->hbmBack;
664
665 if (lprbbi->fMask & RBBIM_ID)
666 lprbbi->wID = lpBand->wID;
667
668 /* check for additional data */
669 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
670 if (lprbbi->fMask & RBBIM_IDEALSIZE)
671 lprbbi->cxIdeal = lpBand->cxIdeal;
672
673 if (lprbbi->fMask & RBBIM_LPARAM)
674 lprbbi->lParam = lpBand->lParam;
675
676 if (lprbbi->fMask & RBBIM_HEADERSIZE)
677 lprbbi->cxHeader = lpBand->cxHeader;
678 }
679
680 return TRUE;
681}
682
683
684static LRESULT
685REBAR_GetBandInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam)
686{
687 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
688 LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam;
689 REBAR_BAND *lpBand;
690
691 if (lprbbi == NULL)
692 return FALSE;
693 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW)
694 return FALSE;
695 if ((UINT)wParam >= infoPtr->uNumBands)
696 return FALSE;
697
698// TRACE (rebar, "index %u\n", (UINT)wParam);
699
700 /* copy band information */
701 lpBand = &infoPtr->bands[(UINT)wParam];
702
703 if (lprbbi->fMask & RBBIM_STYLE)
704 lprbbi->fStyle = lpBand->fStyle;
705
706 if (lprbbi->fMask & RBBIM_COLORS) {
707 lprbbi->clrFore = lpBand->clrFore;
708 lprbbi->clrBack = lpBand->clrBack;
709 }
710
711 if ((lprbbi->fMask & RBBIM_TEXT) &&
712 (lprbbi->lpText) && (lpBand->lpText)) {
713 lstrcpynW (lprbbi->lpText, lpBand->lpText, MIN(lprbbi->cch,lstrlenW(lpBand->lpText)));
714 }
715
716 if (lprbbi->fMask & RBBIM_IMAGE)
717 lprbbi->iImage = lpBand->iImage;
718
719 if (lprbbi->fMask & RBBIM_CHILD)
720 lprbbi->hwndChild = lpBand->hwndChild;
721
722 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
723 lprbbi->cxMinChild = lpBand->cxMinChild;
724 lprbbi->cyMinChild = lpBand->cyMinChild;
725 lprbbi->cyMaxChild = lpBand->cyMaxChild;
726 lprbbi->cyChild = lpBand->cyChild;
727 lprbbi->cyIntegral = lpBand->cyIntegral;
728 }
729
730 if (lprbbi->fMask & RBBIM_SIZE)
731 lprbbi->cx = lpBand->cx;
732
733 if (lprbbi->fMask & RBBIM_BACKGROUND)
734 lprbbi->hbmBack = lpBand->hbmBack;
735
736 if (lprbbi->fMask & RBBIM_ID)
737 lprbbi->wID = lpBand->wID;
738
739 /* check for additional data */
740 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
741 if (lprbbi->fMask & RBBIM_IDEALSIZE)
742 lprbbi->cxIdeal = lpBand->cxIdeal;
743
744 if (lprbbi->fMask & RBBIM_LPARAM)
745 lprbbi->lParam = lpBand->lParam;
746
747 if (lprbbi->fMask & RBBIM_HEADERSIZE)
748 lprbbi->cxHeader = lpBand->cxHeader;
749 }
750
751 return TRUE;
752}
753
754
755static LRESULT
756REBAR_GetBarHeight (HWND hwnd, WPARAM wParam, LPARAM lParam)
757{
758 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
759 INT nHeight;
760
761 REBAR_Layout (hwnd, NULL);
762 nHeight = infoPtr->calcSize.cy;
763
764 if (GetWindowLongA (hwnd, GWL_STYLE) & WS_BORDER)
765 nHeight += (2 * GetSystemMetrics(SM_CYEDGE));
766
767
768// FIXME (rebar, "height = %d\n", nHeight);
769
770 return nHeight;
771}
772
773
774static LRESULT
775REBAR_GetBarInfo (HWND hwnd, WPARAM wParam, LPARAM lParam)
776{
777 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
778 LPREBARINFO lpInfo = (LPREBARINFO)lParam;
779
780 if (lpInfo == NULL)
781 return FALSE;
782
783 if (lpInfo->cbSize < sizeof (REBARINFO))
784 return FALSE;
785
786// TRACE (rebar, "getting bar info!\n");
787
788 if (infoPtr->himl) {
789 lpInfo->himl = infoPtr->himl;
790 lpInfo->fMask |= RBIM_IMAGELIST;
791 }
792
793 return TRUE;
794}
795
796
797static LRESULT
798REBAR_GetBkColor (HWND hwnd)
799{
800 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
801
802// TRACE (rebar, "background color 0x%06lx!\n", infoPtr->clrBk);
803
804 return infoPtr->clrBk;
805}
806
807
808/* << REBAR_GetColorScheme >> */
809/* << REBAR_GetDropTarget >> */
810
811
812static LRESULT
813REBAR_GetPalette (HWND hwnd, WPARAM wParam, LPARAM lParam)
814{
815// FIXME (rebar, "empty stub!\n");
816
817 return 0;
818}
819
820
821static LRESULT
822REBAR_GetRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
823{
824 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
825 INT iBand = (INT)wParam;
826 LPRECT lprc = (LPRECT)lParam;
827 REBAR_BAND *lpBand;
828
829 if ((iBand < 0) && ((UINT)iBand >= infoPtr->uNumBands))
830 return FALSE;
831 if (!lprc)
832 return FALSE;
833
834// TRACE (rebar, "band %d\n", iBand);
835
836 lpBand = &infoPtr->bands[iBand];
837 CopyRect (lprc, &lpBand->rcBand);
838/*
839 lprc->left = lpBand->rcBand.left;
840 lprc->top = lpBand->rcBand.top;
841 lprc->right = lpBand->rcBand.right;
842 lprc->bottom = lpBand->rcBand.bottom;
843*/
844
845 return TRUE;
846}
847
848
849static LRESULT
850REBAR_GetRowCount (HWND hwnd)
851{
852 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
853
854// FIXME (rebar, "%u : semi stub!\n", infoPtr->uNumBands);
855
856 return infoPtr->uNumBands;
857}
858
859
860static LRESULT
861REBAR_GetRowHeight (HWND hwnd, WPARAM wParam, LPARAM lParam)
862{
863/* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */
864
865// FIXME (rebar, "-- height = 20: semi stub!\n");
866
867 return 20;
868}
869
870
871static LRESULT
872REBAR_GetTextColor (HWND hwnd)
873{
874 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
875
876// TRACE (rebar, "text color 0x%06lx!\n", infoPtr->clrText);
877
878 return infoPtr->clrText;
879}
880
881
882static LRESULT
883REBAR_GetToolTips (HWND hwnd)
884{
885 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
886 return infoPtr->hwndToolTip;
887}
888
889
890static LRESULT
891REBAR_GetUnicodeFormat (HWND hwnd)
892{
893 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
894 return infoPtr->bUnicode;
895}
896
897
898static LRESULT
899REBAR_HitTest (HWND hwnd, WPARAM wParam, LPARAM lParam)
900{
901 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */
902 LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam;
903
904 if (!lprbht)
905 return -1;
906
907 REBAR_InternalHitTest (hwnd, &lprbht->pt, &lprbht->flags, &lprbht->iBand);
908
909 return lprbht->iBand;
910}
911
912
913static LRESULT
914REBAR_IdToIndex (HWND hwnd, WPARAM wParam, LPARAM lParam)
915{
916 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
917 UINT i;
918
919 if (infoPtr == NULL)
920 return -1;
921
922 if (infoPtr->uNumBands < 1)
923 return -1;
924
925// TRACE (rebar, "id %u\n", (UINT)wParam);
926
927 for (i = 0; i < infoPtr->uNumBands; i++) {
928 if (infoPtr->bands[i].wID == (UINT)wParam) {
929// TRACE (rebar, "band %u found!\n", i);
930 return i;
931 }
932 }
933
934// TRACE (rebar, "no band found!\n");
935 return -1;
936}
937
938
939static LRESULT
940REBAR_InsertBandA (HWND hwnd, WPARAM wParam, LPARAM lParam)
941{
942 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
943 LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam;
944 UINT uIndex = (UINT)wParam;
945 REBAR_BAND *lpBand;
946
947 if (infoPtr == NULL)
948 return FALSE;
949 if (lprbbi == NULL)
950 return FALSE;
951 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA)
952 return FALSE;
953
954// TRACE (rebar, "insert band at %u!\n", uIndex);
955
956 if (infoPtr->uNumBands == 0) {
957 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));
958 uIndex = 0;
959 }
960 else {
961 REBAR_BAND *oldBands = infoPtr->bands;
962 infoPtr->bands =
963 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
964 if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))
965 uIndex = infoPtr->uNumBands;
966
967 /* pre insert copy */
968 if (uIndex > 0) {
969 memcpy (&infoPtr->bands[0], &oldBands[0],
970 uIndex * sizeof(REBAR_BAND));
971 }
972
973 /* post copy */
974 if (uIndex < infoPtr->uNumBands - 1) {
975 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],
976 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));
977 }
978
979 COMCTL32_Free (oldBands);
980 }
981
982 infoPtr->uNumBands++;
983
984// TRACE (rebar, "index %u!\n", uIndex);
985
986 /* initialize band (infoPtr->bands[uIndex])*/
987 lpBand = &infoPtr->bands[uIndex];
988
989 if (lprbbi->fMask & RBBIM_STYLE)
990 lpBand->fStyle = lprbbi->fStyle;
991
992 if (lprbbi->fMask & RBBIM_COLORS) {
993 lpBand->clrFore = lprbbi->clrFore;
994 lpBand->clrBack = lprbbi->clrBack;
995 }
996 else {
997 lpBand->clrFore = CLR_NONE;
998 lpBand->clrBack = CLR_NONE;
999 }
1000
1001 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
1002 INT len = lstrlenA (lprbbi->lpText);
1003 if (len > 0) {
1004 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
1005 lstrcpyAtoW (lpBand->lpText, lprbbi->lpText);
1006 }
1007 }
1008
1009 if (lprbbi->fMask & RBBIM_IMAGE)
1010 lpBand->iImage = lprbbi->iImage;
1011 else
1012 lpBand->iImage = -1;
1013
1014 if (lprbbi->fMask & RBBIM_CHILD) {
1015// TRACE (rebar, "hwndChild = %x\n", lprbbi->hwndChild);
1016 lpBand->hwndChild = lprbbi->hwndChild;
1017 lpBand->hwndPrevParent =
1018 SetParent (lpBand->hwndChild, hwnd);
1019 }
1020
1021 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
1022 lpBand->cxMinChild = lprbbi->cxMinChild;
1023 lpBand->cyMinChild = lprbbi->cyMinChild;
1024 lpBand->cyMaxChild = lprbbi->cyMaxChild;
1025 lpBand->cyChild = lprbbi->cyChild;
1026 lpBand->cyIntegral = lprbbi->cyIntegral;
1027 }
1028 else {
1029 lpBand->cxMinChild = -1;
1030 lpBand->cyMinChild = -1;
1031 lpBand->cyMaxChild = -1;
1032 lpBand->cyChild = -1;
1033 lpBand->cyIntegral = -1;
1034 }
1035
1036 if (lprbbi->fMask & RBBIM_SIZE)
1037 lpBand->cx = lprbbi->cx;
1038 else
1039 lpBand->cx = -1;
1040
1041 if (lprbbi->fMask & RBBIM_BACKGROUND)
1042 lpBand->hbmBack = lprbbi->hbmBack;
1043
1044 if (lprbbi->fMask & RBBIM_ID)
1045 lpBand->wID = lprbbi->wID;
1046
1047 /* check for additional data */
1048 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
1049 if (lprbbi->fMask & RBBIM_IDEALSIZE)
1050 lpBand->cxIdeal = lprbbi->cxIdeal;
1051
1052 if (lprbbi->fMask & RBBIM_LPARAM)
1053 lpBand->lParam = lprbbi->lParam;
1054
1055 if (lprbbi->fMask & RBBIM_HEADERSIZE)
1056 lpBand->cxHeader = lprbbi->cxHeader;
1057 }
1058
1059
1060 REBAR_Layout (hwnd, NULL);
1061 REBAR_ForceResize (hwnd);
1062 REBAR_MoveChildWindows (hwnd);
1063
1064 return TRUE;
1065}
1066
1067
1068static LRESULT
1069REBAR_InsertBandW (HWND hwnd, WPARAM wParam, LPARAM lParam)
1070{
1071 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1072 LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam;
1073 UINT uIndex = (UINT)wParam;
1074 REBAR_BAND *lpBand;
1075
1076 if (infoPtr == NULL)
1077 return FALSE;
1078 if (lprbbi == NULL)
1079 return FALSE;
1080 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW)
1081 return FALSE;
1082
1083// TRACE (rebar, "insert band at %u!\n", uIndex);
1084
1085 if (infoPtr->uNumBands == 0) {
1086 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));
1087 uIndex = 0;
1088 }
1089 else {
1090 REBAR_BAND *oldBands = infoPtr->bands;
1091 infoPtr->bands =
1092 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
1093 if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))
1094 uIndex = infoPtr->uNumBands;
1095
1096 /* pre insert copy */
1097 if (uIndex > 0) {
1098 memcpy (&infoPtr->bands[0], &oldBands[0],
1099 uIndex * sizeof(REBAR_BAND));
1100 }
1101
1102 /* post copy */
1103 if (uIndex < infoPtr->uNumBands - 1) {
1104 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],
1105 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));
1106 }
1107
1108 COMCTL32_Free (oldBands);
1109 }
1110
1111 infoPtr->uNumBands++;
1112
1113// TRACE (rebar, "index %u!\n", uIndex);
1114
1115 /* initialize band (infoPtr->bands[uIndex])*/
1116 lpBand = &infoPtr->bands[uIndex];
1117
1118 if (lprbbi->fMask & RBBIM_STYLE)
1119 lpBand->fStyle = lprbbi->fStyle;
1120
1121 if (lprbbi->fMask & RBBIM_COLORS) {
1122 lpBand->clrFore = lprbbi->clrFore;
1123 lpBand->clrBack = lprbbi->clrBack;
1124 }
1125 else {
1126 lpBand->clrFore = CLR_NONE;
1127 lpBand->clrBack = CLR_NONE;
1128 }
1129
1130 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
1131 INT len = lstrlenW (lprbbi->lpText);
1132 if (len > 0) {
1133 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
1134 lstrcpyW (lpBand->lpText, lprbbi->lpText);
1135 }
1136 }
1137
1138 if (lprbbi->fMask & RBBIM_IMAGE)
1139 lpBand->iImage = lprbbi->iImage;
1140 else
1141 lpBand->iImage = -1;
1142
1143 if (lprbbi->fMask & RBBIM_CHILD) {
1144// TRACE (rebar, "hwndChild = %x\n", lprbbi->hwndChild);
1145 lpBand->hwndChild = lprbbi->hwndChild;
1146 lpBand->hwndPrevParent =
1147 SetParent (lpBand->hwndChild, hwnd);
1148 }
1149
1150 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
1151 lpBand->cxMinChild = lprbbi->cxMinChild;
1152 lpBand->cyMinChild = lprbbi->cyMinChild;
1153 lpBand->cyMaxChild = lprbbi->cyMaxChild;
1154 lpBand->cyChild = lprbbi->cyChild;
1155 lpBand->cyIntegral = lprbbi->cyIntegral;
1156 }
1157 else {
1158 lpBand->cxMinChild = -1;
1159 lpBand->cyMinChild = -1;
1160 lpBand->cyMaxChild = -1;
1161 lpBand->cyChild = -1;
1162 lpBand->cyIntegral = -1;
1163 }
1164
1165 if (lprbbi->fMask & RBBIM_SIZE)
1166 lpBand->cx = lprbbi->cx;
1167 else
1168 lpBand->cx = -1;
1169
1170 if (lprbbi->fMask & RBBIM_BACKGROUND)
1171 lpBand->hbmBack = lprbbi->hbmBack;
1172
1173 if (lprbbi->fMask & RBBIM_ID)
1174 lpBand->wID = lprbbi->wID;
1175
1176 /* check for additional data */
1177 if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) {
1178 if (lprbbi->fMask & RBBIM_IDEALSIZE)
1179 lpBand->cxIdeal = lprbbi->cxIdeal;
1180
1181 if (lprbbi->fMask & RBBIM_LPARAM)
1182 lpBand->lParam = lprbbi->lParam;
1183
1184 if (lprbbi->fMask & RBBIM_HEADERSIZE)
1185 lpBand->cxHeader = lprbbi->cxHeader;
1186 }
1187
1188
1189 REBAR_Layout (hwnd, NULL);
1190 REBAR_ForceResize (hwnd);
1191 REBAR_MoveChildWindows (hwnd);
1192
1193 return TRUE;
1194}
1195
1196
1197static LRESULT
1198REBAR_MaximizeBand (HWND hwnd, WPARAM wParam, LPARAM lParam)
1199{
1200/* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */
1201
1202// FIXME (rebar, "(uBand = %u fIdeal = %s)\n",
1203// (UINT)wParam, lParam ? "TRUE" : "FALSE");
1204
1205
1206 return 0;
1207}
1208
1209
1210static LRESULT
1211REBAR_MinimizeBand (HWND hwnd, WPARAM wParam, LPARAM lParam)
1212{
1213/* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */
1214
1215// FIXME (rebar, "(uBand = %u)\n", (UINT)wParam);
1216
1217
1218 return 0;
1219}
1220
1221
1222static LRESULT
1223REBAR_MoveBand (HWND hwnd, WPARAM wParam, LPARAM lParam)
1224{
1225/* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */
1226
1227// FIXME (rebar, "(iFrom = %u iTof = %u)\n",
1228// (UINT)wParam, (UINT)lParam);
1229
1230
1231 return FALSE;
1232}
1233
1234
1235static LRESULT
1236REBAR_SetBandInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam)
1237{
1238 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
1239 LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam;
1240 REBAR_BAND *lpBand;
1241
1242 if (lprbbi == NULL)
1243 return FALSE;
1244 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA)
1245 return FALSE;
1246 if ((UINT)wParam >= infoPtr->uNumBands)
1247 return FALSE;
1248
1249// TRACE (rebar, "index %u\n", (UINT)wParam);
1250
1251 /* set band information */
1252 lpBand = &infoPtr->bands[(UINT)wParam];
1253
1254 if (lprbbi->fMask & RBBIM_STYLE)
1255 lpBand->fStyle = lprbbi->fStyle;
1256
1257 if (lprbbi->fMask & RBBIM_COLORS) {
1258 lpBand->clrFore = lprbbi->clrFore;
1259 lpBand->clrBack = lprbbi->clrBack;
1260 }
1261
1262 if (lprbbi->fMask & RBBIM_TEXT) {
1263 if (lpBand->lpText) {
1264 COMCTL32_Free (lpBand->lpText);
1265 lpBand->lpText = NULL;
1266 }
1267 if (lprbbi->lpText) {
1268 INT len = lstrlenA (lprbbi->lpText);
1269 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
1270 lstrcpyAtoW (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.