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