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

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

wm_activate fixes, scrollbar fix, drawframe fix

File size: 36.6 KB
Line 
1/* $Id: win32wbasenonclient.cpp,v 1.4 2000-01-13 13:54:54 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 (getParent()) mapWin32Rect(OSLIB_HWND_DESKTOP,getParent()->getOS2WindowHandle(),clientRect);
369
370 if(!(dwStyle & WS_MINIMIZE))
371 {
372 AdjustRectOuter(&tmpRect,FALSE);
373
374 clientRect->left -= tmpRect.left;
375 clientRect->top -= tmpRect.top;
376 clientRect->right -= tmpRect.right;
377 clientRect->bottom -= tmpRect.bottom;
378
379 if (HAS_MENU())
380 {
381 clientRect->top +=
382 MENU_GetMenuBarHeight(Win32Hwnd,
383 winRect->right - winRect->left,
384 -tmpRect.left, -tmpRect.top ) + 1;
385 }
386
387 SetRect (&tmpRect, 0, 0, 0, 0);
388 AdjustRectInner(&tmpRect);
389 clientRect->left -= tmpRect.left;
390 clientRect->top -= tmpRect.top;
391 clientRect->right -= tmpRect.right;
392 clientRect->bottom -= tmpRect.bottom;
393 }
394
395 return result;
396}
397//******************************************************************************
398//******************************************************************************
399LONG Win32BaseWindow::HandleNCHitTest(POINT pt)
400{
401 RECT rect = rectWindow;
402
403 if (!PtInRect(&rect,pt)) return HTNOWHERE;
404
405 if (dwStyle & WS_MINIMIZE) return HTCAPTION;
406
407 if (!(flags & WIN_MANAGED))
408 {
409 /* Check borders */
410 if (HAS_THICKFRAME(dwStyle,dwExStyle))
411 {
412 InflateRect(&rect,-GetSystemMetrics(SM_CXFRAME),-GetSystemMetrics(SM_CYFRAME));
413 if (!PtInRect(&rect,pt))
414 {
415 /* Check top sizing border */
416 if (pt.y < rect.top)
417 {
418 if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT;
419 if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT;
420 return HTTOP;
421 }
422 /* Check bottom sizing border */
423 if (pt.y >= rect.bottom)
424 {
425 if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT;
426 if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT;
427 return HTBOTTOM;
428 }
429 /* Check left sizing border */
430 if (pt.x < rect.left)
431 {
432 if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT;
433 if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT;
434 return HTLEFT;
435 }
436 /* Check right sizing border */
437 if (pt.x >= rect.right)
438 {
439 if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT;
440 if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT;
441 return HTRIGHT;
442 }
443 }
444 } else /* No thick frame */
445 {
446 if (HAS_DLGFRAME(dwStyle,dwExStyle))
447 InflateRect(&rect, -GetSystemMetrics(SM_CXDLGFRAME), -GetSystemMetrics(SM_CYDLGFRAME));
448 else if (HAS_THINFRAME(dwStyle ))
449 InflateRect(&rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER));
450 if (!PtInRect( &rect, pt )) return HTBORDER;
451 }
452
453 /* Check caption */
454
455 if ((dwStyle & WS_CAPTION) == WS_CAPTION)
456 {
457 if (dwExStyle & WS_EX_TOOLWINDOW)
458 rect.top += GetSystemMetrics(SM_CYSMCAPTION)-1;
459 else
460 rect.top += GetSystemMetrics(SM_CYCAPTION)-1;
461 if (!PtInRect(&rect,pt))
462 {
463 /* Check system menu */
464 if(dwStyle & WS_SYSMENU)
465 {
466 /* Check if there is an user icon */
467 HICON hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);
468 if(!hIcon) hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON);
469
470 /* If there is an icon associated with the window OR */
471 /* If there is no hIcon specified and this is not a modal dialog, */
472 /* there is a system menu icon. */
473 if((hIcon != 0) || (!(dwStyle & DS_MODALFRAME)))
474 rect.left += GetSystemMetrics(SM_CYCAPTION) - 1;
475 }
476 if (pt.x < rect.left) return HTSYSMENU;
477
478 /* Check close button */
479 if (dwStyle & WS_SYSMENU)
480 rect.right -= GetSystemMetrics(SM_CYCAPTION) - 1;
481 if (pt.x > rect.right) return HTCLOSE;
482
483 /* Check maximize box */
484 /* In win95 there is automatically a Maximize button when there is a minimize one*/
485 if ((dwStyle & WS_MAXIMIZEBOX)|| (dwStyle & WS_MINIMIZEBOX))
486 rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
487 if (pt.x > rect.right) return HTMAXBUTTON;
488
489 /* Check minimize box */
490 /* In win95 there is automatically a Maximize button when there is a Maximize one*/
491 if ((dwStyle & WS_MINIMIZEBOX)||(dwStyle & WS_MAXIMIZEBOX))
492 rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
493
494 if (pt.x > rect.right) return HTMINBUTTON;
495 return HTCAPTION;
496 }
497 }
498 }
499
500 /* Check client area */
501
502 ScreenToClient(Win32Hwnd,&pt);
503 getClientRect(&rect);
504 if (PtInRect(&rect,pt)) return HTCLIENT;
505
506 /* Check vertical scroll bar */
507
508 if (dwStyle & WS_VSCROLL)
509 {
510 rect.right += GetSystemMetrics(SM_CXVSCROLL);
511 if (PtInRect( &rect, pt )) return HTVSCROLL;
512 }
513
514 /* Check horizontal scroll bar */
515
516 if (dwStyle & WS_HSCROLL)
517 {
518 rect.bottom += GetSystemMetrics(SM_CYHSCROLL);
519 if (PtInRect( &rect, pt ))
520 {
521 /* Check size box */
522 if ((dwStyle & WS_VSCROLL) &&
523 (pt.x >= rect.right - GetSystemMetrics(SM_CXVSCROLL)))
524 return (dwStyle & WS_CHILD) ? HTSIZE:HTBOTTOMRIGHT;
525 return HTHSCROLL;
526 }
527 }
528
529 /* Check menu bar */
530
531 if (HAS_MENU())
532 {
533 if ((pt.y < 0) && (pt.x >= 0) && (pt.x < rect.right))
534 return HTMENU;
535 }
536
537 /* Should never get here */
538 return HTERROR;
539}
540
541//******************************************************************************
542//******************************************************************************
543VOID Win32BaseWindow::GetInsideRect(RECT *rect)
544{
545 rect->top = rect->left = 0;
546 rect->right = rectWindow.right - rectWindow.left;
547 rect->bottom = rectWindow.bottom - rectWindow.top;
548
549 if ((dwStyle & WS_ICONIC) || (flags & WIN_MANAGED)) return;
550
551 /* Remove frame from rectangle */
552 if (HAS_THICKFRAME(dwStyle,dwExStyle))
553 {
554 InflateRect( rect, -GetSystemMetrics(SM_CXSIZEFRAME), -GetSystemMetrics(SM_CYSIZEFRAME) );
555 }
556 else if (HAS_DLGFRAME(dwStyle,dwExStyle ))
557 {
558 InflateRect( rect, -GetSystemMetrics(SM_CXFIXEDFRAME), -GetSystemMetrics(SM_CYFIXEDFRAME));
559 }
560 else if (HAS_THINFRAME(dwStyle))
561 {
562 InflateRect( rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER) );
563 }
564
565 /* We have additional border information if the window
566 * is a child (but not an MDI child) */
567 if ( (dwStyle & WS_CHILD) &&
568 ( (dwExStyle & WS_EX_MDICHILD) == 0 ) )
569 {
570 if (dwExStyle & WS_EX_CLIENTEDGE)
571 InflateRect (rect, -GetSystemMetrics(SM_CXEDGE), -GetSystemMetrics(SM_CYEDGE));
572
573 if (dwExStyle & WS_EX_STATICEDGE)
574 InflateRect (rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER));
575 }
576}
577//******************************************************************************
578//******************************************************************************
579VOID Win32BaseWindow::DrawFrame(HDC hdc,RECT *rect,BOOL dlgFrame,BOOL active)
580{
581 INT width, height;
582 HBRUSH oldBrush;
583
584 if (dlgFrame)
585 {
586 width = GetSystemMetrics(SM_CXDLGFRAME) - GetSystemMetrics(SM_CXEDGE);
587 height = GetSystemMetrics(SM_CYDLGFRAME) - GetSystemMetrics(SM_CYEDGE);
588 }
589 else
590 {
591 width = GetSystemMetrics(SM_CXFRAME) - GetSystemMetrics(SM_CXEDGE);
592 height = GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYEDGE);
593 }
594
595 oldBrush = SelectObject(hdc,GetSysColorBrush(active ? COLOR_ACTIVEBORDER:COLOR_INACTIVEBORDER));
596
597 /* Draw frame */
598 PatBlt(hdc,rect->left, rect->top, rect->right-rect->left, height,PATCOPY);
599 PatBlt(hdc,rect->left, rect->top, width, rect->bottom-rect->top,PATCOPY);
600 PatBlt(hdc,rect->left, rect->bottom, rect->right-rect->left,-height,PATCOPY);
601 //SvL: Was PatBlt(hdc,rect->left, rect->bottom-1, rect->right-rect->left,-height,PATCOPY);
602 PatBlt(hdc,rect->right, rect->top, -width, rect->bottom-rect->top,PATCOPY);
603 //SvL: Was PatBlt(hdc,rect->right-1, rect->top, -width, rect->bottom-rect->top,PATCOPY);
604 SelectObject(hdc,oldBrush);
605
606 InflateRect(rect,-width,-height);
607}
608//******************************************************************************
609//******************************************************************************
610BOOL Win32BaseWindow::DrawSysButton(HDC hdc,BOOL down)
611{
612 if(!(flags & WIN_MANAGED))
613 {
614 HICON hIcon;
615 RECT rect;
616
617 GetInsideRect(&rect);
618
619 hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);
620 if(!hIcon) hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON);
621
622 /* If there is no hIcon specified or this is not a modal dialog, */
623 /* get the default one. */
624 if(hIcon == 0)
625 if (!(dwStyle & DS_MODALFRAME))
626 hIcon = LoadImageA(0, MAKEINTRESOURCEA(OIC_ODINICON), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
627
628 if (hIcon)
629 DrawIconEx (hdc, rect.left + 2, rect.top + 2, hIcon,
630 GetSystemMetrics(SM_CXSMICON),
631 GetSystemMetrics(SM_CYSMICON),
632 0, 0, DI_NORMAL);
633
634 return (hIcon != 0);
635 }
636 return FALSE;
637}
638//******************************************************************************
639//******************************************************************************
640BOOL Win32BaseWindow::GetSysPopupPos(RECT* rect)
641{
642 if(hSysMenu)
643 {
644 if(dwStyle & WS_MINIMIZE )
645 *rect = rectWindow;
646 else
647 {
648 GetInsideRect(rect );
649 OffsetRect( rect, rectWindow.left, rectWindow.top);
650 if ((dwStyle & WS_CHILD) && getParent())
651 ClientToScreen(getParent()->getWindowHandle(), (POINT *)rect );
652 rect->right = rect->left + GetSystemMetrics(SM_CYCAPTION) - 1;
653 rect->bottom = rect->top + GetSystemMetrics(SM_CYCAPTION) - 1;
654 }
655 return TRUE;
656 }
657 return FALSE;
658}
659//******************************************************************************
660//******************************************************************************
661BOOL Win32BaseWindow::DrawGrayButton(HDC hdc,int x,int y)
662{
663 HBITMAP hMaskBmp;
664 HDC hdcMask = CreateCompatibleDC (0);
665 HBRUSH hOldBrush;
666 hMaskBmp = CreateBitmap (12, 10, 1, 1, lpGrayMask);
667
668 if(hMaskBmp == 0)
669 return FALSE;
670
671 SelectObject (hdcMask, hMaskBmp);
672
673 /* Draw the grayed bitmap using the mask */
674 hOldBrush = SelectObject (hdc, RGB(128, 128, 128));
675 BitBlt (hdc, x, y, 12, 10,
676 hdcMask, 0, 0, 0xB8074A);
677
678 /* Clean up */
679 SelectObject (hdc, hOldBrush);
680 DeleteObject(hMaskBmp);
681 DeleteDC (hdcMask);
682
683 return TRUE;
684}
685//******************************************************************************
686//******************************************************************************
687VOID Win32BaseWindow::DrawCloseButton(HDC hdc,BOOL down,BOOL bGrayed)
688{
689 RECT rect;
690 HDC hdcMem;
691
692 if( !(flags & WIN_MANAGED) )
693 {
694 BITMAP bmp;
695 HBITMAP hBmp, hOldBmp;
696
697 GetInsideRect(&rect);
698
699 hdcMem = CreateCompatibleDC( hdc );
700 hBmp = down ? hbitmapCloseD : hbitmapClose;
701 hOldBmp = SelectObject (hdcMem, hBmp);
702 GetObjectA (hBmp, sizeof(BITMAP), &bmp);
703
704 BitBlt (hdc, rect.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2,
705 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
706 bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY);
707
708 if(bGrayed)
709 DrawGrayButton(hdc,rect.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2 + 2,
710 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
711
712 SelectObject (hdcMem, hOldBmp);
713 DeleteDC (hdcMem);
714 }
715}
716//******************************************************************************
717//******************************************************************************
718VOID Win32BaseWindow::DrawMaxButton(HDC hdc,BOOL down,BOOL bGrayed)
719{
720 RECT rect;
721 HDC hdcMem;
722
723 if( !(flags & WIN_MANAGED))
724 {
725 BITMAP bmp;
726 HBITMAP hBmp,hOldBmp;
727
728 GetInsideRect(&rect);
729 hdcMem = CreateCompatibleDC( hdc );
730 hBmp = IsZoomed(Win32Hwnd) ?
731 (down ? hbitmapRestoreD : hbitmapRestore ) :
732 (down ? hbitmapMaximizeD: hbitmapMaximize);
733 hOldBmp=SelectObject( hdcMem, hBmp );
734 GetObjectA (hBmp, sizeof(BITMAP), &bmp);
735
736 if (dwStyle & WS_SYSMENU)
737 rect.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
738
739 BitBlt( hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
740 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
741 bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY );
742
743 if(bGrayed)
744 DrawGrayButton(hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2,
745 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
746
747
748 SelectObject (hdcMem, hOldBmp);
749 DeleteDC( hdcMem );
750 }
751}
752//******************************************************************************
753//******************************************************************************
754VOID Win32BaseWindow::DrawMinButton(HDC hdc,BOOL down,BOOL bGrayed)
755{
756 RECT rect;
757 HDC hdcMem;
758
759 if( !(flags & WIN_MANAGED))
760
761 {
762 BITMAP bmp;
763 HBITMAP hBmp,hOldBmp;
764
765 GetInsideRect(&rect);
766
767 hdcMem = CreateCompatibleDC( hdc );
768 hBmp = down ? hbitmapMinimizeD : hbitmapMinimize;
769 hOldBmp= SelectObject( hdcMem, hBmp );
770 GetObjectA (hBmp, sizeof(BITMAP), &bmp);
771
772 if (dwStyle & WS_SYSMENU)
773 rect.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
774
775 /* In win 95 there is always a Maximize box when there is a Minimize one */
776 if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX))
777 rect.right += -1 - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2;
778
779 BitBlt( hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
780 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
781 bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY );
782
783 if(bGrayed)
784 DrawGrayButton(hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2,
785 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
786
787
788 SelectObject (hdcMem, hOldBmp);
789 DeleteDC( hdcMem );
790 }
791}
792//******************************************************************************
793//******************************************************************************
794VOID Win32BaseWindow::DrawCaption(HDC hdc,RECT *rect,BOOL active)
795{
796 RECT r = *rect;
797 char buffer[256];
798 HPEN hPrevPen;
799
800 if (flags & WIN_MANAGED) return;
801
802 hPrevPen = SelectObject( hdc, GetSysColorPen(COLOR_3DFACE) );
803 MoveToEx( hdc, r.left, r.bottom - 1, NULL );
804 LineTo( hdc, r.right, r.bottom - 1 );
805 SelectObject( hdc, hPrevPen );
806 r.bottom--;
807
808 if (SYSCOLOR_GetUseWinColors())
809 {
810 COLORREF startColor = GetSysColor(active ? COLOR_ACTIVECAPTION:COLOR_INACTIVECAPTION),endColor = GetSysColor(active ? COLOR_GRADIENTACTIVECAPTION:COLOR_GRADIENTINACTIVECAPTION);
811
812 if (startColor == endColor)
813 FillRect(hdc,&r,GetSysColorBrush(startColor));
814 else
815 {
816 INT rDiff = GetRValue(endColor)-GetRValue(startColor);
817 INT gDiff = GetGValue(endColor)-GetGValue(startColor);
818 INT bDiff = GetBValue(endColor)-GetBValue(startColor);
819 INT steps = MAX(MAX(abs(rDiff),abs(gDiff)),abs(bDiff));
820 INT w = r.right-r.left;
821 RECT r2;
822
823 if (w < steps) steps = w;
824 r2.left = r2.right = r.left;
825 r2.top = r.top;
826 r2.bottom = r.bottom;
827 for (INT x = 0;x <= steps;x++)
828 {
829 COLORREF color = RGB(GetRValue(startColor)+rDiff*x/steps,GetGValue(startColor)+gDiff*x/steps,GetBValue(startColor)+bDiff*x/steps);
830 HBRUSH brush = CreateSolidBrush(color);
831
832 r2.left = r2.right;
833 r2.right = r.left+w*x/steps;
834 FillRect(hdc,&r2,brush);
835 DeleteObject(brush);
836 }
837 }
838 } else FillRect(hdc,&r,GetSysColorBrush(active ? COLOR_ACTIVECAPTION:COLOR_INACTIVECAPTION));
839
840 if (!hbitmapClose)
841 {
842 if (!(hbitmapClose = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_CLOSE)))) return;
843 hbitmapCloseD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_CLOSED));
844 hbitmapMinimize = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_REDUCE));
845 hbitmapMinimizeD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_REDUCED));
846 hbitmapMaximize = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_ZOOM));
847 hbitmapMaximizeD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_ZOOMD));
848 hbitmapRestore = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_RESTORE));
849 hbitmapRestoreD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_RESTORED));
850 }
851
852 if ((dwStyle & WS_SYSMENU) && !(dwExStyle & WS_EX_TOOLWINDOW))
853 {
854 if (DrawSysButton(hdc,FALSE))
855 r.left += GetSystemMetrics(SM_CYCAPTION) - 1;
856 }
857
858 if (dwStyle & WS_SYSMENU)
859 {
860 UINT state;
861
862 /* Go get the sysmenu */
863 state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND);
864
865 /* Draw a grayed close button if disabled and a normal one if SC_CLOSE is not there */
866 DrawCloseButton(hdc, FALSE,
867 ((((state & MF_DISABLED) || (state & MF_GRAYED))) && (state != 0xFFFFFFFF)));
868 r.right -= GetSystemMetrics(SM_CYCAPTION) - 1;
869
870 if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX))
871 {
872 /* In win95 the two buttons are always there */
873 /* But if the menu item is not in the menu they're disabled*/
874
875 DrawMaxButton(hdc, FALSE, (!(dwStyle & WS_MAXIMIZEBOX)));
876 r.right -= GetSystemMetrics(SM_CXSIZE) + 1;
877
878 DrawMinButton(hdc, FALSE, (!(dwStyle & WS_MINIMIZEBOX)));
879 r.right -= GetSystemMetrics(SM_CXSIZE) + 1;
880 }
881 }
882
883 if (GetWindowTextA(buffer, sizeof(buffer) ))
884 {
885 NONCLIENTMETRICSA nclm;
886 HFONT hFont, hOldFont;
887 nclm.cbSize = sizeof(NONCLIENTMETRICSA);
888 SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
889 if (dwExStyle & WS_EX_TOOLWINDOW)
890 hFont = CreateFontIndirectA (&nclm.lfSmCaptionFont);
891 else
892 hFont = CreateFontIndirectA (&nclm.lfCaptionFont);
893 hOldFont = SelectObject (hdc, hFont);
894 if (active) SetTextColor( hdc, GetSysColor( COLOR_CAPTIONTEXT ) );
895 else SetTextColor( hdc, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) );
896 SetBkMode( hdc, TRANSPARENT );
897 r.left += 2;
898 DrawTextA( hdc, buffer, -1, &r,
899 DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT );
900 DeleteObject (SelectObject (hdc, hOldFont));
901 }
902}
903//******************************************************************************
904//******************************************************************************
905VOID Win32BaseWindow::DoNCPaint(HRGN clip,BOOL suppress_menupaint)
906{
907 BOOL active = flags & WIN_NCACTIVATED;
908 HDC hdc;
909 RECT rect,rectClip,rfuzz;
910
911 /* MSDN docs are pretty idiotic here, they say app CAN use clipRgn in
912 the call to GetDCEx implying that it is allowed not to use it either.
913 However, the suggested GetDCEx( , DCX_WINDOW | DCX_INTERSECTRGN)
914 will cause clipRgn to be deleted after ReleaseDC().
915 Now, how is the "system" supposed to tell what happened?
916 */
917
918 if (!(hdc = GetDCEx( Win32Hwnd, (clip > 1) ? clip : 0, DCX_USESTYLE | DCX_WINDOW |
919 ((clip > 1) ?(DCX_INTERSECTRGN /*| DCX_KEEPCLIPRGN*/) : 0) ))) return;
920
921 rect.top = rect.left = 0;
922 rect.right = rectWindow.right - rectWindow.left;
923 rect.bottom = rectWindow.bottom - rectWindow.top;
924
925 if( clip > 1 )
926 GetRgnBox( clip, &rectClip );
927 else
928 {
929 clip = 0;
930 rectClip = rect;
931 }
932
933 SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) );
934
935 if(!(flags & WIN_MANAGED))
936 {
937 if (HAS_BIGFRAME( dwStyle, dwExStyle))
938 {
939 DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT | BF_ADJUST);
940 }
941 if (HAS_THICKFRAME( dwStyle, dwExStyle ))
942 DrawFrame(hdc, &rect, FALSE, active );
943 else if (HAS_DLGFRAME( dwStyle, dwExStyle ))
944 DrawFrame( hdc, &rect, TRUE, active );
945 else if (HAS_THINFRAME( dwStyle ))
946 {
947 SelectObject( hdc, GetStockObject(NULL_BRUSH) );
948 Rectangle( hdc, 0, 0, rect.right, rect.bottom );
949 }
950
951 if ((dwStyle & WS_CAPTION) == WS_CAPTION)
952 {
953 RECT r = rect;
954 if (dwExStyle & WS_EX_TOOLWINDOW)
955 {
956 r.bottom = rect.top + GetSystemMetrics(SM_CYSMCAPTION);
957 rect.top += GetSystemMetrics(SM_CYSMCAPTION);
958 }
959 else
960 {
961 r.bottom = rect.top + GetSystemMetrics(SM_CYCAPTION);
962 rect.top += GetSystemMetrics(SM_CYCAPTION);
963 }
964 if( !clip || IntersectRect( &rfuzz, &r, &rectClip ) )
965 DrawCaption(hdc, &r, active);
966 }
967 }
968 if (HAS_MENU())
969 {
970 RECT r = rect;
971 r.bottom = rect.top + GetSystemMetrics(SM_CYMENU);
972
973 rect.top += MENU_DrawMenuBar( hdc, &r, Win32Hwnd, suppress_menupaint ) + 1;
974 }
975
976 if (dwExStyle & WS_EX_CLIENTEDGE)
977 DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
978
979 if (dwExStyle & WS_EX_STATICEDGE)
980 DrawEdge (hdc, &rect, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST);
981
982 /* Draw the scroll-bars */
983 if (dwStyle & WS_VSCROLL)
984 SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_VERT,TRUE,TRUE);
985 if (dwStyle & WS_HSCROLL)
986 SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_HORZ,TRUE,TRUE);
987
988 /* Draw the "size-box" */
989 if ((dwStyle & WS_VSCROLL) && (dwStyle & WS_HSCROLL))
990 {
991 RECT r = rect;
992 r.left = r.right - GetSystemMetrics(SM_CXVSCROLL) + 1;
993 r.top = r.bottom - GetSystemMetrics(SM_CYHSCROLL) + 1;
994 FillRect( hdc, &r, GetSysColorBrush(COLOR_SCROLLBAR) );
995 if (!(dwStyle & WS_CHILD))
996 {
997 POINT p1,p2;
998 HPEN penDark = GetSysColorPen(COLOR_3DSHADOW);
999 HPEN penWhite = GetSysColorPen(COLOR_3DHILIGHT);
1000 HPEN oldPen = SelectObject(hdc,penDark);
1001 INT x;
1002
1003 p1.x = r.right-1;
1004 p1.y = r.bottom;
1005 p2.x = r.right;
1006 p2.y = r.bottom-1;
1007 for (x = 0;x < 3;x++)
1008 {
1009 SelectObject(hdc,penDark);
1010 MoveToEx(hdc,p1.x,p1.y,NULL);
1011 LineTo(hdc,p2.x,p2.y);
1012 p1.x--;
1013 p2.y--;
1014 MoveToEx(hdc,p1.x,p1.y,NULL);
1015 LineTo(hdc,p2.x,p2.y);
1016 SelectObject(hdc,penWhite);
1017 p1.x--;
1018 p2.y--;
1019 MoveToEx(hdc,p1.x,p1.y,NULL);
1020 LineTo(hdc,p2.x,p2.y);
1021 p1.x -= 2;
1022 p2.y -= 2;
1023 }
1024
1025 SelectObject(hdc,oldPen);
1026 }
1027 }
1028
1029 ReleaseDC(Win32Hwnd,hdc);
1030}
1031//******************************************************************************
1032//******************************************************************************
1033LONG Win32BaseWindow::HandleNCPaint(HRGN clip)
1034{
1035//CB: ignore it for now (SetWindowPos in WM_CREATE)
1036// if (!(dwStyle & WS_VISIBLE)) return 0;
1037
1038 if (dwStyle & WS_MINIMIZE) return 0;
1039
1040 DoNCPaint(clip,FALSE);
1041
1042 return 0;
1043}
1044/***********************************************************************
1045 * NC_HandleNCLButtonDblClk
1046 *
1047 * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
1048 */
1049LONG Win32BaseWindow::HandleNCLButtonDblClk(WPARAM wParam,LPARAM lParam)
1050{
1051 /*
1052 * if this is an icon, send a restore since we are handling
1053 * a double click
1054 */
1055 if (dwStyle & WS_MINIMIZE)
1056 {
1057 SendInternalMessageA(WM_SYSCOMMAND,SC_RESTORE,lParam);
1058 return 0;
1059 }
1060
1061 switch(wParam) /* Hit test */
1062 {
1063 case HTCAPTION:
1064 /* stop processing if WS_MAXIMIZEBOX is missing */
1065 if (dwStyle & WS_MAXIMIZEBOX)
1066 SendInternalMessageA(WM_SYSCOMMAND,
1067 (dwStyle & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE,
1068 lParam);
1069 break;
1070
1071 case HTSYSMENU:
1072 if (!(GetClassWord(Win32Hwnd,GCW_STYLE) & CS_NOCLOSE))
1073 SendInternalMessageA(WM_SYSCOMMAND,SC_CLOSE,lParam);
1074 break;
1075
1076 case HTHSCROLL:
1077 SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
1078 break;
1079
1080 case HTVSCROLL:
1081 SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
1082 break;
1083 }
1084
1085 return 0;
1086}
1087/***********************************************************************
1088 * NC_HandleSysCommand
1089 *
1090 * Handle a WM_SYSCOMMAND message. Called from DefWindowProc().
1091 *
1092 * TODO: Not done (see #if 0)
1093 */
1094LONG Win32BaseWindow::HandleSysCommand(WPARAM wParam,POINT *pt32)
1095{
1096 UINT uCommand = wParam & 0xFFF0;
1097
1098/* //CB: don't need this, perhaps recycle for menus
1099 if ((getStyle() & WS_CHILD) && (uCommand != SC_KEYMENU))
1100 ScreenToClient(getParent()->getWindowHandle(), pt32 );
1101*/
1102 switch (uCommand)
1103 {
1104
1105 case SC_SIZE:
1106 {
1107 DWORD flags = 0;
1108
1109 switch ((wParam & 0xF)+2)
1110 {
1111 case HTLEFT:
1112 flags = TFOS_LEFT;
1113 break;
1114
1115 case HTRIGHT:
1116 flags = TFOS_RIGHT;
1117 break;
1118
1119 case HTTOP:
1120 flags = TFOS_TOP;
1121 break;
1122
1123 case HTTOPLEFT:
1124 flags = TFOS_TOP | TFOS_LEFT;
1125 break;
1126
1127 case HTTOPRIGHT:
1128 flags = TFOS_TOP | TFOS_RIGHT;
1129 break;
1130
1131 case HTBOTTOM:
1132 flags = TFOS_BOTTOM;
1133 break;
1134
1135 case HTBOTTOMLEFT:
1136 flags = TFOS_BOTTOM | TFOS_LEFT;
1137 break;
1138
1139 case HTBOTTOMRIGHT:
1140 flags = TFOS_BOTTOM | TFOS_RIGHT;
1141 break;
1142 }
1143 if (flags) FrameTrackFrame(this,flags);
1144 break;
1145 }
1146
1147 case SC_MOVE:
1148 FrameTrackFrame(this,TFOS_MOVE);
1149 break;
1150
1151 case SC_MINIMIZE:
1152 ShowWindow(SW_MINIMIZE);
1153 break;
1154
1155 case SC_MAXIMIZE:
1156 ShowWindow(SW_MAXIMIZE);
1157 break;
1158
1159 case SC_RESTORE:
1160 ShowWindow(SW_RESTORE);
1161 break;
1162
1163 case SC_CLOSE:
1164 return SendInternalMessageA(WM_CLOSE,0,0);
1165
1166 case SC_VSCROLL:
1167 case SC_HSCROLL:
1168 TrackScrollBar(wParam,*pt32);
1169 break;
1170
1171 case SC_MOUSEMENU:
1172 MENU_TrackMouseMenuBar(Win32Hwnd,wParam & 0x000F,*pt32);
1173 break;
1174
1175 case SC_KEYMENU:
1176 MENU_TrackKbdMenuBar(Win32Hwnd,wParam,pt32->x);
1177 break;
1178
1179 case SC_TASKLIST:
1180 OSLibWinShowTaskList(getOS2FrameWindowHandle());
1181 break;
1182
1183 case SC_SCREENSAVE:
1184 if (wParam == SC_ABOUTODIN) {
1185 if(ShellAboutA == 0) {
1186 HINSTANCE hShell32 = LoadLibraryA("SHELL32");
1187 if(hShell32 == 0)
1188 break;
1189 *(VOID **)&ShellAboutA = (VOID *)GetProcAddress(hShell32, "ShellAboutA");
1190 }
1191 ShellAboutA(Win32Hwnd,"Odin","Odin alpha release compiled with IBM VAC++",0);
1192 }
1193 else
1194 if (wParam == SC_PUTMARK)
1195 dprintf(("Mark requested by user\n"));
1196 break;
1197
1198 case SC_HOTKEY:
1199 case SC_ARRANGE:
1200 case SC_NEXTWINDOW:
1201 case SC_PREVWINDOW:
1202 break;
1203 }
1204 return 0;
1205}
1206//******************************************************************************
1207//******************************************************************************
Note: See TracBrowser for help on using the repository browser.