source: trunk/src/user32/new/win32wbasenonclient.cpp@ 2433

Last change on this file since 2433 was 2433, checked in by sandervl, 26 years ago

Client rectangle changes, GetDCEx bugfix (CS_OWNDC), scroll rectangle calculation fixes

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