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

Last change on this file since 2411 was 2411, checked in by cbratschi, 26 years ago

* empty log message *

File size: 36.4 KB
Line 
1/* $Id: win32wbasenonclient.cpp,v 1.3 2000-01-11 18:32:07 cbratschi 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 } else
589 {
590 width = GetSystemMetrics(SM_CXFRAME) - GetSystemMetrics(SM_CXEDGE);
591 height = GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYEDGE);
592 }
593
594 oldBrush = SelectObject(hdc,GetSysColorBrush(active ? COLOR_ACTIVEBORDER:COLOR_INACTIVEBORDER));
595
596 /* Draw frame */
597
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-1,rect->right-rect->left,-height,PATCOPY);
601 PatBlt(hdc,rect->right-1,rect->top,-width,rect->bottom-rect->top,PATCOPY);
602 SelectObject(hdc,oldBrush);
603
604 InflateRect(rect,-width,-height);
605}
606//******************************************************************************
607//******************************************************************************
608BOOL Win32BaseWindow::DrawSysButton(HDC hdc,BOOL down)
609{
610 if(!(flags & WIN_MANAGED))
611 {
612 HICON hIcon;
613 RECT rect;
614
615 GetInsideRect(&rect);
616
617 hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);
618 if(!hIcon) hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON);
619
620 /* If there is no hIcon specified or this is not a modal dialog, */
621 /* get the default one. */
622 if(hIcon == 0)
623 if (!(dwStyle & DS_MODALFRAME))
624 hIcon = LoadImageA(0, MAKEINTRESOURCEA(OIC_ODINICON), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
625
626 if (hIcon)
627 DrawIconEx (hdc, rect.left + 2, rect.top + 2, hIcon,
628 GetSystemMetrics(SM_CXSMICON),
629 GetSystemMetrics(SM_CYSMICON),
630 0, 0, DI_NORMAL);
631
632 return (hIcon != 0);
633 }
634 return FALSE;
635}
636//******************************************************************************
637//******************************************************************************
638BOOL Win32BaseWindow::GetSysPopupPos(RECT* rect)
639{
640 if(hSysMenu)
641 {
642 if(dwStyle & WS_MINIMIZE )
643 *rect = rectWindow;
644 else
645 {
646 GetInsideRect(rect );
647 OffsetRect( rect, rectWindow.left, rectWindow.top);
648 if ((dwStyle & WS_CHILD) && getParent())
649 ClientToScreen(getParent()->getWindowHandle(), (POINT *)rect );
650 rect->right = rect->left + GetSystemMetrics(SM_CYCAPTION) - 1;
651 rect->bottom = rect->top + GetSystemMetrics(SM_CYCAPTION) - 1;
652 }
653 return TRUE;
654 }
655 return FALSE;
656}
657//******************************************************************************
658//******************************************************************************
659BOOL Win32BaseWindow::DrawGrayButton(HDC hdc,int x,int y)
660{
661 HBITMAP hMaskBmp;
662 HDC hdcMask = CreateCompatibleDC (0);
663 HBRUSH hOldBrush;
664 hMaskBmp = CreateBitmap (12, 10, 1, 1, lpGrayMask);
665
666 if(hMaskBmp == 0)
667 return FALSE;
668
669 SelectObject (hdcMask, hMaskBmp);
670
671 /* Draw the grayed bitmap using the mask */
672 hOldBrush = SelectObject (hdc, RGB(128, 128, 128));
673 BitBlt (hdc, x, y, 12, 10,
674 hdcMask, 0, 0, 0xB8074A);
675
676 /* Clean up */
677 SelectObject (hdc, hOldBrush);
678 DeleteObject(hMaskBmp);
679 DeleteDC (hdcMask);
680
681 return TRUE;
682}
683//******************************************************************************
684//******************************************************************************
685VOID Win32BaseWindow::DrawCloseButton(HDC hdc,BOOL down,BOOL bGrayed)
686{
687 RECT rect;
688 HDC hdcMem;
689
690 if( !(flags & WIN_MANAGED) )
691 {
692 BITMAP bmp;
693 HBITMAP hBmp, hOldBmp;
694
695 GetInsideRect(&rect);
696
697 hdcMem = CreateCompatibleDC( hdc );
698 hBmp = down ? hbitmapCloseD : hbitmapClose;
699 hOldBmp = SelectObject (hdcMem, hBmp);
700 GetObjectA (hBmp, sizeof(BITMAP), &bmp);
701
702 BitBlt (hdc, rect.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2,
703 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
704 bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY);
705
706 if(bGrayed)
707 DrawGrayButton(hdc,rect.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2 + 2,
708 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
709
710 SelectObject (hdcMem, hOldBmp);
711 DeleteDC (hdcMem);
712 }
713}
714//******************************************************************************
715//******************************************************************************
716VOID Win32BaseWindow::DrawMaxButton(HDC hdc,BOOL down,BOOL bGrayed)
717{
718 RECT rect;
719 HDC hdcMem;
720
721 if( !(flags & WIN_MANAGED))
722 {
723 BITMAP bmp;
724 HBITMAP hBmp,hOldBmp;
725
726 GetInsideRect(&rect);
727 hdcMem = CreateCompatibleDC( hdc );
728 hBmp = IsZoomed(Win32Hwnd) ?
729 (down ? hbitmapRestoreD : hbitmapRestore ) :
730 (down ? hbitmapMaximizeD: hbitmapMaximize);
731 hOldBmp=SelectObject( hdcMem, hBmp );
732 GetObjectA (hBmp, sizeof(BITMAP), &bmp);
733
734 if (dwStyle & WS_SYSMENU)
735 rect.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
736
737 BitBlt( hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
738 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
739 bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY );
740
741 if(bGrayed)
742 DrawGrayButton(hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2,
743 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
744
745
746 SelectObject (hdcMem, hOldBmp);
747 DeleteDC( hdcMem );
748 }
749}
750//******************************************************************************
751//******************************************************************************
752VOID Win32BaseWindow::DrawMinButton(HDC hdc,BOOL down,BOOL bGrayed)
753{
754 RECT rect;
755 HDC hdcMem;
756
757 if( !(flags & WIN_MANAGED))
758
759 {
760 BITMAP bmp;
761 HBITMAP hBmp,hOldBmp;
762
763 GetInsideRect(&rect);
764
765 hdcMem = CreateCompatibleDC( hdc );
766 hBmp = down ? hbitmapMinimizeD : hbitmapMinimize;
767 hOldBmp= SelectObject( hdcMem, hBmp );
768 GetObjectA (hBmp, sizeof(BITMAP), &bmp);
769
770 if (dwStyle & WS_SYSMENU)
771 rect.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
772
773 /* In win 95 there is always a Maximize box when there is a Minimize one */
774 if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX))
775 rect.right += -1 - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2;
776
777 BitBlt( hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
778 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
779 bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY );
780
781 if(bGrayed)
782 DrawGrayButton(hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2,
783 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
784
785
786 SelectObject (hdcMem, hOldBmp);
787 DeleteDC( hdcMem );
788 }
789}
790//******************************************************************************
791//******************************************************************************
792VOID Win32BaseWindow::DrawCaption(HDC hdc,RECT *rect,BOOL active)
793{
794 RECT r = *rect;
795 char buffer[256];
796 HPEN hPrevPen;
797
798 if (flags & WIN_MANAGED) return;
799
800 hPrevPen = SelectObject( hdc, GetSysColorPen(COLOR_3DFACE) );
801 MoveToEx( hdc, r.left, r.bottom - 1, NULL );
802 LineTo( hdc, r.right, r.bottom - 1 );
803 SelectObject( hdc, hPrevPen );
804 r.bottom--;
805
806 if (SYSCOLOR_GetUseWinColors())
807 {
808 COLORREF startColor = GetSysColor(active ? COLOR_ACTIVECAPTION:COLOR_INACTIVECAPTION),endColor = GetSysColor(active ? COLOR_GRADIENTACTIVECAPTION:COLOR_GRADIENTINACTIVECAPTION);
809
810 if (startColor == endColor)
811 FillRect(hdc,&r,GetSysColorBrush(startColor));
812 else
813 {
814 INT rDiff = GetRValue(endColor)-GetRValue(startColor);
815 INT gDiff = GetGValue(endColor)-GetGValue(startColor);
816 INT bDiff = GetBValue(endColor)-GetBValue(startColor);
817 INT steps = MAX(MAX(abs(rDiff),abs(gDiff)),abs(bDiff));
818 INT w = r.right-r.left;
819 RECT r2;
820
821 if (w < steps) steps = w;
822 r2.left = r2.right = r.left;
823 r2.top = r.top;
824 r2.bottom = r.bottom;
825 for (INT x = 0;x <= steps;x++)
826 {
827 COLORREF color = RGB(GetRValue(startColor)+rDiff*x/steps,GetGValue(startColor)+gDiff*x/steps,GetBValue(startColor)+bDiff*x/steps);
828 HBRUSH brush = CreateSolidBrush(color);
829
830 r2.left = r2.right;
831 r2.right = r.left+w*x/steps;
832 FillRect(hdc,&r2,brush);
833 DeleteObject(brush);
834 }
835 }
836 } else FillRect(hdc,&r,GetSysColorBrush(active ? COLOR_ACTIVECAPTION:COLOR_INACTIVECAPTION));
837
838 if (!hbitmapClose)
839 {
840 if (!(hbitmapClose = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_CLOSE)))) return;
841 hbitmapCloseD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_CLOSED));
842 hbitmapMinimize = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_REDUCE));
843 hbitmapMinimizeD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_REDUCED));
844 hbitmapMaximize = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_ZOOM));
845 hbitmapMaximizeD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_ZOOMD));
846 hbitmapRestore = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_RESTORE));
847 hbitmapRestoreD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_RESTORED));
848 }
849
850 if ((dwStyle & WS_SYSMENU) && !(dwExStyle & WS_EX_TOOLWINDOW))
851 {
852 if (DrawSysButton(hdc,FALSE))
853 r.left += GetSystemMetrics(SM_CYCAPTION) - 1;
854 }
855
856 if (dwStyle & WS_SYSMENU)
857 {
858 UINT state;
859
860 /* Go get the sysmenu */
861 state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND);
862
863 /* Draw a grayed close button if disabled and a normal one if SC_CLOSE is not there */
864 DrawCloseButton(hdc, FALSE,
865 ((((state & MF_DISABLED) || (state & MF_GRAYED))) && (state != 0xFFFFFFFF)));
866 r.right -= GetSystemMetrics(SM_CYCAPTION) - 1;
867
868 if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX))
869 {
870 /* In win95 the two buttons are always there */
871 /* But if the menu item is not in the menu they're disabled*/
872
873 DrawMaxButton(hdc, FALSE, (!(dwStyle & WS_MAXIMIZEBOX)));
874 r.right -= GetSystemMetrics(SM_CXSIZE) + 1;
875
876 DrawMinButton(hdc, FALSE, (!(dwStyle & WS_MINIMIZEBOX)));
877 r.right -= GetSystemMetrics(SM_CXSIZE) + 1;
878 }
879 }
880
881 if (GetWindowTextA(buffer, sizeof(buffer) ))
882 {
883 NONCLIENTMETRICSA nclm;
884 HFONT hFont, hOldFont;
885 nclm.cbSize = sizeof(NONCLIENTMETRICSA);
886 SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
887 if (dwExStyle & WS_EX_TOOLWINDOW)
888 hFont = CreateFontIndirectA (&nclm.lfSmCaptionFont);
889 else
890 hFont = CreateFontIndirectA (&nclm.lfCaptionFont);
891 hOldFont = SelectObject (hdc, hFont);
892 if (active) SetTextColor( hdc, GetSysColor( COLOR_CAPTIONTEXT ) );
893 else SetTextColor( hdc, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) );
894 SetBkMode( hdc, TRANSPARENT );
895 r.left += 2;
896 DrawTextA( hdc, buffer, -1, &r,
897 DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT );
898 DeleteObject (SelectObject (hdc, hOldFont));
899 }
900}
901//******************************************************************************
902//******************************************************************************
903VOID Win32BaseWindow::DoNCPaint(HRGN clip,BOOL suppress_menupaint)
904{
905 BOOL active = flags & WIN_NCACTIVATED;
906 HDC hdc;
907 RECT rect,rectClip,rfuzz;
908
909 /* MSDN docs are pretty idiotic here, they say app CAN use clipRgn in
910 the call to GetDCEx implying that it is allowed not to use it either.
911 However, the suggested GetDCEx( , DCX_WINDOW | DCX_INTERSECTRGN)
912 will cause clipRgn to be deleted after ReleaseDC().
913 Now, how is the "system" supposed to tell what happened?
914 */
915
916 if (!(hdc = GetDCEx( Win32Hwnd, (clip > 1) ? clip : 0, DCX_USESTYLE | DCX_WINDOW |
917 ((clip > 1) ?(DCX_INTERSECTRGN /*| DCX_KEEPCLIPRGN*/) : 0) ))) return;
918
919 rect.top = rect.left = 0;
920 rect.right = rectWindow.right - rectWindow.left;
921 rect.bottom = rectWindow.bottom - rectWindow.top;
922
923 if( clip > 1 )
924 GetRgnBox( clip, &rectClip );
925 else
926 {
927 clip = 0;
928 rectClip = rect;
929 }
930
931 SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) );
932
933 if(!(flags & WIN_MANAGED))
934 {
935 if (HAS_BIGFRAME( dwStyle, dwExStyle))
936 {
937 DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT | BF_ADJUST);
938 }
939 if (HAS_THICKFRAME( dwStyle, dwExStyle ))
940 DrawFrame(hdc, &rect, FALSE, active );
941 else if (HAS_DLGFRAME( dwStyle, dwExStyle ))
942 DrawFrame( hdc, &rect, TRUE, active );
943 else if (HAS_THINFRAME( dwStyle ))
944 {
945 SelectObject( hdc, GetStockObject(NULL_BRUSH) );
946 Rectangle( hdc, 0, 0, rect.right, rect.bottom );
947 }
948
949 if ((dwStyle & WS_CAPTION) == WS_CAPTION)
950 {
951 RECT r = rect;
952 if (dwExStyle & WS_EX_TOOLWINDOW)
953 {
954 r.bottom = rect.top + GetSystemMetrics(SM_CYSMCAPTION);
955 rect.top += GetSystemMetrics(SM_CYSMCAPTION);
956 }
957 else
958 {
959 r.bottom = rect.top + GetSystemMetrics(SM_CYCAPTION);
960 rect.top += GetSystemMetrics(SM_CYCAPTION);
961 }
962 if( !clip || IntersectRect( &rfuzz, &r, &rectClip ) )
963 DrawCaption(hdc, &r, active);
964 }
965 }
966 if (HAS_MENU())
967 {
968 RECT r = rect;
969 r.bottom = rect.top + GetSystemMetrics(SM_CYMENU);
970
971 rect.top += MENU_DrawMenuBar( hdc, &r, Win32Hwnd, suppress_menupaint ) + 1;
972 }
973
974 if (dwExStyle & WS_EX_CLIENTEDGE)
975 DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
976
977 if (dwExStyle & WS_EX_STATICEDGE)
978 DrawEdge (hdc, &rect, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST);
979
980 /* Draw the scroll-bars */
981 if (dwStyle & WS_VSCROLL)
982 SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_VERT,TRUE,TRUE);
983 if (dwStyle & WS_HSCROLL)
984 SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_HORZ,TRUE,TRUE);
985
986 /* Draw the "size-box" */
987 if ((dwStyle & WS_VSCROLL) && (dwStyle & WS_HSCROLL))
988 {
989 RECT r = rect;
990 r.left = r.right - GetSystemMetrics(SM_CXVSCROLL) + 1;
991 r.top = r.bottom - GetSystemMetrics(SM_CYHSCROLL) + 1;
992 FillRect( hdc, &r, GetSysColorBrush(COLOR_SCROLLBAR) );
993 if (!(dwStyle & WS_CHILD))
994 {
995 POINT p1,p2;
996 HPEN penDark = GetSysColorPen(COLOR_3DSHADOW);
997 HPEN penWhite = GetSysColorPen(COLOR_3DHILIGHT);
998 HPEN oldPen = SelectObject(hdc,penDark);
999 INT x;
1000
1001 p1.x = r.right-1;
1002 p1.y = r.bottom;
1003 p2.x = r.right;
1004 p2.y = r.bottom-1;
1005 for (x = 0;x < 3;x++)
1006 {
1007 SelectObject(hdc,penDark);
1008 MoveToEx(hdc,p1.x,p1.y,NULL);
1009 LineTo(hdc,p2.x,p2.y);
1010 p1.x--;
1011 p2.y--;
1012 MoveToEx(hdc,p1.x,p1.y,NULL);
1013 LineTo(hdc,p2.x,p2.y);
1014 SelectObject(hdc,penWhite);
1015 p1.x--;
1016 p2.y--;
1017 MoveToEx(hdc,p1.x,p1.y,NULL);
1018 LineTo(hdc,p2.x,p2.y);
1019 p1.x -= 2;
1020 p2.y -= 2;
1021 }
1022
1023 SelectObject(hdc,oldPen);
1024 }
1025 }
1026
1027 ReleaseDC(Win32Hwnd,hdc);
1028}
1029//******************************************************************************
1030//******************************************************************************
1031LONG Win32BaseWindow::HandleNCPaint(HRGN clip)
1032{
1033//CB: ignore it for now (SetWindowPos in WM_CREATE)
1034// if (!(dwStyle & WS_VISIBLE)) return 0;
1035
1036 if (dwStyle & WS_MINIMIZE) return 0;
1037
1038 DoNCPaint(clip,FALSE);
1039
1040 return 0;
1041}
1042/***********************************************************************
1043 * NC_HandleNCLButtonDblClk
1044 *
1045 * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
1046 */
1047LONG Win32BaseWindow::HandleNCLButtonDblClk(WPARAM wParam,LPARAM lParam)
1048{
1049 /*
1050 * if this is an icon, send a restore since we are handling
1051 * a double click
1052 */
1053 if (dwStyle & WS_MINIMIZE)
1054 {
1055 SendInternalMessageA(WM_SYSCOMMAND,SC_RESTORE,lParam);
1056 return 0;
1057 }
1058
1059 switch(wParam) /* Hit test */
1060 {
1061 case HTCAPTION:
1062 /* stop processing if WS_MAXIMIZEBOX is missing */
1063 if (dwStyle & WS_MAXIMIZEBOX)
1064 SendInternalMessageA(WM_SYSCOMMAND,
1065 (dwStyle & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE,
1066 lParam);
1067 break;
1068
1069 case HTSYSMENU:
1070 if (!(GetClassWord(Win32Hwnd,GCW_STYLE) & CS_NOCLOSE))
1071 SendInternalMessageA(WM_SYSCOMMAND,SC_CLOSE,lParam);
1072 break;
1073
1074 case HTHSCROLL:
1075 SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
1076 break;
1077
1078 case HTVSCROLL:
1079 SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
1080 break;
1081 }
1082
1083 return 0;
1084}
1085/***********************************************************************
1086 * NC_HandleSysCommand
1087 *
1088 * Handle a WM_SYSCOMMAND message. Called from DefWindowProc().
1089 *
1090 * TODO: Not done (see #if 0)
1091 */
1092LONG Win32BaseWindow::HandleSysCommand(WPARAM wParam,POINT *pt32)
1093{
1094 UINT uCommand = wParam & 0xFFF0;
1095
1096/* //CB: don't need this, perhaps recycle for menus
1097 if ((getStyle() & WS_CHILD) && (uCommand != SC_KEYMENU))
1098 ScreenToClient(getParent()->getWindowHandle(), pt32 );
1099*/
1100 switch (uCommand)
1101 {
1102
1103 case SC_SIZE:
1104 {
1105 DWORD flags = 0;
1106
1107 switch ((wParam & 0xF)+2)
1108 {
1109 case HTLEFT:
1110 flags = TFOS_LEFT;
1111 break;
1112
1113 case HTRIGHT:
1114 flags = TFOS_RIGHT;
1115 break;
1116
1117 case HTTOP:
1118 flags = TFOS_TOP;
1119 break;
1120
1121 case HTTOPLEFT:
1122 flags = TFOS_TOP | TFOS_LEFT;
1123 break;
1124
1125 case HTTOPRIGHT:
1126 flags = TFOS_TOP | TFOS_RIGHT;
1127 break;
1128
1129 case HTBOTTOM:
1130 flags = TFOS_BOTTOM;
1131 break;
1132
1133 case HTBOTTOMLEFT:
1134 flags = TFOS_BOTTOM | TFOS_LEFT;
1135 break;
1136
1137 case HTBOTTOMRIGHT:
1138 flags = TFOS_BOTTOM | TFOS_RIGHT;
1139 break;
1140 }
1141 if (flags) FrameTrackFrame(this,flags);
1142 break;
1143 }
1144
1145 case SC_MOVE:
1146 FrameTrackFrame(this,TFOS_MOVE);
1147 break;
1148
1149 case SC_MINIMIZE:
1150 ShowWindow(SW_MINIMIZE);
1151 break;
1152
1153 case SC_MAXIMIZE:
1154 ShowWindow(SW_MAXIMIZE);
1155 break;
1156
1157 case SC_RESTORE:
1158 ShowWindow(SW_RESTORE);
1159 break;
1160
1161 case SC_CLOSE:
1162 return SendInternalMessageA(WM_CLOSE,0,0);
1163
1164 case SC_VSCROLL:
1165 case SC_HSCROLL:
1166 TrackScrollBar(wParam,*pt32);
1167 break;
1168
1169 case SC_MOUSEMENU:
1170 MENU_TrackMouseMenuBar(Win32Hwnd,wParam & 0x000F,*pt32);
1171 break;
1172
1173 case SC_KEYMENU:
1174 MENU_TrackKbdMenuBar(Win32Hwnd,wParam,pt32->x);
1175 break;
1176
1177 case SC_TASKLIST:
1178 OSLibWinShowTaskList(getOS2FrameWindowHandle());
1179 break;
1180
1181 case SC_SCREENSAVE:
1182 if (wParam == SC_ABOUTODIN) {
1183 if(ShellAboutA == 0) {
1184 HINSTANCE hShell32 = LoadLibraryA("SHELL32");
1185 if(hShell32 == 0)
1186 break;
1187 *(VOID **)&ShellAboutA = (VOID *)GetProcAddress(hShell32, "ShellAboutA");
1188 }
1189 ShellAboutA(Win32Hwnd,"Odin","Odin alpha release compiled with IBM VAC++",0);
1190 }
1191 else
1192 if (wParam == SC_PUTMARK)
1193 dprintf(("Mark requested by user\n"));
1194 break;
1195
1196 case SC_HOTKEY:
1197 case SC_ARRANGE:
1198 case SC_NEXTWINDOW:
1199 case SC_PREVWINDOW:
1200 break;
1201 }
1202 return 0;
1203}
1204//******************************************************************************
1205//******************************************************************************
Note: See TracBrowser for help on using the repository browser.