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

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

WINE 991212 updates - treeview missing

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