1 | /* $Id: win32wbasenonclient.cpp,v 1.1 2000-01-18 19:57:17 sandervl Exp $ */
|
---|
2 | /*
|
---|
3 | * Win32 Window Base Class for OS/2 (non-client methods)
|
---|
4 | *
|
---|
5 | * Copyright 2000 Christoph Bratschi (cbratschi@datacomm.ch)
|
---|
6 | *
|
---|
7 | * Based on Wine code (windows\nonclient.c)
|
---|
8 | *
|
---|
9 | * Copyright 1994 Alexandre Julliard
|
---|
10 | *
|
---|
11 | * TODO: Not thread/process safe
|
---|
12 | *
|
---|
13 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
14 | *
|
---|
15 | */
|
---|
16 | #include <os2win.h>
|
---|
17 | #include <win.h>
|
---|
18 | #include <stdlib.h>
|
---|
19 | #include <string.h>
|
---|
20 | #include <stdarg.h>
|
---|
21 | #include <assert.h>
|
---|
22 | #include <misc.h>
|
---|
23 | #include <heapstring.h>
|
---|
24 | #include <win32wbase.h>
|
---|
25 | #include <winres.h>
|
---|
26 | #include "wndmsg.h"
|
---|
27 | #include "pmframe.h"
|
---|
28 | #include "oslibwin.h"
|
---|
29 | #include "oslibmsg.h"
|
---|
30 | #include "oslibutil.h"
|
---|
31 | #include "oslibgdi.h"
|
---|
32 | #include "oslibres.h"
|
---|
33 | #include "oslibdos.h"
|
---|
34 | #include "syscolor.h"
|
---|
35 | #include "win32wndhandle.h"
|
---|
36 | #include "dc.h"
|
---|
37 | #include "win32wdesktop.h"
|
---|
38 | #include "controls.h"
|
---|
39 | #include <menu.h>
|
---|
40 |
|
---|
41 | #define SC_ABOUTODIN (SC_SCREENSAVE+1)
|
---|
42 | #define SC_PUTMARK (SC_SCREENSAVE+2)
|
---|
43 |
|
---|
44 | /* bits in the dwKeyData */
|
---|
45 | #define KEYDATA_ALT 0x2000
|
---|
46 | #define KEYDATA_PREVSTATE 0x4000
|
---|
47 |
|
---|
48 | static HBITMAP hbitmapClose = 0;
|
---|
49 | static HBITMAP hbitmapCloseD = 0;
|
---|
50 | static HBITMAP hbitmapMinimize = 0;
|
---|
51 | static HBITMAP hbitmapMinimizeD = 0;
|
---|
52 | static HBITMAP hbitmapMaximize = 0;
|
---|
53 | static HBITMAP hbitmapMaximizeD = 0;
|
---|
54 | static HBITMAP hbitmapRestore = 0;
|
---|
55 | static HBITMAP hbitmapRestoreD = 0;
|
---|
56 |
|
---|
57 | BYTE lpGrayMask[] = { 0xAA, 0xA0,
|
---|
58 | 0x55, 0x50,
|
---|
59 | 0xAA, 0xA0,
|
---|
60 | 0x55, 0x50,
|
---|
61 | 0xAA, 0xA0,
|
---|
62 | 0x55, 0x50,
|
---|
63 | 0xAA, 0xA0,
|
---|
64 | 0x55, 0x50,
|
---|
65 | 0xAA, 0xA0,
|
---|
66 | 0x55, 0x50};
|
---|
67 |
|
---|
68 | static INT (* WINAPI ShellAboutA)(HWND,LPCSTR,LPCSTR,HICON) = 0;
|
---|
69 |
|
---|
70 | //******************************************************************************
|
---|
71 | //******************************************************************************
|
---|
72 | LONG Win32BaseWindow::HandleNCActivate(WPARAM wParam)
|
---|
73 | {
|
---|
74 | WORD wStateChange;
|
---|
75 |
|
---|
76 | //CB: only caption is changed on activation
|
---|
77 | if (!(dwStyle & WS_CAPTION)) return TRUE;
|
---|
78 |
|
---|
79 | if( wParam ) wStateChange = !(flags & WIN_NCACTIVATED);
|
---|
80 | else wStateChange = flags & WIN_NCACTIVATED;
|
---|
81 |
|
---|
82 | if( wStateChange )
|
---|
83 | {
|
---|
84 | if (wParam) flags |= WIN_NCACTIVATED;
|
---|
85 | else flags &= ~WIN_NCACTIVATED;
|
---|
86 |
|
---|
87 | if(!(dwStyle & WS_MINIMIZE))
|
---|
88 | DoNCPaint((HRGN)1,FALSE);
|
---|
89 | }
|
---|
90 |
|
---|
91 | return TRUE;
|
---|
92 | }
|
---|
93 | //******************************************************************************
|
---|
94 | //******************************************************************************
|
---|
95 | VOID Win32BaseWindow::TrackMinMaxBox(WORD wParam)
|
---|
96 | {
|
---|
97 | MSG msg;
|
---|
98 | HDC hdc;
|
---|
99 | BOOL pressed = TRUE;
|
---|
100 | UINT state;
|
---|
101 |
|
---|
102 | if (wParam == HTMINBUTTON)
|
---|
103 | {
|
---|
104 | /* If the style is not present, do nothing */
|
---|
105 | if (!(dwStyle & WS_MINIMIZEBOX))
|
---|
106 | return;
|
---|
107 | /* Check if the sysmenu item for minimize is there */
|
---|
108 | state = GetMenuState(hSysMenu,SC_MINIMIZE,MF_BYCOMMAND);
|
---|
109 | } else
|
---|
110 | {
|
---|
111 | /* If the style is not present, do nothing */
|
---|
112 | if (!(dwStyle & WS_MAXIMIZEBOX))
|
---|
113 | return;
|
---|
114 | /* Check if the sysmenu item for maximize is there */
|
---|
115 | state = GetMenuState(hSysMenu, SC_MAXIMIZE, MF_BYCOMMAND);
|
---|
116 | }
|
---|
117 | SetCapture(Win32Hwnd);
|
---|
118 | hdc = GetWindowDC(Win32Hwnd);
|
---|
119 | if (wParam == HTMINBUTTON)
|
---|
120 | DrawMinButton(hdc,NULL,TRUE,FALSE);
|
---|
121 | else
|
---|
122 | DrawMaxButton(hdc,NULL,TRUE,FALSE);
|
---|
123 | do
|
---|
124 | {
|
---|
125 | BOOL oldstate = pressed;
|
---|
126 |
|
---|
127 | GetMessageA(&msg,Win32Hwnd,0,0);
|
---|
128 | pressed = (HandleNCHitTest(msg.pt) == wParam);
|
---|
129 | if (pressed != oldstate)
|
---|
130 | {
|
---|
131 | if (wParam == HTMINBUTTON)
|
---|
132 | DrawMinButton(hdc,NULL,pressed,FALSE);
|
---|
133 | else
|
---|
134 | DrawMaxButton(hdc,NULL,pressed,FALSE);
|
---|
135 | }
|
---|
136 | } while (msg.message != WM_LBUTTONUP);
|
---|
137 | if (wParam == HTMINBUTTON)
|
---|
138 | DrawMinButton(hdc,NULL,FALSE,FALSE);
|
---|
139 | else
|
---|
140 | DrawMaxButton(hdc,NULL,FALSE,FALSE);
|
---|
141 | ReleaseCapture();
|
---|
142 | ReleaseDC(Win32Hwnd,hdc);
|
---|
143 | /* If the item minimize or maximize of the sysmenu are not there */
|
---|
144 | /* or if the style is not present, do nothing */
|
---|
145 | if ((!pressed) || (state == 0xFFFFFFFF))
|
---|
146 | return;
|
---|
147 | if (wParam == HTMINBUTTON)
|
---|
148 | SendInternalMessageA(WM_SYSCOMMAND,SC_MINIMIZE,*(LPARAM*)&msg.pt);
|
---|
149 | else
|
---|
150 | SendInternalMessageA(WM_SYSCOMMAND,IsZoomed(Win32Hwnd) ? SC_RESTORE:SC_MAXIMIZE,*(LPARAM*)&msg.pt);
|
---|
151 | }
|
---|
152 | //******************************************************************************
|
---|
153 | //******************************************************************************
|
---|
154 | VOID Win32BaseWindow::TrackCloseButton(WORD wParam)
|
---|
155 | {
|
---|
156 | MSG msg;
|
---|
157 | HDC hdc;
|
---|
158 | BOOL pressed = TRUE;
|
---|
159 | UINT state;
|
---|
160 |
|
---|
161 | if (hSysMenu == 0)
|
---|
162 | return;
|
---|
163 | state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND);
|
---|
164 | /* If the item close of the sysmenu is disabled or not there do nothing */
|
---|
165 | if((state & MF_DISABLED) || (state & MF_GRAYED) || (state == 0xFFFFFFFF))
|
---|
166 | return;
|
---|
167 | hdc = GetWindowDC(Win32Hwnd);
|
---|
168 | SetCapture(Win32Hwnd);
|
---|
169 | DrawCloseButton(hdc,NULL,TRUE,FALSE);
|
---|
170 | do
|
---|
171 | {
|
---|
172 | BOOL oldstate = pressed;
|
---|
173 |
|
---|
174 | GetMessageA(&msg,Win32Hwnd,0,0);
|
---|
175 | pressed = (HandleNCHitTest(msg.pt) == wParam);
|
---|
176 | if (pressed != oldstate)
|
---|
177 | DrawCloseButton(hdc,NULL,pressed,FALSE);
|
---|
178 | } while (msg.message != WM_LBUTTONUP);
|
---|
179 | DrawCloseButton(hdc,NULL,FALSE,FALSE);
|
---|
180 | ReleaseCapture();
|
---|
181 | ReleaseDC(Win32Hwnd,hdc);
|
---|
182 | if (!pressed) return;
|
---|
183 | SendInternalMessageA(WM_SYSCOMMAND,SC_CLOSE,*(LPARAM*)&msg.pt);
|
---|
184 | }
|
---|
185 | //******************************************************************************
|
---|
186 | //******************************************************************************
|
---|
187 | VOID Win32BaseWindow::TrackScrollBar(WPARAM wParam,POINT pt)
|
---|
188 | {
|
---|
189 | INT scrollbar;
|
---|
190 | MSG msg;
|
---|
191 |
|
---|
192 | if ((wParam & 0xfff0) == SC_HSCROLL)
|
---|
193 | {
|
---|
194 | if ((wParam & 0x0f) != HTHSCROLL) return;
|
---|
195 | scrollbar = SB_HORZ;
|
---|
196 | } else /* SC_VSCROLL */
|
---|
197 | {
|
---|
198 | if ((wParam & 0x0f) != HTVSCROLL) return;
|
---|
199 | scrollbar = SB_VERT;
|
---|
200 | }
|
---|
201 |
|
---|
202 | pt.x -= rectWindow.left;
|
---|
203 | pt.y -= rectWindow.top;
|
---|
204 | SCROLL_HandleScrollEvent(Win32Hwnd,0,MAKELONG(pt.x,pt.y),scrollbar,WM_LBUTTONDOWN);
|
---|
205 | if (GetCapture() != Win32Hwnd) return;
|
---|
206 | do
|
---|
207 | {
|
---|
208 | GetMessageA(&msg, 0, 0, 0);
|
---|
209 | if(msg.hwnd == getWindowHandle())
|
---|
210 | {
|
---|
211 | switch(msg.message)
|
---|
212 | {
|
---|
213 | case WM_LBUTTONUP:
|
---|
214 | case WM_MOUSEMOVE:
|
---|
215 | pt.x = msg.pt.x-rectWindow.left;
|
---|
216 | pt.y = msg.pt.y-rectWindow.top;
|
---|
217 | msg.lParam = MAKELONG(pt.x,pt.y);
|
---|
218 |
|
---|
219 | case WM_SYSTIMER:
|
---|
220 | SCROLL_HandleScrollEvent(Win32Hwnd,msg.wParam,msg.lParam,scrollbar,msg.message);
|
---|
221 | break;
|
---|
222 |
|
---|
223 | default:
|
---|
224 | TranslateMessage(&msg);
|
---|
225 | DispatchMessageA(&msg);
|
---|
226 | break;
|
---|
227 | }
|
---|
228 | }
|
---|
229 | else {
|
---|
230 | TranslateMessage(&msg);
|
---|
231 | DispatchMessageA(&msg);
|
---|
232 | }
|
---|
233 | if (!IsWindow())
|
---|
234 | {
|
---|
235 | ReleaseCapture();
|
---|
236 | break;
|
---|
237 | }
|
---|
238 | } while (msg.message != WM_LBUTTONUP);
|
---|
239 | }
|
---|
240 | //******************************************************************************
|
---|
241 | //******************************************************************************
|
---|
242 | LONG Win32BaseWindow::HandleNCLButtonDown(WPARAM wParam,LPARAM lParam)
|
---|
243 | {
|
---|
244 | switch(wParam) /* Hit test */
|
---|
245 | {
|
---|
246 | case HTCAPTION:
|
---|
247 | {
|
---|
248 | Win32BaseWindow *topparent = GetTopParent();
|
---|
249 |
|
---|
250 | if (GetActiveWindow() != topparent->getWindowHandle())
|
---|
251 | topparent->SetActiveWindow();
|
---|
252 |
|
---|
253 | if (GetActiveWindow() == topparent->getWindowHandle())
|
---|
254 | SendInternalMessageA(WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam);
|
---|
255 | break;
|
---|
256 | }
|
---|
257 |
|
---|
258 | case HTSYSMENU:
|
---|
259 | if(dwStyle & WS_SYSMENU )
|
---|
260 | {
|
---|
261 | SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTSYSMENU,lParam);
|
---|
262 | }
|
---|
263 | break;
|
---|
264 |
|
---|
265 | case HTMENU:
|
---|
266 | SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU,lParam);
|
---|
267 | break;
|
---|
268 |
|
---|
269 | case HTHSCROLL:
|
---|
270 | SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
|
---|
271 | break;
|
---|
272 |
|
---|
273 | case HTVSCROLL:
|
---|
274 | SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
|
---|
275 | break;
|
---|
276 |
|
---|
277 | case HTMINBUTTON:
|
---|
278 | case HTMAXBUTTON:
|
---|
279 | TrackMinMaxBox(wParam);
|
---|
280 | break;
|
---|
281 |
|
---|
282 | case HTCLOSE:
|
---|
283 | TrackCloseButton(wParam);
|
---|
284 | break;
|
---|
285 |
|
---|
286 | case HTLEFT:
|
---|
287 | case HTRIGHT:
|
---|
288 | case HTTOP:
|
---|
289 | case HTTOPLEFT:
|
---|
290 | case HTTOPRIGHT:
|
---|
291 | case HTBOTTOM:
|
---|
292 | case HTBOTTOMLEFT:
|
---|
293 | case HTBOTTOMRIGHT:
|
---|
294 | /* make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU */
|
---|
295 | SendInternalMessageA(WM_SYSCOMMAND,SC_SIZE+wParam-2,lParam);
|
---|
296 | break;
|
---|
297 | case HTBORDER:
|
---|
298 | break;
|
---|
299 | }
|
---|
300 |
|
---|
301 | return 0;
|
---|
302 | }
|
---|
303 | //******************************************************************************
|
---|
304 | //******************************************************************************
|
---|
305 | BOOL Win32BaseWindow::WindowNeedsWMBorder()
|
---|
306 | {
|
---|
307 | if (!(dwStyle & WS_CHILD) &&
|
---|
308 | //Options.managed && //CB: to check
|
---|
309 | !(dwExStyle & WS_EX_TOOLWINDOW) &&
|
---|
310 | ( ((dwStyle & WS_CAPTION) == WS_CAPTION) ||
|
---|
311 | (dwStyle & WS_THICKFRAME)))
|
---|
312 | return TRUE;
|
---|
313 | if (dwExStyle & WS_EX_TRAYWINDOW)
|
---|
314 | return TRUE;
|
---|
315 | return FALSE;
|
---|
316 | }
|
---|
317 | //******************************************************************************
|
---|
318 | //******************************************************************************
|
---|
319 | VOID Win32BaseWindow::AdjustMaximizedRect(LPRECT rect)
|
---|
320 | {
|
---|
321 | /* Decide if the window will be managed (see CreateWindowEx) */
|
---|
322 | //if (!WindowNeedsWMBorder()) //CB: check Options.managed
|
---|
323 | {
|
---|
324 | if (HAS_THICKFRAME(dwStyle,dwExStyle ))
|
---|
325 | InflateRect( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) );
|
---|
326 | else
|
---|
327 | if (HAS_DLGFRAME( dwStyle, dwExStyle ))
|
---|
328 | InflateRect(rect, GetSystemMetrics(SM_CXDLGFRAME), GetSystemMetrics(SM_CYDLGFRAME) );
|
---|
329 | else
|
---|
330 | if (HAS_THINFRAME( dwStyle ))
|
---|
331 | InflateRect( rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
|
---|
332 | }
|
---|
333 | }
|
---|
334 | //******************************************************************************
|
---|
335 | //******************************************************************************
|
---|
336 | VOID Win32BaseWindow::AdjustRectOuter(LPRECT rect,BOOL menu)
|
---|
337 | {
|
---|
338 | if(dwStyle & WS_ICONIC) return;
|
---|
339 |
|
---|
340 | /* Decide if the window will be managed (see CreateWindowEx) */
|
---|
341 | //if (!WindowNeedsWMBorder()) //CB: check Options.managed
|
---|
342 | {
|
---|
343 | if (HAS_THICKFRAME(dwStyle,dwExStyle ))
|
---|
344 | InflateRect( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) );
|
---|
345 | else
|
---|
346 | if (HAS_DLGFRAME( dwStyle, dwExStyle ))
|
---|
347 | InflateRect(rect, GetSystemMetrics(SM_CXDLGFRAME), GetSystemMetrics(SM_CYDLGFRAME) );
|
---|
348 | else
|
---|
349 | if (HAS_THINFRAME( dwStyle ))
|
---|
350 | InflateRect( rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
|
---|
351 |
|
---|
352 | if ((dwStyle & WS_CAPTION) == WS_CAPTION)
|
---|
353 | {
|
---|
354 | if (dwExStyle & WS_EX_TOOLWINDOW)
|
---|
355 | rect->top -= GetSystemMetrics(SM_CYSMCAPTION);
|
---|
356 | else
|
---|
357 | rect->top -= GetSystemMetrics(SM_CYCAPTION);
|
---|
358 | }
|
---|
359 | }
|
---|
360 |
|
---|
361 | if (menu)
|
---|
362 | rect->top -= GetSystemMetrics(SM_CYMENU);
|
---|
363 | }
|
---|
364 | //******************************************************************************
|
---|
365 | //******************************************************************************
|
---|
366 | VOID Win32BaseWindow::AdjustRectInner(LPRECT rect)
|
---|
367 | {
|
---|
368 | if(dwStyle & WS_ICONIC) return;
|
---|
369 |
|
---|
370 | if (dwExStyle & WS_EX_CLIENTEDGE)
|
---|
371 | InflateRect (rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));
|
---|
372 |
|
---|
373 | if (dwExStyle & WS_EX_STATICEDGE)
|
---|
374 | InflateRect (rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
|
---|
375 |
|
---|
376 | if (dwStyle & WS_VSCROLL) rect->right += GetSystemMetrics(SM_CXVSCROLL);
|
---|
377 | if (dwStyle & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL);
|
---|
378 | }
|
---|
379 | //******************************************************************************
|
---|
380 | //******************************************************************************
|
---|
381 | LONG Win32BaseWindow::HandleNCCalcSize(BOOL calcValidRects,RECT *winRect)
|
---|
382 | {
|
---|
383 | RECT tmpRect = { 0, 0, 0, 0 };
|
---|
384 | LONG result = 0;
|
---|
385 | UINT style;
|
---|
386 |
|
---|
387 | dprintf(("Default WM_NCCALCSIZE handler"));
|
---|
388 |
|
---|
389 | if (!calcValidRects) return 0;
|
---|
390 |
|
---|
391 | style = (UINT) GetClassLongA(Win32Hwnd,GCL_STYLE);
|
---|
392 |
|
---|
393 | if (style & CS_VREDRAW) result |= WVR_VREDRAW;
|
---|
394 | if (style & CS_HREDRAW) result |= WVR_HREDRAW;
|
---|
395 |
|
---|
396 | if(!(dwStyle & WS_MINIMIZE))
|
---|
397 | {
|
---|
398 | AdjustRectOuter(&tmpRect,FALSE);
|
---|
399 |
|
---|
400 | winRect->left -= tmpRect.left;
|
---|
401 | winRect->top -= tmpRect.top;
|
---|
402 | winRect->right -= tmpRect.right;
|
---|
403 | winRect->bottom -= tmpRect.bottom;
|
---|
404 |
|
---|
405 | if (HAS_MENU())
|
---|
406 | {
|
---|
407 | winRect->top +=
|
---|
408 | MENU_GetMenuBarHeight(Win32Hwnd,
|
---|
409 | winRect->right - winRect->left,
|
---|
410 | -tmpRect.left, -tmpRect.top ) + 1;
|
---|
411 | }
|
---|
412 |
|
---|
413 | SetRect (&tmpRect, 0, 0, 0, 0);
|
---|
414 | AdjustRectInner(&tmpRect);
|
---|
415 | winRect->left -= tmpRect.left;
|
---|
416 | winRect->top -= tmpRect.top;
|
---|
417 | winRect->right -= tmpRect.right;
|
---|
418 | winRect->bottom -= tmpRect.bottom;
|
---|
419 | }
|
---|
420 |
|
---|
421 | return result;
|
---|
422 | }
|
---|
423 | //******************************************************************************
|
---|
424 | //******************************************************************************
|
---|
425 | LONG Win32BaseWindow::HandleNCHitTest(POINT pt)
|
---|
426 | {
|
---|
427 | RECT rect = rectWindow;
|
---|
428 |
|
---|
429 | if (dwStyle & WS_MINIMIZE) return HTCAPTION;
|
---|
430 |
|
---|
431 | if (!PtInRect(&rect,pt)) return HTNOWHERE;
|
---|
432 |
|
---|
433 | if (!(flags & WIN_MANAGED))
|
---|
434 | {
|
---|
435 | /* Check borders */
|
---|
436 | if (HAS_THICKFRAME(dwStyle,dwExStyle))
|
---|
437 | {
|
---|
438 | InflateRect(&rect,-GetSystemMetrics(SM_CXFRAME),-GetSystemMetrics(SM_CYFRAME));
|
---|
439 | if (!PtInRect(&rect,pt))
|
---|
440 | {
|
---|
441 | /* Check top sizing border */
|
---|
442 | if (pt.y < rect.top)
|
---|
443 | {
|
---|
444 | if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT;
|
---|
445 | if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT;
|
---|
446 | return HTTOP;
|
---|
447 | }
|
---|
448 | /* Check bottom sizing border */
|
---|
449 | if (pt.y >= rect.bottom)
|
---|
450 | {
|
---|
451 | if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT;
|
---|
452 | if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT;
|
---|
453 | return HTBOTTOM;
|
---|
454 | }
|
---|
455 | /* Check left sizing border */
|
---|
456 | if (pt.x < rect.left)
|
---|
457 | {
|
---|
458 | if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT;
|
---|
459 | if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT;
|
---|
460 | return HTLEFT;
|
---|
461 | }
|
---|
462 | /* Check right sizing border */
|
---|
463 | if (pt.x >= rect.right)
|
---|
464 | {
|
---|
465 | if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT;
|
---|
466 | if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT;
|
---|
467 | return HTRIGHT;
|
---|
468 | }
|
---|
469 | }
|
---|
470 | } else /* No thick frame */
|
---|
471 | {
|
---|
472 | if (HAS_DLGFRAME(dwStyle,dwExStyle))
|
---|
473 | InflateRect(&rect, -GetSystemMetrics(SM_CXDLGFRAME), -GetSystemMetrics(SM_CYDLGFRAME));
|
---|
474 | else if (HAS_THINFRAME(dwStyle ))
|
---|
475 | InflateRect(&rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER));
|
---|
476 | if (!PtInRect( &rect, pt )) return HTBORDER;
|
---|
477 | }
|
---|
478 |
|
---|
479 | /* Check caption */
|
---|
480 |
|
---|
481 | if ((dwStyle & WS_CAPTION) == WS_CAPTION)
|
---|
482 | {
|
---|
483 | if (dwExStyle & WS_EX_TOOLWINDOW)
|
---|
484 | rect.top += GetSystemMetrics(SM_CYSMCAPTION)-1;
|
---|
485 | else
|
---|
486 | rect.top += GetSystemMetrics(SM_CYCAPTION)-1;
|
---|
487 | if (!PtInRect(&rect,pt))
|
---|
488 | {
|
---|
489 | /* Check system menu */
|
---|
490 | if(dwStyle & WS_SYSMENU)
|
---|
491 | {
|
---|
492 | /* Check if there is an user icon */
|
---|
493 | HICON hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);
|
---|
494 | if(!hIcon) hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON);
|
---|
495 |
|
---|
496 | /* If there is an icon associated with the window OR */
|
---|
497 | /* If there is no hIcon specified and this is not a modal dialog, */
|
---|
498 | /* there is a system menu icon. */
|
---|
499 | if((hIcon != 0) || (!(dwStyle & DS_MODALFRAME)))
|
---|
500 | rect.left += GetSystemMetrics(SM_CYCAPTION) - 1;
|
---|
501 | }
|
---|
502 | if (pt.x < rect.left) return HTSYSMENU;
|
---|
503 |
|
---|
504 | /* Check close button */
|
---|
505 | if (dwStyle & WS_SYSMENU)
|
---|
506 | rect.right -= GetSystemMetrics(SM_CYCAPTION) - 1;
|
---|
507 | if (pt.x > rect.right) return HTCLOSE;
|
---|
508 |
|
---|
509 | /* Check maximize box */
|
---|
510 | /* In win95 there is automatically a Maximize button when there is a minimize one*/
|
---|
511 | if ((dwStyle & WS_MAXIMIZEBOX)|| (dwStyle & WS_MINIMIZEBOX))
|
---|
512 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
|
---|
513 | if (pt.x > rect.right) return HTMAXBUTTON;
|
---|
514 |
|
---|
515 | /* Check minimize box */
|
---|
516 | /* In win95 there is automatically a Maximize button when there is a Maximize one*/
|
---|
517 | if ((dwStyle & WS_MINIMIZEBOX)||(dwStyle & WS_MAXIMIZEBOX))
|
---|
518 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
|
---|
519 |
|
---|
520 | if (pt.x > rect.right) return HTMINBUTTON;
|
---|
521 | return HTCAPTION;
|
---|
522 | }
|
---|
523 | }
|
---|
524 | }
|
---|
525 |
|
---|
526 | /* Check client area */
|
---|
527 |
|
---|
528 | ScreenToClient(Win32Hwnd,&pt);
|
---|
529 | getClientRect(&rect);
|
---|
530 | if (PtInRect(&rect,pt)) return HTCLIENT;
|
---|
531 |
|
---|
532 | /* Check vertical scroll bar */
|
---|
533 |
|
---|
534 | if (dwStyle & WS_VSCROLL)
|
---|
535 | {
|
---|
536 | rect.right += GetSystemMetrics(SM_CXVSCROLL);
|
---|
537 | if (PtInRect( &rect, pt )) return HTVSCROLL;
|
---|
538 | }
|
---|
539 |
|
---|
540 | /* Check horizontal scroll bar */
|
---|
541 |
|
---|
542 | if (dwStyle & WS_HSCROLL)
|
---|
543 | {
|
---|
544 | rect.bottom += GetSystemMetrics(SM_CYHSCROLL);
|
---|
545 | if (PtInRect( &rect, pt ))
|
---|
546 | {
|
---|
547 | /* Check size box */
|
---|
548 | if ((dwStyle & WS_VSCROLL) &&
|
---|
549 | (pt.x >= rect.right - GetSystemMetrics(SM_CXVSCROLL)))
|
---|
550 | return (dwStyle & WS_CHILD) ? HTSIZE:HTBOTTOMRIGHT;
|
---|
551 | return HTHSCROLL;
|
---|
552 | }
|
---|
553 | }
|
---|
554 |
|
---|
555 | /* Check menu bar */
|
---|
556 |
|
---|
557 | if (HAS_MENU())
|
---|
558 | {
|
---|
559 | if ((pt.y < 0) && (pt.x >= 0) && (pt.x < rect.right))
|
---|
560 | return HTMENU;
|
---|
561 | }
|
---|
562 |
|
---|
563 | /* Should never get here */
|
---|
564 | return HTERROR;
|
---|
565 | }
|
---|
566 |
|
---|
567 | //******************************************************************************
|
---|
568 | //******************************************************************************
|
---|
569 | VOID Win32BaseWindow::GetInsideRect(RECT *rect)
|
---|
570 | {
|
---|
571 | rect->top = rect->left = 0;
|
---|
572 | rect->right = rectWindow.right - rectWindow.left;
|
---|
573 | rect->bottom = rectWindow.bottom - rectWindow.top;
|
---|
574 |
|
---|
575 | if ((dwStyle & WS_ICONIC) || (flags & WIN_MANAGED)) return;
|
---|
576 |
|
---|
577 | /* Remove frame from rectangle */
|
---|
578 | if (HAS_THICKFRAME(dwStyle,dwExStyle))
|
---|
579 | {
|
---|
580 | InflateRect( rect, -GetSystemMetrics(SM_CXSIZEFRAME), -GetSystemMetrics(SM_CYSIZEFRAME) );
|
---|
581 | }
|
---|
582 | else if (HAS_DLGFRAME(dwStyle,dwExStyle ))
|
---|
583 | {
|
---|
584 | InflateRect( rect, -GetSystemMetrics(SM_CXFIXEDFRAME), -GetSystemMetrics(SM_CYFIXEDFRAME));
|
---|
585 | }
|
---|
586 | else if (HAS_THINFRAME(dwStyle))
|
---|
587 | {
|
---|
588 | InflateRect( rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER) );
|
---|
589 | }
|
---|
590 |
|
---|
591 | /* We have additional border information if the window
|
---|
592 | * is a child (but not an MDI child) */
|
---|
593 | if ( (dwStyle & WS_CHILD) &&
|
---|
594 | ( (dwExStyle & WS_EX_MDICHILD) == 0 ) )
|
---|
595 | {
|
---|
596 | if (dwExStyle & WS_EX_CLIENTEDGE)
|
---|
597 | InflateRect (rect, -GetSystemMetrics(SM_CXEDGE), -GetSystemMetrics(SM_CYEDGE));
|
---|
598 |
|
---|
599 | if (dwExStyle & WS_EX_STATICEDGE)
|
---|
600 | InflateRect (rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER));
|
---|
601 | }
|
---|
602 | }
|
---|
603 | //******************************************************************************
|
---|
604 | //******************************************************************************
|
---|
605 | VOID Win32BaseWindow::DrawFrame(HDC hdc,RECT *rect,BOOL dlgFrame,BOOL active)
|
---|
606 | {
|
---|
607 | INT width, height;
|
---|
608 | HBRUSH oldBrush;
|
---|
609 |
|
---|
610 | if (dlgFrame)
|
---|
611 | {
|
---|
612 | width = GetSystemMetrics(SM_CXDLGFRAME) - GetSystemMetrics(SM_CXEDGE);
|
---|
613 | height = GetSystemMetrics(SM_CYDLGFRAME) - GetSystemMetrics(SM_CYEDGE);
|
---|
614 | }
|
---|
615 | else
|
---|
616 | {
|
---|
617 | width = GetSystemMetrics(SM_CXFRAME) - GetSystemMetrics(SM_CXEDGE);
|
---|
618 | height = GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYEDGE);
|
---|
619 | }
|
---|
620 |
|
---|
621 | oldBrush = SelectObject(hdc,GetSysColorBrush(active ? COLOR_ACTIVEBORDER:COLOR_INACTIVEBORDER));
|
---|
622 |
|
---|
623 | /* Draw frame */
|
---|
624 | PatBlt(hdc,rect->left, rect->top, rect->right-rect->left, height,PATCOPY);
|
---|
625 | PatBlt(hdc,rect->left, rect->top, width, rect->bottom-rect->top,PATCOPY);
|
---|
626 | PatBlt(hdc,rect->left, rect->bottom-1, rect->right-rect->left,-height,PATCOPY);
|
---|
627 | PatBlt(hdc,rect->right-1,rect->top, -width, rect->bottom-rect->top,PATCOPY);
|
---|
628 | SelectObject(hdc,oldBrush);
|
---|
629 |
|
---|
630 | InflateRect(rect,-width,-height);
|
---|
631 | }
|
---|
632 | //******************************************************************************
|
---|
633 | //******************************************************************************
|
---|
634 | BOOL Win32BaseWindow::DrawSysButton(HDC hdc,RECT *rect)
|
---|
635 | {
|
---|
636 | if(!(flags & WIN_MANAGED))
|
---|
637 | {
|
---|
638 | HICON hIcon;
|
---|
639 | RECT r;
|
---|
640 |
|
---|
641 | if (!rect) GetInsideRect(&r);
|
---|
642 | else r = *rect;
|
---|
643 |
|
---|
644 | hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);
|
---|
645 | if(!hIcon) hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON);
|
---|
646 |
|
---|
647 | /* If there is no hIcon specified or this is not a modal dialog, */
|
---|
648 | /* get the default one. */
|
---|
649 | if(hIcon == 0)
|
---|
650 | if (!(dwStyle & DS_MODALFRAME))
|
---|
651 | hIcon = LoadImageA(0, MAKEINTRESOURCEA(OIC_ODINICON), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
|
---|
652 |
|
---|
653 | if (hIcon)
|
---|
654 | DrawIconEx(hdc,r.left+2,r.top+2,hIcon,
|
---|
655 | GetSystemMetrics(SM_CXSMICON),
|
---|
656 | GetSystemMetrics(SM_CYSMICON),
|
---|
657 | 0, 0, DI_NORMAL);
|
---|
658 |
|
---|
659 | return (hIcon != 0);
|
---|
660 | }
|
---|
661 | return FALSE;
|
---|
662 | }
|
---|
663 | //******************************************************************************
|
---|
664 | //******************************************************************************
|
---|
665 | BOOL Win32BaseWindow::GetSysPopupPos(RECT* rect)
|
---|
666 | {
|
---|
667 | if(hSysMenu)
|
---|
668 | {
|
---|
669 | if(dwStyle & WS_MINIMIZE )
|
---|
670 | *rect = rectWindow;
|
---|
671 | else
|
---|
672 | {
|
---|
673 | GetInsideRect(rect );
|
---|
674 | OffsetRect( rect, rectWindow.left, rectWindow.top);
|
---|
675 | rect->right = rect->left + GetSystemMetrics(SM_CYCAPTION) - 1;
|
---|
676 | rect->bottom = rect->top + GetSystemMetrics(SM_CYCAPTION) - 1;
|
---|
677 | }
|
---|
678 | return TRUE;
|
---|
679 | }
|
---|
680 | return FALSE;
|
---|
681 | }
|
---|
682 | //******************************************************************************
|
---|
683 | //******************************************************************************
|
---|
684 | BOOL Win32BaseWindow::DrawGrayButton(HDC hdc,int x,int y)
|
---|
685 | {
|
---|
686 | HBITMAP hMaskBmp;
|
---|
687 | HDC hdcMask = CreateCompatibleDC (0);
|
---|
688 | HBRUSH hOldBrush;
|
---|
689 | hMaskBmp = CreateBitmap (12, 10, 1, 1, lpGrayMask);
|
---|
690 |
|
---|
691 | if(hMaskBmp == 0)
|
---|
692 | return FALSE;
|
---|
693 |
|
---|
694 | SelectObject (hdcMask, hMaskBmp);
|
---|
695 |
|
---|
696 | /* Draw the grayed bitmap using the mask */
|
---|
697 | hOldBrush = SelectObject (hdc, RGB(128, 128, 128));
|
---|
698 | BitBlt (hdc, x, y, 12, 10,
|
---|
699 | hdcMask, 0, 0, 0xB8074A);
|
---|
700 |
|
---|
701 | /* Clean up */
|
---|
702 | SelectObject (hdc, hOldBrush);
|
---|
703 | DeleteObject(hMaskBmp);
|
---|
704 | DeleteDC (hdcMask);
|
---|
705 |
|
---|
706 | return TRUE;
|
---|
707 | }
|
---|
708 | //******************************************************************************
|
---|
709 | //******************************************************************************
|
---|
710 | VOID Win32BaseWindow::DrawCloseButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed)
|
---|
711 | {
|
---|
712 | RECT r;
|
---|
713 | HDC hdcMem;
|
---|
714 |
|
---|
715 | if( !(flags & WIN_MANAGED) )
|
---|
716 | {
|
---|
717 | BITMAP bmp;
|
---|
718 | HBITMAP hBmp, hOldBmp;
|
---|
719 |
|
---|
720 | if (!rect) GetInsideRect(&r);
|
---|
721 | else r = *rect;
|
---|
722 |
|
---|
723 | hdcMem = CreateCompatibleDC( hdc );
|
---|
724 | hBmp = down ? hbitmapCloseD : hbitmapClose;
|
---|
725 | hOldBmp = SelectObject (hdcMem, hBmp);
|
---|
726 | GetObjectA (hBmp, sizeof(BITMAP), &bmp);
|
---|
727 |
|
---|
728 | BitBlt (hdc, r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2,
|
---|
729 | r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
|
---|
730 | bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY);
|
---|
731 |
|
---|
732 | if(bGrayed)
|
---|
733 | DrawGrayButton(hdc,r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2 + 2,
|
---|
734 | r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
|
---|
735 |
|
---|
736 | SelectObject (hdcMem, hOldBmp);
|
---|
737 | DeleteDC (hdcMem);
|
---|
738 | }
|
---|
739 | }
|
---|
740 | //******************************************************************************
|
---|
741 | //******************************************************************************
|
---|
742 | VOID Win32BaseWindow::DrawMaxButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed)
|
---|
743 | {
|
---|
744 | RECT r;
|
---|
745 | HDC hdcMem;
|
---|
746 |
|
---|
747 | if( !(flags & WIN_MANAGED))
|
---|
748 | {
|
---|
749 | BITMAP bmp;
|
---|
750 | HBITMAP hBmp,hOldBmp;
|
---|
751 |
|
---|
752 | if (!rect) GetInsideRect(&r);
|
---|
753 | else r = *rect;
|
---|
754 | hdcMem = CreateCompatibleDC( hdc );
|
---|
755 | hBmp = IsZoomed(Win32Hwnd) ?
|
---|
756 | (down ? hbitmapRestoreD : hbitmapRestore ) :
|
---|
757 | (down ? hbitmapMaximizeD: hbitmapMaximize);
|
---|
758 | hOldBmp=SelectObject( hdcMem, hBmp );
|
---|
759 | GetObjectA (hBmp, sizeof(BITMAP), &bmp);
|
---|
760 |
|
---|
761 | if (dwStyle & WS_SYSMENU)
|
---|
762 | r.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
|
---|
763 |
|
---|
764 | BitBlt( hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
|
---|
765 | r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
|
---|
766 | bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY );
|
---|
767 |
|
---|
768 | if(bGrayed)
|
---|
769 | DrawGrayButton(hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2,
|
---|
770 | r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
|
---|
771 |
|
---|
772 |
|
---|
773 | SelectObject (hdcMem, hOldBmp);
|
---|
774 | DeleteDC( hdcMem );
|
---|
775 | }
|
---|
776 | }
|
---|
777 | //******************************************************************************
|
---|
778 | //******************************************************************************
|
---|
779 | VOID Win32BaseWindow::DrawMinButton(HDC hdc,RECT *rect,BOOL down,BOOL bGrayed)
|
---|
780 | {
|
---|
781 | RECT r;
|
---|
782 | HDC hdcMem;
|
---|
783 |
|
---|
784 | if( !(flags & WIN_MANAGED))
|
---|
785 |
|
---|
786 | {
|
---|
787 | BITMAP bmp;
|
---|
788 | HBITMAP hBmp,hOldBmp;
|
---|
789 |
|
---|
790 | if (!rect) GetInsideRect(&r);
|
---|
791 | else r = *rect;
|
---|
792 |
|
---|
793 | hdcMem = CreateCompatibleDC( hdc );
|
---|
794 | hBmp = down ? hbitmapMinimizeD : hbitmapMinimize;
|
---|
795 | hOldBmp= SelectObject( hdcMem, hBmp );
|
---|
796 | GetObjectA (hBmp, sizeof(BITMAP), &bmp);
|
---|
797 |
|
---|
798 | if (dwStyle & WS_SYSMENU)
|
---|
799 | r.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
|
---|
800 |
|
---|
801 | /* In win 95 there is always a Maximize box when there is a Minimize one */
|
---|
802 | if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX))
|
---|
803 | r.right -= bmp.bmWidth;
|
---|
804 |
|
---|
805 | BitBlt( hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
|
---|
806 | r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
|
---|
807 | bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY );
|
---|
808 |
|
---|
809 | if(bGrayed)
|
---|
810 | DrawGrayButton(hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2,
|
---|
811 | r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
|
---|
812 |
|
---|
813 |
|
---|
814 | SelectObject (hdcMem, hOldBmp);
|
---|
815 | DeleteDC( hdcMem );
|
---|
816 | }
|
---|
817 | }
|
---|
818 | //******************************************************************************
|
---|
819 | // redrawText: only redraws text
|
---|
820 | //******************************************************************************
|
---|
821 | VOID Win32BaseWindow::DrawCaption(HDC hdc,RECT *rect,BOOL active,BOOL redrawText)
|
---|
822 | {
|
---|
823 | RECT r = *rect,r2;
|
---|
824 | char buffer[256];
|
---|
825 | HPEN hPrevPen;
|
---|
826 | HDC memDC;
|
---|
827 | HBITMAP memBmp,oldBmp;
|
---|
828 |
|
---|
829 | if (flags & WIN_MANAGED) return;
|
---|
830 |
|
---|
831 | memDC = CreateCompatibleDC(hdc);
|
---|
832 | r.right -= r.left;
|
---|
833 | r.bottom -= r.top;
|
---|
834 | r.left = r.top = 0;
|
---|
835 | r2 = r;
|
---|
836 | memBmp = CreateCompatibleBitmap(hdc,r.right,r.bottom);
|
---|
837 | oldBmp = SelectObject(memDC,memBmp);
|
---|
838 |
|
---|
839 | hPrevPen = SelectObject(memDC,GetSysColorPen(COLOR_3DFACE));
|
---|
840 | MoveToEx(memDC,r.left,r.bottom-1,NULL);
|
---|
841 | LineTo(memDC,r.right,r.bottom-1);
|
---|
842 | SelectObject(memDC,hPrevPen);
|
---|
843 | r.bottom--;
|
---|
844 |
|
---|
845 | if (SYSCOLOR_GetUseWinColors())
|
---|
846 | {
|
---|
847 | COLORREF startColor = GetSysColor(active ? COLOR_ACTIVECAPTION:COLOR_INACTIVECAPTION),endColor = GetSysColor(active ? COLOR_GRADIENTACTIVECAPTION:COLOR_GRADIENTINACTIVECAPTION);
|
---|
848 |
|
---|
849 | if (startColor == endColor)
|
---|
850 | FillRect(memDC,&r,GetSysColorBrush(startColor));
|
---|
851 | else
|
---|
852 | {
|
---|
853 | INT rDiff = GetRValue(endColor)-GetRValue(startColor);
|
---|
854 | INT gDiff = GetGValue(endColor)-GetGValue(startColor);
|
---|
855 | INT bDiff = GetBValue(endColor)-GetBValue(startColor);
|
---|
856 | INT steps = MAX(MAX(abs(rDiff),abs(gDiff)),abs(bDiff));
|
---|
857 | INT w = r.right-r.left;
|
---|
858 | RECT r2;
|
---|
859 |
|
---|
860 | if (w < steps) steps = w;
|
---|
861 | r2.left = r2.right = r.left;
|
---|
862 | r2.top = r.top;
|
---|
863 | r2.bottom = r.bottom;
|
---|
864 | for (INT x = 0;x <= steps;x++)
|
---|
865 | {
|
---|
866 | COLORREF color = RGB(GetRValue(startColor)+rDiff*x/steps,GetGValue(startColor)+gDiff*x/steps,GetBValue(startColor)+bDiff*x/steps);
|
---|
867 | HBRUSH brush = CreateSolidBrush(color);
|
---|
868 |
|
---|
869 | r2.left = r2.right;
|
---|
870 | r2.right = r.left+w*x/steps;
|
---|
871 | FillRect(memDC,&r2,brush);
|
---|
872 | DeleteObject(brush);
|
---|
873 | }
|
---|
874 | }
|
---|
875 | } else FillRect(memDC,&r,GetSysColorBrush(active ? COLOR_ACTIVECAPTION:COLOR_INACTIVECAPTION));
|
---|
876 |
|
---|
877 | if (!hbitmapClose)
|
---|
878 | {
|
---|
879 | if (!(hbitmapClose = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_CLOSE)))) return;
|
---|
880 | hbitmapCloseD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_CLOSED));
|
---|
881 | hbitmapMinimize = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_REDUCE));
|
---|
882 | hbitmapMinimizeD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_REDUCED));
|
---|
883 | hbitmapMaximize = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_ZOOM));
|
---|
884 | hbitmapMaximizeD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_ZOOMD));
|
---|
885 | hbitmapRestore = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_RESTORE));
|
---|
886 | hbitmapRestoreD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_RESTORED));
|
---|
887 | }
|
---|
888 |
|
---|
889 | if ((dwStyle & WS_SYSMENU) && !(dwExStyle & WS_EX_TOOLWINDOW))
|
---|
890 | {
|
---|
891 | if (redrawText || DrawSysButton(memDC,&r))
|
---|
892 | r.left += GetSystemMetrics(SM_CYCAPTION) - 1;
|
---|
893 | }
|
---|
894 |
|
---|
895 | if (dwStyle & WS_SYSMENU)
|
---|
896 | {
|
---|
897 | UINT state;
|
---|
898 |
|
---|
899 | if (!redrawText)
|
---|
900 | {
|
---|
901 | /* Go get the sysmenu */
|
---|
902 | state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND);
|
---|
903 |
|
---|
904 | /* Draw a grayed close button if disabled and a normal one if SC_CLOSE is not there */
|
---|
905 | DrawCloseButton(memDC,&r2,FALSE,
|
---|
906 | ((((state & MF_DISABLED) || (state & MF_GRAYED))) && (state != 0xFFFFFFFF)));
|
---|
907 | }
|
---|
908 | r.right -= GetSystemMetrics(SM_CYCAPTION) - 1;
|
---|
909 |
|
---|
910 | if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX))
|
---|
911 | {
|
---|
912 | /* In win95 the two buttons are always there */
|
---|
913 | /* But if the menu item is not in the menu they're disabled*/
|
---|
914 |
|
---|
915 | if (!redrawText)
|
---|
916 | DrawMaxButton(memDC,&r2,FALSE,(!(dwStyle & WS_MAXIMIZEBOX)));
|
---|
917 | r.right -= GetSystemMetrics(SM_CXSIZE) + 1;
|
---|
918 |
|
---|
919 | if (!redrawText)
|
---|
920 | DrawMinButton(memDC,&r2,FALSE, (!(dwStyle & WS_MINIMIZEBOX)));
|
---|
921 | r.right -= GetSystemMetrics(SM_CXSIZE) + 1;
|
---|
922 | }
|
---|
923 | }
|
---|
924 |
|
---|
925 | if (GetWindowTextA(buffer, sizeof(buffer) ))
|
---|
926 | {
|
---|
927 | NONCLIENTMETRICSA nclm;
|
---|
928 | HFONT hFont, hOldFont;
|
---|
929 |
|
---|
930 | nclm.cbSize = sizeof(NONCLIENTMETRICSA);
|
---|
931 | SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
|
---|
932 | if (dwExStyle & WS_EX_TOOLWINDOW)
|
---|
933 | hFont = CreateFontIndirectA (&nclm.lfSmCaptionFont);
|
---|
934 | else
|
---|
935 | hFont = CreateFontIndirectA (&nclm.lfCaptionFont);
|
---|
936 | hOldFont = SelectObject (memDC, hFont);
|
---|
937 | SetTextColor(memDC,GetSysColor(active ? COLOR_CAPTIONTEXT:COLOR_INACTIVECAPTIONTEXT));
|
---|
938 | SetBkMode(memDC, TRANSPARENT );
|
---|
939 | r.left += 2;
|
---|
940 | DrawTextA(memDC, buffer, -1, &r,
|
---|
941 | DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT );
|
---|
942 | DeleteObject (SelectObject (memDC, hOldFont));
|
---|
943 | }
|
---|
944 |
|
---|
945 | BitBlt(hdc,rect->left,rect->top,rect->right-rect->left,rect->bottom-rect->top,memDC,0,0,SRCCOPY);
|
---|
946 | SelectObject(memDC,oldBmp);
|
---|
947 | DeleteObject(memBmp);
|
---|
948 | DeleteDC(memDC);
|
---|
949 | }
|
---|
950 | //******************************************************************************
|
---|
951 | //******************************************************************************
|
---|
952 | VOID Win32BaseWindow::UpdateCaptionText()
|
---|
953 | {
|
---|
954 | BOOL active = flags & WIN_NCACTIVATED;
|
---|
955 | HDC hdc;
|
---|
956 | RECT rect,r;
|
---|
957 | HRGN hrgn;
|
---|
958 |
|
---|
959 | if (!((dwStyle & WS_CAPTION) == WS_CAPTION)) return;
|
---|
960 |
|
---|
961 | rect.top = rect.left = 0;
|
---|
962 | rect.right = rectWindow.right - rectWindow.left;
|
---|
963 | rect.bottom = rectWindow.bottom - rectWindow.top;
|
---|
964 | if(!(flags & WIN_MANAGED))
|
---|
965 | {
|
---|
966 | if (HAS_BIGFRAME( dwStyle, dwExStyle))
|
---|
967 | {
|
---|
968 | InflateRect(&rect,-2,-2);
|
---|
969 | }
|
---|
970 |
|
---|
971 | if (HAS_THICKFRAME(dwStyle,dwExStyle))
|
---|
972 | {
|
---|
973 | INT width = GetSystemMetrics(SM_CXFRAME) - GetSystemMetrics(SM_CXEDGE);
|
---|
974 | INT height = GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYEDGE);
|
---|
975 |
|
---|
976 | InflateRect(&rect,-width,-height);
|
---|
977 | }
|
---|
978 | else if (HAS_DLGFRAME(dwStyle,dwExStyle))
|
---|
979 | {
|
---|
980 | INT width = GetSystemMetrics(SM_CXDLGFRAME) - GetSystemMetrics(SM_CXEDGE);
|
---|
981 | INT height = GetSystemMetrics(SM_CYDLGFRAME) - GetSystemMetrics(SM_CYEDGE);
|
---|
982 |
|
---|
983 | InflateRect(&rect,-width,-height);
|
---|
984 | }
|
---|
985 | else if (HAS_THINFRAME(dwStyle))
|
---|
986 | {
|
---|
987 | }
|
---|
988 |
|
---|
989 | r = rect;
|
---|
990 | if (dwExStyle & WS_EX_TOOLWINDOW)
|
---|
991 | {
|
---|
992 | r.bottom = rect.top + GetSystemMetrics(SM_CYSMCAPTION);
|
---|
993 | }
|
---|
994 | else
|
---|
995 | {
|
---|
996 | r.bottom = rect.top + GetSystemMetrics(SM_CYCAPTION);
|
---|
997 | }
|
---|
998 |
|
---|
999 | //clip the buttons
|
---|
1000 | if ((dwStyle & WS_SYSMENU) && !(dwExStyle & WS_EX_TOOLWINDOW))
|
---|
1001 | {
|
---|
1002 | HICON hIcon;
|
---|
1003 |
|
---|
1004 | hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);
|
---|
1005 | if(!hIcon) hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON);
|
---|
1006 | if (hIcon)
|
---|
1007 | rect.left += GetSystemMetrics(SM_CYCAPTION) - 1;
|
---|
1008 | }
|
---|
1009 | if (dwStyle & WS_SYSMENU)
|
---|
1010 | {
|
---|
1011 | rect.right -= GetSystemMetrics(SM_CYCAPTION) - 1;
|
---|
1012 |
|
---|
1013 | if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX))
|
---|
1014 | {
|
---|
1015 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
|
---|
1016 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
|
---|
1017 | }
|
---|
1018 | }
|
---|
1019 |
|
---|
1020 | hrgn = CreateRectRgnIndirect(&rect);
|
---|
1021 | hdc = GetDCEx(Win32Hwnd,hrgn,DCX_USESTYLE | DCX_WINDOW | DCX_INTERSECTRGN);
|
---|
1022 | SelectObject(hdc,GetSysColorPen(COLOR_WINDOWFRAME));
|
---|
1023 | DrawCaption(hdc,&r,active,TRUE);
|
---|
1024 | DeleteObject(hrgn);
|
---|
1025 | ReleaseDC(Win32Hwnd,hdc);
|
---|
1026 | }
|
---|
1027 | }
|
---|
1028 | //******************************************************************************
|
---|
1029 | //******************************************************************************
|
---|
1030 | VOID Win32BaseWindow::DoNCPaint(HRGN clip,BOOL suppress_menupaint)
|
---|
1031 | {
|
---|
1032 | BOOL active = flags & WIN_NCACTIVATED;
|
---|
1033 | HDC hdc;
|
---|
1034 | RECT rect,rectClip,rfuzz;
|
---|
1035 |
|
---|
1036 | /* MSDN docs are pretty idiotic here, they say app CAN use clipRgn in
|
---|
1037 | the call to GetDCEx implying that it is allowed not to use it either.
|
---|
1038 | However, the suggested GetDCEx( , DCX_WINDOW | DCX_INTERSECTRGN)
|
---|
1039 | will cause clipRgn to be deleted after ReleaseDC().
|
---|
1040 | Now, how is the "system" supposed to tell what happened?
|
---|
1041 | */
|
---|
1042 |
|
---|
1043 | if (!(hdc = GetDCEx( Win32Hwnd, (clip > 1) ? clip : 0, DCX_USESTYLE | DCX_WINDOW |
|
---|
1044 | ((clip > 1) ?(DCX_INTERSECTRGN /*| DCX_KEEPCLIPRGN*/) : 0) ))) return;
|
---|
1045 |
|
---|
1046 | rect.top = rect.left = 0;
|
---|
1047 | rect.right = rectWindow.right - rectWindow.left;
|
---|
1048 | rect.bottom = rectWindow.bottom - rectWindow.top;
|
---|
1049 |
|
---|
1050 | if( clip > 1 )
|
---|
1051 | {
|
---|
1052 | //CB: unknown WINE handling (clip == 1), clip client?
|
---|
1053 | GetRgnBox( clip, &rectClip );
|
---|
1054 | } else
|
---|
1055 | {
|
---|
1056 | clip = 0;
|
---|
1057 | rectClip = rect;
|
---|
1058 | }
|
---|
1059 |
|
---|
1060 | SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) );
|
---|
1061 |
|
---|
1062 | if(!(flags & WIN_MANAGED))
|
---|
1063 | {
|
---|
1064 | if (HAS_BIGFRAME( dwStyle, dwExStyle))
|
---|
1065 | {
|
---|
1066 | DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT | BF_ADJUST);
|
---|
1067 | }
|
---|
1068 | if (HAS_THICKFRAME( dwStyle, dwExStyle ))
|
---|
1069 | DrawFrame(hdc, &rect, FALSE, active );
|
---|
1070 | else if (HAS_DLGFRAME( dwStyle, dwExStyle ))
|
---|
1071 | DrawFrame( hdc, &rect, TRUE, active );
|
---|
1072 | else if (HAS_THINFRAME( dwStyle ))
|
---|
1073 | {
|
---|
1074 | SelectObject( hdc, GetStockObject(NULL_BRUSH) );
|
---|
1075 | Rectangle( hdc, 0, 0, rect.right, rect.bottom );
|
---|
1076 | }
|
---|
1077 |
|
---|
1078 | if ((dwStyle & WS_CAPTION) == WS_CAPTION)
|
---|
1079 | {
|
---|
1080 | RECT r = rect;
|
---|
1081 | if (dwExStyle & WS_EX_TOOLWINDOW)
|
---|
1082 | {
|
---|
1083 | r.bottom = rect.top + GetSystemMetrics(SM_CYSMCAPTION);
|
---|
1084 | rect.top += GetSystemMetrics(SM_CYSMCAPTION);
|
---|
1085 | }
|
---|
1086 | else
|
---|
1087 | {
|
---|
1088 | r.bottom = rect.top + GetSystemMetrics(SM_CYCAPTION);
|
---|
1089 | rect.top += GetSystemMetrics(SM_CYCAPTION);
|
---|
1090 | }
|
---|
1091 | if( !clip || IntersectRect( &rfuzz, &r, &rectClip ) )
|
---|
1092 | DrawCaption(hdc,&r,active,FALSE);
|
---|
1093 | }
|
---|
1094 | }
|
---|
1095 | if (HAS_MENU())
|
---|
1096 | {
|
---|
1097 | RECT r = rect;
|
---|
1098 | r.bottom = rect.top + GetSystemMetrics(SM_CYMENU);
|
---|
1099 |
|
---|
1100 | rect.top += MENU_DrawMenuBar(hdc,&r,Win32Hwnd,suppress_menupaint)+1;
|
---|
1101 | }
|
---|
1102 |
|
---|
1103 | if (dwExStyle & WS_EX_CLIENTEDGE)
|
---|
1104 | DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
|
---|
1105 |
|
---|
1106 | if (dwExStyle & WS_EX_STATICEDGE)
|
---|
1107 | DrawEdge (hdc, &rect, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST);
|
---|
1108 |
|
---|
1109 | /* Draw the scroll-bars */
|
---|
1110 | if (dwStyle & WS_VSCROLL)
|
---|
1111 | SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_VERT,TRUE,TRUE);
|
---|
1112 | if (dwStyle & WS_HSCROLL)
|
---|
1113 | SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_HORZ,TRUE,TRUE);
|
---|
1114 |
|
---|
1115 | /* Draw the "size-box" */
|
---|
1116 | if ((dwStyle & WS_VSCROLL) && (dwStyle & WS_HSCROLL))
|
---|
1117 | {
|
---|
1118 | RECT r = rect;
|
---|
1119 | r.left = r.right - GetSystemMetrics(SM_CXVSCROLL) + 1;
|
---|
1120 | r.top = r.bottom - GetSystemMetrics(SM_CYHSCROLL) + 1;
|
---|
1121 | FillRect( hdc, &r, GetSysColorBrush(COLOR_SCROLLBAR) );
|
---|
1122 | if (!(dwStyle & WS_CHILD))
|
---|
1123 | {
|
---|
1124 | POINT p1,p2;
|
---|
1125 | HPEN penDark = GetSysColorPen(COLOR_3DSHADOW);
|
---|
1126 | HPEN penWhite = GetSysColorPen(COLOR_3DHILIGHT);
|
---|
1127 | HPEN oldPen = SelectObject(hdc,penDark);
|
---|
1128 | INT x;
|
---|
1129 |
|
---|
1130 | p1.x = r.right-1;
|
---|
1131 | p1.y = r.bottom;
|
---|
1132 | p2.x = r.right;
|
---|
1133 | p2.y = r.bottom-1;
|
---|
1134 | for (x = 0;x < 3;x++)
|
---|
1135 | {
|
---|
1136 | SelectObject(hdc,penDark);
|
---|
1137 | MoveToEx(hdc,p1.x,p1.y,NULL);
|
---|
1138 | LineTo(hdc,p2.x,p2.y);
|
---|
1139 | p1.x--;
|
---|
1140 | p2.y--;
|
---|
1141 | MoveToEx(hdc,p1.x,p1.y,NULL);
|
---|
1142 | LineTo(hdc,p2.x,p2.y);
|
---|
1143 | SelectObject(hdc,penWhite);
|
---|
1144 | p1.x--;
|
---|
1145 | p2.y--;
|
---|
1146 | MoveToEx(hdc,p1.x,p1.y,NULL);
|
---|
1147 | LineTo(hdc,p2.x,p2.y);
|
---|
1148 | p1.x -= 2;
|
---|
1149 | p2.y -= 2;
|
---|
1150 | }
|
---|
1151 |
|
---|
1152 | SelectObject(hdc,oldPen);
|
---|
1153 | }
|
---|
1154 | }
|
---|
1155 |
|
---|
1156 | ReleaseDC(Win32Hwnd,hdc);
|
---|
1157 | }
|
---|
1158 | //******************************************************************************
|
---|
1159 | //******************************************************************************
|
---|
1160 | LONG Win32BaseWindow::HandleNCPaint(HRGN clip)
|
---|
1161 | {
|
---|
1162 | //CB: ignore it for now (SetWindowPos in WM_CREATE)
|
---|
1163 | // if (!(dwStyle & WS_VISIBLE)) return 0;
|
---|
1164 |
|
---|
1165 | if (dwStyle & WS_MINIMIZE) return 0;
|
---|
1166 |
|
---|
1167 | DoNCPaint(clip,FALSE);
|
---|
1168 |
|
---|
1169 | return 0;
|
---|
1170 | }
|
---|
1171 | /***********************************************************************
|
---|
1172 | * NC_HandleNCLButtonDblClk
|
---|
1173 | *
|
---|
1174 | * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
|
---|
1175 | */
|
---|
1176 | LONG Win32BaseWindow::HandleNCLButtonDblClk(WPARAM wParam,LPARAM lParam)
|
---|
1177 | {
|
---|
1178 | /*
|
---|
1179 | * if this is an icon, send a restore since we are handling
|
---|
1180 | * a double click
|
---|
1181 | */
|
---|
1182 | if (dwStyle & WS_MINIMIZE)
|
---|
1183 | {
|
---|
1184 | SendInternalMessageA(WM_SYSCOMMAND,SC_RESTORE,lParam);
|
---|
1185 | return 0;
|
---|
1186 | }
|
---|
1187 |
|
---|
1188 | switch(wParam) /* Hit test */
|
---|
1189 | {
|
---|
1190 | case HTCAPTION:
|
---|
1191 | /* stop processing if WS_MAXIMIZEBOX is missing */
|
---|
1192 | if (dwStyle & WS_MAXIMIZEBOX)
|
---|
1193 | SendInternalMessageA(WM_SYSCOMMAND,
|
---|
1194 | (dwStyle & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE,
|
---|
1195 | lParam);
|
---|
1196 | break;
|
---|
1197 |
|
---|
1198 | case HTSYSMENU:
|
---|
1199 | if (!(GetClassWord(Win32Hwnd,GCW_STYLE) & CS_NOCLOSE))
|
---|
1200 | SendInternalMessageA(WM_SYSCOMMAND,SC_CLOSE,lParam);
|
---|
1201 | break;
|
---|
1202 |
|
---|
1203 | case HTHSCROLL:
|
---|
1204 | SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
|
---|
1205 | break;
|
---|
1206 |
|
---|
1207 | case HTVSCROLL:
|
---|
1208 | SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
|
---|
1209 | break;
|
---|
1210 | }
|
---|
1211 |
|
---|
1212 | return 0;
|
---|
1213 | }
|
---|
1214 | //******************************************************************************
|
---|
1215 | //******************************************************************************
|
---|
1216 | LONG Win32BaseWindow::HandleNCRButtonUp(WPARAM wParam,LPARAM lParam)
|
---|
1217 | {
|
---|
1218 | switch(wParam)
|
---|
1219 | {
|
---|
1220 | case HTCAPTION:
|
---|
1221 | if (GetActiveWindow() != Win32Hwnd)
|
---|
1222 | SetActiveWindow();
|
---|
1223 |
|
---|
1224 | if ((GetActiveWindow() == Win32Hwnd) && (dwStyle & WS_SYSMENU))
|
---|
1225 | {
|
---|
1226 | SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTCAPTION,lParam);
|
---|
1227 | }
|
---|
1228 | break;
|
---|
1229 |
|
---|
1230 | default:
|
---|
1231 | break;
|
---|
1232 | }
|
---|
1233 |
|
---|
1234 | return 0;
|
---|
1235 | }
|
---|
1236 | /***********************************************************************
|
---|
1237 | * NC_HandleSysCommand
|
---|
1238 | *
|
---|
1239 | * Handle a WM_SYSCOMMAND message. Called from DefWindowProc().
|
---|
1240 | *
|
---|
1241 | */
|
---|
1242 | LONG Win32BaseWindow::HandleSysCommand(WPARAM wParam,POINT *pt32)
|
---|
1243 | {
|
---|
1244 | UINT uCommand = wParam & 0xFFF0;
|
---|
1245 |
|
---|
1246 | switch (uCommand)
|
---|
1247 | {
|
---|
1248 |
|
---|
1249 | case SC_SIZE:
|
---|
1250 | {
|
---|
1251 | DWORD flags;
|
---|
1252 |
|
---|
1253 | if (dwStyle & WS_MAXIMIZE) break;
|
---|
1254 |
|
---|
1255 | switch ((wParam & 0xF)+2)
|
---|
1256 | {
|
---|
1257 | case HTLEFT:
|
---|
1258 | flags = TFOS_LEFT;
|
---|
1259 | break;
|
---|
1260 |
|
---|
1261 | case HTRIGHT:
|
---|
1262 | flags = TFOS_RIGHT;
|
---|
1263 | break;
|
---|
1264 |
|
---|
1265 | case HTTOP:
|
---|
1266 | flags = TFOS_TOP;
|
---|
1267 | break;
|
---|
1268 |
|
---|
1269 | case HTTOPLEFT:
|
---|
1270 | flags = TFOS_TOP | TFOS_LEFT;
|
---|
1271 | break;
|
---|
1272 |
|
---|
1273 | case HTTOPRIGHT:
|
---|
1274 | flags = TFOS_TOP | TFOS_RIGHT;
|
---|
1275 | break;
|
---|
1276 |
|
---|
1277 | case HTBOTTOM:
|
---|
1278 | flags = TFOS_BOTTOM;
|
---|
1279 | break;
|
---|
1280 |
|
---|
1281 | case HTBOTTOMLEFT:
|
---|
1282 | flags = TFOS_BOTTOM | TFOS_LEFT;
|
---|
1283 | break;
|
---|
1284 |
|
---|
1285 | case HTBOTTOMRIGHT:
|
---|
1286 | flags = TFOS_BOTTOM | TFOS_RIGHT;
|
---|
1287 | break;
|
---|
1288 |
|
---|
1289 | default:
|
---|
1290 | flags = TFOS_BOTTOM | TFOS_RIGHT;
|
---|
1291 | break;
|
---|
1292 | }
|
---|
1293 | if (flags) FrameTrackFrame(this,flags);
|
---|
1294 | break;
|
---|
1295 | }
|
---|
1296 |
|
---|
1297 | case SC_MOVE:
|
---|
1298 | if (dwStyle & WS_MAXIMIZE) break;
|
---|
1299 | FrameTrackFrame(this,TFOS_MOVE);
|
---|
1300 | break;
|
---|
1301 |
|
---|
1302 | case SC_MINIMIZE:
|
---|
1303 | ShowWindow(SW_MINIMIZE);
|
---|
1304 | break;
|
---|
1305 |
|
---|
1306 | case SC_MAXIMIZE:
|
---|
1307 | ShowWindow(SW_MAXIMIZE);
|
---|
1308 | break;
|
---|
1309 |
|
---|
1310 | case SC_RESTORE:
|
---|
1311 | ShowWindow(SW_RESTORE);
|
---|
1312 | break;
|
---|
1313 |
|
---|
1314 | case SC_CLOSE:
|
---|
1315 | return SendInternalMessageA(WM_CLOSE,0,0);
|
---|
1316 |
|
---|
1317 | case SC_VSCROLL:
|
---|
1318 | case SC_HSCROLL:
|
---|
1319 | TrackScrollBar(wParam,*pt32);
|
---|
1320 | break;
|
---|
1321 |
|
---|
1322 | case SC_MOUSEMENU:
|
---|
1323 | MENU_TrackMouseMenuBar(Win32Hwnd,wParam & 0x000F,*pt32);
|
---|
1324 | break;
|
---|
1325 |
|
---|
1326 | case SC_KEYMENU:
|
---|
1327 | MENU_TrackKbdMenuBar(Win32Hwnd,wParam,pt32->x);
|
---|
1328 | break;
|
---|
1329 |
|
---|
1330 | case SC_TASKLIST:
|
---|
1331 | OSLibWinShowTaskList(getOS2FrameWindowHandle());
|
---|
1332 | break;
|
---|
1333 |
|
---|
1334 | case SC_SCREENSAVE:
|
---|
1335 | if (wParam == SC_ABOUTODIN) {
|
---|
1336 | if(ShellAboutA == 0) {
|
---|
1337 | HINSTANCE hShell32 = LoadLibraryA("SHELL32");
|
---|
1338 | if(hShell32 == 0)
|
---|
1339 | break;
|
---|
1340 | *(VOID **)&ShellAboutA = (VOID *)GetProcAddress(hShell32, "ShellAboutA");
|
---|
1341 | }
|
---|
1342 | ShellAboutA(Win32Hwnd,"Odin","Odin alpha release compiled with IBM VAC++",0);
|
---|
1343 | }
|
---|
1344 | else
|
---|
1345 | if (wParam == SC_PUTMARK)
|
---|
1346 | dprintf(("Mark requested by user\n"));
|
---|
1347 | break;
|
---|
1348 |
|
---|
1349 | case SC_HOTKEY:
|
---|
1350 | case SC_ARRANGE:
|
---|
1351 | case SC_NEXTWINDOW:
|
---|
1352 | case SC_PREVWINDOW:
|
---|
1353 | break;
|
---|
1354 | }
|
---|
1355 | return 0;
|
---|
1356 | }
|
---|
1357 | //******************************************************************************
|
---|
1358 | //******************************************************************************
|
---|