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