2 * Non-client area window functions
4 * Copyright 1994 Alexandre Julliard
8 #include "wine/winuser16.h"
15 #include "cursoricon.h"
21 #include "nonclient.h"
23 #include "selectors.h"
25 #include "debugtools.h"
30 DECLARE_DEBUG_CHANNEL(nonclient
)
31 DECLARE_DEBUG_CHANNEL(shell
)
33 static HBITMAP16 hbitmapClose
= 0;
34 static HBITMAP16 hbitmapCloseD
= 0;
35 static HBITMAP16 hbitmapMinimize
= 0;
36 static HBITMAP16 hbitmapMinimizeD
= 0;
37 static HBITMAP16 hbitmapMaximize
= 0;
38 static HBITMAP16 hbitmapMaximizeD
= 0;
39 static HBITMAP16 hbitmapRestore
= 0;
40 static HBITMAP16 hbitmapRestoreD
= 0;
42 #define SC_ABOUTWINE (SC_SCREENSAVE+1)
43 #define SC_PUTMARK (SC_SCREENSAVE+2)
45 /* Some useful macros */
46 #define HAS_DLGFRAME(style,exStyle) \
47 (((exStyle) & WS_EX_DLGMODALFRAME) || \
48 (((style) & WS_DLGFRAME) && !((style) & WS_THICKFRAME)))
50 #define HAS_THICKFRAME(style,exStyle) \
51 (((style) & WS_THICKFRAME) && \
52 !((exStyle) & WS_EX_DLGMODALFRAME))
54 #define HAS_THINFRAME(style) \
55 (((style) & WS_BORDER) || !((style) & (WS_CHILD | WS_POPUP)))
57 #define HAS_BIGFRAME(style,exStyle) \
58 (((style) & (WS_THICKFRAME | WS_DLGFRAME)) || \
59 ((exStyle) & WS_EX_DLGMODALFRAME))
61 #define HAS_ANYFRAME(style,exStyle) \
62 (((style) & (WS_THICKFRAME | WS_DLGFRAME | WS_BORDER)) || \
63 ((exStyle) & WS_EX_DLGMODALFRAME) || \
64 !((style) & (WS_CHILD | WS_POPUP)))
66 #define HAS_MENU(w) (!((w)->dwStyle & WS_CHILD) && ((w)->wIDmenu != 0))
68 #define ON_LEFT_BORDER(hit) \
69 (((hit) == HTLEFT) || ((hit) == HTTOPLEFT) || ((hit) == HTBOTTOMLEFT))
70 #define ON_RIGHT_BORDER(hit) \
71 (((hit) == HTRIGHT) || ((hit) == HTTOPRIGHT) || ((hit) == HTBOTTOMRIGHT))
72 #define ON_TOP_BORDER(hit) \
73 (((hit) == HTTOP) || ((hit) == HTTOPLEFT) || ((hit) == HTTOPRIGHT))
74 #define ON_BOTTOM_BORDER(hit) \
75 (((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT))
77 /***********************************************************************
78 * WIN_WindowNeedsWMBorder
80 * This method defines the rules for a window to have a WM border,
81 * caption... It is used for consitency purposes.
83 BOOL
WIN_WindowNeedsWMBorder( DWORD style
, DWORD exStyle
)
85 if (!(style
& WS_CHILD
) && Options
.managed
&&
86 (((style
& WS_CAPTION
) == WS_CAPTION
) ||
87 (style
& WS_THICKFRAME
) ||
88 (exStyle
& WS_EX_DLGMODALFRAME
))) return TRUE
;
92 /***********************************************************************
95 * Compute the size of the window rectangle from the size of the
98 static void NC_AdjustRect( LPRECT16 rect
, DWORD style
, BOOL menu
,
101 if (TWEAK_WineLook
> WIN31_LOOK
)
102 ERR_(nonclient
)("Called in Win95 mode. Aiee! Please report this.\n" );
104 if(style
& WS_ICONIC
) return;
105 /* Decide if the window will be managed (see CreateWindowEx) */
106 if (!WIN_WindowNeedsWMBorder(style
, exStyle
))
108 if (HAS_THICKFRAME( style
, exStyle
))
109 InflateRect16( rect
, GetSystemMetrics(SM_CXFRAME
), GetSystemMetrics(SM_CYFRAME
) );
111 if (HAS_DLGFRAME( style
, exStyle
))
112 InflateRect16( rect
, GetSystemMetrics(SM_CXDLGFRAME
), GetSystemMetrics(SM_CYDLGFRAME
) );
114 if (HAS_THINFRAME( style
))
115 InflateRect16( rect
, GetSystemMetrics(SM_CXBORDER
), GetSystemMetrics(SM_CYBORDER
));
117 if ((style
& WS_CAPTION
) == WS_CAPTION
)
118 rect
->top
-= GetSystemMetrics(SM_CYCAPTION
) - GetSystemMetrics(SM_CYBORDER
);
120 if (menu
) rect
->top
-= GetSystemMetrics(SM_CYMENU
) + GetSystemMetrics(SM_CYBORDER
);
122 if (style
& WS_VSCROLL
) {
123 rect
->right
+= GetSystemMetrics(SM_CXVSCROLL
) - 1;
124 if(!HAS_ANYFRAME( style
, exStyle
))
128 if (style
& WS_HSCROLL
) {
129 rect
->bottom
+= GetSystemMetrics(SM_CYHSCROLL
) - 1;
130 if(!HAS_ANYFRAME( style
, exStyle
))
136 /******************************************************************************
137 * NC_AdjustRectOuter95
139 * Computes the size of the "outside" parts of the window based on the
140 * parameters of the client area.
149 * "Outer" parts of a window means the whole window frame, caption and
150 * menu bar. It does not include "inner" parts of the frame like client
151 * edge, static edge or scroll bars.
154 * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
155 * Original (NC_AdjustRect95) cut & paste from NC_AdjustRect
157 * 20-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
158 * Split NC_AdjustRect95 into NC_AdjustRectOuter95 and
159 * NC_AdjustRectInner95 and added handling of Win95 styles.
161 * 28-Jul-1999 Ove Kåven (ovek@arcticnet.no)
162 * Streamlined window style checks.
164 *****************************************************************************/
167 NC_AdjustRectOuter95 (LPRECT16 rect
, DWORD style
, BOOL menu
, DWORD exStyle
)
169 if(style
& WS_ICONIC
) return;
171 /* Decide if the window will be managed (see CreateWindowEx) */
172 if (!WIN_WindowNeedsWMBorder(style
, exStyle
))
174 if (HAS_THICKFRAME( style
, exStyle
))
175 InflateRect16( rect
, GetSystemMetrics(SM_CXFRAME
), GetSystemMetrics(SM_CYFRAME
) );
177 if (HAS_DLGFRAME( style
, exStyle
))
178 InflateRect16(rect
, GetSystemMetrics(SM_CXDLGFRAME
), GetSystemMetrics(SM_CYDLGFRAME
) );
180 if (HAS_THINFRAME( style
))
181 InflateRect16( rect
, GetSystemMetrics(SM_CXBORDER
), GetSystemMetrics(SM_CYBORDER
));
183 if ((style
& WS_CAPTION
) == WS_CAPTION
)
185 if (exStyle
& WS_EX_TOOLWINDOW
)
186 rect
->top
-= GetSystemMetrics(SM_CYSMCAPTION
);
188 rect
->top
-= GetSystemMetrics(SM_CYCAPTION
);
193 rect
->top
-= GetSystemMetrics(SM_CYMENU
);
197 /******************************************************************************
198 * NC_AdjustRectInner95
200 * Computes the size of the "inside" part of the window based on the
201 * parameters of the client area.
209 * "Inner" part of a window means the window frame inside of the flat
210 * window frame. It includes the client edge, the static edge and the
214 * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
215 * Original (NC_AdjustRect95) cut & paste from NC_AdjustRect
217 * 20-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
218 * Split NC_AdjustRect95 into NC_AdjustRectOuter95 and
219 * NC_AdjustRectInner95 and added handling of Win95 styles.
221 *****************************************************************************/
224 NC_AdjustRectInner95 (LPRECT16 rect
, DWORD style
, DWORD exStyle
)
226 if(style
& WS_ICONIC
) return;
228 if (exStyle
& WS_EX_CLIENTEDGE
)
229 InflateRect16 (rect
, GetSystemMetrics(SM_CXEDGE
), GetSystemMetrics(SM_CYEDGE
));
231 if (exStyle
& WS_EX_STATICEDGE
)
232 InflateRect16 (rect
, GetSystemMetrics(SM_CXBORDER
), GetSystemMetrics(SM_CYBORDER
));
234 if (style
& WS_VSCROLL
) rect
->right
+= GetSystemMetrics(SM_CXVSCROLL
);
235 if (style
& WS_HSCROLL
) rect
->bottom
+= GetSystemMetrics(SM_CYHSCROLL
);
239 /***********************************************************************
240 * DrawCaption16 [USER.660] Draws a caption bar
254 DrawCaption16 (HWND16 hwnd
, HDC16 hdc
, const RECT16
*rect
, UINT16 uFlags
)
259 CONV_RECT16TO32 (rect
, &rect32
);
261 return (BOOL16
)DrawCaptionTempA (hwnd
, hdc
, rect
? &rect32
: NULL
,
262 0, 0, NULL
, uFlags
& 0x1F);
266 /***********************************************************************
267 * DrawCaption32 [USER32.154] Draws a caption bar
281 DrawCaption (HWND hwnd
, HDC hdc
, const RECT
*lpRect
, UINT uFlags
)
283 return DrawCaptionTempA (hwnd
, hdc
, lpRect
, 0, 0, NULL
, uFlags
& 0x1F);
287 /***********************************************************************
288 * DrawCaptionTemp16 [USER.657]
298 DrawCaptionTemp16 (HWND16 hwnd
, HDC16 hdc
, const RECT16
*rect
, HFONT16 hFont
,
299 HICON16 hIcon
, LPCSTR str
, UINT16 uFlags
)
304 CONV_RECT16TO32(rect
,&rect32
);
306 return (BOOL16
)DrawCaptionTempA (hwnd
, hdc
, rect
?&rect32
:NULL
, hFont
,
307 hIcon
, str
, uFlags
& 0x1F);
311 /***********************************************************************
312 * DrawCaptionTemp32A [USER32.599]
322 DrawCaptionTempA (HWND hwnd
, HDC hdc
, const RECT
*rect
, HFONT hFont
,
323 HICON hIcon
, LPCSTR str
, UINT uFlags
)
327 TRACE_(nonclient
)("(%08x,%08x,%p,%08x,%08x,\"%s\",%08x)\n",
328 hwnd
, hdc
, rect
, hFont
, hIcon
, str
, uFlags
);
330 /* drawing background */
331 if (uFlags
& DC_INBUTTON
) {
332 FillRect (hdc
, &rc
, GetSysColorBrush (COLOR_3DFACE
));
334 if (uFlags
& DC_ACTIVE
) {
335 HBRUSH hbr
= SelectObject (hdc
, CACHE_GetPattern55AABrush ());
336 PatBlt (hdc
, rc
.left
, rc
.top
,
337 rc
.right
-rc
.left
, rc
.bottom
-rc
.top
, 0xFA0089);
338 SelectObject (hdc
, hbr
);
342 FillRect (hdc
, &rc
, GetSysColorBrush ((uFlags
& DC_ACTIVE
) ?
343 COLOR_ACTIVECAPTION
: COLOR_INACTIVECAPTION
));
348 if ((uFlags
& DC_ICON
) && !(uFlags
& DC_SMALLCAP
)) {
352 pt
.y
= (rc
.bottom
+ rc
.top
- GetSystemMetrics(SM_CYSMICON
)) / 2;
355 DrawIconEx (hdc
, pt
.x
, pt
.y
, hIcon
, GetSystemMetrics(SM_CXSMICON
),
356 GetSystemMetrics(SM_CYSMICON
), 0, 0, DI_NORMAL
);
359 HICON hAppIcon
= (HICON
) GetClassLongA(hwnd
, GCL_HICONSM
);
360 if(!hAppIcon
) hAppIcon
= (HICON
) GetClassLongA(hwnd
, GCL_HICON
);
362 DrawIconEx (hdc
, pt
.x
, pt
.y
, hAppIcon
, GetSystemMetrics(SM_CXSMICON
),
363 GetSystemMetrics(SM_CYSMICON
), 0, 0, DI_NORMAL
);
366 rc
.left
+= (rc
.bottom
- rc
.top
);
370 if (uFlags
& DC_TEXT
) {
373 if (uFlags
& DC_INBUTTON
)
374 SetTextColor (hdc
, GetSysColor (COLOR_BTNTEXT
));
375 else if (uFlags
& DC_ACTIVE
)
376 SetTextColor (hdc
, GetSysColor (COLOR_CAPTIONTEXT
));
378 SetTextColor (hdc
, GetSysColor (COLOR_INACTIVECAPTIONTEXT
));
380 SetBkMode (hdc
, TRANSPARENT
);
383 hOldFont
= SelectObject (hdc
, hFont
);
385 NONCLIENTMETRICSA nclm
;
387 nclm
.cbSize
= sizeof(NONCLIENTMETRICSA
);
388 SystemParametersInfoA (SPI_GETNONCLIENTMETRICS
, 0, &nclm
, 0);
389 hNewFont
= CreateFontIndirectA ((uFlags
& DC_SMALLCAP
) ?
390 &nclm
.lfSmCaptionFont
: &nclm
.lfCaptionFont
);
391 hOldFont
= SelectObject (hdc
, hNewFont
);
395 DrawTextA (hdc
, str
, -1, &rc
,
396 DT_SINGLELINE
| DT_VCENTER
| DT_NOPREFIX
| DT_LEFT
);
400 nLen
= GetWindowTextA (hwnd
, szText
, 128);
401 DrawTextA (hdc
, szText
, nLen
, &rc
,
402 DT_SINGLELINE
| DT_VCENTER
| DT_NOPREFIX
| DT_LEFT
);
406 SelectObject (hdc
, hOldFont
);
408 DeleteObject (SelectObject (hdc
, hOldFont
));
411 /* drawing focus ??? */
413 FIXME_(nonclient
)("undocumented flag (0x2000)!\n");
419 /***********************************************************************
420 * DrawCaptionTemp32W [USER32.602]
430 DrawCaptionTempW (HWND hwnd
, HDC hdc
, const RECT
*rect
, HFONT hFont
,
431 HICON hIcon
, LPCWSTR str
, UINT uFlags
)
433 LPSTR p
= HEAP_strdupWtoA (GetProcessHeap (), 0, str
);
434 BOOL res
= DrawCaptionTempA (hwnd
, hdc
, rect
, hFont
, hIcon
, p
, uFlags
);
435 HeapFree (GetProcessHeap (), 0, p
);
440 /***********************************************************************
441 * AdjustWindowRect16 (USER.102)
443 BOOL16 WINAPI
AdjustWindowRect16( LPRECT16 rect
, DWORD style
, BOOL16 menu
)
445 return AdjustWindowRectEx16( rect
, style
, menu
, 0 );
449 /***********************************************************************
450 * AdjustWindowRect32 (USER32.2)
452 BOOL WINAPI
AdjustWindowRect( LPRECT rect
, DWORD style
, BOOL menu
)
454 return AdjustWindowRectEx( rect
, style
, menu
, 0 );
458 /***********************************************************************
459 * AdjustWindowRectEx16 (USER.454)
461 BOOL16 WINAPI
AdjustWindowRectEx16( LPRECT16 rect
, DWORD style
,
462 BOOL16 menu
, DWORD exStyle
)
464 /* Correct the window style */
466 if (!(style
& (WS_POPUP
| WS_CHILD
))) /* Overlapped window */
468 style
&= (WS_DLGFRAME
| WS_BORDER
| WS_THICKFRAME
| WS_CHILD
);
469 exStyle
&= (WS_EX_DLGMODALFRAME
| WS_EX_CLIENTEDGE
|
470 WS_EX_STATICEDGE
| WS_EX_TOOLWINDOW
);
471 if (exStyle
& WS_EX_DLGMODALFRAME
) style
&= ~WS_THICKFRAME
;
473 TRACE_(nonclient
)("(%d,%d)-(%d,%d) %08lx %d %08lx\n",
474 rect
->left
, rect
->top
, rect
->right
, rect
->bottom
,
475 style
, menu
, exStyle
);
477 if (TWEAK_WineLook
== WIN31_LOOK
)
478 NC_AdjustRect( rect
, style
, menu
, exStyle
);
480 NC_AdjustRectOuter95( rect
, style
, menu
, exStyle
);
481 NC_AdjustRectInner95( rect
, style
, exStyle
);
488 /***********************************************************************
489 * AdjustWindowRectEx32 (USER32.3)
491 BOOL WINAPI
AdjustWindowRectEx( LPRECT rect
, DWORD style
,
492 BOOL menu
, DWORD exStyle
)
497 CONV_RECT32TO16( rect
, &rect16
);
498 ret
= AdjustWindowRectEx16( &rect16
, style
, (BOOL16
)menu
, exStyle
);
499 CONV_RECT16TO32( &rect16
, rect
);
504 /***********************************************************************
505 * NC_HandleNCCalcSize
507 * Handle a WM_NCCALCSIZE message. Called from DefWindowProc().
509 LONG
NC_HandleNCCalcSize( WND
*pWnd
, RECT
*winRect
)
511 RECT16 tmpRect
= { 0, 0, 0, 0 };
513 UINT style
= (UINT
) GetClassLongA(pWnd
->hwndSelf
, GCL_STYLE
);
515 if (style
& CS_VREDRAW
) result
|= WVR_VREDRAW
;
516 if (style
& CS_HREDRAW
) result
|= WVR_HREDRAW
;
518 if( !( pWnd
->dwStyle
& WS_MINIMIZE
) ) {
519 if (TWEAK_WineLook
== WIN31_LOOK
)
520 NC_AdjustRect( &tmpRect
, pWnd
->dwStyle
, FALSE
, pWnd
->dwExStyle
);
522 NC_AdjustRectOuter95( &tmpRect
, pWnd
->dwStyle
, FALSE
, pWnd
->dwExStyle
);
524 winRect
->left
-= tmpRect
.left
;
525 winRect
->top
-= tmpRect
.top
;
526 winRect
->right
-= tmpRect
.right
;
527 winRect
->bottom
-= tmpRect
.bottom
;
529 if (HAS_MENU(pWnd
)) {
530 TRACE_(nonclient
)("Calling "
531 "GetMenuBarHeight with HWND 0x%x, width %d, "
532 "at (%d, %d).\n", pWnd
->hwndSelf
,
533 winRect
->right
- winRect
->left
,
534 -tmpRect
.left
, -tmpRect
.top
);
537 MENU_GetMenuBarHeight( pWnd
->hwndSelf
,
538 winRect
->right
- winRect
->left
,
539 -tmpRect
.left
, -tmpRect
.top
) + 1;
542 if (TWEAK_WineLook
> WIN31_LOOK
) {
543 SetRect16 (&tmpRect
, 0, 0, 0, 0);
544 NC_AdjustRectInner95 (&tmpRect
, pWnd
->dwStyle
, pWnd
->dwExStyle
);
545 winRect
->left
-= tmpRect
.left
;
546 winRect
->top
-= tmpRect
.top
;
547 winRect
->right
-= tmpRect
.right
;
548 winRect
->bottom
-= tmpRect
.bottom
;
555 /***********************************************************************
558 * Get the 'inside' rectangle of a window, i.e. the whole window rectangle
559 * but without the borders (if any).
560 * The rectangle is in window coordinates (for drawing with GetWindowDC()).
562 static void NC_GetInsideRect( HWND hwnd
, RECT
*rect
)
564 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
566 rect
->top
= rect
->left
= 0;
567 rect
->right
= wndPtr
->rectWindow
.right
- wndPtr
->rectWindow
.left
;
568 rect
->bottom
= wndPtr
->rectWindow
.bottom
- wndPtr
->rectWindow
.top
;
570 if ((wndPtr
->dwStyle
& WS_ICONIC
) || (wndPtr
->flags
& WIN_MANAGED
)) goto END
;
572 /* Remove frame from rectangle */
573 if (HAS_THICKFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
574 InflateRect( rect
, -GetSystemMetrics(SM_CXFRAME
), -GetSystemMetrics(SM_CYFRAME
) );
576 if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
578 InflateRect( rect
, -GetSystemMetrics(SM_CXDLGFRAME
), -GetSystemMetrics(SM_CYDLGFRAME
));
579 /* FIXME: this isn't in NC_AdjustRect? why not? */
580 if (wndPtr
->dwExStyle
& WS_EX_DLGMODALFRAME
)
581 InflateRect( rect
, -1, 0 );
584 if (HAS_THINFRAME( wndPtr
->dwStyle
))
585 InflateRect( rect
, -GetSystemMetrics(SM_CXBORDER
), -GetSystemMetrics(SM_CYBORDER
) );
587 WIN_ReleaseWndPtr(wndPtr
);
592 /***********************************************************************
595 * Get the 'inside' rectangle of a window, i.e. the whole window rectangle
596 * but without the borders (if any).
597 * The rectangle is in window coordinates (for drawing with GetWindowDC()).
601 NC_GetInsideRect95 (HWND hwnd
, RECT
*rect
)
603 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
605 rect
->top
= rect
->left
= 0;
606 rect
->right
= wndPtr
->rectWindow
.right
- wndPtr
->rectWindow
.left
;
607 rect
->bottom
= wndPtr
->rectWindow
.bottom
- wndPtr
->rectWindow
.top
;
609 if ((wndPtr
->dwStyle
& WS_ICONIC
) || (wndPtr
->flags
& WIN_MANAGED
)) goto END
;
611 /* Remove frame from rectangle */
612 if (HAS_THICKFRAME (wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
614 InflateRect( rect
, -GetSystemMetrics(SM_CXSIZEFRAME
), -GetSystemMetrics(SM_CYSIZEFRAME
) );
616 else if (HAS_DLGFRAME (wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
618 InflateRect( rect
, -GetSystemMetrics(SM_CXFIXEDFRAME
), -GetSystemMetrics(SM_CYFIXEDFRAME
));
620 else if (HAS_THINFRAME (wndPtr
->dwStyle
))
622 InflateRect( rect
, -GetSystemMetrics(SM_CXBORDER
), -GetSystemMetrics(SM_CYBORDER
) );
625 if (wndPtr
->dwStyle
& WS_CHILD
) {
626 if (wndPtr
->dwExStyle
& WS_EX_CLIENTEDGE
)
627 InflateRect (rect
, -GetSystemMetrics(SM_CXEDGE
), -GetSystemMetrics(SM_CYEDGE
));
629 if (wndPtr
->dwExStyle
& WS_EX_STATICEDGE
)
630 InflateRect (rect
, -GetSystemMetrics(SM_CXBORDER
), -GetSystemMetrics(SM_CYBORDER
));
633 WIN_ReleaseWndPtr(wndPtr
);
638 /***********************************************************************
641 * Handle a WM_NCHITTEST message. Called from NC_HandleNcHitTest().
644 static LONG
NC_DoNCHitTest (WND
*wndPtr
, POINT16 pt
)
648 TRACE_(nonclient
)("hwnd=%04x pt=%d,%d\n",
649 wndPtr
->hwndSelf
, pt
.x
, pt
.y
);
651 GetWindowRect16 (wndPtr
->hwndSelf
, &rect
);
652 if (!PtInRect16( &rect
, pt
)) return HTNOWHERE
;
654 if (wndPtr
->dwStyle
& WS_MINIMIZE
) return HTCAPTION
;
656 if (!(wndPtr
->flags
& WIN_MANAGED
))
659 if (HAS_THICKFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
661 InflateRect16( &rect
, -GetSystemMetrics(SM_CXFRAME
), -GetSystemMetrics(SM_CYFRAME
) );
662 if (!PtInRect16( &rect
, pt
))
664 /* Check top sizing border */
667 if (pt
.x
< rect
.left
+GetSystemMetrics(SM_CXSIZE
)) return HTTOPLEFT
;
668 if (pt
.x
>= rect
.right
-GetSystemMetrics(SM_CXSIZE
)) return HTTOPRIGHT
;
671 /* Check bottom sizing border */
672 if (pt
.y
>= rect
.bottom
)
674 if (pt
.x
< rect
.left
+GetSystemMetrics(SM_CXSIZE
)) return HTBOTTOMLEFT
;
675 if (pt
.x
>= rect
.right
-GetSystemMetrics(SM_CXSIZE
)) return HTBOTTOMRIGHT
;
678 /* Check left sizing border */
679 if (pt
.x
< rect
.left
)
681 if (pt
.y
< rect
.top
+GetSystemMetrics(SM_CYSIZE
)) return HTTOPLEFT
;
682 if (pt
.y
>= rect
.bottom
-GetSystemMetrics(SM_CYSIZE
)) return HTBOTTOMLEFT
;
685 /* Check right sizing border */
686 if (pt
.x
>= rect
.right
)
688 if (pt
.y
< rect
.top
+GetSystemMetrics(SM_CYSIZE
)) return HTTOPRIGHT
;
689 if (pt
.y
>= rect
.bottom
-GetSystemMetrics(SM_CYSIZE
)) return HTBOTTOMRIGHT
;
694 else /* No thick frame */
696 if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
697 InflateRect16(&rect
, -GetSystemMetrics(SM_CXDLGFRAME
), -GetSystemMetrics(SM_CYDLGFRAME
));
698 else if (HAS_THINFRAME( wndPtr
->dwStyle
))
699 InflateRect16(&rect
, -GetSystemMetrics(SM_CXBORDER
), -GetSystemMetrics(SM_CYBORDER
));
700 if (!PtInRect16( &rect
, pt
)) return HTBORDER
;
705 if ((wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
707 rect
.top
+= GetSystemMetrics(SM_CYCAPTION
) - GetSystemMetrics(SM_CYBORDER
);
708 if (!PtInRect16( &rect
, pt
))
710 /* Check system menu */
711 if (wndPtr
->dwStyle
& WS_SYSMENU
)
712 rect
.left
+= GetSystemMetrics(SM_CXSIZE
);
713 if (pt
.x
<= rect
.left
) return HTSYSMENU
;
714 /* Check maximize box */
715 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
)
716 rect
.right
-= GetSystemMetrics(SM_CXSIZE
) + 1;
717 if (pt
.x
>= rect
.right
) return HTMAXBUTTON
;
718 /* Check minimize box */
719 if (wndPtr
->dwStyle
& WS_MINIMIZEBOX
)
720 rect
.right
-= GetSystemMetrics(SM_CXSIZE
) + 1;
721 if (pt
.x
>= rect
.right
) return HTMINBUTTON
;
727 /* Check client area */
729 ScreenToClient16( wndPtr
->hwndSelf
, &pt
);
730 GetClientRect16( wndPtr
->hwndSelf
, &rect
);
731 if (PtInRect16( &rect
, pt
)) return HTCLIENT
;
733 /* Check vertical scroll bar */
735 if (wndPtr
->dwStyle
& WS_VSCROLL
)
737 rect
.right
+= GetSystemMetrics(SM_CXVSCROLL
);
738 if (PtInRect16( &rect
, pt
)) return HTVSCROLL
;
741 /* Check horizontal scroll bar */
743 if (wndPtr
->dwStyle
& WS_HSCROLL
)
745 rect
.bottom
+= GetSystemMetrics(SM_CYHSCROLL
);
746 if (PtInRect16( &rect
, pt
))
749 if ((wndPtr
->dwStyle
& WS_VSCROLL
) &&
750 (pt
.x
>= rect
.right
- GetSystemMetrics(SM_CXVSCROLL
)))
758 if (HAS_MENU(wndPtr
))
760 if ((pt
.y
< 0) && (pt
.x
>= 0) && (pt
.x
< rect
.right
))
764 /* Should never get here */
769 /***********************************************************************
772 * Handle a WM_NCHITTEST message. Called from NC_HandleNCHitTest().
774 * FIXME: Just a modified copy of the Win 3.1 version.
778 NC_DoNCHitTest95 (WND
*wndPtr
, POINT16 pt
)
782 TRACE_(nonclient
)("hwnd=%04x pt=%d,%d\n",
783 wndPtr
->hwndSelf
, pt
.x
, pt
.y
);
785 GetWindowRect16 (wndPtr
->hwndSelf
, &rect
);
786 if (!PtInRect16( &rect
, pt
)) return HTNOWHERE
;
788 if (wndPtr
->dwStyle
& WS_MINIMIZE
) return HTCAPTION
;
790 if (!(wndPtr
->flags
& WIN_MANAGED
))
793 if (HAS_THICKFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
795 InflateRect16( &rect
, -GetSystemMetrics(SM_CXFRAME
), -GetSystemMetrics(SM_CYFRAME
) );
796 if (!PtInRect16( &rect
, pt
))
798 /* Check top sizing border */
801 if (pt
.x
< rect
.left
+GetSystemMetrics(SM_CXSIZE
)) return HTTOPLEFT
;
802 if (pt
.x
>= rect
.right
-GetSystemMetrics(SM_CXSIZE
)) return HTTOPRIGHT
;
805 /* Check bottom sizing border */
806 if (pt
.y
>= rect
.bottom
)
808 if (pt
.x
< rect
.left
+GetSystemMetrics(SM_CXSIZE
)) return HTBOTTOMLEFT
;
809 if (pt
.x
>= rect
.right
-GetSystemMetrics(SM_CXSIZE
)) return HTBOTTOMRIGHT
;
812 /* Check left sizing border */
813 if (pt
.x
< rect
.left
)
815 if (pt
.y
< rect
.top
+GetSystemMetrics(SM_CYSIZE
)) return HTTOPLEFT
;
816 if (pt
.y
>= rect
.bottom
-GetSystemMetrics(SM_CYSIZE
)) return HTBOTTOMLEFT
;
819 /* Check right sizing border */
820 if (pt
.x
>= rect
.right
)
822 if (pt
.y
< rect
.top
+GetSystemMetrics(SM_CYSIZE
)) return HTTOPRIGHT
;
823 if (pt
.y
>= rect
.bottom
-GetSystemMetrics(SM_CYSIZE
)) return HTBOTTOMRIGHT
;
828 else /* No thick frame */
830 if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
831 InflateRect16(&rect
, -GetSystemMetrics(SM_CXDLGFRAME
), -GetSystemMetrics(SM_CYDLGFRAME
));
832 else if (HAS_THINFRAME( wndPtr
->dwStyle
))
833 InflateRect16(&rect
, -GetSystemMetrics(SM_CXBORDER
), -GetSystemMetrics(SM_CYBORDER
));
834 if (!PtInRect16( &rect
, pt
)) return HTBORDER
;
839 if ((wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
841 if (wndPtr
->dwExStyle
& WS_EX_TOOLWINDOW
)
842 rect
.top
+= GetSystemMetrics(SM_CYSMCAPTION
) - 1;
844 rect
.top
+= GetSystemMetrics(SM_CYCAPTION
) - 1;
845 if (!PtInRect16( &rect
, pt
))
847 /* Check system menu */
848 if ((wndPtr
->dwStyle
& WS_SYSMENU
) &&
849 (((HICON
) GetClassLongA(wndPtr
->hwndSelf
, GCL_HICONSM
)) ||
850 ((HICON
) GetClassLongA(wndPtr
->hwndSelf
, GCL_HICON
))))
851 rect
.left
+= GetSystemMetrics(SM_CYCAPTION
) - 1;
852 if (pt
.x
< rect
.left
) return HTSYSMENU
;
854 /* Check close button */
855 if (wndPtr
->dwStyle
& WS_SYSMENU
)
856 rect
.right
-= GetSystemMetrics(SM_CYCAPTION
) - 1;
857 if (pt
.x
> rect
.right
) return HTCLOSE
;
859 /* Check maximize box */
860 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
)
861 rect
.right
-= GetSystemMetrics(SM_CXSIZE
) + 1;
862 if (pt
.x
> rect
.right
) return HTMAXBUTTON
;
864 /* Check minimize box */
865 if (wndPtr
->dwStyle
& WS_MINIMIZEBOX
)
866 rect
.right
-= GetSystemMetrics(SM_CXSIZE
) + 1;
867 if (pt
.x
> rect
.right
) return HTMINBUTTON
;
873 /* Check client area */
875 ScreenToClient16( wndPtr
->hwndSelf
, &pt
);
876 GetClientRect16( wndPtr
->hwndSelf
, &rect
);
877 if (PtInRect16( &rect
, pt
)) return HTCLIENT
;
879 /* Check vertical scroll bar */
881 if (wndPtr
->dwStyle
& WS_VSCROLL
)
883 rect
.right
+= GetSystemMetrics(SM_CXVSCROLL
);
884 if (PtInRect16( &rect
, pt
)) return HTVSCROLL
;
887 /* Check horizontal scroll bar */
889 if (wndPtr
->dwStyle
& WS_HSCROLL
)
891 rect
.bottom
+= GetSystemMetrics(SM_CYHSCROLL
);
892 if (PtInRect16( &rect
, pt
))
895 if ((wndPtr
->dwStyle
& WS_VSCROLL
) &&
896 (pt
.x
>= rect
.right
- GetSystemMetrics(SM_CXVSCROLL
)))
904 if (HAS_MENU(wndPtr
))
906 if ((pt
.y
< 0) && (pt
.x
>= 0) && (pt
.x
< rect
.right
))
910 /* Should never get here */
915 /***********************************************************************
918 * Handle a WM_NCHITTEST message. Called from DefWindowProc().
921 NC_HandleNCHitTest (HWND hwnd
, POINT16 pt
)
924 WND
*wndPtr
= WIN_FindWndPtr (hwnd
);
929 if (TWEAK_WineLook
== WIN31_LOOK
)
930 retvalue
= NC_DoNCHitTest (wndPtr
, pt
);
932 retvalue
= NC_DoNCHitTest95 (wndPtr
, pt
);
933 WIN_ReleaseWndPtr(wndPtr
);
938 /***********************************************************************
941 void NC_DrawSysButton( HWND hwnd
, HDC hdc
, BOOL down
)
946 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
948 if( !(wndPtr
->flags
& WIN_MANAGED
) )
950 NC_GetInsideRect( hwnd
, &rect
);
951 hdcMem
= CreateCompatibleDC( hdc
);
952 hbitmap
= SelectObject( hdcMem
, hbitmapClose
);
953 BitBlt(hdc
, rect
.left
, rect
.top
, GetSystemMetrics(SM_CXSIZE
), GetSystemMetrics(SM_CYSIZE
),
954 hdcMem
, (wndPtr
->dwStyle
& WS_CHILD
) ? GetSystemMetrics(SM_CXSIZE
) : 0, 0,
955 down
? NOTSRCCOPY
: SRCCOPY
);
956 SelectObject( hdcMem
, hbitmap
);
959 WIN_ReleaseWndPtr(wndPtr
);
963 /***********************************************************************
966 static void NC_DrawMaxButton( HWND hwnd
, HDC16 hdc
, BOOL down
)
969 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
972 if( !(wndPtr
->flags
& WIN_MANAGED
) )
974 NC_GetInsideRect( hwnd
, &rect
);
975 hdcMem
= CreateCompatibleDC( hdc
);
976 SelectObject( hdcMem
, (IsZoomed(hwnd
)
977 ? (down
? hbitmapRestoreD
: hbitmapRestore
)
978 : (down
? hbitmapMaximizeD
: hbitmapMaximize
)) );
979 BitBlt( hdc
, rect
.right
- GetSystemMetrics(SM_CXSIZE
) - 1, rect
.top
,
980 GetSystemMetrics(SM_CXSIZE
) + 1, GetSystemMetrics(SM_CYSIZE
), hdcMem
, 0, 0,
984 WIN_ReleaseWndPtr(wndPtr
);
989 /***********************************************************************
992 static void NC_DrawMinButton( HWND hwnd
, HDC16 hdc
, BOOL down
)
995 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
998 if( !(wndPtr
->flags
& WIN_MANAGED
) )
1000 NC_GetInsideRect( hwnd
, &rect
);
1001 hdcMem
= CreateCompatibleDC( hdc
);
1002 SelectObject( hdcMem
, (down
? hbitmapMinimizeD
: hbitmapMinimize
) );
1003 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
) rect
.right
-= GetSystemMetrics(SM_CXSIZE
)+1;
1004 BitBlt( hdc
, rect
.right
- GetSystemMetrics(SM_CXSIZE
) - 1, rect
.top
,
1005 GetSystemMetrics(SM_CXSIZE
) + 1, GetSystemMetrics(SM_CYSIZE
), hdcMem
, 0, 0,
1009 WIN_ReleaseWndPtr(wndPtr
);
1013 /******************************************************************************
1015 * void NC_DrawSysButton95(
1020 * Draws the Win95 system icon.
1023 * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
1024 * Original implementation from NC_DrawSysButton source.
1025 * 11-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
1028 *****************************************************************************/
1031 NC_DrawSysButton95 (HWND hwnd
, HDC hdc
, BOOL down
)
1033 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
1035 if( !(wndPtr
->flags
& WIN_MANAGED
) )
1040 NC_GetInsideRect95( hwnd
, &rect
);
1042 hIcon
= (HICON
) GetClassLongA(wndPtr
->hwndSelf
, GCL_HICONSM
);
1043 if(!hIcon
) hIcon
= (HICON
) GetClassLongA(wndPtr
->hwndSelf
, GCL_HICON
);
1046 DrawIconEx (hdc
, rect
.left
+ 2, rect
.top
+ 2, hIcon
,
1047 GetSystemMetrics(SM_CXSMICON
),
1048 GetSystemMetrics(SM_CYSMICON
),
1051 WIN_ReleaseWndPtr(wndPtr
);
1052 return (hIcon
!= 0);
1054 WIN_ReleaseWndPtr(wndPtr
);
1059 /******************************************************************************
1061 * void NC_DrawCloseButton95(
1066 * Draws the Win95 close button.
1069 * 11-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
1070 * Original implementation from NC_DrawSysButton95 source.
1072 *****************************************************************************/
1074 static void NC_DrawCloseButton95 (HWND hwnd
, HDC hdc
, BOOL down
)
1078 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
1080 if( !(wndPtr
->flags
& WIN_MANAGED
) )
1083 HBITMAP hBmp
, hOldBmp
;
1085 NC_GetInsideRect95( hwnd
, &rect
);
1087 hdcMem
= CreateCompatibleDC( hdc
);
1088 hBmp
= down
? hbitmapCloseD
: hbitmapClose
;
1089 hOldBmp
= SelectObject (hdcMem
, hBmp
);
1090 GetObjectA (hBmp
, sizeof(BITMAP
), &bmp
);
1091 BitBlt (hdc
, rect
.right
- (GetSystemMetrics(SM_CYCAPTION
) + 1 + bmp
.bmWidth
) / 2,
1092 rect
.top
+ (GetSystemMetrics(SM_CYCAPTION
) - 1 - bmp
.bmHeight
) / 2,
1093 bmp
.bmWidth
, bmp
.bmHeight
, hdcMem
, 0, 0, SRCCOPY
);
1095 SelectObject (hdcMem
, hOldBmp
);
1098 WIN_ReleaseWndPtr(wndPtr
);
1101 /******************************************************************************
1103 * NC_DrawMaxButton95(
1108 * Draws the maximize button for Win95 style windows.
1111 * Many. Spacing might still be incorrect. Need to fit a close
1112 * button between the max button and the edge.
1113 * Should scale the image with the title bar. And more...
1116 * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
1117 * Original implementation.
1119 *****************************************************************************/
1121 static void NC_DrawMaxButton95(HWND hwnd
,HDC16 hdc
,BOOL down
)
1125 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
1127 if( !(wndPtr
->flags
& WIN_MANAGED
))
1130 HBITMAP hBmp
,hOldBmp
;
1132 NC_GetInsideRect95( hwnd
, &rect
);
1133 hdcMem
= CreateCompatibleDC( hdc
);
1134 hBmp
= IsZoomed(hwnd
) ?
1135 (down
? hbitmapRestoreD
: hbitmapRestore
) :
1136 (down
? hbitmapMaximizeD
: hbitmapMaximize
);
1137 hOldBmp
=SelectObject( hdcMem
, hBmp
);
1138 GetObjectA (hBmp
, sizeof(BITMAP
), &bmp
);
1140 if (wndPtr
->dwStyle
& WS_SYSMENU
)
1141 rect
.right
-= GetSystemMetrics(SM_CYCAPTION
) + 1;
1143 BitBlt( hdc
, rect
.right
- (GetSystemMetrics(SM_CXSIZE
) + bmp
.bmWidth
) / 2,
1144 rect
.top
+ (GetSystemMetrics(SM_CYCAPTION
) - 1 - bmp
.bmHeight
) / 2,
1145 bmp
.bmWidth
, bmp
.bmHeight
, hdcMem
, 0, 0, SRCCOPY
);
1146 SelectObject (hdcMem
, hOldBmp
);
1149 WIN_ReleaseWndPtr(wndPtr
);
1152 /******************************************************************************
1154 * NC_DrawMinButton95(
1159 * Draws the minimize button for Win95 style windows.
1162 * Many. Spacing is still incorrect. Should scale the image with the
1163 * title bar. And more...
1166 * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
1167 * Original implementation.
1169 *****************************************************************************/
1171 static void NC_DrawMinButton95(HWND hwnd
,HDC16 hdc
,BOOL down
)
1175 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
1177 if( !(wndPtr
->flags
& WIN_MANAGED
))
1181 HBITMAP hBmp
,hOldBmp
;
1183 NC_GetInsideRect95( hwnd
, &rect
);
1185 hdcMem
= CreateCompatibleDC( hdc
);
1186 hBmp
= down
? hbitmapMinimizeD
: hbitmapMinimize
;
1187 hOldBmp
= SelectObject( hdcMem
, hBmp
);
1188 GetObjectA (hBmp
, sizeof(BITMAP
), &bmp
);
1190 if (wndPtr
->dwStyle
& WS_SYSMENU
)
1191 rect
.right
-= GetSystemMetrics(SM_CYCAPTION
) + 1;
1193 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
)
1194 rect
.right
+= -1 - (GetSystemMetrics(SM_CXSIZE
) + bmp
.bmWidth
) / 2;
1196 BitBlt( hdc
, rect
.right
- (GetSystemMetrics(SM_CXSIZE
) + bmp
.bmWidth
) / 2,
1197 rect
.top
+ (GetSystemMetrics(SM_CYCAPTION
) - 1 - bmp
.bmHeight
) / 2,
1198 bmp
.bmWidth
, bmp
.bmHeight
, hdcMem
, 0, 0, SRCCOPY
);
1200 SelectObject (hdcMem
, hOldBmp
);
1203 WIN_ReleaseWndPtr(wndPtr
);
1206 /***********************************************************************
1209 * Draw a window frame inside the given rectangle, and update the rectangle.
1210 * The correct pen for the frame must be selected in the DC.
1212 static void NC_DrawFrame( HDC hdc
, RECT
*rect
, BOOL dlgFrame
,
1217 if (TWEAK_WineLook
!= WIN31_LOOK
)
1218 ERR_(nonclient
)("Called in Win95 mode. Aiee! Please report this.\n" );
1222 width
= GetSystemMetrics(SM_CXDLGFRAME
) - 1;
1223 height
= GetSystemMetrics(SM_CYDLGFRAME
) - 1;
1224 SelectObject( hdc
, GetSysColorBrush(active
? COLOR_ACTIVECAPTION
:
1225 COLOR_INACTIVECAPTION
) );
1229 width
= GetSystemMetrics(SM_CXFRAME
) - 2;
1230 height
= GetSystemMetrics(SM_CYFRAME
) - 2;
1231 SelectObject( hdc
, GetSysColorBrush(active
? COLOR_ACTIVEBORDER
:
1232 COLOR_INACTIVEBORDER
) );
1236 PatBlt( hdc
, rect
->left
, rect
->top
,
1237 rect
->right
- rect
->left
, height
, PATCOPY
);
1238 PatBlt( hdc
, rect
->left
, rect
->top
,
1239 width
, rect
->bottom
- rect
->top
, PATCOPY
);
1240 PatBlt( hdc
, rect
->left
, rect
->bottom
- 1,
1241 rect
->right
- rect
->left
, -height
, PATCOPY
);
1242 PatBlt( hdc
, rect
->right
- 1, rect
->top
,
1243 -width
, rect
->bottom
- rect
->top
, PATCOPY
);
1247 InflateRect( rect
, -width
, -height
);
1251 INT decYOff
= GetSystemMetrics(SM_CXFRAME
) + GetSystemMetrics(SM_CXSIZE
) - 1;
1252 INT decXOff
= GetSystemMetrics(SM_CYFRAME
) + GetSystemMetrics(SM_CYSIZE
) - 1;
1254 /* Draw inner rectangle */
1256 SelectObject( hdc
, GetStockObject(NULL_BRUSH
) );
1257 Rectangle( hdc
, rect
->left
+ width
, rect
->top
+ height
,
1258 rect
->right
- width
, rect
->bottom
- height
);
1260 /* Draw the decorations */
1262 MoveToEx( hdc
, rect
->left
, rect
->top
+ decYOff
, NULL
);
1263 LineTo( hdc
, rect
->left
+ width
, rect
->top
+ decYOff
);
1264 MoveToEx( hdc
, rect
->right
- 1, rect
->top
+ decYOff
, NULL
);
1265 LineTo( hdc
, rect
->right
- width
- 1, rect
->top
+ decYOff
);
1266 MoveToEx( hdc
, rect
->left
, rect
->bottom
- decYOff
, NULL
);
1267 LineTo( hdc
, rect
->left
+ width
, rect
->bottom
- decYOff
);
1268 MoveToEx( hdc
, rect
->right
- 1, rect
->bottom
- decYOff
, NULL
);
1269 LineTo( hdc
, rect
->right
- width
- 1, rect
->bottom
- decYOff
);
1271 MoveToEx( hdc
, rect
->left
+ decXOff
, rect
->top
, NULL
);
1272 LineTo( hdc
, rect
->left
+ decXOff
, rect
->top
+ height
);
1273 MoveToEx( hdc
, rect
->left
+ decXOff
, rect
->bottom
- 1, NULL
);
1274 LineTo( hdc
, rect
->left
+ decXOff
, rect
->bottom
- height
- 1 );
1275 MoveToEx( hdc
, rect
->right
- decXOff
, rect
->top
, NULL
);
1276 LineTo( hdc
, rect
->right
- decXOff
, rect
->top
+ height
);
1277 MoveToEx( hdc
, rect
->right
- decXOff
, rect
->bottom
- 1, NULL
);
1278 LineTo( hdc
, rect
->right
- decXOff
, rect
->bottom
- height
- 1 );
1280 InflateRect( rect
, -width
- 1, -height
- 1 );
1285 /******************************************************************************
1287 * void NC_DrawFrame95(
1293 * Draw a window frame inside the given rectangle, and update the rectangle.
1294 * The correct pen for the frame must be selected in the DC.
1297 * Many. First, just what IS a frame in Win95? Note that the 3D look
1298 * on the outer edge is handled by NC_DoNCPaint95. As is the inner
1299 * edge. The inner rectangle just inside the frame is handled by the
1302 * In short, for most people, this function should be a nop (unless
1303 * you LIKE thick borders in Win95/NT4.0 -- I've been working with
1304 * them lately, but just to get this code right). Even so, it doesn't
1305 * appear to be so. It's being worked on...
1308 * 06-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
1309 * Original implementation (based on NC_DrawFrame)
1310 * 02-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
1312 * 29-Jun-1999 Ove Kåven (ovek@arcticnet.no)
1313 * Fixed a fix or something.
1315 *****************************************************************************/
1317 static void NC_DrawFrame95(
1327 width
= GetSystemMetrics(SM_CXDLGFRAME
) - GetSystemMetrics(SM_CXEDGE
);
1328 height
= GetSystemMetrics(SM_CYDLGFRAME
) - GetSystemMetrics(SM_CYEDGE
);
1332 width
= GetSystemMetrics(SM_CXFRAME
) - GetSystemMetrics(SM_CXEDGE
);
1333 height
= GetSystemMetrics(SM_CYFRAME
) - GetSystemMetrics(SM_CYEDGE
);
1336 SelectObject( hdc
, GetSysColorBrush(active
? COLOR_ACTIVEBORDER
:
1337 COLOR_INACTIVEBORDER
) );
1340 PatBlt( hdc
, rect
->left
, rect
->top
,
1341 rect
->right
- rect
->left
, height
, PATCOPY
);
1342 PatBlt( hdc
, rect
->left
, rect
->top
,
1343 width
, rect
->bottom
- rect
->top
, PATCOPY
);
1344 PatBlt( hdc
, rect
->left
, rect
->bottom
- 1,
1345 rect
->right
- rect
->left
, -height
, PATCOPY
);
1346 PatBlt( hdc
, rect
->right
- 1, rect
->top
,
1347 -width
, rect
->bottom
- rect
->top
, PATCOPY
);
1349 InflateRect( rect
, -width
, -height
);
1352 /***********************************************************************
1353 * NC_DrawMovingFrame
1355 * Draw the frame used when moving or resizing window.
1357 * FIXME: This causes problems in Win95 mode. (why?)
1359 static void NC_DrawMovingFrame( HDC hdc
, RECT
*rect
, BOOL thickframe
)
1364 CONV_RECT32TO16( rect
, &r16
);
1365 FastWindowFrame16( hdc
, &r16
, GetSystemMetrics(SM_CXFRAME
),
1366 GetSystemMetrics(SM_CYFRAME
), PATINVERT
);
1368 else DrawFocusRect( hdc
, rect
);
1372 /***********************************************************************
1375 * Draw the window caption.
1376 * The correct pen for the window frame must be selected in the DC.
1378 static void NC_DrawCaption( HDC hdc
, RECT
*rect
, HWND hwnd
,
1379 DWORD style
, BOOL active
)
1382 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
1385 if (wndPtr
->flags
& WIN_MANAGED
)
1387 WIN_ReleaseWndPtr(wndPtr
);
1393 if (!(hbitmapClose
= LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_CLOSE
) )))
1395 WIN_ReleaseWndPtr(wndPtr
);
1398 hbitmapCloseD
= LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_CLOSED
) );
1399 hbitmapMinimize
= LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_REDUCE
) );
1400 hbitmapMinimizeD
= LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_REDUCED
) );
1401 hbitmapMaximize
= LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_ZOOM
) );
1402 hbitmapMaximizeD
= LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_ZOOMD
) );
1403 hbitmapRestore
= LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_RESTORE
) );
1404 hbitmapRestoreD
= LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_RESTORED
) );
1407 if (wndPtr
->dwExStyle
& WS_EX_DLGMODALFRAME
)
1409 HBRUSH hbrushOld
= SelectObject(hdc
, GetSysColorBrush(COLOR_WINDOW
) );
1410 PatBlt( hdc
, r
.left
, r
.top
, 1, r
.bottom
-r
.top
+1,PATCOPY
);
1411 PatBlt( hdc
, r
.right
-1, r
.top
, 1, r
.bottom
-r
.top
+1, PATCOPY
);
1412 PatBlt( hdc
, r
.left
, r
.top
-1, r
.right
-r
.left
, 1, PATCOPY
);
1415 SelectObject( hdc
, hbrushOld
);
1417 WIN_ReleaseWndPtr(wndPtr
);
1418 MoveTo16( hdc
, r
.left
, r
.bottom
);
1419 LineTo( hdc
, r
.right
, r
.bottom
);
1421 if (style
& WS_SYSMENU
)
1423 NC_DrawSysButton( hwnd
, hdc
, FALSE
);
1424 r
.left
+= GetSystemMetrics(SM_CXSIZE
) + 1;
1425 MoveTo16( hdc
, r
.left
- 1, r
.top
);
1426 LineTo( hdc
, r
.left
- 1, r
.bottom
);
1428 if (style
& WS_MAXIMIZEBOX
)
1430 NC_DrawMaxButton( hwnd
, hdc
, FALSE
);
1431 r
.right
-= GetSystemMetrics(SM_CXSIZE
) + 1;
1433 if (style
& WS_MINIMIZEBOX
)
1435 NC_DrawMinButton( hwnd
, hdc
, FALSE
);
1436 r
.right
-= GetSystemMetrics(SM_CXSIZE
) + 1;
1439 FillRect( hdc
, &r
, GetSysColorBrush(active
? COLOR_ACTIVECAPTION
:
1440 COLOR_INACTIVECAPTION
) );
1442 if (GetWindowTextA( hwnd
, buffer
, sizeof(buffer
) ))
1444 if (active
) SetTextColor( hdc
, GetSysColor( COLOR_CAPTIONTEXT
) );
1445 else SetTextColor( hdc
, GetSysColor( COLOR_INACTIVECAPTIONTEXT
) );
1446 SetBkMode( hdc
, TRANSPARENT
);
1447 DrawTextA( hdc
, buffer
, -1, &r
,
1448 DT_SINGLELINE
| DT_CENTER
| DT_VCENTER
| DT_NOPREFIX
);
1453 /******************************************************************************
1462 * Draw the window caption for Win95 style windows.
1463 * The correct pen for the window frame must be selected in the DC.
1466 * Hey, a function that finally works! Well, almost.
1467 * It's being worked on.
1470 * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
1471 * Original implementation.
1472 * 02-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
1475 *****************************************************************************/
1477 static void NC_DrawCaption95(
1486 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
1490 if (wndPtr
->flags
& WIN_MANAGED
)
1492 WIN_ReleaseWndPtr(wndPtr
);
1495 WIN_ReleaseWndPtr(wndPtr
);
1497 hPrevPen
= SelectObject( hdc
, GetSysColorPen(COLOR_3DFACE
) );
1498 MoveToEx( hdc
, r
.left
, r
.bottom
- 1, NULL
);
1499 LineTo( hdc
, r
.right
, r
.bottom
- 1 );
1500 SelectObject( hdc
, hPrevPen
);
1503 FillRect( hdc
, &r
, GetSysColorBrush(active
? COLOR_ACTIVECAPTION
:
1504 COLOR_INACTIVECAPTION
) );
1506 if (!hbitmapClose
) {
1507 if (!(hbitmapClose
= LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_CLOSE
) )))
1509 hbitmapCloseD
= LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_CLOSED
));
1510 hbitmapMinimize
= LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_REDUCE
) );
1511 hbitmapMinimizeD
= LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_REDUCED
) );
1512 hbitmapMaximize
= LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_ZOOM
) );
1513 hbitmapMaximizeD
= LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_ZOOMD
) );
1514 hbitmapRestore
= LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_RESTORE
) );
1515 hbitmapRestoreD
= LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_RESTORED
) );
1518 if ((style
& WS_SYSMENU
) && !(exStyle
& WS_EX_TOOLWINDOW
)) {
1519 if (NC_DrawSysButton95 (hwnd
, hdc
, FALSE
))
1520 r
.left
+= GetSystemMetrics(SM_CYCAPTION
) - 1;
1522 if (style
& WS_SYSMENU
) {
1523 NC_DrawCloseButton95 (hwnd
, hdc
, FALSE
);
1524 r
.right
-= GetSystemMetrics(SM_CYCAPTION
) - 1;
1526 if (style
& WS_MAXIMIZEBOX
) {
1527 NC_DrawMaxButton95( hwnd
, hdc
, FALSE
);
1528 r
.right
-= GetSystemMetrics(SM_CXSIZE
) + 1;
1530 if (style
& WS_MINIMIZEBOX
) {
1531 NC_DrawMinButton95( hwnd
, hdc
, FALSE
);
1532 r
.right
-= GetSystemMetrics(SM_CXSIZE
) + 1;
1535 if (GetWindowTextA( hwnd
, buffer
, sizeof(buffer
) )) {
1536 NONCLIENTMETRICSA nclm
;
1537 HFONT hFont
, hOldFont
;
1538 nclm
.cbSize
= sizeof(NONCLIENTMETRICSA
);
1539 SystemParametersInfoA (SPI_GETNONCLIENTMETRICS
, 0, &nclm
, 0);
1540 if (exStyle
& WS_EX_TOOLWINDOW
)
1541 hFont
= CreateFontIndirectA (&nclm
.lfSmCaptionFont
);
1543 hFont
= CreateFontIndirectA (&nclm
.lfCaptionFont
);
1544 hOldFont
= SelectObject (hdc
, hFont
);
1545 if (active
) SetTextColor( hdc
, GetSysColor( COLOR_CAPTIONTEXT
) );
1546 else SetTextColor( hdc
, GetSysColor( COLOR_INACTIVECAPTIONTEXT
) );
1547 SetBkMode( hdc
, TRANSPARENT
);
1549 DrawTextA( hdc
, buffer
, -1, &r
,
1550 DT_SINGLELINE
| DT_VCENTER
| DT_NOPREFIX
| DT_LEFT
);
1551 DeleteObject (SelectObject (hdc
, hOldFont
));
1557 /***********************************************************************
1560 * Paint the non-client area. clip is currently unused.
1562 static void NC_DoNCPaint( WND
* wndPtr
, HRGN clip
, BOOL suppress_menupaint
)
1567 HWND hwnd
= wndPtr
->hwndSelf
;
1569 if ( wndPtr
->dwStyle
& WS_MINIMIZE
||
1570 !WIN_IsWindowDrawable( wndPtr
, 0 )) return; /* Nothing to do */
1572 active
= wndPtr
->flags
& WIN_NCACTIVATED
;
1574 TRACE_(nonclient
)("%04x %d\n", hwnd
, active
);
1576 if (!(hdc
= GetDCEx( hwnd
, (clip
> 1) ? clip
: 0, DCX_USESTYLE
| DCX_WINDOW
|
1577 ((clip
> 1) ? (DCX_INTERSECTRGN
| DCX_KEEPCLIPRGN
): 0) ))) return;
1579 if (ExcludeVisRect16( hdc
, wndPtr
->rectClient
.left
-wndPtr
->rectWindow
.left
,
1580 wndPtr
->rectClient
.top
-wndPtr
->rectWindow
.top
,
1581 wndPtr
->rectClient
.right
-wndPtr
->rectWindow
.left
,
1582 wndPtr
->rectClient
.bottom
-wndPtr
->rectWindow
.top
)
1585 ReleaseDC( hwnd
, hdc
);
1589 rect
.top
= rect
.left
= 0;
1590 rect
.right
= wndPtr
->rectWindow
.right
- wndPtr
->rectWindow
.left
;
1591 rect
.bottom
= wndPtr
->rectWindow
.bottom
- wndPtr
->rectWindow
.top
;
1593 SelectObject( hdc
, GetSysColorPen(COLOR_WINDOWFRAME
) );
1595 if (!(wndPtr
->flags
& WIN_MANAGED
))
1597 if (HAS_ANYFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
1599 SelectObject( hdc
, GetStockObject(NULL_BRUSH
) );
1600 Rectangle( hdc
, 0, 0, rect
.right
, rect
.bottom
);
1601 InflateRect( &rect
, -1, -1 );
1604 if (HAS_THICKFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
1605 NC_DrawFrame(hdc
, &rect
, FALSE
, active
);
1606 else if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
1607 NC_DrawFrame( hdc
, &rect
, TRUE
, active
);
1609 if ((wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
1612 r
.bottom
= rect
.top
+ GetSystemMetrics(SM_CYSIZE
);
1613 rect
.top
+= GetSystemMetrics(SM_CYSIZE
) + GetSystemMetrics(SM_CYBORDER
);
1614 NC_DrawCaption( hdc
, &r
, hwnd
, wndPtr
->dwStyle
, active
);
1618 if (HAS_MENU(wndPtr
))
1621 r
.bottom
= rect
.top
+ GetSystemMetrics(SM_CYMENU
); /* default height */
1622 rect
.top
+= MENU_DrawMenuBar( hdc
, &r
, hwnd
, suppress_menupaint
);
1625 /* Draw the scroll-bars */
1627 if (wndPtr
->dwStyle
& WS_VSCROLL
)
1628 SCROLL_DrawScrollBar( hwnd
, hdc
, SB_VERT
, TRUE
, TRUE
);
1629 if (wndPtr
->dwStyle
& WS_HSCROLL
)
1630 SCROLL_DrawScrollBar( hwnd
, hdc
, SB_HORZ
, TRUE
, TRUE
);
1632 /* Draw the "size-box" */
1634 if ((wndPtr
->dwStyle
& WS_VSCROLL
) && (wndPtr
->dwStyle
& WS_HSCROLL
))
1637 r
.left
= r
.right
- GetSystemMetrics(SM_CXVSCROLL
) + 1;
1638 r
.top
= r
.bottom
- GetSystemMetrics(SM_CYHSCROLL
) + 1;
1639 if(wndPtr
->dwStyle
& WS_BORDER
) {
1643 FillRect( hdc
, &r
, GetSysColorBrush(COLOR_SCROLLBAR
) );
1646 ReleaseDC( hwnd
, hdc
);
1650 /******************************************************************************
1652 * void NC_DoNCPaint95(
1655 * BOOL32 suppress_menupaint )
1657 * Paint the non-client area for Win95 windows. The clip region is
1658 * currently ignored.
1661 * grep -E -A10 -B5 \(95\)\|\(Bugs\)\|\(FIXME\) windows/nonclient.c \
1662 * misc/tweak.c controls/menu.c # :-)
1665 * 03-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
1666 * Original implementation
1667 * 10-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
1669 * 29-Jun-1999 Ove Kåven (ovek@arcticnet.no)
1670 * Streamlined window style checks.
1672 *****************************************************************************/
1674 static void NC_DoNCPaint95(
1677 BOOL suppress_menupaint
)
1680 RECT rfuzz
, rect
, rectClip
;
1682 HWND hwnd
= wndPtr
->hwndSelf
;
1684 if ( wndPtr
->dwStyle
& WS_MINIMIZE
||
1685 !WIN_IsWindowDrawable( wndPtr
, 0 )) return; /* Nothing to do */
1687 active
= wndPtr
->flags
& WIN_NCACTIVATED
;
1689 TRACE_(nonclient
)("%04x %d\n", hwnd
, active
);
1691 /* MSDN docs are pretty idiotic here, they say app CAN use clipRgn in the call to
1692 * GetDCEx implying that it is allowed not to use it either. However, the suggested
1693 * GetDCEx( , DCX_WINDOW | DCX_INTERSECTRGN) will cause clipRgn to be deleted
1694 * after ReleaseDC(). Now, how is the "system" supposed to tell what happened?
1697 if (!(hdc
= GetDCEx( hwnd
, (clip
> 1) ? clip
: 0, DCX_USESTYLE
| DCX_WINDOW
|
1698 ((clip
> 1) ?(DCX_INTERSECTRGN
| DCX_KEEPCLIPRGN
) : 0) ))) return;
1701 if (ExcludeVisRect16( hdc
, wndPtr
->rectClient
.left
-wndPtr
->rectWindow
.left
,
1702 wndPtr
->rectClient
.top
-wndPtr
->rectWindow
.top
,
1703 wndPtr
->rectClient
.right
-wndPtr
->rectWindow
.left
,
1704 wndPtr
->rectClient
.bottom
-wndPtr
->rectWindow
.top
)
1707 ReleaseDC( hwnd
, hdc
);
1711 rect
.top
= rect
.left
= 0;
1712 rect
.right
= wndPtr
->rectWindow
.right
- wndPtr
->rectWindow
.left
;
1713 rect
.bottom
= wndPtr
->rectWindow
.bottom
- wndPtr
->rectWindow
.top
;
1716 GetRgnBox( clip
, &rectClip
);
1723 SelectObject( hdc
, GetSysColorPen(COLOR_WINDOWFRAME
) );
1725 if(!(wndPtr
->flags
& WIN_MANAGED
)) {
1726 if (HAS_BIGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
)) {
1727 DrawEdge (hdc
, &rect
, EDGE_RAISED
, BF_RECT
| BF_ADJUST
);
1729 if (HAS_THICKFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
1730 NC_DrawFrame95(hdc
, &rect
, FALSE
, active
);
1731 else if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
1732 NC_DrawFrame95( hdc
, &rect
, TRUE
, active
);
1733 else if (HAS_THINFRAME( wndPtr
->dwStyle
)) {
1734 SelectObject( hdc
, GetStockObject(NULL_BRUSH
) );
1735 Rectangle( hdc
, 0, 0, rect
.right
, rect
.bottom
);
1738 if ((wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
1741 if (wndPtr
->dwExStyle
& WS_EX_TOOLWINDOW
) {
1742 r
.bottom
= rect
.top
+ GetSystemMetrics(SM_CYSMCAPTION
);
1743 rect
.top
+= GetSystemMetrics(SM_CYSMCAPTION
);
1746 r
.bottom
= rect
.top
+ GetSystemMetrics(SM_CYCAPTION
);
1747 rect
.top
+= GetSystemMetrics(SM_CYCAPTION
);
1749 if( !clip
|| IntersectRect( &rfuzz
, &r
, &rectClip
) )
1750 NC_DrawCaption95 (hdc
, &r
, hwnd
, wndPtr
->dwStyle
,
1751 wndPtr
->dwExStyle
, active
);
1755 if (HAS_MENU(wndPtr
))
1758 r
.bottom
= rect
.top
+ GetSystemMetrics(SM_CYMENU
);
1760 TRACE_(nonclient
)("Calling DrawMenuBar with "
1761 "rect (%d, %d)-(%d, %d)\n", r
.left
, r
.top
,
1764 rect
.top
+= MENU_DrawMenuBar( hdc
, &r
, hwnd
, suppress_menupaint
) + 1;
1767 TRACE_(nonclient
)("After MenuBar, rect is (%d, %d)-(%d, %d).\n",
1768 rect
.left
, rect
.top
, rect
.right
, rect
.bottom
);
1770 if (wndPtr
->dwExStyle
& WS_EX_CLIENTEDGE
)
1771 DrawEdge (hdc
, &rect
, EDGE_SUNKEN
, BF_RECT
| BF_ADJUST
);
1773 if (wndPtr
->dwExStyle
& WS_EX_STATICEDGE
)
1774 DrawEdge (hdc
, &rect
, BDR_SUNKENOUTER
, BF_RECT
| BF_ADJUST
);
1776 /* Draw the scroll-bars */
1778 if (wndPtr
->dwStyle
& WS_VSCROLL
)
1779 SCROLL_DrawScrollBar( hwnd
, hdc
, SB_VERT
, TRUE
, TRUE
);
1780 if (wndPtr
->dwStyle
& WS_HSCROLL
)
1781 SCROLL_DrawScrollBar( hwnd
, hdc
, SB_HORZ
, TRUE
, TRUE
);
1783 /* Draw the "size-box" */
1784 if ((wndPtr
->dwStyle
& WS_VSCROLL
) && (wndPtr
->dwStyle
& WS_HSCROLL
))
1787 r
.left
= r
.right
- GetSystemMetrics(SM_CXVSCROLL
) + 1;
1788 r
.top
= r
.bottom
- GetSystemMetrics(SM_CYHSCROLL
) + 1;
1789 FillRect( hdc
, &r
, GetSysColorBrush(COLOR_SCROLLBAR
) );
1792 ReleaseDC( hwnd
, hdc
);
1798 /***********************************************************************
1801 * Handle a WM_NCPAINT message. Called from DefWindowProc().
1803 LONG
NC_HandleNCPaint( HWND hwnd
, HRGN clip
)
1805 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
1807 if( wndPtr
&& wndPtr
->dwStyle
& WS_VISIBLE
)
1809 if( wndPtr
->dwStyle
& WS_MINIMIZE
)
1810 WINPOS_RedrawIconTitle( hwnd
);
1811 else if (TWEAK_WineLook
== WIN31_LOOK
)
1812 NC_DoNCPaint( wndPtr
, clip
, FALSE
);
1814 NC_DoNCPaint95( wndPtr
, clip
, FALSE
);
1816 WIN_ReleaseWndPtr(wndPtr
);
1821 /***********************************************************************
1822 * NC_HandleNCActivate
1824 * Handle a WM_NCACTIVATE message. Called from DefWindowProc().
1826 LONG
NC_HandleNCActivate( WND
*wndPtr
, WPARAM16 wParam
)
1830 if( wParam
) wStateChange
= !(wndPtr
->flags
& WIN_NCACTIVATED
);
1831 else wStateChange
= wndPtr
->flags
& WIN_NCACTIVATED
;
1835 if (wParam
) wndPtr
->flags
|= WIN_NCACTIVATED
;
1836 else wndPtr
->flags
&= ~WIN_NCACTIVATED
;
1838 if( wndPtr
->dwStyle
& WS_MINIMIZE
)
1839 WINPOS_RedrawIconTitle( wndPtr
->hwndSelf
);
1840 else if (TWEAK_WineLook
== WIN31_LOOK
)
1841 NC_DoNCPaint( wndPtr
, (HRGN
)1, FALSE
);
1843 NC_DoNCPaint95( wndPtr
, (HRGN
)1, FALSE
);
1849 /***********************************************************************
1850 * NC_HandleSetCursor
1852 * Handle a WM_SETCURSOR message. Called from DefWindowProc().
1854 LONG
NC_HandleSetCursor( HWND hwnd
, WPARAM16 wParam
, LPARAM lParam
)
1856 if (hwnd
!= (HWND
)wParam
) return 0; /* Don't set the cursor for child windows */
1858 switch(LOWORD(lParam
))
1862 WORD msg
= HIWORD( lParam
);
1863 if ((msg
== WM_LBUTTONDOWN
) || (msg
== WM_MBUTTONDOWN
) ||
1864 (msg
== WM_RBUTTONDOWN
))
1871 HICON16 hCursor
= (HICON16
) GetClassWord(hwnd
, GCW_HCURSOR
);
1873 SetCursor16(hCursor
);
1881 return (LONG
)SetCursor16( LoadCursor16( 0, IDC_SIZEWE16
) );
1885 return (LONG
)SetCursor16( LoadCursor16( 0, IDC_SIZENS16
) );
1889 return (LONG
)SetCursor16( LoadCursor16( 0, IDC_SIZENWSE16
) );
1893 return (LONG
)SetCursor16( LoadCursor16( 0, IDC_SIZENESW16
) );
1896 /* Default cursor: arrow */
1897 return (LONG
)SetCursor16( LoadCursor16( 0, IDC_ARROW16
) );
1900 /***********************************************************************
1903 BOOL
NC_GetSysPopupPos( WND
* wndPtr
, RECT
* rect
)
1905 if( wndPtr
->hSysMenu
)
1907 if( wndPtr
->dwStyle
& WS_MINIMIZE
)
1908 GetWindowRect( wndPtr
->hwndSelf
, rect
);
1911 if (TWEAK_WineLook
== WIN31_LOOK
)
1912 NC_GetInsideRect( wndPtr
->hwndSelf
, rect
);
1914 NC_GetInsideRect95( wndPtr
->hwndSelf
, rect
);
1915 OffsetRect( rect
, wndPtr
->rectWindow
.left
, wndPtr
->rectWindow
.top
);
1916 if (wndPtr
->dwStyle
& WS_CHILD
)
1917 ClientToScreen( wndPtr
->parent
->hwndSelf
, (POINT
*)rect
);
1918 if (TWEAK_WineLook
== WIN31_LOOK
) {
1919 rect
->right
= rect
->left
+ GetSystemMetrics(SM_CXSIZE
);
1920 rect
->bottom
= rect
->top
+ GetSystemMetrics(SM_CYSIZE
);
1923 rect
->right
= rect
->left
+ GetSystemMetrics(SM_CYCAPTION
) - 1;
1924 rect
->bottom
= rect
->top
+ GetSystemMetrics(SM_CYCAPTION
) - 1;
1932 /***********************************************************************
1935 * Initialisation of a move or resize, when initiatied from a menu choice.
1936 * Return hit test code for caption or sizing border.
1938 static LONG
NC_StartSizeMove( WND
* wndPtr
, WPARAM16 wParam
,
1939 POINT16
*capturePoint
)
1946 GetWindowRect(wndPtr
->hwndSelf
,&rectWindow
);
1948 if ((wParam
& 0xfff0) == SC_MOVE
)
1950 /* Move pointer at the center of the caption */
1952 if (TWEAK_WineLook
== WIN31_LOOK
)
1953 NC_GetInsideRect( wndPtr
->hwndSelf
, &rect
);
1955 NC_GetInsideRect95( wndPtr
->hwndSelf
, &rect
);
1956 if (wndPtr
->dwStyle
& WS_SYSMENU
)
1957 rect
.left
+= GetSystemMetrics(SM_CXSIZE
) + 1;
1958 if (wndPtr
->dwStyle
& WS_MINIMIZEBOX
)
1959 rect
.right
-= GetSystemMetrics(SM_CXSIZE
) + 1;
1960 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
)
1961 rect
.right
-= GetSystemMetrics(SM_CXSIZE
) + 1;
1962 pt
.x
= rectWindow
.left
+ (rect
.right
- rect
.left
) / 2;
1963 pt
.y
= rectWindow
.top
+ rect
.top
+ GetSystemMetrics(SM_CYSIZE
)/2;
1964 hittest
= HTCAPTION
;
1971 MSG_InternalGetMessage( &msg
, 0, 0, MSGF_SIZE
, PM_REMOVE
, FALSE
);
1975 CONV_POINT32TO16(&msg
.pt
, &pt
);
1976 hittest
= NC_HandleNCHitTest( wndPtr
->hwndSelf
, pt
);
1977 if ((hittest
< HTLEFT
) || (hittest
> HTBOTTOMRIGHT
))
1989 pt
.x
=(rectWindow
.left
+rectWindow
.right
)/2;
1990 pt
.y
= rectWindow
.top
+ GetSystemMetrics(SM_CYFRAME
) / 2;
1994 pt
.x
=(rectWindow
.left
+rectWindow
.right
)/2;
1995 pt
.y
= rectWindow
.bottom
- GetSystemMetrics(SM_CYFRAME
) / 2;
1999 pt
.x
= rectWindow
.left
+ GetSystemMetrics(SM_CXFRAME
) / 2;
2000 pt
.y
=(rectWindow
.top
+rectWindow
.bottom
)/2;
2004 pt
.x
= rectWindow
.right
- GetSystemMetrics(SM_CXFRAME
) / 2;
2005 pt
.y
=(rectWindow
.top
+rectWindow
.bottom
)/2;
2008 case VK_ESCAPE
: return 0;
2014 SetCursorPos( pt
.x
, pt
.y
);
2015 NC_HandleSetCursor( wndPtr
->hwndSelf
,
2016 wndPtr
->hwndSelf
, MAKELONG( hittest
, WM_MOUSEMOVE
));
2021 /***********************************************************************
2024 * Perform SC_MOVE and SC_SIZE commands. `
2026 static void NC_DoSizeMove( HWND hwnd
, WORD wParam
)
2029 RECT sizingRect
, mouseRect
;
2031 LONG hittest
= (LONG
)(wParam
& 0x0f);
2032 HCURSOR16 hDragCursor
= 0, hOldCursor
= 0;
2033 POINT minTrack
, maxTrack
;
2034 POINT16 capturePoint
, pt
;
2035 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
2036 BOOL thickframe
= HAS_THICKFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
);
2037 BOOL iconic
= wndPtr
->dwStyle
& WS_MINIMIZE
;
2039 DWORD dwPoint
= GetMessagePos ();
2041 capturePoint
= pt
= *(POINT16
*)&dwPoint
;
2043 if (IsZoomed(hwnd
) || !IsWindowVisible(hwnd
) ||
2044 (wndPtr
->flags
& WIN_MANAGED
)) goto END
;
2046 if ((wParam
& 0xfff0) == SC_MOVE
)
2048 if (!(wndPtr
->dwStyle
& WS_CAPTION
)) goto END
;
2050 hittest
= NC_StartSizeMove( wndPtr
, wParam
, &capturePoint
);
2051 if (!hittest
) goto END
;
2055 if (!thickframe
) goto END
;
2056 if ( hittest
&& hittest
!= HTSYSMENU
) hittest
+= 2;
2060 hittest
= NC_StartSizeMove( wndPtr
, wParam
, &capturePoint
);
2069 /* Get min/max info */
2071 WINPOS_GetMinMaxInfo( wndPtr
, NULL
, NULL
, &minTrack
, &maxTrack
);
2072 sizingRect
= wndPtr
->rectWindow
;
2073 if (wndPtr
->dwStyle
& WS_CHILD
)
2074 GetClientRect( wndPtr
->parent
->hwndSelf
, &mouseRect
);
2076 SetRect(&mouseRect
, 0, 0, GetSystemMetrics(SM_CXSCREEN
), GetSystemMetrics(SM_CYSCREEN
));
2077 if (ON_LEFT_BORDER(hittest
))
2079 mouseRect
.left
= MAX( mouseRect
.left
, sizingRect
.right
-maxTrack
.x
);
2080 mouseRect
.right
= MIN( mouseRect
.right
, sizingRect
.right
-minTrack
.x
);
2082 else if (ON_RIGHT_BORDER(hittest
))
2084 mouseRect
.left
= MAX( mouseRect
.left
, sizingRect
.left
+minTrack
.x
);
2085 mouseRect
.right
= MIN( mouseRect
.right
, sizingRect
.left
+maxTrack
.x
);
2087 if (ON_TOP_BORDER(hittest
))
2089 mouseRect
.top
= MAX( mouseRect
.top
, sizingRect
.bottom
-maxTrack
.y
);
2090 mouseRect
.bottom
= MIN( mouseRect
.bottom
,sizingRect
.bottom
-minTrack
.y
);
2092 else if (ON_BOTTOM_BORDER(hittest
))
2094 mouseRect
.top
= MAX( mouseRect
.top
, sizingRect
.top
+minTrack
.y
);
2095 mouseRect
.bottom
= MIN( mouseRect
.bottom
, sizingRect
.top
+maxTrack
.y
);
2097 if (wndPtr
->dwStyle
& WS_CHILD
)
2099 MapWindowPoints( wndPtr
->parent
->hwndSelf
, 0,
2100 (LPPOINT
)&mouseRect
, 2 );
2102 SendMessage16( hwnd
, WM_ENTERSIZEMOVE
, 0, 0 );
2104 if (GetCapture() != hwnd
) SetCapture( hwnd
);
2106 if (wndPtr
->dwStyle
& WS_CHILD
)
2108 /* Retrieve a default cache DC (without using the window style) */
2109 hdc
= GetDCEx( wndPtr
->parent
->hwndSelf
, 0, DCX_CACHE
);
2112 { /* Grab the server only when moving top-level windows without desktop */
2116 wndPtr
->pDriver
->pPreSizeMove(wndPtr
);
2118 if( iconic
) /* create a cursor for dragging */
2120 HICON16 hIcon
= GetClassWord(wndPtr
->hwndSelf
, GCW_HICON
);
2121 if(!hIcon
) hIcon
= (HICON16
) SendMessage16( hwnd
, WM_QUERYDRAGICON
, 0, 0L);
2122 if( hIcon
) hDragCursor
= CURSORICON_IconToCursor( hIcon
, TRUE
);
2123 if( !hDragCursor
) iconic
= FALSE
;
2126 if( !iconic
) NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
2132 MSG_InternalGetMessage( &msg
, 0, 0, MSGF_SIZE
, PM_REMOVE
, FALSE
);
2134 /* Exit on button-up, Return, or Esc */
2135 if ((msg
.message
== WM_LBUTTONUP
) ||
2136 ((msg
.message
== WM_KEYDOWN
) &&
2137 ((msg
.wParam
== VK_RETURN
) || (msg
.wParam
== VK_ESCAPE
)))) break;
2139 if ((msg
.message
!= WM_KEYDOWN
) && (msg
.message
!= WM_MOUSEMOVE
))
2140 continue; /* We are not interested in other messages */
2142 dwPoint
= GetMessagePos ();
2143 pt
= *(POINT16
*)&dwPoint
;
2145 if (msg
.message
== WM_KEYDOWN
) switch(msg
.wParam
)
2147 case VK_UP
: pt
.y
-= 8; break;
2148 case VK_DOWN
: pt
.y
+= 8; break;
2149 case VK_LEFT
: pt
.x
-= 8; break;
2150 case VK_RIGHT
: pt
.x
+= 8; break;
2153 pt
.x
= MAX( pt
.x
, mouseRect
.left
);
2154 pt
.x
= MIN( pt
.x
, mouseRect
.right
);
2155 pt
.y
= MAX( pt
.y
, mouseRect
.top
);
2156 pt
.y
= MIN( pt
.y
, mouseRect
.bottom
);
2158 dx
= pt
.x
- capturePoint
.x
;
2159 dy
= pt
.y
- capturePoint
.y
;
2166 if( iconic
) /* ok, no system popup tracking */
2168 hOldCursor
= SetCursor(hDragCursor
);
2170 WINPOS_ShowIconTitle( wndPtr
, FALSE
);
2174 if (msg
.message
== WM_KEYDOWN
) SetCursorPos( pt
.x
, pt
.y
);
2177 RECT newRect
= sizingRect
;
2179 if (hittest
== HTCAPTION
) OffsetRect( &newRect
, dx
, dy
);
2180 if (ON_LEFT_BORDER(hittest
)) newRect
.left
+= dx
;
2181 else if (ON_RIGHT_BORDER(hittest
)) newRect
.right
+= dx
;
2182 if (ON_TOP_BORDER(hittest
)) newRect
.top
+= dy
;
2183 else if (ON_BOTTOM_BORDER(hittest
)) newRect
.bottom
+= dy
;
2186 NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
2187 NC_DrawMovingFrame( hdc
, &newRect
, thickframe
);
2190 sizingRect
= newRect
;
2198 if( moved
) /* restore cursors, show icon title later on */
2200 ShowCursor( FALSE
);
2201 SetCursor( hOldCursor
);
2203 DestroyCursor( hDragCursor
);
2206 NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
2208 if (wndPtr
->dwStyle
& WS_CHILD
)
2209 ReleaseDC( wndPtr
->parent
->hwndSelf
, hdc
);
2212 ReleaseDC( 0, hdc
);
2215 wndPtr
->pDriver
->pPostSizeMove(wndPtr
);
2217 if (HOOK_IsHooked( WH_CBT
))
2219 RECT16
* pr
= SEGPTR_NEW(RECT16
);
2222 CONV_RECT32TO16( &sizingRect
, pr
);
2223 if( HOOK_CallHooks16( WH_CBT
, HCBT_MOVESIZE
, hwnd
,
2224 (LPARAM
)SEGPTR_GET(pr
)) )
2225 sizingRect
= wndPtr
->rectWindow
;
2227 CONV_RECT16TO32( pr
, &sizingRect
);
2231 SendMessage16( hwnd
, WM_EXITSIZEMOVE
, 0, 0 );
2232 SendMessage16( hwnd
, WM_SETVISIBLE
, !IsIconic16(hwnd
), 0L);
2234 /* window moved or resized */
2237 /* if the moving/resizing isn't canceled call SetWindowPos
2238 * with the new position or the new size of the window
2240 if (!((msg
.message
== WM_KEYDOWN
) && (msg
.wParam
== VK_ESCAPE
)) )
2242 /* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
2243 SetWindowPos( hwnd
, 0, sizingRect
.left
, sizingRect
.top
,
2244 sizingRect
.right
- sizingRect
.left
,
2245 sizingRect
.bottom
- sizingRect
.top
,
2246 ( hittest
== HTCAPTION
) ? SWP_NOSIZE
: 0 );
2250 /* if the moving/resizing is canceled and the window is not active
2251 * call SetWindowPos to activate and to show this window
2253 if (GetActiveWindow() != hwnd
)
2254 SetWindowPos( hwnd
, 0, 0, 0,0,0,SWP_NOSIZE
| SWP_NOMOVE
| SWP_SHOWWINDOW
);
2259 /* show the window if it is not moved/resized and it is not active */
2260 if (GetActiveWindow() != hwnd
)
2261 SetWindowPos( hwnd
, 0, 0, 0,0,0,SWP_NOSIZE
| SWP_NOMOVE
| SWP_SHOWWINDOW
);
2264 if( IsWindow(hwnd
) )
2265 if( wndPtr
->dwStyle
& WS_MINIMIZE
)
2267 /* Single click brings up the system menu when iconized */
2271 if( wndPtr
->dwStyle
& WS_SYSMENU
)
2272 SendMessage16( hwnd
, WM_SYSCOMMAND
,
2273 SC_MOUSEMENU
+ HTSYSMENU
, *((LPARAM
*)&pt
));
2275 else WINPOS_ShowIconTitle( wndPtr
, TRUE
);
2279 WIN_ReleaseWndPtr(wndPtr
);
2283 /***********************************************************************
2286 * Track a mouse button press on the minimize or maximize box.
2288 static void NC_TrackMinMaxBox( HWND hwnd
, WORD wParam
)
2292 HDC hdc
= GetWindowDC( hwnd
);
2293 BOOL pressed
= TRUE
;
2294 void (*paintButton
)(HWND
, HDC16
, BOOL
);
2297 if (wParam
== HTMINBUTTON
)
2299 (TWEAK_WineLook
== WIN31_LOOK
) ? &NC_DrawMinButton
: &NC_DrawMinButton95
;
2302 (TWEAK_WineLook
== WIN31_LOOK
) ? &NC_DrawMaxButton
: &NC_DrawMaxButton95
;
2304 (*paintButton
)( hwnd
, hdc
, TRUE
);
2308 BOOL oldstate
= pressed
;
2309 MSG_InternalGetMessage( &msg
, 0, 0, 0, PM_REMOVE
, FALSE
);
2310 CONV_POINT32TO16( &msg
.pt
, &pt16
);
2312 pressed
= (NC_HandleNCHitTest( hwnd
, pt16
) == wParam
);
2313 if (pressed
!= oldstate
)
2314 (*paintButton
)( hwnd
, hdc
, pressed
);
2315 } while (msg
.message
!= WM_LBUTTONUP
);
2317 (*paintButton
)( hwnd
, hdc
, FALSE
);
2320 ReleaseDC( hwnd
, hdc
);
2321 if (!pressed
) return;
2323 if (wParam
== HTMINBUTTON
)
2324 SendMessage16( hwnd
, WM_SYSCOMMAND
, SC_MINIMIZE
, *(LONG
*)&pt16
);
2326 SendMessage16( hwnd
, WM_SYSCOMMAND
,
2327 IsZoomed(hwnd
) ? SC_RESTORE
:SC_MAXIMIZE
, *(LONG
*)&pt16
);
2331 /***********************************************************************
2332 * NC_TrackCloseButton95
2334 * Track a mouse button press on the Win95 close button.
2337 NC_TrackCloseButton95 (HWND hwnd
, WORD wParam
)
2341 HDC hdc
= GetWindowDC( hwnd
);
2342 BOOL pressed
= TRUE
;
2346 NC_DrawCloseButton95 (hwnd
, hdc
, TRUE
);
2350 BOOL oldstate
= pressed
;
2351 MSG_InternalGetMessage( &msg
, 0, 0, 0, PM_REMOVE
, FALSE
);
2352 CONV_POINT32TO16( &msg
.pt
, &pt16
);
2354 pressed
= (NC_HandleNCHitTest( hwnd
, pt16
) == wParam
);
2355 if (pressed
!= oldstate
)
2356 NC_DrawCloseButton95 (hwnd
, hdc
, pressed
);
2357 } while (msg
.message
!= WM_LBUTTONUP
);
2359 NC_DrawCloseButton95 (hwnd
, hdc
, FALSE
);
2362 ReleaseDC( hwnd
, hdc
);
2363 if (!pressed
) return;
2365 SendMessage16( hwnd
, WM_SYSCOMMAND
, SC_CLOSE
, *(LONG
*)&pt16
);
2369 /***********************************************************************
2372 * Track a mouse button press on the horizontal or vertical scroll-bar.
2374 static void NC_TrackScrollBar( HWND hwnd
, WPARAM wParam
, POINT pt
)
2378 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
2380 if ((wParam
& 0xfff0) == SC_HSCROLL
)
2382 if ((wParam
& 0x0f) != HTHSCROLL
) goto END
;
2383 scrollbar
= SB_HORZ
;
2385 else /* SC_VSCROLL */
2387 if ((wParam
& 0x0f) != HTVSCROLL
) goto END
;
2388 scrollbar
= SB_VERT
;
2391 if (!(msg
= SEGPTR_NEW(MSG16
))) goto END
;
2392 pt
.x
-= wndPtr
->rectWindow
.left
;
2393 pt
.y
-= wndPtr
->rectWindow
.top
;
2395 SCROLL_HandleScrollEvent( hwnd
, scrollbar
, WM_LBUTTONDOWN
, pt
);
2399 GetMessage16( SEGPTR_GET(msg
), 0, 0, 0 );
2400 switch(msg
->message
)
2405 pt
.x
= LOWORD(msg
->lParam
) + wndPtr
->rectClient
.left
-
2406 wndPtr
->rectWindow
.left
;
2407 pt
.y
= HIWORD(msg
->lParam
) + wndPtr
->rectClient
.top
-
2408 wndPtr
->rectWindow
.top
;
2409 SCROLL_HandleScrollEvent( hwnd
, scrollbar
, msg
->message
, pt
);
2412 TranslateMessage16( msg
);
2413 DispatchMessage16( msg
);
2416 if (!IsWindow( hwnd
))
2421 } while (msg
->message
!= WM_LBUTTONUP
);
2424 WIN_ReleaseWndPtr(wndPtr
);
2427 /***********************************************************************
2428 * NC_HandleNCLButtonDown
2430 * Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
2432 LONG
NC_HandleNCLButtonDown( WND
* pWnd
, WPARAM16 wParam
, LPARAM lParam
)
2434 HWND hwnd
= pWnd
->hwndSelf
;
2436 switch(wParam
) /* Hit test */
2439 hwnd
= WIN_GetTopParent(hwnd
);
2441 if( WINPOS_SetActiveWindow(hwnd
, TRUE
, TRUE
) || (GetActiveWindow() == hwnd
) )
2442 SendMessage16( pWnd
->hwndSelf
, WM_SYSCOMMAND
, SC_MOVE
+ HTCAPTION
, lParam
);
2446 if( pWnd
->dwStyle
& WS_SYSMENU
)
2448 if( !(pWnd
->dwStyle
& WS_MINIMIZE
) )
2450 HDC hDC
= GetWindowDC(hwnd
);
2451 if (TWEAK_WineLook
== WIN31_LOOK
)
2452 NC_DrawSysButton( hwnd
, hDC
, TRUE
);
2454 NC_DrawSysButton95( hwnd
, hDC
, TRUE
);
2455 ReleaseDC( hwnd
, hDC
);
2457 SendMessage16( hwnd
, WM_SYSCOMMAND
, SC_MOUSEMENU
+ HTSYSMENU
, lParam
);
2462 SendMessage16( hwnd
, WM_SYSCOMMAND
, SC_MOUSEMENU
, lParam
);
2466 SendMessage16( hwnd
, WM_SYSCOMMAND
, SC_HSCROLL
+ HTHSCROLL
, lParam
);
2470 SendMessage16( hwnd
, WM_SYSCOMMAND
, SC_VSCROLL
+ HTVSCROLL
, lParam
);
2475 NC_TrackMinMaxBox( hwnd
, wParam
);
2479 if (TWEAK_WineLook
>= WIN95_LOOK
)
2480 NC_TrackCloseButton95 (hwnd
, wParam
);
2491 /* make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU */
2492 SendMessage16( hwnd
, WM_SYSCOMMAND
, SC_SIZE
+ wParam
- 2, lParam
);
2502 /***********************************************************************
2503 * NC_HandleNCLButtonDblClk
2505 * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
2507 LONG
NC_HandleNCLButtonDblClk( WND
*pWnd
, WPARAM16 wParam
, LPARAM lParam
)
2510 * if this is an icon, send a restore since we are handling
2513 if (pWnd
->dwStyle
& WS_MINIMIZE
)
2515 SendMessage16( pWnd
->hwndSelf
, WM_SYSCOMMAND
, SC_RESTORE
, lParam
);
2519 switch(wParam
) /* Hit test */
2522 /* stop processing if WS_MAXIMIZEBOX is missing */
2523 if (pWnd
->dwStyle
& WS_MAXIMIZEBOX
)
2524 SendMessage16( pWnd
->hwndSelf
, WM_SYSCOMMAND
,
2525 (pWnd
->dwStyle
& WS_MAXIMIZE
) ? SC_RESTORE
: SC_MAXIMIZE
,
2530 if (!(GetClassWord(pWnd
->hwndSelf
, GCW_STYLE
) & CS_NOCLOSE
))
2531 SendMessage16( pWnd
->hwndSelf
, WM_SYSCOMMAND
, SC_CLOSE
, lParam
);
2535 SendMessage16( pWnd
->hwndSelf
, WM_SYSCOMMAND
, SC_HSCROLL
+ HTHSCROLL
,
2540 SendMessage16( pWnd
->hwndSelf
, WM_SYSCOMMAND
, SC_VSCROLL
+ HTVSCROLL
,
2548 /***********************************************************************
2549 * NC_HandleSysCommand
2551 * Handle a WM_SYSCOMMAND message. Called from DefWindowProc().
2553 LONG
NC_HandleSysCommand( HWND hwnd
, WPARAM16 wParam
, POINT16 pt
)
2555 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
2557 UINT16 uCommand
= wParam
& 0xFFF0;
2559 TRACE_(nonclient
)("Handling WM_SYSCOMMAND %x %d,%d\n",
2560 wParam
, pt
.x
, pt
.y
);
2562 if (wndPtr
->dwStyle
& WS_CHILD
&& uCommand
!= SC_KEYMENU
)
2563 ScreenToClient16( wndPtr
->parent
->hwndSelf
, &pt
);
2569 NC_DoSizeMove( hwnd
, wParam
);
2573 ShowWindow( hwnd
, SW_MINIMIZE
);
2577 ShowWindow( hwnd
, SW_MAXIMIZE
);
2581 ShowWindow( hwnd
, SW_RESTORE
);
2585 WIN_ReleaseWndPtr(wndPtr
);
2586 return SendMessage16( hwnd
, WM_CLOSE
, 0, 0 );
2590 CONV_POINT16TO32( &pt
, &pt32
);
2591 NC_TrackScrollBar( hwnd
, wParam
, pt32
);
2595 CONV_POINT16TO32( &pt
, &pt32
);
2596 MENU_TrackMouseMenuBar( wndPtr
, wParam
& 0x000F, pt32
);
2600 MENU_TrackKbdMenuBar( wndPtr
, wParam
, pt
.x
);
2604 WinExec( "taskman.exe", SW_SHOWNORMAL
);
2608 if (wParam
== SC_ABOUTWINE
)
2609 ShellAboutA(hwnd
,"Wine", WINE_RELEASE_INFO
, 0);
2611 if (wParam
== SC_PUTMARK
)
2612 TRACE_(shell
)("Mark requested by user\n");
2619 FIXME_(nonclient
)("unimplemented!\n");
2622 WIN_ReleaseWndPtr(wndPtr
);