1 | /*
|
---|
2 | * Interface code to StatusWindow widget/control
|
---|
3 | *
|
---|
4 | * Copyright 1996 Bruce Milner
|
---|
5 | * Copyright 1998, 1999 Eric Kohl
|
---|
6 | */
|
---|
7 | /*
|
---|
8 | * FIXME/TODO
|
---|
9 | * 1) Don't hard code bar to bottom of window, allow CCS_TOP also.
|
---|
10 | * 2) Tooltip support (almost done).
|
---|
11 | * 3) where else should we use infoPtr->hwndParent instead of GetParent() ?
|
---|
12 | * 4) send WM_QUERYFORMAT
|
---|
13 | */
|
---|
14 |
|
---|
15 | #include <string.h>
|
---|
16 | #include "winbase.h"
|
---|
17 | #include "wine/unicode.h"
|
---|
18 | #include "commctrl.h"
|
---|
19 | #include "debugtools.h"
|
---|
20 | #ifdef __WIN32OS2__
|
---|
21 | #include "ccbase.h"
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | DEFAULT_DEBUG_CHANNEL(statusbar);
|
---|
25 |
|
---|
26 | typedef struct
|
---|
27 | {
|
---|
28 | INT x;
|
---|
29 | INT style;
|
---|
30 | RECT bound;
|
---|
31 | LPWSTR text;
|
---|
32 | HICON hIcon;
|
---|
33 | } STATUSWINDOWPART;
|
---|
34 |
|
---|
35 | typedef struct
|
---|
36 | {
|
---|
37 | #ifdef __WIN32OS2__
|
---|
38 | COMCTL32_HEADER header;
|
---|
39 | #endif
|
---|
40 | HWND hwndParent;
|
---|
41 | WORD numParts;
|
---|
42 | WORD textHeight;
|
---|
43 | UINT height;
|
---|
44 | BOOL simple;
|
---|
45 | HWND hwndToolTip;
|
---|
46 | HFONT hFont;
|
---|
47 | HFONT hDefaultFont;
|
---|
48 | COLORREF clrBk; /* background color */
|
---|
49 | BOOL bUnicode; /* unicode flag */
|
---|
50 | STATUSWINDOWPART part0; /* simple window */
|
---|
51 | STATUSWINDOWPART *parts;
|
---|
52 | } STATUSWINDOWINFO;
|
---|
53 |
|
---|
54 | /*
|
---|
55 | * Run tests using Waite Group Windows95 API Bible Vol. 1&2
|
---|
56 | * The second cdrom contains executables drawstat.exe, gettext.exe,
|
---|
57 | * simple.exe, getparts.exe, setparts.exe, statwnd.exe
|
---|
58 | */
|
---|
59 |
|
---|
60 |
|
---|
61 | #define _MAX(a,b) (((a)>(b))?(a):(b))
|
---|
62 | #define _MIN(a,b) (((a)>(b))?(b):(a))
|
---|
63 |
|
---|
64 | #define HORZ_BORDER 0
|
---|
65 | #define VERT_BORDER 2
|
---|
66 | #define HORZ_GAP 2
|
---|
67 |
|
---|
68 | #define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO *)GetWindowLongA (hwnd, 0))
|
---|
69 |
|
---|
70 | /* prototype */
|
---|
71 | static void
|
---|
72 | STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr, HWND hwnd);
|
---|
73 |
|
---|
74 | static void
|
---|
75 | STATUSBAR_DrawSizeGrip (HDC hdc, LPRECT lpRect)
|
---|
76 | {
|
---|
77 | HPEN hOldPen;
|
---|
78 | POINT pt;
|
---|
79 | INT i;
|
---|
80 |
|
---|
81 | TRACE("draw size grip %d,%d - %d,%d\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
|
---|
82 | pt.x = lpRect->right - 1;
|
---|
83 | pt.y = lpRect->bottom - 1;
|
---|
84 |
|
---|
85 | hOldPen = SelectObject (hdc, GetSysColorPen (COLOR_3DFACE));
|
---|
86 | MoveToEx (hdc, pt.x - 12, pt.y, NULL);
|
---|
87 | LineTo (hdc, pt.x, pt.y);
|
---|
88 | LineTo (hdc, pt.x, pt.y - 12);
|
---|
89 |
|
---|
90 | pt.x--;
|
---|
91 | pt.y--;
|
---|
92 |
|
---|
93 | SelectObject (hdc, GetSysColorPen (COLOR_3DSHADOW));
|
---|
94 | for (i = 1; i < 11; i += 4) {
|
---|
95 | MoveToEx (hdc, pt.x - i, pt.y, NULL);
|
---|
96 | LineTo (hdc, pt.x, pt.y - i);
|
---|
97 |
|
---|
98 | MoveToEx (hdc, pt.x - i-1, pt.y, NULL);
|
---|
99 | LineTo (hdc, pt.x, pt.y - i-1);
|
---|
100 | }
|
---|
101 |
|
---|
102 | SelectObject (hdc, GetSysColorPen (COLOR_3DHIGHLIGHT));
|
---|
103 | for (i = 3; i < 13; i += 4) {
|
---|
104 | MoveToEx (hdc, pt.x - i, pt.y, NULL);
|
---|
105 | LineTo (hdc, pt.x, pt.y - i);
|
---|
106 | }
|
---|
107 |
|
---|
108 | SelectObject (hdc, hOldPen);
|
---|
109 | }
|
---|
110 |
|
---|
111 |
|
---|
112 | static void
|
---|
113 | STATUSBAR_DrawPart (HDC hdc, STATUSWINDOWPART *part)
|
---|
114 | {
|
---|
115 | RECT r = part->bound;
|
---|
116 | UINT border = BDR_SUNKENOUTER;
|
---|
117 |
|
---|
118 | TRACE("part bound %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom);
|
---|
119 | if (part->style & SBT_POPOUT)
|
---|
120 | border = BDR_RAISEDOUTER;
|
---|
121 | else if (part->style & SBT_NOBORDERS)
|
---|
122 | border = 0;
|
---|
123 |
|
---|
124 | DrawEdge(hdc, &r, border, BF_RECT|BF_ADJUST);
|
---|
125 |
|
---|
126 | /* draw the icon */
|
---|
127 | if (part->hIcon) {
|
---|
128 | INT cy = r.bottom - r.top;
|
---|
129 |
|
---|
130 | r.left += 2;
|
---|
131 | DrawIconEx (hdc, r.left, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL);
|
---|
132 | r.left += cy;
|
---|
133 | }
|
---|
134 |
|
---|
135 | /* now draw text */
|
---|
136 | if (part->text) {
|
---|
137 | int oldbkmode = SetBkMode(hdc, TRANSPARENT);
|
---|
138 | LPWSTR p = (LPWSTR)part->text;
|
---|
139 | UINT align = DT_LEFT;
|
---|
140 | if (*p == L'\t') {
|
---|
141 | p++;
|
---|
142 | align = DT_CENTER;
|
---|
143 |
|
---|
144 | if (*p == L'\t') {
|
---|
145 | p++;
|
---|
146 | align = DT_RIGHT;
|
---|
147 | }
|
---|
148 | }
|
---|
149 | r.left += 3;
|
---|
150 | TRACE("%s at %d,%d - %d,%d\n", debugstr_w(p), r.left, r.top, r.right, r.bottom);
|
---|
151 | DrawTextW (hdc, p, -1, &r, align|DT_VCENTER|DT_SINGLELINE);
|
---|
152 | if (oldbkmode != TRANSPARENT)
|
---|
153 | SetBkMode(hdc, oldbkmode);
|
---|
154 | }
|
---|
155 | }
|
---|
156 |
|
---|
157 |
|
---|
158 | static VOID
|
---|
159 | STATUSBAR_RefreshPart (STATUSWINDOWINFO *infoPtr, HWND hwnd, STATUSWINDOWPART *part, HDC hdc, int itemID)
|
---|
160 | {
|
---|
161 | HBRUSH hbrBk;
|
---|
162 | HFONT hOldFont;
|
---|
163 |
|
---|
164 | TRACE("item %d\n", itemID);
|
---|
165 | if (!IsWindowVisible (hwnd))
|
---|
166 | return;
|
---|
167 |
|
---|
168 | if (part->bound.right < part->bound.left) return;
|
---|
169 |
|
---|
170 | if (infoPtr->clrBk != CLR_DEFAULT)
|
---|
171 | hbrBk = CreateSolidBrush (infoPtr->clrBk);
|
---|
172 | else
|
---|
173 | hbrBk = GetSysColorBrush (COLOR_3DFACE);
|
---|
174 | FillRect(hdc, &part->bound, hbrBk);
|
---|
175 |
|
---|
176 | hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
|
---|
177 |
|
---|
178 | if (part->style & SBT_OWNERDRAW) {
|
---|
179 | DRAWITEMSTRUCT dis;
|
---|
180 |
|
---|
181 | dis.CtlID = GetWindowLongA (hwnd, GWL_ID);
|
---|
182 | dis.itemID = itemID;
|
---|
183 | dis.hwndItem = hwnd;
|
---|
184 | dis.hDC = hdc;
|
---|
185 | dis.rcItem = part->bound;
|
---|
186 | dis.itemData = (INT)part->text;
|
---|
187 | SendMessageA (GetParent (hwnd), WM_DRAWITEM,
|
---|
188 | (WPARAM)dis.CtlID, (LPARAM)&dis);
|
---|
189 | } else
|
---|
190 | STATUSBAR_DrawPart (hdc, part);
|
---|
191 |
|
---|
192 | SelectObject (hdc, hOldFont);
|
---|
193 |
|
---|
194 | if (infoPtr->clrBk != CLR_DEFAULT)
|
---|
195 | DeleteObject (hbrBk);
|
---|
196 |
|
---|
197 | if (GetWindowLongA (hwnd, GWL_STYLE) & SBARS_SIZEGRIP) {
|
---|
198 | RECT rect;
|
---|
199 |
|
---|
200 | GetClientRect (hwnd, &rect);
|
---|
201 | STATUSBAR_DrawSizeGrip (hdc, &rect);
|
---|
202 | }
|
---|
203 | }
|
---|
204 |
|
---|
205 |
|
---|
206 | static BOOL
|
---|
207 | STATUSBAR_Refresh (STATUSWINDOWINFO *infoPtr, HWND hwnd, HDC hdc)
|
---|
208 | {
|
---|
209 | int i;
|
---|
210 | RECT rect;
|
---|
211 | HBRUSH hbrBk;
|
---|
212 | HFONT hOldFont;
|
---|
213 |
|
---|
214 | TRACE("\n");
|
---|
215 | if (!IsWindowVisible(hwnd))
|
---|
216 | return (TRUE);
|
---|
217 |
|
---|
218 | STATUSBAR_SetPartBounds(infoPtr, hwnd);
|
---|
219 |
|
---|
220 | GetClientRect (hwnd, &rect);
|
---|
221 |
|
---|
222 | if (infoPtr->clrBk != CLR_DEFAULT)
|
---|
223 | hbrBk = CreateSolidBrush (infoPtr->clrBk);
|
---|
224 | else
|
---|
225 | hbrBk = GetSysColorBrush (COLOR_3DFACE);
|
---|
226 | FillRect(hdc, &rect, hbrBk);
|
---|
227 |
|
---|
228 | hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
|
---|
229 |
|
---|
230 | if (infoPtr->simple) {
|
---|
231 | STATUSBAR_RefreshPart (infoPtr, hwnd, &infoPtr->part0, hdc, 0);
|
---|
232 | } else {
|
---|
233 | for (i = 0; i < infoPtr->numParts; i++) {
|
---|
234 | if (infoPtr->parts[i].style & SBT_OWNERDRAW) {
|
---|
235 | DRAWITEMSTRUCT dis;
|
---|
236 |
|
---|
237 | dis.CtlID = GetWindowLongA (hwnd, GWL_ID);
|
---|
238 | dis.itemID = i;
|
---|
239 | dis.hwndItem = hwnd;
|
---|
240 | dis.hDC = hdc;
|
---|
241 | dis.rcItem = infoPtr->parts[i].bound;
|
---|
242 | dis.itemData = (INT)infoPtr->parts[i].text;
|
---|
243 | SendMessageA (GetParent (hwnd), WM_DRAWITEM,
|
---|
244 | (WPARAM)dis.CtlID, (LPARAM)&dis);
|
---|
245 | } else
|
---|
246 | STATUSBAR_RefreshPart (infoPtr, hwnd, &infoPtr->parts[i], hdc, i);
|
---|
247 | }
|
---|
248 | }
|
---|
249 |
|
---|
250 | SelectObject (hdc, hOldFont);
|
---|
251 |
|
---|
252 | if (infoPtr->clrBk != CLR_DEFAULT)
|
---|
253 | DeleteObject (hbrBk);
|
---|
254 |
|
---|
255 | if (GetWindowLongA(hwnd, GWL_STYLE) & SBARS_SIZEGRIP)
|
---|
256 | STATUSBAR_DrawSizeGrip (hdc, &rect);
|
---|
257 |
|
---|
258 | return TRUE;
|
---|
259 | }
|
---|
260 |
|
---|
261 |
|
---|
262 | static void
|
---|
263 | STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr, HWND hwnd)
|
---|
264 | {
|
---|
265 | STATUSWINDOWPART *part;
|
---|
266 | RECT rect, *r;
|
---|
267 | int i;
|
---|
268 |
|
---|
269 | /* get our window size */
|
---|
270 | GetClientRect (hwnd, &rect);
|
---|
271 | TRACE("client wnd size is %d,%d - %d,%d\n", rect.left, rect.top, rect.right, rect.bottom);
|
---|
272 |
|
---|
273 | rect.top += VERT_BORDER;
|
---|
274 |
|
---|
275 | /* set bounds for simple rectangle */
|
---|
276 | infoPtr->part0.bound = rect;
|
---|
277 |
|
---|
278 | /* set bounds for non-simple rectangles */
|
---|
279 | for (i = 0; i < infoPtr->numParts; i++) {
|
---|
280 | part = &infoPtr->parts[i];
|
---|
281 | r = &infoPtr->parts[i].bound;
|
---|
282 | r->top = rect.top;
|
---|
283 | r->bottom = rect.bottom;
|
---|
284 | if (i == 0)
|
---|
285 | r->left = 0;
|
---|
286 | else
|
---|
287 | r->left = infoPtr->parts[i-1].bound.right + HORZ_GAP;
|
---|
288 | if (part->x == -1)
|
---|
289 | r->right = rect.right;
|
---|
290 | else
|
---|
291 | r->right = part->x;
|
---|
292 |
|
---|
293 | if (infoPtr->hwndToolTip) {
|
---|
294 | TTTOOLINFOA ti;
|
---|
295 |
|
---|
296 | ti.cbSize = sizeof(TTTOOLINFOA);
|
---|
297 | ti.hwnd = hwnd;
|
---|
298 | ti.uId = i;
|
---|
299 | ti.rect = *r;
|
---|
300 | SendMessageA (infoPtr->hwndToolTip, TTM_NEWTOOLRECTA,
|
---|
301 | 0, (LPARAM)&ti);
|
---|
302 | }
|
---|
303 | }
|
---|
304 | }
|
---|
305 |
|
---|
306 |
|
---|
307 | static VOID
|
---|
308 | STATUSBAR_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg,
|
---|
309 | WPARAM wParam, LPARAM lParam)
|
---|
310 | {
|
---|
311 | MSG msg;
|
---|
312 |
|
---|
313 | msg.hwnd = hwndMsg;
|
---|
314 | msg.message = uMsg;
|
---|
315 | msg.wParam = wParam;
|
---|
316 | msg.lParam = lParam;
|
---|
317 | msg.time = GetMessageTime ();
|
---|
318 | msg.pt.x = LOWORD(GetMessagePos ());
|
---|
319 | msg.pt.y = HIWORD(GetMessagePos ());
|
---|
320 |
|
---|
321 | SendMessageA (hwndTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
|
---|
322 | }
|
---|
323 |
|
---|
324 |
|
---|
325 | inline static LRESULT
|
---|
326 | STATUSBAR_GetBorders (LPARAM lParam)
|
---|
327 | {
|
---|
328 | LPINT out = (LPINT) lParam;
|
---|
329 |
|
---|
330 | TRACE("\n");
|
---|
331 | out[0] = HORZ_BORDER; /* horizontal border width */
|
---|
332 | out[1] = VERT_BORDER; /* vertical border width */
|
---|
333 | out[2] = HORZ_GAP; /* width of border between rectangles */
|
---|
334 |
|
---|
335 | return TRUE;
|
---|
336 | }
|
---|
337 |
|
---|
338 |
|
---|
339 | static LRESULT
|
---|
340 | STATUSBAR_GetIcon (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam)
|
---|
341 | {
|
---|
342 | INT nPart;
|
---|
343 |
|
---|
344 | nPart = (INT)wParam & 0x00ff;
|
---|
345 | TRACE("%d\n", nPart);
|
---|
346 | if ((nPart < -1) || (nPart >= infoPtr->numParts))
|
---|
347 | return 0;
|
---|
348 |
|
---|
349 | if (nPart == -1)
|
---|
350 | return (infoPtr->part0.hIcon);
|
---|
351 | else
|
---|
352 | return (infoPtr->parts[nPart].hIcon);
|
---|
353 | }
|
---|
354 |
|
---|
355 |
|
---|
356 | static LRESULT
|
---|
357 | STATUSBAR_GetParts (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
358 | {
|
---|
359 | LPINT parts;
|
---|
360 | INT num_parts;
|
---|
361 | INT i;
|
---|
362 |
|
---|
363 | num_parts = (INT) wParam;
|
---|
364 | TRACE("(%d)\n", num_parts);
|
---|
365 | parts = (LPINT) lParam;
|
---|
366 | if (parts) {
|
---|
367 | for (i = 0; i < num_parts; i++) {
|
---|
368 | parts[i] = infoPtr->parts[i].x;
|
---|
369 | }
|
---|
370 | }
|
---|
371 | return (infoPtr->numParts);
|
---|
372 | }
|
---|
373 |
|
---|
374 |
|
---|
375 | static LRESULT
|
---|
376 | STATUSBAR_GetRect (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
377 | {
|
---|
378 | int nPart;
|
---|
379 | LPRECT rect;
|
---|
380 |
|
---|
381 | nPart = ((INT) wParam) & 0x00ff;
|
---|
382 | TRACE("part %d\n", nPart);
|
---|
383 | rect = (LPRECT) lParam;
|
---|
384 | if (infoPtr->simple)
|
---|
385 | *rect = infoPtr->part0.bound;
|
---|
386 | else
|
---|
387 | *rect = infoPtr->parts[nPart].bound;
|
---|
388 | return TRUE;
|
---|
389 | }
|
---|
390 |
|
---|
391 |
|
---|
392 | static LRESULT
|
---|
393 | STATUSBAR_GetTextA (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
394 | {
|
---|
395 | STATUSWINDOWPART *part;
|
---|
396 | INT nPart;
|
---|
397 | LRESULT result;
|
---|
398 |
|
---|
399 | nPart = ((INT) wParam) & 0x00ff;
|
---|
400 | TRACE("part %d\n", nPart);
|
---|
401 | if (infoPtr->simple)
|
---|
402 | part = &infoPtr->part0;
|
---|
403 | else
|
---|
404 | #ifdef __WIN32OS2__
|
---|
405 | {
|
---|
406 | if (nPart >= infoPtr->numParts)
|
---|
407 | return FALSE;
|
---|
408 | part = &infoPtr->parts[nPart];
|
---|
409 | }
|
---|
410 | #else
|
---|
411 | part = &infoPtr->parts[nPart];
|
---|
412 | #endif
|
---|
413 |
|
---|
414 | if (part->style & SBT_OWNERDRAW)
|
---|
415 | result = (LRESULT)part->text;
|
---|
416 | else {
|
---|
417 | DWORD len = part->text ? WideCharToMultiByte( CP_ACP, 0, part->text, -1,
|
---|
418 | NULL, 0, NULL, NULL ) - 1 : 0;
|
---|
419 | result = MAKELONG( len, part->style );
|
---|
420 | if (lParam && len)
|
---|
421 | WideCharToMultiByte( CP_ACP, 0, part->text, -1, (LPSTR)lParam, len+1, NULL, NULL );
|
---|
422 | }
|
---|
423 | return result;
|
---|
424 | }
|
---|
425 |
|
---|
426 |
|
---|
427 | static LRESULT
|
---|
428 | STATUSBAR_GetTextW (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
429 | {
|
---|
430 | STATUSWINDOWPART *part;
|
---|
431 | INT nPart;
|
---|
432 | LRESULT result;
|
---|
433 |
|
---|
434 | nPart = ((INT)wParam) & 0x00ff;
|
---|
435 | TRACE("part %d\n", nPart);
|
---|
436 | if (infoPtr->simple)
|
---|
437 | part = &infoPtr->part0;
|
---|
438 | else
|
---|
439 | #ifdef __WIN32OS2__
|
---|
440 | {
|
---|
441 | if (nPart >= infoPtr->numParts)
|
---|
442 | return FALSE;
|
---|
443 | part = &infoPtr->parts[nPart];
|
---|
444 | }
|
---|
445 | #else
|
---|
446 | part = &infoPtr->parts[nPart];
|
---|
447 | #endif
|
---|
448 |
|
---|
449 | if (part->style & SBT_OWNERDRAW)
|
---|
450 | result = (LRESULT)part->text;
|
---|
451 | else {
|
---|
452 | result = part->text ? strlenW (part->text) : 0;
|
---|
453 | result |= (part->style << 16);
|
---|
454 | if (part->text && lParam)
|
---|
455 | strcpyW ((LPWSTR)lParam, part->text);
|
---|
456 | }
|
---|
457 | return result;
|
---|
458 | }
|
---|
459 |
|
---|
460 |
|
---|
461 | static LRESULT
|
---|
462 | STATUSBAR_GetTextLength (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam)
|
---|
463 | {
|
---|
464 | STATUSWINDOWPART *part;
|
---|
465 | INT nPart;
|
---|
466 | DWORD result;
|
---|
467 |
|
---|
468 | nPart = ((INT) wParam) & 0x00ff;
|
---|
469 |
|
---|
470 | TRACE("part %d\n", nPart);
|
---|
471 |
|
---|
472 | if (infoPtr->simple)
|
---|
473 | part = &infoPtr->part0;
|
---|
474 | else
|
---|
475 | #ifdef __WIN32OS2__
|
---|
476 | {
|
---|
477 | if (nPart >= infoPtr->numParts)
|
---|
478 | return FALSE;
|
---|
479 | part = &infoPtr->parts[nPart];
|
---|
480 | }
|
---|
481 | #else
|
---|
482 | part = &infoPtr->parts[nPart];
|
---|
483 | #endif
|
---|
484 |
|
---|
485 | if (part->text)
|
---|
486 | result = strlenW(part->text);
|
---|
487 | else
|
---|
488 | result = 0;
|
---|
489 |
|
---|
490 | result |= (part->style << 16);
|
---|
491 | return result;
|
---|
492 | }
|
---|
493 |
|
---|
494 |
|
---|
495 | static LRESULT
|
---|
496 | STATUSBAR_GetTipTextA (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
497 | {
|
---|
498 | LPSTR tip = (LPSTR)lParam;
|
---|
499 |
|
---|
500 | if (tip) {
|
---|
501 | CHAR buf[INFOTIPSIZE];
|
---|
502 | buf[0]='\0';
|
---|
503 |
|
---|
504 | if (infoPtr->hwndToolTip) {
|
---|
505 | TTTOOLINFOA ti;
|
---|
506 | ti.cbSize = sizeof(TTTOOLINFOA);
|
---|
507 | ti.hwnd = hwnd;
|
---|
508 | ti.uId = LOWORD(wParam);
|
---|
509 | ti.lpszText = buf;
|
---|
510 | SendMessageA(infoPtr->hwndToolTip, TTM_GETTEXTA, 0, (LPARAM)&ti);
|
---|
511 | }
|
---|
512 | lstrcpynA(tip, buf, HIWORD(wParam));
|
---|
513 | }
|
---|
514 | return 0;
|
---|
515 | }
|
---|
516 |
|
---|
517 |
|
---|
518 | static LRESULT
|
---|
519 | STATUSBAR_GetTipTextW (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
520 | {
|
---|
521 | LPWSTR tip = (LPWSTR)lParam;
|
---|
522 |
|
---|
523 | TRACE("\n");
|
---|
524 | if (tip) {
|
---|
525 | WCHAR buf[INFOTIPSIZE];
|
---|
526 | buf[0]=0;
|
---|
527 |
|
---|
528 | if (infoPtr->hwndToolTip) {
|
---|
529 | TTTOOLINFOW ti;
|
---|
530 | ti.cbSize = sizeof(TTTOOLINFOW);
|
---|
531 | ti.hwnd = hwnd;
|
---|
532 | ti.uId = LOWORD(wParam);
|
---|
533 | ti.lpszText = buf;
|
---|
534 | SendMessageW(infoPtr->hwndToolTip, TTM_GETTEXTW, 0, (LPARAM)&ti);
|
---|
535 | }
|
---|
536 | lstrcpynW(tip, buf, HIWORD(wParam));
|
---|
537 | }
|
---|
538 |
|
---|
539 | return 0;
|
---|
540 | }
|
---|
541 |
|
---|
542 |
|
---|
543 | inline static LRESULT
|
---|
544 | STATUSBAR_GetUnicodeFormat (STATUSWINDOWINFO *infoPtr, HWND hwnd)
|
---|
545 | {
|
---|
546 | return infoPtr->bUnicode;
|
---|
547 | }
|
---|
548 |
|
---|
549 |
|
---|
550 | inline static LRESULT
|
---|
551 | STATUSBAR_IsSimple (STATUSWINDOWINFO *infoPtr, HWND hwnd)
|
---|
552 | {
|
---|
553 | return infoPtr->simple;
|
---|
554 | }
|
---|
555 |
|
---|
556 |
|
---|
557 | static LRESULT
|
---|
558 | STATUSBAR_SetBkColor (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
559 | {
|
---|
560 | COLORREF oldBkColor;
|
---|
561 |
|
---|
562 | oldBkColor = infoPtr->clrBk;
|
---|
563 | infoPtr->clrBk = (COLORREF)lParam;
|
---|
564 | InvalidateRect(hwnd, NULL, FALSE);
|
---|
565 |
|
---|
566 | TRACE("CREF: %08lx -> %08lx\n", oldBkColor, infoPtr->clrBk);
|
---|
567 | return oldBkColor;
|
---|
568 | }
|
---|
569 |
|
---|
570 |
|
---|
571 | static LRESULT
|
---|
572 | STATUSBAR_SetIcon (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
573 | {
|
---|
574 | INT nPart = (INT)wParam & 0x00ff;
|
---|
575 |
|
---|
576 | if ((nPart < -1) || (nPart >= infoPtr->numParts))
|
---|
577 | return FALSE;
|
---|
578 |
|
---|
579 | TRACE("setting part %d, icon %lx\n",nPart,lParam);
|
---|
580 |
|
---|
581 | if (nPart == -1) {
|
---|
582 | if (infoPtr->part0.hIcon == (HICON)lParam) /* same as - no redraw */
|
---|
583 | return TRUE;
|
---|
584 | infoPtr->part0.hIcon = (HICON)lParam;
|
---|
585 | if (infoPtr->simple)
|
---|
586 | InvalidateRect(hwnd, &infoPtr->part0.bound, FALSE);
|
---|
587 | } else {
|
---|
588 | if (infoPtr->parts[nPart].hIcon == (HICON)lParam) /* same as - no redraw */
|
---|
589 | return TRUE;
|
---|
590 |
|
---|
591 | infoPtr->parts[nPart].hIcon = (HICON)lParam;
|
---|
592 | if (!(infoPtr->simple))
|
---|
593 | InvalidateRect(hwnd, &infoPtr->parts[nPart].bound, FALSE);
|
---|
594 | }
|
---|
595 | return TRUE;
|
---|
596 | }
|
---|
597 |
|
---|
598 |
|
---|
599 | static LRESULT
|
---|
600 | STATUSBAR_SetMinHeight (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
601 | {
|
---|
602 |
|
---|
603 | TRACE("\n");
|
---|
604 | if (IsWindowVisible (hwnd)) {
|
---|
605 | HWND parent = GetParent (hwnd);
|
---|
606 | INT width, x, y;
|
---|
607 | RECT parent_rect;
|
---|
608 |
|
---|
609 | GetClientRect (parent, &parent_rect);
|
---|
610 | infoPtr->height = (INT)wParam + VERT_BORDER;
|
---|
611 | width = parent_rect.right - parent_rect.left;
|
---|
612 | x = parent_rect.left;
|
---|
613 | y = parent_rect.bottom - infoPtr->height;
|
---|
614 | MoveWindow (hwnd, parent_rect.left,
|
---|
615 | parent_rect.bottom - infoPtr->height,
|
---|
616 | width, infoPtr->height, TRUE);
|
---|
617 | STATUSBAR_SetPartBounds (infoPtr, hwnd);
|
---|
618 | }
|
---|
619 |
|
---|
620 | return TRUE;
|
---|
621 | }
|
---|
622 |
|
---|
623 |
|
---|
624 | static LRESULT
|
---|
625 | STATUSBAR_SetParts (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
626 | {
|
---|
627 | STATUSWINDOWPART *tmp;
|
---|
628 | LPINT parts;
|
---|
629 | int i;
|
---|
630 | int oldNumParts;
|
---|
631 |
|
---|
632 | TRACE("(%d,%p)\n",wParam,(LPVOID)lParam);
|
---|
633 |
|
---|
634 | /* FIXME: should return FALSE sometimes (maybe when wParam == 0 ?) */
|
---|
635 | if (infoPtr->simple)
|
---|
636 | infoPtr->simple = FALSE;
|
---|
637 |
|
---|
638 | oldNumParts = infoPtr->numParts;
|
---|
639 | infoPtr->numParts = (INT) wParam;
|
---|
640 | parts = (LPINT) lParam;
|
---|
641 | if (oldNumParts > infoPtr->numParts) {
|
---|
642 | for (i = infoPtr->numParts ; i < oldNumParts; i++) {
|
---|
643 | if (infoPtr->parts[i].text && !(infoPtr->parts[i].style & SBT_OWNERDRAW))
|
---|
644 | COMCTL32_Free (infoPtr->parts[i].text);
|
---|
645 | }
|
---|
646 | }
|
---|
647 | if (oldNumParts < infoPtr->numParts) {
|
---|
648 | tmp = COMCTL32_Alloc (sizeof(STATUSWINDOWPART) * infoPtr->numParts);
|
---|
649 | for (i = 0; i < oldNumParts; i++) {
|
---|
650 | tmp[i] = infoPtr->parts[i];
|
---|
651 | }
|
---|
652 | if (infoPtr->parts)
|
---|
653 | COMCTL32_Free (infoPtr->parts);
|
---|
654 | infoPtr->parts = tmp;
|
---|
655 | }
|
---|
656 | if (oldNumParts == infoPtr->numParts) {
|
---|
657 | for (i=0;i<oldNumParts;i++)
|
---|
658 | if (infoPtr->parts[i].x != parts[i])
|
---|
659 | break;
|
---|
660 | if (i==oldNumParts) /* Unchanged? no need to redraw! */
|
---|
661 | return TRUE;
|
---|
662 | }
|
---|
663 |
|
---|
664 | for (i = 0; i < infoPtr->numParts; i++)
|
---|
665 | infoPtr->parts[i].x = parts[i];
|
---|
666 |
|
---|
667 | if (infoPtr->hwndToolTip) {
|
---|
668 | INT nTipCount =
|
---|
669 | SendMessageA (infoPtr->hwndToolTip, TTM_GETTOOLCOUNT, 0, 0);
|
---|
670 |
|
---|
671 | if (nTipCount < infoPtr->numParts) {
|
---|
672 | /* add tools */
|
---|
673 | TTTOOLINFOA ti;
|
---|
674 | INT i;
|
---|
675 |
|
---|
676 | ZeroMemory (&ti, sizeof(TTTOOLINFOA));
|
---|
677 | ti.cbSize = sizeof(TTTOOLINFOA);
|
---|
678 | ti.hwnd = hwnd;
|
---|
679 | for (i = nTipCount; i < infoPtr->numParts; i++) {
|
---|
680 | TRACE("add tool %d\n", i);
|
---|
681 | ti.uId = i;
|
---|
682 | SendMessageA (infoPtr->hwndToolTip, TTM_ADDTOOLA,
|
---|
683 | 0, (LPARAM)&ti);
|
---|
684 | }
|
---|
685 | }
|
---|
686 | else if (nTipCount > infoPtr->numParts) {
|
---|
687 | /* delete tools */
|
---|
688 | INT i;
|
---|
689 |
|
---|
690 | for (i = nTipCount - 1; i >= infoPtr->numParts; i--) {
|
---|
691 | FIXME("delete tool %d\n", i);
|
---|
692 | }
|
---|
693 | }
|
---|
694 | }
|
---|
695 | STATUSBAR_SetPartBounds (infoPtr, hwnd);
|
---|
696 | InvalidateRect(hwnd, NULL, FALSE);
|
---|
697 | return TRUE;
|
---|
698 | }
|
---|
699 |
|
---|
700 |
|
---|
701 | static LRESULT
|
---|
702 | STATUSBAR_SetTextA (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
703 | {
|
---|
704 | STATUSWINDOWPART *part=NULL;
|
---|
705 | int nPart;
|
---|
706 | int style;
|
---|
707 | LPSTR text;
|
---|
708 | BOOL changed = FALSE;
|
---|
709 |
|
---|
710 | text = (LPSTR) lParam;
|
---|
711 | nPart = ((INT) wParam) & 0x00ff;
|
---|
712 | style = ((INT) wParam) & 0xff00;
|
---|
713 |
|
---|
714 | TRACE("part %d, text %s\n",nPart,debugstr_a(text));
|
---|
715 |
|
---|
716 | if (nPart==255)
|
---|
717 | part = &infoPtr->part0;
|
---|
718 | else if (!infoPtr->simple && infoPtr->parts!=NULL)
|
---|
719 | #ifdef __WIN32OS2__
|
---|
720 | {
|
---|
721 | if (nPart >= infoPtr->numParts)
|
---|
722 | return FALSE;
|
---|
723 | part = &infoPtr->parts[nPart];
|
---|
724 | }
|
---|
725 | #else
|
---|
726 | part = &infoPtr->parts[nPart];
|
---|
727 | #endif
|
---|
728 | if (!part) return FALSE;
|
---|
729 |
|
---|
730 | if (part->style != style)
|
---|
731 | changed = TRUE;
|
---|
732 |
|
---|
733 | part->style = style;
|
---|
734 | if (style & SBT_OWNERDRAW) {
|
---|
735 | if (part->text == (LPWSTR)text)
|
---|
736 | return TRUE;
|
---|
737 | part->text = (LPWSTR)text;
|
---|
738 | } else {
|
---|
739 | LPWSTR ntext;
|
---|
740 |
|
---|
741 | /* check if text is unchanged -> no need to redraw */
|
---|
742 | if (text) {
|
---|
743 | DWORD len = MultiByteToWideChar( CP_ACP, 0, text, -1, NULL, 0 );
|
---|
744 | LPWSTR tmptext = COMCTL32_Alloc(len*sizeof(WCHAR));
|
---|
745 | MultiByteToWideChar( CP_ACP, 0, text, -1, tmptext, len );
|
---|
746 |
|
---|
747 | if (!changed && part->text && !lstrcmpW(tmptext,part->text)) {
|
---|
748 | COMCTL32_Free(tmptext);
|
---|
749 | return TRUE;
|
---|
750 | }
|
---|
751 | ntext = tmptext;
|
---|
752 | } else {
|
---|
753 | if (!changed && !part->text)
|
---|
754 | return TRUE;
|
---|
755 | ntext = 0;
|
---|
756 | }
|
---|
757 |
|
---|
758 | if (part->text)
|
---|
759 | COMCTL32_Free (part->text);
|
---|
760 | part->text = ntext;
|
---|
761 | }
|
---|
762 | InvalidateRect(hwnd, &part->bound, FALSE);
|
---|
763 |
|
---|
764 | return TRUE;
|
---|
765 | }
|
---|
766 |
|
---|
767 |
|
---|
768 | static LRESULT
|
---|
769 | STATUSBAR_SetTextW (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
770 | {
|
---|
771 | STATUSWINDOWPART *part;
|
---|
772 | INT nPart, style, len;
|
---|
773 | LPWSTR text;
|
---|
774 | BOOL bRedraw = FALSE;
|
---|
775 |
|
---|
776 | text = (LPWSTR) lParam;
|
---|
777 | nPart = ((INT) wParam) & 0x00ff;
|
---|
778 | style = ((INT) wParam) & 0xff00;
|
---|
779 |
|
---|
780 | TRACE("part %d -> '%s' with style %04x\n", nPart, debugstr_w(text), style);
|
---|
781 | if ((infoPtr->simple) || (infoPtr->parts==NULL) || (nPart==255))
|
---|
782 | part = &infoPtr->part0;
|
---|
783 | else
|
---|
784 | #ifdef __WIN32OS2__
|
---|
785 | {
|
---|
786 | if (nPart >= infoPtr->numParts)
|
---|
787 | return FALSE;
|
---|
788 | part = &infoPtr->parts[nPart];
|
---|
789 | }
|
---|
790 | #else
|
---|
791 | part = &infoPtr->parts[nPart];
|
---|
792 | #endif
|
---|
793 | if (!part) return FALSE;
|
---|
794 |
|
---|
795 | if(part->style != style)
|
---|
796 | bRedraw = TRUE;
|
---|
797 |
|
---|
798 | part->style = style;
|
---|
799 |
|
---|
800 | /* FIXME: not sure how/if we can check for change in string with ownerdraw(remove this if we can't)... */
|
---|
801 | if (style & SBT_OWNERDRAW)
|
---|
802 | {
|
---|
803 | part->text = text;
|
---|
804 | bRedraw = TRUE;
|
---|
805 | } else if(!text)
|
---|
806 | {
|
---|
807 | if(part->text)
|
---|
808 | {
|
---|
809 | COMCTL32_Free(part->text);
|
---|
810 | bRedraw = TRUE;
|
---|
811 | }
|
---|
812 | part->text = 0;
|
---|
813 | } else if(!part->text || strcmpW(part->text, text)) /* see if the new string differs from the existing string */
|
---|
814 | {
|
---|
815 | if(part->text) COMCTL32_Free(part->text);
|
---|
816 |
|
---|
817 | len = strlenW(text);
|
---|
818 | part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
|
---|
819 | strcpyW(part->text, text);
|
---|
820 | bRedraw = TRUE;
|
---|
821 | }
|
---|
822 |
|
---|
823 | if(bRedraw)
|
---|
824 | InvalidateRect(hwnd, &part->bound, FALSE);
|
---|
825 |
|
---|
826 | return TRUE;
|
---|
827 | }
|
---|
828 |
|
---|
829 |
|
---|
830 | static LRESULT
|
---|
831 | STATUSBAR_SetTipTextA (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
832 | {
|
---|
833 | TRACE("part %d: \"%s\"\n", (INT)wParam, (LPSTR)lParam);
|
---|
834 | if (infoPtr->hwndToolTip) {
|
---|
835 | TTTOOLINFOA ti;
|
---|
836 | ti.cbSize = sizeof(TTTOOLINFOA);
|
---|
837 | ti.hwnd = hwnd;
|
---|
838 | ti.uId = (INT)wParam;
|
---|
839 | ti.hinst = 0;
|
---|
840 | ti.lpszText = (LPSTR)lParam;
|
---|
841 | SendMessageA (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTA,
|
---|
842 | 0, (LPARAM)&ti);
|
---|
843 | }
|
---|
844 |
|
---|
845 | return 0;
|
---|
846 | }
|
---|
847 |
|
---|
848 |
|
---|
849 | static LRESULT
|
---|
850 | STATUSBAR_SetTipTextW (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
851 | {
|
---|
852 | TRACE("part %d: \"%s\"\n", (INT)wParam, (LPSTR)lParam);
|
---|
853 | if (infoPtr->hwndToolTip) {
|
---|
854 | TTTOOLINFOW ti;
|
---|
855 | ti.cbSize = sizeof(TTTOOLINFOW);
|
---|
856 | ti.hwnd = hwnd;
|
---|
857 | ti.uId = (INT)wParam;
|
---|
858 | ti.hinst = 0;
|
---|
859 | ti.lpszText = (LPWSTR)lParam;
|
---|
860 | SendMessageW (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTW,
|
---|
861 | 0, (LPARAM)&ti);
|
---|
862 | }
|
---|
863 |
|
---|
864 | return 0;
|
---|
865 | }
|
---|
866 |
|
---|
867 |
|
---|
868 | inline static LRESULT
|
---|
869 | STATUSBAR_SetUnicodeFormat (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam)
|
---|
870 | {
|
---|
871 | BOOL bOld = infoPtr->bUnicode;
|
---|
872 |
|
---|
873 | TRACE("(0x%x)\n", (BOOL)wParam);
|
---|
874 | infoPtr->bUnicode = (BOOL)wParam;
|
---|
875 |
|
---|
876 | return bOld;
|
---|
877 | }
|
---|
878 |
|
---|
879 |
|
---|
880 | static LRESULT
|
---|
881 | STATUSBAR_Simple (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
882 | {
|
---|
883 | NMHDR nmhdr;
|
---|
884 |
|
---|
885 | TRACE("(is simple: %d)\n", wParam);
|
---|
886 | if (infoPtr->simple == wParam) /* no need to change */
|
---|
887 | return TRUE;
|
---|
888 |
|
---|
889 | infoPtr->simple = (BOOL)wParam;
|
---|
890 |
|
---|
891 | /* send notification */
|
---|
892 | nmhdr.hwndFrom = hwnd;
|
---|
893 | nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
|
---|
894 | nmhdr.code = SBN_SIMPLEMODECHANGE;
|
---|
895 | SendMessageA (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr);
|
---|
896 | InvalidateRect(hwnd, NULL, FALSE);
|
---|
897 | return TRUE;
|
---|
898 | }
|
---|
899 |
|
---|
900 |
|
---|
901 | static LRESULT
|
---|
902 | STATUSBAR_WMCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
903 | {
|
---|
904 | LPCREATESTRUCTA lpCreate = (LPCREATESTRUCTA)lParam;
|
---|
905 | NONCLIENTMETRICSA nclm;
|
---|
906 | DWORD dwStyle;
|
---|
907 | RECT rect;
|
---|
908 | int width, len;
|
---|
909 | HDC hdc;
|
---|
910 | STATUSWINDOWINFO *infoPtr;
|
---|
911 |
|
---|
912 | TRACE("\n");
|
---|
913 | #ifdef __WIN32OS2__
|
---|
914 | infoPtr = (STATUSWINDOWINFO*)initControl(hwnd,sizeof(STATUSWINDOWINFO));
|
---|
915 | #else
|
---|
916 | infoPtr = (STATUSWINDOWINFO*)COMCTL32_Alloc (sizeof(STATUSWINDOWINFO));
|
---|
917 | #endif
|
---|
918 | SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
|
---|
919 |
|
---|
920 | infoPtr->hwndParent = lpCreate->hwndParent;
|
---|
921 | infoPtr->numParts = 1;
|
---|
922 | infoPtr->parts = 0;
|
---|
923 | infoPtr->simple = FALSE;
|
---|
924 | infoPtr->clrBk = CLR_DEFAULT;
|
---|
925 | infoPtr->hFont = 0;
|
---|
926 |
|
---|
927 | /* TODO: send unicode parent notification query (WM_QUERYFORMAT) here */
|
---|
928 |
|
---|
929 | GetClientRect (hwnd, &rect);
|
---|
930 | InvalidateRect (hwnd, &rect, 0);
|
---|
931 | UpdateWindow(hwnd);
|
---|
932 |
|
---|
933 | nclm.cbSize = sizeof(NONCLIENTMETRICSA);
|
---|
934 | SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, nclm.cbSize, &nclm, 0);
|
---|
935 | infoPtr->hDefaultFont = CreateFontIndirectA (&nclm.lfStatusFont);
|
---|
936 |
|
---|
937 | /* initialize simple case */
|
---|
938 | infoPtr->part0.bound = rect;
|
---|
939 | infoPtr->part0.text = 0;
|
---|
940 | infoPtr->part0.x = 0;
|
---|
941 | infoPtr->part0.style = 0;
|
---|
942 | infoPtr->part0.hIcon = 0;
|
---|
943 |
|
---|
944 | /* initialize first part */
|
---|
945 | infoPtr->parts = COMCTL32_Alloc (sizeof(STATUSWINDOWPART));
|
---|
946 | infoPtr->parts[0].bound = rect;
|
---|
947 | infoPtr->parts[0].text = 0;
|
---|
948 | infoPtr->parts[0].x = -1;
|
---|
949 | infoPtr->parts[0].style = 0;
|
---|
950 | infoPtr->parts[0].hIcon = 0;
|
---|
951 |
|
---|
952 | if (IsWindowUnicode (hwnd)) {
|
---|
953 | infoPtr->bUnicode = TRUE;
|
---|
954 | if (lpCreate->lpszName &&
|
---|
955 | (len = strlenW ((LPCWSTR)lpCreate->lpszName))) {
|
---|
956 | infoPtr->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
|
---|
957 | strcpyW (infoPtr->parts[0].text, (LPCWSTR)lpCreate->lpszName);
|
---|
958 | }
|
---|
959 | }
|
---|
960 | else {
|
---|
961 | if (lpCreate->lpszName &&
|
---|
962 | (len = strlen((LPCSTR)lpCreate->lpszName))) {
|
---|
963 | DWORD lenW = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1, NULL, 0 );
|
---|
964 | infoPtr->parts[0].text = COMCTL32_Alloc (lenW*sizeof(WCHAR));
|
---|
965 | MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1,
|
---|
966 | infoPtr->parts[0].text, lenW );
|
---|
967 | }
|
---|
968 | }
|
---|
969 |
|
---|
970 | dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
|
---|
971 |
|
---|
972 | #ifndef __WIN32OS2__
|
---|
973 | /* statusbars on managed windows should not have SIZEGRIP style */
|
---|
974 | if ((dwStyle & SBARS_SIZEGRIP) && lpCreate->hwndParent)
|
---|
975 | if (GetWindowLongA(lpCreate->hwndParent, GWL_EXSTYLE) & WS_EX_MANAGED)
|
---|
976 | SetWindowLongA (hwnd, GWL_STYLE, dwStyle & ~SBARS_SIZEGRIP);
|
---|
977 | #endif
|
---|
978 | if ((hdc = GetDC (0))) {
|
---|
979 | TEXTMETRICA tm;
|
---|
980 | HFONT hOldFont;
|
---|
981 |
|
---|
982 | hOldFont = SelectObject (hdc,infoPtr->hDefaultFont);
|
---|
983 | GetTextMetricsA(hdc, &tm);
|
---|
984 | infoPtr->textHeight = tm.tmHeight;
|
---|
985 | SelectObject (hdc, hOldFont);
|
---|
986 | ReleaseDC(0, hdc);
|
---|
987 | }
|
---|
988 |
|
---|
989 | if (dwStyle & SBT_TOOLTIPS) {
|
---|
990 | infoPtr->hwndToolTip =
|
---|
991 | CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0,
|
---|
992 | CW_USEDEFAULT, CW_USEDEFAULT,
|
---|
993 | CW_USEDEFAULT, CW_USEDEFAULT,
|
---|
994 | hwnd, 0,
|
---|
995 | GetWindowLongA (hwnd, GWL_HINSTANCE), NULL);
|
---|
996 |
|
---|
997 | if (infoPtr->hwndToolTip) {
|
---|
998 | NMTOOLTIPSCREATED nmttc;
|
---|
999 |
|
---|
1000 | nmttc.hdr.hwndFrom = hwnd;
|
---|
1001 | nmttc.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
|
---|
1002 | nmttc.hdr.code = NM_TOOLTIPSCREATED;
|
---|
1003 | nmttc.hwndToolTips = infoPtr->hwndToolTip;
|
---|
1004 |
|
---|
1005 | SendMessageA (lpCreate->hwndParent, WM_NOTIFY,
|
---|
1006 | (WPARAM)nmttc.hdr.idFrom, (LPARAM)&nmttc);
|
---|
1007 | }
|
---|
1008 | }
|
---|
1009 |
|
---|
1010 | if (!dwStyle & CCS_NORESIZE) /* don't resize wnd if it doesn't want it ! */
|
---|
1011 | {
|
---|
1012 | GetClientRect (GetParent (hwnd), &rect);
|
---|
1013 | width = rect.right - rect.left;
|
---|
1014 | infoPtr->height = infoPtr->textHeight + 4 + VERT_BORDER;
|
---|
1015 | SetWindowPos(hwnd, 0, lpCreate->x, lpCreate->y - 1,
|
---|
1016 | width, infoPtr->height, SWP_NOZORDER);
|
---|
1017 | STATUSBAR_SetPartBounds (infoPtr, hwnd);
|
---|
1018 | }
|
---|
1019 |
|
---|
1020 | return 0;
|
---|
1021 | }
|
---|
1022 |
|
---|
1023 |
|
---|
1024 | static LRESULT
|
---|
1025 | STATUSBAR_WMDestroy (STATUSWINDOWINFO *infoPtr, HWND hwnd)
|
---|
1026 | {
|
---|
1027 | int i;
|
---|
1028 |
|
---|
1029 | TRACE("\n");
|
---|
1030 | for (i = 0; i < infoPtr->numParts; i++) {
|
---|
1031 | if (infoPtr->parts[i].text && !(infoPtr->parts[i].style & SBT_OWNERDRAW))
|
---|
1032 | COMCTL32_Free (infoPtr->parts[i].text);
|
---|
1033 | }
|
---|
1034 | if (infoPtr->part0.text && !(infoPtr->part0.style & SBT_OWNERDRAW))
|
---|
1035 | COMCTL32_Free (infoPtr->part0.text);
|
---|
1036 | COMCTL32_Free (infoPtr->parts);
|
---|
1037 |
|
---|
1038 | /* delete default font */
|
---|
1039 | if (infoPtr->hDefaultFont)
|
---|
1040 | DeleteObject (infoPtr->hDefaultFont);
|
---|
1041 |
|
---|
1042 | /* delete tool tip control */
|
---|
1043 | if (infoPtr->hwndToolTip)
|
---|
1044 | DestroyWindow (infoPtr->hwndToolTip);
|
---|
1045 |
|
---|
1046 | COMCTL32_Free (infoPtr);
|
---|
1047 | SetWindowLongA(hwnd, 0, 0);
|
---|
1048 | return 0;
|
---|
1049 | }
|
---|
1050 |
|
---|
1051 |
|
---|
1052 | static inline LRESULT
|
---|
1053 | STATUSBAR_WMGetFont (STATUSWINDOWINFO *infoPtr, HWND hwnd)
|
---|
1054 | {
|
---|
1055 | TRACE("\n");
|
---|
1056 | return infoPtr->hFont? infoPtr->hFont : infoPtr->hDefaultFont;
|
---|
1057 | }
|
---|
1058 |
|
---|
1059 |
|
---|
1060 | /* in contrast to SB_GETTEXT*, WM_GETTEXT handles the text
|
---|
1061 | * of the first part only (usual behaviour) */
|
---|
1062 | static LRESULT
|
---|
1063 | STATUSBAR_WMGetText (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
1064 | {
|
---|
1065 | INT len;
|
---|
1066 |
|
---|
1067 | TRACE("\n");
|
---|
1068 | if (!(infoPtr->parts[0].text))
|
---|
1069 | return 0;
|
---|
1070 | if (infoPtr->bUnicode)
|
---|
1071 | len = strlenW (infoPtr->parts[0].text);
|
---|
1072 | else
|
---|
1073 | len = WideCharToMultiByte( CP_ACP, 0, infoPtr->parts[0].text, -1, NULL, 0, NULL, NULL )-1;
|
---|
1074 |
|
---|
1075 | if (wParam > len) {
|
---|
1076 | if (infoPtr->bUnicode)
|
---|
1077 | strcpyW ((LPWSTR)lParam, infoPtr->parts[0].text);
|
---|
1078 | else
|
---|
1079 | WideCharToMultiByte( CP_ACP, 0, infoPtr->parts[0].text, -1,
|
---|
1080 | (LPSTR)lParam, len+1, NULL, NULL );
|
---|
1081 | return len;
|
---|
1082 | }
|
---|
1083 |
|
---|
1084 | return -1;
|
---|
1085 | }
|
---|
1086 |
|
---|
1087 |
|
---|
1088 | inline static LRESULT
|
---|
1089 | STATUSBAR_WMMouseMove (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
1090 | {
|
---|
1091 | if (infoPtr->hwndToolTip)
|
---|
1092 | STATUSBAR_RelayEvent (infoPtr->hwndToolTip, hwnd,
|
---|
1093 | WM_MOUSEMOVE, wParam, lParam);
|
---|
1094 | return 0;
|
---|
1095 | }
|
---|
1096 |
|
---|
1097 |
|
---|
1098 | static LRESULT
|
---|
1099 | STATUSBAR_WMNCHitTest (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
1100 | {
|
---|
1101 | if (GetWindowLongA (hwnd, GWL_STYLE) & SBARS_SIZEGRIP) {
|
---|
1102 | RECT rect;
|
---|
1103 | POINT pt;
|
---|
1104 |
|
---|
1105 | GetClientRect (hwnd, &rect);
|
---|
1106 |
|
---|
1107 | pt.x = (INT)LOWORD(lParam);
|
---|
1108 | pt.y = (INT)HIWORD(lParam);
|
---|
1109 | ScreenToClient (hwnd, &pt);
|
---|
1110 |
|
---|
1111 | rect.left = rect.right - 13;
|
---|
1112 | rect.top += 2;
|
---|
1113 |
|
---|
1114 | if (PtInRect (&rect, pt))
|
---|
1115 | return HTBOTTOMRIGHT;
|
---|
1116 | }
|
---|
1117 |
|
---|
1118 | /* FIXME: instead check result in StatusWindowProc and call if needed ? */
|
---|
1119 | return DefWindowProcA (hwnd, WM_NCHITTEST, wParam, lParam);
|
---|
1120 | }
|
---|
1121 |
|
---|
1122 |
|
---|
1123 | static inline LRESULT
|
---|
1124 | STATUSBAR_WMNCLButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
1125 | {
|
---|
1126 | TRACE("\n");
|
---|
1127 | PostMessageA (GetParent (hwnd), WM_NCLBUTTONDOWN, wParam, lParam);
|
---|
1128 | return 0;
|
---|
1129 | }
|
---|
1130 |
|
---|
1131 |
|
---|
1132 | static inline LRESULT
|
---|
1133 | STATUSBAR_WMNCLButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
1134 | {
|
---|
1135 | TRACE("\n");
|
---|
1136 | PostMessageA (GetParent (hwnd), WM_NCLBUTTONUP, wParam, lParam);
|
---|
1137 | return 0;
|
---|
1138 | }
|
---|
1139 |
|
---|
1140 |
|
---|
1141 | static LRESULT
|
---|
1142 | STATUSBAR_WMPaint (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam)
|
---|
1143 | {
|
---|
1144 | HDC hdc;
|
---|
1145 | PAINTSTRUCT ps;
|
---|
1146 |
|
---|
1147 | TRACE("\n");
|
---|
1148 | hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam;
|
---|
1149 | STATUSBAR_Refresh (infoPtr, hwnd, hdc);
|
---|
1150 | if (!wParam)
|
---|
1151 | EndPaint (hwnd, &ps);
|
---|
1152 |
|
---|
1153 | return 0;
|
---|
1154 | }
|
---|
1155 |
|
---|
1156 |
|
---|
1157 | static LRESULT
|
---|
1158 | STATUSBAR_WMSetFont (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
1159 | {
|
---|
1160 | infoPtr->hFont = (HFONT)wParam;
|
---|
1161 | TRACE("%04x\n", infoPtr->hFont);
|
---|
1162 | #ifdef __WIN32OS2__
|
---|
1163 | if (LOWORD(lParam) == TRUE)
|
---|
1164 | {
|
---|
1165 | HDC hdc = GetDC (hwnd);
|
---|
1166 | TEXTMETRICA tm;
|
---|
1167 | HFONT hOldFont;
|
---|
1168 |
|
---|
1169 | hOldFont = SelectObject(hdc,infoPtr->hFont);
|
---|
1170 | GetTextMetricsA(hdc,&tm);
|
---|
1171 | infoPtr->textHeight = tm.tmHeight+tm.tmExternalLeading;
|
---|
1172 | SelectObject(hdc,hOldFont);
|
---|
1173 |
|
---|
1174 | //CB: todo: move window
|
---|
1175 |
|
---|
1176 | STATUSBAR_Refresh (infoPtr, hwnd, hdc);
|
---|
1177 | ReleaseDC (hwnd, hdc);
|
---|
1178 | }
|
---|
1179 | #else
|
---|
1180 | if (LOWORD(lParam) == TRUE)
|
---|
1181 | InvalidateRect(hwnd, NULL, FALSE);
|
---|
1182 | #endif
|
---|
1183 |
|
---|
1184 | return 0;
|
---|
1185 | }
|
---|
1186 |
|
---|
1187 |
|
---|
1188 | static LRESULT
|
---|
1189 | STATUSBAR_WMSetText (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
1190 | {
|
---|
1191 | STATUSWINDOWPART *part;
|
---|
1192 | int len;
|
---|
1193 |
|
---|
1194 | TRACE("\n");
|
---|
1195 | if (infoPtr->numParts == 0)
|
---|
1196 | return FALSE;
|
---|
1197 |
|
---|
1198 | part = &infoPtr->parts[0];
|
---|
1199 | /* duplicate string */
|
---|
1200 | if (part->text)
|
---|
1201 | COMCTL32_Free (part->text);
|
---|
1202 | part->text = 0;
|
---|
1203 | if (infoPtr->bUnicode) {
|
---|
1204 | if (lParam && (len = strlenW((LPCWSTR)lParam))) {
|
---|
1205 | part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
|
---|
1206 | strcpyW (part->text, (LPCWSTR)lParam);
|
---|
1207 | }
|
---|
1208 | }
|
---|
1209 | else {
|
---|
1210 | if (lParam && (len = lstrlenA((LPCSTR)lParam))) {
|
---|
1211 | DWORD lenW = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lParam, -1, NULL, 0 );
|
---|
1212 | part->text = COMCTL32_Alloc (lenW*sizeof(WCHAR));
|
---|
1213 | MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lParam, -1, part->text, lenW );
|
---|
1214 | }
|
---|
1215 | }
|
---|
1216 |
|
---|
1217 | InvalidateRect(hwnd, &part->bound, FALSE);
|
---|
1218 |
|
---|
1219 | return TRUE;
|
---|
1220 | }
|
---|
1221 |
|
---|
1222 |
|
---|
1223 | static LRESULT
|
---|
1224 | STATUSBAR_WMSize (STATUSWINDOWINFO *infoPtr, HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
1225 | {
|
---|
1226 | INT width, x, y, flags;
|
---|
1227 | RECT parent_rect;
|
---|
1228 | DWORD dwStyle;
|
---|
1229 |
|
---|
1230 | /* Need to resize width to match parent */
|
---|
1231 | flags = (INT) wParam;
|
---|
1232 |
|
---|
1233 | TRACE("flags %04x\n", flags);
|
---|
1234 | /* FIXME for flags =
|
---|
1235 | * SIZE_MAXIMIZED, SIZE_MAXSHOW, SIZE_MINIMIZED, SIZE_RESTORED
|
---|
1236 | */
|
---|
1237 |
|
---|
1238 | dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
|
---|
1239 | if (!dwStyle & CCS_NORESIZE) /* don't resize wnd if it doesn't want it ! */
|
---|
1240 | {
|
---|
1241 | if (flags == SIZE_RESTORED) {
|
---|
1242 | /* width and height don't apply */
|
---|
1243 | GetClientRect (infoPtr->hwndParent, &parent_rect);
|
---|
1244 | width = parent_rect.right - parent_rect.left;
|
---|
1245 | x = parent_rect.left;
|
---|
1246 | y = parent_rect.bottom - infoPtr->height;
|
---|
1247 | MoveWindow (hwnd, parent_rect.left,
|
---|
1248 | parent_rect.bottom - infoPtr->height,
|
---|
1249 | width, infoPtr->height, TRUE);
|
---|
1250 | STATUSBAR_SetPartBounds (infoPtr, hwnd);
|
---|
1251 | }
|
---|
1252 | return 0; /* FIXME: ok to return here ? */
|
---|
1253 | }
|
---|
1254 |
|
---|
1255 | /* FIXME: instead check result in StatusWindowProc and call if needed ? */
|
---|
1256 | return DefWindowProcA (hwnd, WM_SIZE, wParam, lParam);
|
---|
1257 | }
|
---|
1258 |
|
---|
1259 |
|
---|
1260 | static LRESULT
|
---|
1261 | STATUSBAR_SendNotify (HWND hwnd, UINT code)
|
---|
1262 | {
|
---|
1263 | NMHDR nmhdr;
|
---|
1264 |
|
---|
1265 | TRACE("code %04x\n", code);
|
---|
1266 | nmhdr.hwndFrom = hwnd;
|
---|
1267 | nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
|
---|
1268 | nmhdr.code = code;
|
---|
1269 | SendMessageA (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr);
|
---|
1270 | return 0;
|
---|
1271 | }
|
---|
1272 |
|
---|
1273 |
|
---|
1274 |
|
---|
1275 | static LRESULT WINAPI
|
---|
1276 | StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
---|
1277 | {
|
---|
1278 | STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr(hwnd);
|
---|
1279 |
|
---|
1280 | TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", hwnd, msg, wParam, lParam);
|
---|
1281 | if (!(infoPtr) && (msg != WM_CREATE))
|
---|
1282 | return DefWindowProcA (hwnd, msg, wParam, lParam);
|
---|
1283 |
|
---|
1284 | switch (msg) {
|
---|
1285 | case SB_GETBORDERS:
|
---|
1286 | return STATUSBAR_GetBorders (lParam);
|
---|
1287 |
|
---|
1288 | case SB_GETICON:
|
---|
1289 | return STATUSBAR_GetIcon (infoPtr, hwnd, wParam);
|
---|
1290 |
|
---|
1291 | case SB_GETPARTS:
|
---|
1292 | return STATUSBAR_GetParts (infoPtr, hwnd, wParam, lParam);
|
---|
1293 |
|
---|
1294 | case SB_GETRECT:
|
---|
1295 | return STATUSBAR_GetRect (infoPtr, hwnd, wParam, lParam);
|
---|
1296 |
|
---|
1297 | case SB_GETTEXTA:
|
---|
1298 | return STATUSBAR_GetTextA (infoPtr, hwnd, wParam, lParam);
|
---|
1299 |
|
---|
1300 | case SB_GETTEXTW:
|
---|
1301 | return STATUSBAR_GetTextW (infoPtr, hwnd, wParam, lParam);
|
---|
1302 |
|
---|
1303 | case SB_GETTEXTLENGTHA:
|
---|
1304 | case SB_GETTEXTLENGTHW:
|
---|
1305 | return STATUSBAR_GetTextLength (infoPtr, hwnd, wParam);
|
---|
1306 |
|
---|
1307 | case SB_GETTIPTEXTA:
|
---|
1308 | return STATUSBAR_GetTipTextA (infoPtr, hwnd, wParam, lParam);
|
---|
1309 |
|
---|
1310 | case SB_GETTIPTEXTW:
|
---|
1311 | return STATUSBAR_GetTipTextW (infoPtr, hwnd, wParam, lParam);
|
---|
1312 |
|
---|
1313 | case SB_GETUNICODEFORMAT:
|
---|
1314 | return STATUSBAR_GetUnicodeFormat (infoPtr, hwnd);
|
---|
1315 |
|
---|
1316 | case SB_ISSIMPLE:
|
---|
1317 | return STATUSBAR_IsSimple (infoPtr, hwnd);
|
---|
1318 |
|
---|
1319 | case SB_SETBKCOLOR:
|
---|
1320 | return STATUSBAR_SetBkColor (infoPtr, hwnd, wParam, lParam);
|
---|
1321 |
|
---|
1322 | case SB_SETICON:
|
---|
1323 | return STATUSBAR_SetIcon (infoPtr, hwnd, wParam, lParam);
|
---|
1324 |
|
---|
1325 | case SB_SETMINHEIGHT:
|
---|
1326 | return STATUSBAR_SetMinHeight (infoPtr, hwnd, wParam, lParam);
|
---|
1327 |
|
---|
1328 | case SB_SETPARTS:
|
---|
1329 | return STATUSBAR_SetParts (infoPtr, hwnd, wParam, lParam);
|
---|
1330 |
|
---|
1331 | case SB_SETTEXTA:
|
---|
1332 | return STATUSBAR_SetTextA (infoPtr, hwnd, wParam, lParam);
|
---|
1333 |
|
---|
1334 | case SB_SETTEXTW:
|
---|
1335 | return STATUSBAR_SetTextW (infoPtr, hwnd, wParam, lParam);
|
---|
1336 |
|
---|
1337 | case SB_SETTIPTEXTA:
|
---|
1338 | return STATUSBAR_SetTipTextA (infoPtr, hwnd, wParam, lParam);
|
---|
1339 |
|
---|
1340 | case SB_SETTIPTEXTW:
|
---|
1341 | return STATUSBAR_SetTipTextW (infoPtr, hwnd, wParam, lParam);
|
---|
1342 |
|
---|
1343 | case SB_SETUNICODEFORMAT:
|
---|
1344 | return STATUSBAR_SetUnicodeFormat (infoPtr, hwnd, wParam);
|
---|
1345 |
|
---|
1346 | case SB_SIMPLE:
|
---|
1347 | return STATUSBAR_Simple (infoPtr, hwnd, wParam, lParam);
|
---|
1348 |
|
---|
1349 |
|
---|
1350 | case WM_CREATE:
|
---|
1351 | return STATUSBAR_WMCreate (hwnd, wParam, lParam);
|
---|
1352 |
|
---|
1353 | case WM_DESTROY:
|
---|
1354 | return STATUSBAR_WMDestroy (infoPtr, hwnd);
|
---|
1355 |
|
---|
1356 | case WM_GETFONT:
|
---|
1357 | return STATUSBAR_WMGetFont (infoPtr, hwnd);
|
---|
1358 |
|
---|
1359 | case WM_GETTEXT:
|
---|
1360 | return STATUSBAR_WMGetText (infoPtr, hwnd, wParam, lParam);
|
---|
1361 |
|
---|
1362 | case WM_GETTEXTLENGTH:
|
---|
1363 | return STATUSBAR_GetTextLength (infoPtr, hwnd, 0);
|
---|
1364 |
|
---|
1365 | case WM_LBUTTONDBLCLK:
|
---|
1366 | return STATUSBAR_SendNotify (hwnd, NM_DBLCLK);
|
---|
1367 |
|
---|
1368 | case WM_LBUTTONUP:
|
---|
1369 | return STATUSBAR_SendNotify (hwnd, NM_CLICK);
|
---|
1370 |
|
---|
1371 | case WM_MOUSEMOVE:
|
---|
1372 | return STATUSBAR_WMMouseMove (infoPtr, hwnd, wParam, lParam);
|
---|
1373 |
|
---|
1374 | case WM_NCHITTEST:
|
---|
1375 | return STATUSBAR_WMNCHitTest (hwnd, wParam, lParam);
|
---|
1376 |
|
---|
1377 | case WM_NCLBUTTONDOWN:
|
---|
1378 | return STATUSBAR_WMNCLButtonDown (hwnd, wParam, lParam);
|
---|
1379 |
|
---|
1380 | case WM_NCLBUTTONUP:
|
---|
1381 | return STATUSBAR_WMNCLButtonUp (hwnd, wParam, lParam);
|
---|
1382 |
|
---|
1383 | case WM_PAINT:
|
---|
1384 | return STATUSBAR_WMPaint (infoPtr, hwnd, wParam);
|
---|
1385 |
|
---|
1386 | case WM_RBUTTONDBLCLK:
|
---|
1387 | return STATUSBAR_SendNotify (hwnd, NM_RDBLCLK);
|
---|
1388 |
|
---|
1389 | case WM_RBUTTONUP:
|
---|
1390 | return STATUSBAR_SendNotify (hwnd, NM_RCLICK);
|
---|
1391 |
|
---|
1392 | case WM_SETFONT:
|
---|
1393 | return STATUSBAR_WMSetFont (infoPtr, hwnd, wParam, lParam);
|
---|
1394 |
|
---|
1395 | case WM_SETTEXT:
|
---|
1396 | return STATUSBAR_WMSetText (infoPtr, hwnd, wParam, lParam);
|
---|
1397 |
|
---|
1398 | case WM_SIZE:
|
---|
1399 | return STATUSBAR_WMSize (infoPtr, hwnd, wParam, lParam);
|
---|
1400 |
|
---|
1401 | default:
|
---|
1402 | if (msg >= WM_USER)
|
---|
1403 | ERR("unknown msg %04x wp=%04x lp=%08lx\n",
|
---|
1404 | msg, wParam, lParam);
|
---|
1405 | #ifdef __WIN32OS2__
|
---|
1406 | return defComCtl32ProcA (hwnd, msg, wParam, lParam);
|
---|
1407 | #else
|
---|
1408 | return DefWindowProcA (hwnd, msg, wParam, lParam);
|
---|
1409 | #endif
|
---|
1410 | }
|
---|
1411 | return 0;
|
---|
1412 | }
|
---|
1413 |
|
---|
1414 |
|
---|
1415 | /***********************************************************************
|
---|
1416 | * STATUS_Register [Internal]
|
---|
1417 | *
|
---|
1418 | * Registers the status window class.
|
---|
1419 | */
|
---|
1420 |
|
---|
1421 | VOID
|
---|
1422 | STATUS_Register (void)
|
---|
1423 | {
|
---|
1424 | WNDCLASSA wndClass;
|
---|
1425 |
|
---|
1426 | ZeroMemory (&wndClass, sizeof(WNDCLASSA));
|
---|
1427 | wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW;
|
---|
1428 | wndClass.lpfnWndProc = (WNDPROC)StatusWindowProc;
|
---|
1429 | wndClass.cbClsExtra = 0;
|
---|
1430 | wndClass.cbWndExtra = sizeof(STATUSWINDOWINFO *);
|
---|
1431 | wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
|
---|
1432 | wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
|
---|
1433 | wndClass.lpszClassName = STATUSCLASSNAMEA;
|
---|
1434 |
|
---|
1435 | RegisterClassA (&wndClass);
|
---|
1436 | }
|
---|
1437 |
|
---|
1438 |
|
---|
1439 | /***********************************************************************
|
---|
1440 | * STATUS_Unregister [Internal]
|
---|
1441 | *
|
---|
1442 | * Unregisters the status window class.
|
---|
1443 | */
|
---|
1444 |
|
---|
1445 | VOID
|
---|
1446 | STATUS_Unregister (void)
|
---|
1447 | {
|
---|
1448 | UnregisterClassA (STATUSCLASSNAMEA, (HINSTANCE)NULL);
|
---|
1449 | }
|
---|
1450 |
|
---|