Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Non-client area window functions |
| 3 | * |
| 4 | * Copyright 1994 Alexandre Julliard |
Alexandre Julliard | 234bc24 | 1994-12-10 13:02:28 +0000 | [diff] [blame] | 5 | * |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 6 | */ |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 7 | |
Jeremy White | d3e22d9 | 2000-02-10 19:03:02 +0000 | [diff] [blame] | 8 | #include "windef.h" |
| 9 | #include "wingdi.h" |
Michael Veksler | 9d14a00 | 1999-05-08 12:40:24 +0000 | [diff] [blame] | 10 | #include "wine/winuser16.h" |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 11 | #include "version.h" |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 12 | #include "win.h" |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 13 | #include "user.h" |
Alex Korobka | 4f1ac05 | 1999-03-28 09:37:57 +0000 | [diff] [blame] | 14 | #include "dce.h" |
Alexandre Julliard | 91222da | 2000-12-10 23:01:33 +0000 | [diff] [blame] | 15 | #include "controls.h" |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 16 | #include "cursoricon.h" |
Alexandre Julliard | 234bc24 | 1994-12-10 13:02:28 +0000 | [diff] [blame] | 17 | #include "winpos.h" |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 18 | #include "hook.h" |
Alexandre Julliard | 234bc24 | 1994-12-10 13:02:28 +0000 | [diff] [blame] | 19 | #include "nonclient.h" |
Alexandre Julliard | 06c275a | 1999-05-02 14:32:27 +0000 | [diff] [blame] | 20 | #include "debugtools.h" |
Marcus Meissner | 317af32 | 1999-02-17 13:51:06 +0000 | [diff] [blame] | 21 | #include "shellapi.h" |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 22 | #include "bitmap.h" |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 23 | |
Dimitrie O. Paun | 529da54 | 2000-11-27 23:54:25 +0000 | [diff] [blame] | 24 | DEFAULT_DEBUG_CHANNEL(nonclient); |
| 25 | DECLARE_DEBUG_CHANNEL(shell); |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 26 | |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 27 | BOOL NC_DrawGrayButton(HDC hdc, int x, int y); |
| 28 | |
Alexandre Julliard | c1d35cc | 2001-01-24 19:47:57 +0000 | [diff] [blame] | 29 | static HBITMAP hbitmapClose; |
| 30 | static HBITMAP hbitmapMinimize; |
| 31 | static HBITMAP hbitmapMinimizeD; |
| 32 | static HBITMAP hbitmapMaximize; |
| 33 | static HBITMAP hbitmapMaximizeD; |
| 34 | static HBITMAP hbitmapRestore; |
| 35 | static HBITMAP hbitmapRestoreD; |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 36 | |
Alexandre Julliard | c1d35cc | 2001-01-24 19:47:57 +0000 | [diff] [blame] | 37 | static const BYTE lpGrayMask[] = { 0xAA, 0xA0, |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 38 | 0x55, 0x50, |
| 39 | 0xAA, 0xA0, |
| 40 | 0x55, 0x50, |
| 41 | 0xAA, 0xA0, |
| 42 | 0x55, 0x50, |
| 43 | 0xAA, 0xA0, |
| 44 | 0x55, 0x50, |
| 45 | 0xAA, 0xA0, |
| 46 | 0x55, 0x50}; |
| 47 | |
Alexandre Julliard | 3f2abfa | 1994-08-16 15:43:11 +0000 | [diff] [blame] | 48 | #define SC_ABOUTWINE (SC_SCREENSAVE+1) |
Uwe Bonnes | 3700777 | 1998-11-01 15:07:24 +0000 | [diff] [blame] | 49 | #define SC_PUTMARK (SC_SCREENSAVE+2) |
Alexandre Julliard | 3f2abfa | 1994-08-16 15:43:11 +0000 | [diff] [blame] | 50 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 51 | /* Some useful macros */ |
| 52 | #define HAS_DLGFRAME(style,exStyle) \ |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 53 | (((exStyle) & WS_EX_DLGMODALFRAME) || \ |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 54 | (((style) & WS_DLGFRAME) && !((style) & WS_THICKFRAME))) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 55 | |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 56 | #define HAS_THICKFRAME(style,exStyle) \ |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 57 | (((style) & WS_THICKFRAME) && \ |
Abey George | 48c6eb5 | 1999-09-03 12:33:40 +0000 | [diff] [blame] | 58 | !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME)) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 59 | |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 60 | #define HAS_THINFRAME(style) \ |
| 61 | (((style) & WS_BORDER) || !((style) & (WS_CHILD | WS_POPUP))) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 62 | |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 63 | #define HAS_BIGFRAME(style,exStyle) \ |
| 64 | (((style) & (WS_THICKFRAME | WS_DLGFRAME)) || \ |
| 65 | ((exStyle) & WS_EX_DLGMODALFRAME)) |
Gerard Patel | 5773dad | 1999-06-12 14:45:56 +0000 | [diff] [blame] | 66 | |
Bill Medland | cbfbf2a | 2001-07-20 18:36:49 +0000 | [diff] [blame] | 67 | #define HAS_STATICOUTERFRAME(style,exStyle) \ |
| 68 | (((exStyle) & (WS_EX_STATICEDGE|WS_EX_DLGMODALFRAME)) == \ |
| 69 | WS_EX_STATICEDGE) |
| 70 | |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 71 | #define HAS_ANYFRAME(style,exStyle) \ |
| 72 | (((style) & (WS_THICKFRAME | WS_DLGFRAME | WS_BORDER)) || \ |
| 73 | ((exStyle) & WS_EX_DLGMODALFRAME) || \ |
| 74 | !((style) & (WS_CHILD | WS_POPUP))) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 75 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 76 | #define HAS_MENU(w) (!((w)->dwStyle & WS_CHILD) && ((w)->wIDmenu != 0)) |
| 77 | |
Sylvain St-Germain | 00bf381 | 1999-07-24 12:11:22 +0000 | [diff] [blame] | 78 | |
| 79 | /*********************************************************************** |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 80 | * NC_AdjustRect |
| 81 | * |
| 82 | * Compute the size of the window rectangle from the size of the |
| 83 | * client rectangle. |
| 84 | */ |
Alexandre Julliard | 3abeae8 | 2001-05-09 17:21:04 +0000 | [diff] [blame] | 85 | static void NC_AdjustRect( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 86 | { |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 87 | if (TWEAK_WineLook > WIN31_LOOK) |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 88 | ERR("Called in Win95 mode. Aiee! Please report this.\n" ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 89 | |
Alexandre Julliard | bf9130a | 1996-10-13 17:45:47 +0000 | [diff] [blame] | 90 | if(style & WS_ICONIC) return; |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 91 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 92 | if (HAS_THICKFRAME( style, exStyle )) |
| 93 | InflateRect( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) ); |
| 94 | else if (HAS_DLGFRAME( style, exStyle )) |
| 95 | InflateRect( rect, GetSystemMetrics(SM_CXDLGFRAME), GetSystemMetrics(SM_CYDLGFRAME) ); |
| 96 | else if (HAS_THINFRAME( style )) |
| 97 | InflateRect( rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER)); |
| 98 | |
| 99 | if ((style & WS_CAPTION) == WS_CAPTION) |
| 100 | rect->top -= GetSystemMetrics(SM_CYCAPTION) - GetSystemMetrics(SM_CYBORDER); |
| 101 | |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 102 | if (menu) rect->top -= GetSystemMetrics(SM_CYMENU) + GetSystemMetrics(SM_CYBORDER); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 103 | |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 104 | if (style & WS_VSCROLL) { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 105 | rect->right += GetSystemMetrics(SM_CXVSCROLL) - 1; |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 106 | if(!HAS_ANYFRAME( style, exStyle )) |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 107 | rect->right++; |
| 108 | } |
| 109 | |
| 110 | if (style & WS_HSCROLL) { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 111 | rect->bottom += GetSystemMetrics(SM_CYHSCROLL) - 1; |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 112 | if(!HAS_ANYFRAME( style, exStyle )) |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 113 | rect->bottom++; |
| 114 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 118 | /****************************************************************************** |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 119 | * NC_AdjustRectOuter95 |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 120 | * |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 121 | * Computes the size of the "outside" parts of the window based on the |
| 122 | * parameters of the client area. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 123 | * |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 124 | + PARAMS |
| 125 | * LPRECT16 rect |
| 126 | * DWORD style |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 127 | * BOOL menu |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 128 | * DWORD exStyle |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 129 | * |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 130 | * NOTES |
| 131 | * "Outer" parts of a window means the whole window frame, caption and |
| 132 | * menu bar. It does not include "inner" parts of the frame like client |
| 133 | * edge, static edge or scroll bars. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 134 | * |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 135 | * Revision history |
| 136 | * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) |
| 137 | * Original (NC_AdjustRect95) cut & paste from NC_AdjustRect |
| 138 | * |
| 139 | * 20-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de) |
| 140 | * Split NC_AdjustRect95 into NC_AdjustRectOuter95 and |
| 141 | * NC_AdjustRectInner95 and added handling of Win95 styles. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 142 | * |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 143 | * 28-Jul-1999 Ove KÃ¥ven (ovek@arcticnet.no) |
| 144 | * Streamlined window style checks. |
| 145 | * |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 146 | *****************************************************************************/ |
| 147 | |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 148 | static void |
Alexandre Julliard | 3abeae8 | 2001-05-09 17:21:04 +0000 | [diff] [blame] | 149 | NC_AdjustRectOuter95 (LPRECT rect, DWORD style, BOOL menu, DWORD exStyle) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 150 | { |
Bill Medland | cbfbf2a | 2001-07-20 18:36:49 +0000 | [diff] [blame] | 151 | int adjust; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 152 | if(style & WS_ICONIC) return; |
| 153 | |
Bill Medland | cbfbf2a | 2001-07-20 18:36:49 +0000 | [diff] [blame] | 154 | if ((exStyle & (WS_EX_STATICEDGE|WS_EX_DLGMODALFRAME)) == |
| 155 | WS_EX_STATICEDGE) |
| 156 | { |
| 157 | adjust = 1; /* for the outer frame always present */ |
| 158 | } |
| 159 | else |
| 160 | { |
| 161 | adjust = 0; |
| 162 | if ((exStyle & WS_EX_DLGMODALFRAME) || |
| 163 | (style & (WS_THICKFRAME|WS_DLGFRAME))) adjust = 2; /* outer */ |
| 164 | } |
| 165 | if (style & WS_THICKFRAME) |
| 166 | adjust += ( GetSystemMetrics (SM_CXFRAME) |
| 167 | - GetSystemMetrics (SM_CXDLGFRAME)); /* The resize border */ |
| 168 | if ((style & (WS_BORDER|WS_DLGFRAME)) || |
| 169 | (exStyle & WS_EX_DLGMODALFRAME)) |
| 170 | adjust++; /* The other border */ |
| 171 | |
| 172 | InflateRect (rect, adjust, adjust); |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 173 | |
| 174 | if ((style & WS_CAPTION) == WS_CAPTION) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 175 | { |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 176 | if (exStyle & WS_EX_TOOLWINDOW) |
| 177 | rect->top -= GetSystemMetrics(SM_CYSMCAPTION); |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 178 | else |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 179 | rect->top -= GetSystemMetrics(SM_CYCAPTION); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 180 | } |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 181 | if (menu) rect->top -= GetSystemMetrics(SM_CYMENU); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | |
| 185 | /****************************************************************************** |
| 186 | * NC_AdjustRectInner95 |
| 187 | * |
| 188 | * Computes the size of the "inside" part of the window based on the |
| 189 | * parameters of the client area. |
| 190 | * |
| 191 | + PARAMS |
| 192 | * LPRECT16 rect |
| 193 | * DWORD style |
| 194 | * DWORD exStyle |
| 195 | * |
| 196 | * NOTES |
| 197 | * "Inner" part of a window means the window frame inside of the flat |
| 198 | * window frame. It includes the client edge, the static edge and the |
| 199 | * scroll bars. |
| 200 | * |
| 201 | * Revision history |
| 202 | * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) |
| 203 | * Original (NC_AdjustRect95) cut & paste from NC_AdjustRect |
| 204 | * |
| 205 | * 20-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de) |
| 206 | * Split NC_AdjustRect95 into NC_AdjustRectOuter95 and |
| 207 | * NC_AdjustRectInner95 and added handling of Win95 styles. |
| 208 | * |
| 209 | *****************************************************************************/ |
| 210 | |
| 211 | static void |
Alexandre Julliard | 3abeae8 | 2001-05-09 17:21:04 +0000 | [diff] [blame] | 212 | NC_AdjustRectInner95 (LPRECT rect, DWORD style, DWORD exStyle) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 213 | { |
| 214 | if(style & WS_ICONIC) return; |
| 215 | |
| 216 | if (exStyle & WS_EX_CLIENTEDGE) |
Alexandre Julliard | 3abeae8 | 2001-05-09 17:21:04 +0000 | [diff] [blame] | 217 | InflateRect(rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 218 | |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 219 | if (style & WS_VSCROLL) rect->right += GetSystemMetrics(SM_CXVSCROLL); |
| 220 | if (style & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 224 | |
| 225 | static HICON NC_IconForWindow( HWND hwnd ) |
| 226 | { |
| 227 | HICON hIcon = (HICON) GetClassLongA( hwnd, GCL_HICONSM ); |
| 228 | if (!hIcon) hIcon = (HICON) GetClassLongA( hwnd, GCL_HICON ); |
| 229 | |
| 230 | /* If there is no hIcon specified and this is a modal dialog, |
| 231 | * get the default one. |
| 232 | */ |
| 233 | if (!hIcon && (GetWindowLongA( hwnd, GWL_STYLE ) & DS_MODALFRAME)) |
| 234 | hIcon = LoadImageA(0, IDI_WINLOGOA, IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR); |
| 235 | return hIcon; |
| 236 | } |
| 237 | |
Alexandre Julliard | e658d82 | 1997-11-30 17:45:40 +0000 | [diff] [blame] | 238 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 239 | * DrawCaption (USER32.@) Draws a caption bar |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 240 | * |
| 241 | * PARAMS |
| 242 | * hwnd [I] |
| 243 | * hdc [I] |
| 244 | * lpRect [I] |
| 245 | * uFlags [I] |
| 246 | * |
Eric Kohl | d0b79c0 | 1998-10-24 10:45:42 +0000 | [diff] [blame] | 247 | * RETURNS |
| 248 | * Success: |
| 249 | * Failure: |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 250 | */ |
| 251 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 252 | BOOL WINAPI |
| 253 | DrawCaption (HWND hwnd, HDC hdc, const RECT *lpRect, UINT uFlags) |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 254 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 255 | return DrawCaptionTempA (hwnd, hdc, lpRect, 0, 0, NULL, uFlags & 0x1F); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 256 | } |
| 257 | |
| 258 | |
| 259 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 260 | * DrawCaptionTempA (USER32.@) |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 261 | */ |
Alexandre Julliard | 193cf50 | 2002-01-01 00:24:30 +0000 | [diff] [blame^] | 262 | BOOL WINAPI DrawCaptionTempA (HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, |
| 263 | HICON hIcon, LPCSTR str, UINT uFlags) |
| 264 | { |
| 265 | LPWSTR strW; |
| 266 | INT len; |
| 267 | BOOL ret = FALSE; |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 268 | |
Alexandre Julliard | 193cf50 | 2002-01-01 00:24:30 +0000 | [diff] [blame^] | 269 | if (!(uFlags & DC_TEXT) || !str) |
| 270 | return DrawCaptionTempW( hwnd, hdc, rect, hFont, hIcon, NULL, uFlags ); |
| 271 | |
| 272 | len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); |
| 273 | if ((strW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) |
| 274 | { |
| 275 | MultiByteToWideChar( CP_ACP, 0, str, -1, strW, len ); |
| 276 | ret = DrawCaptionTempW (hwnd, hdc, rect, hFont, hIcon, strW, uFlags); |
| 277 | HeapFree( GetProcessHeap (), 0, strW ); |
| 278 | } |
| 279 | return ret; |
| 280 | } |
| 281 | |
| 282 | |
| 283 | /*********************************************************************** |
| 284 | * DrawCaptionTempW (USER32.@) |
| 285 | */ |
| 286 | BOOL WINAPI DrawCaptionTempW (HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, |
| 287 | HICON hIcon, LPCWSTR str, UINT uFlags) |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 288 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 289 | RECT rc = *rect; |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 290 | |
Alexandre Julliard | 193cf50 | 2002-01-01 00:24:30 +0000 | [diff] [blame^] | 291 | TRACE("(%08x,%08x,%p,%08x,%08x,%s,%08x)\n", |
| 292 | hwnd, hdc, rect, hFont, hIcon, debugstr_w(str), uFlags); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 293 | |
| 294 | /* drawing background */ |
| 295 | if (uFlags & DC_INBUTTON) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 296 | FillRect (hdc, &rc, GetSysColorBrush (COLOR_3DFACE)); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 297 | |
| 298 | if (uFlags & DC_ACTIVE) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 299 | HBRUSH hbr = SelectObject (hdc, CACHE_GetPattern55AABrush ()); |
| 300 | PatBlt (hdc, rc.left, rc.top, |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 301 | rc.right-rc.left, rc.bottom-rc.top, 0xFA0089); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 302 | SelectObject (hdc, hbr); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 303 | } |
| 304 | } |
| 305 | else { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 306 | FillRect (hdc, &rc, GetSysColorBrush ((uFlags & DC_ACTIVE) ? |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 307 | COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION)); |
| 308 | } |
| 309 | |
| 310 | |
| 311 | /* drawing icon */ |
| 312 | if ((uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP)) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 313 | POINT pt; |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 314 | |
| 315 | pt.x = rc.left + 2; |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 316 | pt.y = (rc.bottom + rc.top - GetSystemMetrics(SM_CYSMICON)) / 2; |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 317 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 318 | if (!hIcon) hIcon = NC_IconForWindow(hwnd); |
| 319 | DrawIconEx (hdc, pt.x, pt.y, hIcon, GetSystemMetrics(SM_CXSMICON), |
| 320 | GetSystemMetrics(SM_CYSMICON), 0, 0, DI_NORMAL); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 321 | rc.left += (rc.bottom - rc.top); |
| 322 | } |
| 323 | |
| 324 | /* drawing text */ |
| 325 | if (uFlags & DC_TEXT) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 326 | HFONT hOldFont; |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 327 | |
| 328 | if (uFlags & DC_INBUTTON) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 329 | SetTextColor (hdc, GetSysColor (COLOR_BTNTEXT)); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 330 | else if (uFlags & DC_ACTIVE) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 331 | SetTextColor (hdc, GetSysColor (COLOR_CAPTIONTEXT)); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 332 | else |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 333 | SetTextColor (hdc, GetSysColor (COLOR_INACTIVECAPTIONTEXT)); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 334 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 335 | SetBkMode (hdc, TRANSPARENT); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 336 | |
| 337 | if (hFont) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 338 | hOldFont = SelectObject (hdc, hFont); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 339 | else { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 340 | NONCLIENTMETRICSA nclm; |
| 341 | HFONT hNewFont; |
| 342 | nclm.cbSize = sizeof(NONCLIENTMETRICSA); |
| 343 | SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0); |
| 344 | hNewFont = CreateFontIndirectA ((uFlags & DC_SMALLCAP) ? |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 345 | &nclm.lfSmCaptionFont : &nclm.lfCaptionFont); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 346 | hOldFont = SelectObject (hdc, hNewFont); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 347 | } |
| 348 | |
| 349 | if (str) |
Alexandre Julliard | 193cf50 | 2002-01-01 00:24:30 +0000 | [diff] [blame^] | 350 | DrawTextW (hdc, str, -1, &rc, |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 351 | DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT); |
| 352 | else { |
Alexandre Julliard | 193cf50 | 2002-01-01 00:24:30 +0000 | [diff] [blame^] | 353 | WCHAR szText[128]; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 354 | INT nLen; |
Alexandre Julliard | 193cf50 | 2002-01-01 00:24:30 +0000 | [diff] [blame^] | 355 | nLen = GetWindowTextW (hwnd, szText, 128); |
| 356 | DrawTextW (hdc, szText, nLen, &rc, |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 357 | DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT); |
| 358 | } |
| 359 | |
| 360 | if (hFont) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 361 | SelectObject (hdc, hOldFont); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 362 | else |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 363 | DeleteObject (SelectObject (hdc, hOldFont)); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 364 | } |
| 365 | |
| 366 | /* drawing focus ??? */ |
| 367 | if (uFlags & 0x2000) |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 368 | FIXME("undocumented flag (0x2000)!\n"); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 369 | |
| 370 | return 0; |
| 371 | } |
| 372 | |
| 373 | |
| 374 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 375 | * AdjustWindowRect (USER.102) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 376 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 377 | BOOL16 WINAPI AdjustWindowRect16( LPRECT16 rect, DWORD style, BOOL16 menu ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 378 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 379 | return AdjustWindowRectEx16( rect, style, menu, 0 ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 380 | } |
| 381 | |
| 382 | |
| 383 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 384 | * AdjustWindowRect (USER32.@) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 385 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 386 | BOOL WINAPI AdjustWindowRect( LPRECT rect, DWORD style, BOOL menu ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 387 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 388 | return AdjustWindowRectEx( rect, style, menu, 0 ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 389 | } |
| 390 | |
| 391 | |
| 392 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 393 | * AdjustWindowRectEx (USER.454) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 394 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 395 | BOOL16 WINAPI AdjustWindowRectEx16( LPRECT16 rect, DWORD style, |
| 396 | BOOL16 menu, DWORD exStyle ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 397 | { |
Alexandre Julliard | 3abeae8 | 2001-05-09 17:21:04 +0000 | [diff] [blame] | 398 | RECT rect32; |
| 399 | BOOL ret; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 400 | |
Alexandre Julliard | 3abeae8 | 2001-05-09 17:21:04 +0000 | [diff] [blame] | 401 | CONV_RECT16TO32( rect, &rect32 ); |
| 402 | ret = AdjustWindowRectEx( &rect32, style, menu, exStyle ); |
| 403 | CONV_RECT32TO16( &rect32, rect ); |
| 404 | return ret; |
| 405 | } |
| 406 | |
| 407 | |
| 408 | /*********************************************************************** |
| 409 | * AdjustWindowRectEx (USER32.@) |
| 410 | */ |
| 411 | BOOL WINAPI AdjustWindowRectEx( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle ) |
| 412 | { |
| 413 | /* Correct the window style */ |
| 414 | |
| 415 | if (!(style & (WS_POPUP | WS_CHILD))) style |= WS_CAPTION; /* Overlapped window */ |
Alexandre Julliard | 84c70f5 | 1997-05-09 08:40:27 +0000 | [diff] [blame] | 416 | style &= (WS_DLGFRAME | WS_BORDER | WS_THICKFRAME | WS_CHILD); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 417 | exStyle &= (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | |
Alexandre Julliard | 3abeae8 | 2001-05-09 17:21:04 +0000 | [diff] [blame] | 418 | WS_EX_STATICEDGE | WS_EX_TOOLWINDOW); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 419 | if (exStyle & WS_EX_DLGMODALFRAME) style &= ~WS_THICKFRAME; |
| 420 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 421 | TRACE("(%d,%d)-(%d,%d) %08lx %d %08lx\n", |
| 422 | rect->left, rect->top, rect->right, rect->bottom, |
| 423 | style, menu, exStyle ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 424 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 425 | if (TWEAK_WineLook == WIN31_LOOK) |
Alexandre Julliard | 3abeae8 | 2001-05-09 17:21:04 +0000 | [diff] [blame] | 426 | NC_AdjustRect( rect, style, menu, exStyle ); |
| 427 | else |
| 428 | { |
| 429 | NC_AdjustRectOuter95( rect, style, menu, exStyle ); |
| 430 | NC_AdjustRectInner95( rect, style, exStyle ); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 431 | } |
Alexandre Julliard | 7e56f68 | 1996-01-31 19:02:28 +0000 | [diff] [blame] | 432 | return TRUE; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 433 | } |
| 434 | |
| 435 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 436 | /*********************************************************************** |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 437 | * NC_HandleNCCalcSize |
| 438 | * |
| 439 | * Handle a WM_NCCALCSIZE message. Called from DefWindowProc(). |
| 440 | */ |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 441 | LONG NC_HandleNCCalcSize( HWND hwnd, RECT *winRect ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 442 | { |
Alexandre Julliard | 3abeae8 | 2001-05-09 17:21:04 +0000 | [diff] [blame] | 443 | RECT tmpRect = { 0, 0, 0, 0 }; |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 444 | LONG result = 0; |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 445 | LONG cls_style = GetClassLongA(hwnd, GCL_STYLE); |
| 446 | LONG style = GetWindowLongA( hwnd, GWL_STYLE ); |
| 447 | LONG exStyle = GetWindowLongA( hwnd, GWL_EXSTYLE ); |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 448 | |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 449 | if (cls_style & CS_VREDRAW) result |= WVR_VREDRAW; |
| 450 | if (cls_style & CS_HREDRAW) result |= WVR_HREDRAW; |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 451 | |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 452 | if (!IsIconic(hwnd)) |
| 453 | { |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 454 | if (TWEAK_WineLook == WIN31_LOOK) |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 455 | NC_AdjustRect( &tmpRect, style, FALSE, exStyle ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 456 | else |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 457 | NC_AdjustRectOuter95( &tmpRect, style, FALSE, exStyle ); |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 458 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 459 | winRect->left -= tmpRect.left; |
| 460 | winRect->top -= tmpRect.top; |
| 461 | winRect->right -= tmpRect.right; |
| 462 | winRect->bottom -= tmpRect.bottom; |
| 463 | |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 464 | if (!(style & WS_CHILD) && GetMenu(hwnd)) |
| 465 | { |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 466 | TRACE("Calling GetMenuBarHeight with HWND 0x%x, width %d, " |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 467 | "at (%d, %d).\n", hwnd, |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 468 | winRect->right - winRect->left, |
| 469 | -tmpRect.left, -tmpRect.top ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 470 | |
| 471 | winRect->top += |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 472 | MENU_GetMenuBarHeight( hwnd, |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 473 | winRect->right - winRect->left, |
| 474 | -tmpRect.left, -tmpRect.top ) + 1; |
| 475 | } |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 476 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 477 | if (TWEAK_WineLook > WIN31_LOOK) { |
Alexandre Julliard | 3abeae8 | 2001-05-09 17:21:04 +0000 | [diff] [blame] | 478 | SetRect(&tmpRect, 0, 0, 0, 0); |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 479 | NC_AdjustRectInner95 (&tmpRect, style, exStyle); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 480 | winRect->left -= tmpRect.left; |
| 481 | winRect->top -= tmpRect.top; |
| 482 | winRect->right -= tmpRect.right; |
| 483 | winRect->bottom -= tmpRect.bottom; |
| 484 | } |
Mike McCormack | a2bdade | 2000-09-12 23:37:57 +0000 | [diff] [blame] | 485 | |
| 486 | if (winRect->top > winRect->bottom) |
| 487 | winRect->bottom = winRect->top; |
| 488 | |
| 489 | if (winRect->left > winRect->right) |
| 490 | winRect->right = winRect->left; |
Alexandre Julliard | 2d159fb | 1994-07-15 16:04:31 +0000 | [diff] [blame] | 491 | } |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 492 | return result; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 493 | } |
| 494 | |
| 495 | |
| 496 | /*********************************************************************** |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 497 | * NC_GetInsideRect |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 498 | * |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 499 | * Get the 'inside' rectangle of a window, i.e. the whole window rectangle |
| 500 | * but without the borders (if any). |
| 501 | * The rectangle is in window coordinates (for drawing with GetWindowDC()). |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 502 | */ |
Alexandre Julliard | 3abeae8 | 2001-05-09 17:21:04 +0000 | [diff] [blame] | 503 | void NC_GetInsideRect( HWND hwnd, RECT *rect ) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 504 | { |
| 505 | WND * wndPtr = WIN_FindWndPtr( hwnd ); |
| 506 | |
| 507 | rect->top = rect->left = 0; |
| 508 | rect->right = wndPtr->rectWindow.right - wndPtr->rectWindow.left; |
| 509 | rect->bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top; |
| 510 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 511 | if (wndPtr->dwStyle & WS_ICONIC) goto END; |
Alexandre Julliard | 3ed37e0 | 1994-11-07 18:20:42 +0000 | [diff] [blame] | 512 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 513 | /* Remove frame from rectangle */ |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 514 | if (HAS_THICKFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 515 | { |
Alexandre Julliard | 3abeae8 | 2001-05-09 17:21:04 +0000 | [diff] [blame] | 516 | InflateRect( rect, -GetSystemMetrics(SM_CXFRAME), -GetSystemMetrics(SM_CYFRAME) ); |
| 517 | } |
| 518 | else if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) |
| 519 | { |
| 520 | InflateRect( rect, -GetSystemMetrics(SM_CXDLGFRAME), -GetSystemMetrics(SM_CYDLGFRAME)); |
| 521 | /* FIXME: this isn't in NC_AdjustRect? why not? */ |
| 522 | if ((TWEAK_WineLook == WIN31_LOOK) && (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME)) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 523 | InflateRect( rect, -1, 0 ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 524 | } |
Alexandre Julliard | 3abeae8 | 2001-05-09 17:21:04 +0000 | [diff] [blame] | 525 | else if (HAS_THINFRAME( wndPtr->dwStyle )) |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 526 | { |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 527 | InflateRect( rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER) ); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 528 | } |
| 529 | |
Francis Beaudet | 1cc0a9a | 1999-09-03 15:00:45 +0000 | [diff] [blame] | 530 | /* We have additional border information if the window |
| 531 | * is a child (but not an MDI child) */ |
Alexandre Julliard | 3abeae8 | 2001-05-09 17:21:04 +0000 | [diff] [blame] | 532 | if (TWEAK_WineLook != WIN31_LOOK) |
| 533 | { |
| 534 | if ( (wndPtr->dwStyle & WS_CHILD) && |
| 535 | ( (wndPtr->dwExStyle & WS_EX_MDICHILD) == 0 ) ) |
| 536 | { |
| 537 | if (wndPtr->dwExStyle & WS_EX_CLIENTEDGE) |
| 538 | InflateRect (rect, -GetSystemMetrics(SM_CXEDGE), -GetSystemMetrics(SM_CYEDGE)); |
| 539 | if (wndPtr->dwExStyle & WS_EX_STATICEDGE) |
| 540 | InflateRect (rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER)); |
| 541 | } |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 542 | } |
Alexandre Julliard | 3abeae8 | 2001-05-09 17:21:04 +0000 | [diff] [blame] | 543 | |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 544 | END: |
| 545 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 546 | return; |
| 547 | } |
| 548 | |
| 549 | |
| 550 | /*********************************************************************** |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 551 | * NC_DoNCHitTest |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 552 | * |
Andreas Mohr | 260f1a1 | 2000-09-22 20:59:29 +0000 | [diff] [blame] | 553 | * Handle a WM_NCHITTEST message. Called from NC_HandleNCHitTest(). |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 554 | */ |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 555 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 556 | static LONG NC_DoNCHitTest (WND *wndPtr, POINT pt ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 557 | { |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 558 | RECT rect; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 559 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 560 | TRACE("hwnd=%04x pt=%ld,%ld\n", wndPtr->hwndSelf, pt.x, pt.y ); |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 561 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 562 | GetWindowRect(wndPtr->hwndSelf, &rect ); |
| 563 | if (!PtInRect( &rect, pt )) return HTNOWHERE; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 564 | |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 565 | if (wndPtr->dwStyle & WS_MINIMIZE) return HTCAPTION; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 566 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 567 | /* Check borders */ |
| 568 | if (HAS_THICKFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 569 | { |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 570 | InflateRect( &rect, -GetSystemMetrics(SM_CXFRAME), -GetSystemMetrics(SM_CYFRAME) ); |
| 571 | if (!PtInRect( &rect, pt )) |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 572 | { |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 573 | /* Check top sizing border */ |
| 574 | if (pt.y < rect.top) |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 575 | { |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 576 | if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT; |
| 577 | if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT; |
| 578 | return HTTOP; |
| 579 | } |
| 580 | /* Check bottom sizing border */ |
| 581 | if (pt.y >= rect.bottom) |
| 582 | { |
| 583 | if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT; |
| 584 | if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT; |
| 585 | return HTBOTTOM; |
| 586 | } |
| 587 | /* Check left sizing border */ |
| 588 | if (pt.x < rect.left) |
| 589 | { |
| 590 | if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT; |
| 591 | if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT; |
| 592 | return HTLEFT; |
| 593 | } |
| 594 | /* Check right sizing border */ |
| 595 | if (pt.x >= rect.right) |
| 596 | { |
| 597 | if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT; |
| 598 | if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT; |
| 599 | return HTRIGHT; |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 600 | } |
| 601 | } |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 602 | } |
| 603 | else /* No thick frame */ |
| 604 | { |
| 605 | if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) |
| 606 | InflateRect(&rect, -GetSystemMetrics(SM_CXDLGFRAME), -GetSystemMetrics(SM_CYDLGFRAME)); |
| 607 | else if (HAS_THINFRAME( wndPtr->dwStyle )) |
| 608 | InflateRect(&rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER)); |
| 609 | if (!PtInRect( &rect, pt )) return HTBORDER; |
| 610 | } |
| 611 | |
| 612 | /* Check caption */ |
| 613 | |
| 614 | if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION) |
| 615 | { |
| 616 | rect.top += GetSystemMetrics(SM_CYCAPTION) - GetSystemMetrics(SM_CYBORDER); |
| 617 | if (!PtInRect( &rect, pt )) |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 618 | { |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 619 | /* Check system menu */ |
| 620 | if ((wndPtr->dwStyle & WS_SYSMENU) && !(wndPtr->dwExStyle & WS_EX_TOOLWINDOW)) |
| 621 | rect.left += GetSystemMetrics(SM_CXSIZE); |
| 622 | if (pt.x <= rect.left) return HTSYSMENU; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 623 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 624 | /* Check maximize box */ |
| 625 | if (wndPtr->dwStyle & WS_MAXIMIZEBOX) |
| 626 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 627 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 628 | if (pt.x >= rect.right) return HTMAXBUTTON; |
| 629 | /* Check minimize box */ |
| 630 | if (wndPtr->dwStyle & WS_MINIMIZEBOX) |
| 631 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
| 632 | if (pt.x >= rect.right) return HTMINBUTTON; |
| 633 | return HTCAPTION; |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 634 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 635 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 636 | |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 637 | /* Check client area */ |
| 638 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 639 | ScreenToClient( wndPtr->hwndSelf, &pt ); |
| 640 | GetClientRect( wndPtr->hwndSelf, &rect ); |
| 641 | if (PtInRect( &rect, pt )) return HTCLIENT; |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 642 | |
| 643 | /* Check vertical scroll bar */ |
| 644 | |
| 645 | if (wndPtr->dwStyle & WS_VSCROLL) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 646 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 647 | rect.right += GetSystemMetrics(SM_CXVSCROLL); |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 648 | if (PtInRect( &rect, pt )) return HTVSCROLL; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 649 | } |
| 650 | |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 651 | /* Check horizontal scroll bar */ |
| 652 | |
| 653 | if (wndPtr->dwStyle & WS_HSCROLL) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 654 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 655 | rect.bottom += GetSystemMetrics(SM_CYHSCROLL); |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 656 | if (PtInRect( &rect, pt )) |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 657 | { |
| 658 | /* Check size box */ |
| 659 | if ((wndPtr->dwStyle & WS_VSCROLL) && |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 660 | (pt.x >= rect.right - GetSystemMetrics(SM_CXVSCROLL))) |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 661 | return HTSIZE; |
| 662 | return HTHSCROLL; |
| 663 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 664 | } |
| 665 | |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 666 | /* Check menu bar */ |
| 667 | |
| 668 | if (HAS_MENU(wndPtr)) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 669 | { |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 670 | if ((pt.y < 0) && (pt.x >= 0) && (pt.x < rect.right)) |
| 671 | return HTMENU; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 672 | } |
| 673 | |
Francois Boisvert | 5538ec4 | 2000-07-29 00:00:29 +0000 | [diff] [blame] | 674 | /* Has to return HTNOWHERE if nothing was found |
| 675 | Could happen when a window has a customized non client area */ |
| 676 | return HTNOWHERE; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 677 | } |
| 678 | |
| 679 | |
| 680 | /*********************************************************************** |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 681 | * NC_DoNCHitTest95 |
| 682 | * |
| 683 | * Handle a WM_NCHITTEST message. Called from NC_HandleNCHitTest(). |
| 684 | * |
Alexandre Julliard | 829fe32 | 1998-07-26 14:27:39 +0000 | [diff] [blame] | 685 | * FIXME: Just a modified copy of the Win 3.1 version. |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 686 | */ |
| 687 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 688 | static LONG NC_DoNCHitTest95 (WND *wndPtr, POINT pt ) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 689 | { |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 690 | RECT rect; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 691 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 692 | TRACE("hwnd=%04x pt=%ld,%ld\n", wndPtr->hwndSelf, pt.x, pt.y ); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 693 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 694 | GetWindowRect(wndPtr->hwndSelf, &rect ); |
| 695 | if (!PtInRect( &rect, pt )) return HTNOWHERE; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 696 | |
| 697 | if (wndPtr->dwStyle & WS_MINIMIZE) return HTCAPTION; |
| 698 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 699 | /* Check borders */ |
| 700 | if (HAS_THICKFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 701 | { |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 702 | InflateRect( &rect, -GetSystemMetrics(SM_CXFRAME), -GetSystemMetrics(SM_CYFRAME) ); |
| 703 | if (!PtInRect( &rect, pt )) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 704 | { |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 705 | /* Check top sizing border */ |
| 706 | if (pt.y < rect.top) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 707 | { |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 708 | if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT; |
| 709 | if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT; |
| 710 | return HTTOP; |
| 711 | } |
| 712 | /* Check bottom sizing border */ |
| 713 | if (pt.y >= rect.bottom) |
| 714 | { |
| 715 | if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT; |
| 716 | if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT; |
| 717 | return HTBOTTOM; |
| 718 | } |
| 719 | /* Check left sizing border */ |
| 720 | if (pt.x < rect.left) |
| 721 | { |
| 722 | if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT; |
| 723 | if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT; |
| 724 | return HTLEFT; |
| 725 | } |
| 726 | /* Check right sizing border */ |
| 727 | if (pt.x >= rect.right) |
| 728 | { |
| 729 | if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT; |
| 730 | if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT; |
| 731 | return HTRIGHT; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 732 | } |
| 733 | } |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 734 | } |
| 735 | else /* No thick frame */ |
| 736 | { |
| 737 | if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) |
| 738 | InflateRect(&rect, -GetSystemMetrics(SM_CXDLGFRAME), -GetSystemMetrics(SM_CYDLGFRAME)); |
| 739 | else if (HAS_THINFRAME( wndPtr->dwStyle )) |
| 740 | InflateRect(&rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER)); |
| 741 | if (!PtInRect( &rect, pt )) return HTBORDER; |
| 742 | } |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 743 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 744 | /* Check caption */ |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 745 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 746 | if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION) |
| 747 | { |
| 748 | if (wndPtr->dwExStyle & WS_EX_TOOLWINDOW) |
| 749 | rect.top += GetSystemMetrics(SM_CYSMCAPTION) - 1; |
| 750 | else |
| 751 | rect.top += GetSystemMetrics(SM_CYCAPTION) - 1; |
| 752 | if (!PtInRect( &rect, pt )) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 753 | { |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 754 | /* Check system menu */ |
| 755 | if ((wndPtr->dwStyle & WS_SYSMENU) && !(wndPtr->dwExStyle & WS_EX_TOOLWINDOW)) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 756 | { |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 757 | if (NC_IconForWindow(wndPtr->hwndSelf)) |
| 758 | rect.left += GetSystemMetrics(SM_CYCAPTION) - 1; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 759 | } |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 760 | if (pt.x < rect.left) return HTSYSMENU; |
| 761 | |
| 762 | /* Check close button */ |
| 763 | if (wndPtr->dwStyle & WS_SYSMENU) |
| 764 | rect.right -= GetSystemMetrics(SM_CYCAPTION) - 1; |
| 765 | if (pt.x > rect.right) return HTCLOSE; |
| 766 | |
| 767 | /* Check maximize box */ |
| 768 | /* In win95 there is automatically a Maximize button when there is a minimize one*/ |
| 769 | if ((wndPtr->dwStyle & WS_MAXIMIZEBOX)|| (wndPtr->dwStyle & WS_MINIMIZEBOX)) |
| 770 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
| 771 | if (pt.x > rect.right) return HTMAXBUTTON; |
| 772 | |
| 773 | /* Check minimize box */ |
| 774 | /* In win95 there is automatically a Maximize button when there is a Maximize one*/ |
| 775 | if ((wndPtr->dwStyle & WS_MINIMIZEBOX)||(wndPtr->dwStyle & WS_MAXIMIZEBOX)) |
| 776 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
| 777 | |
| 778 | if (pt.x > rect.right) return HTMINBUTTON; |
| 779 | return HTCAPTION; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 780 | } |
| 781 | } |
| 782 | |
| 783 | /* Check client area */ |
| 784 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 785 | ScreenToClient( wndPtr->hwndSelf, &pt ); |
| 786 | GetClientRect( wndPtr->hwndSelf, &rect ); |
| 787 | if (PtInRect( &rect, pt )) return HTCLIENT; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 788 | |
| 789 | /* Check vertical scroll bar */ |
| 790 | |
| 791 | if (wndPtr->dwStyle & WS_VSCROLL) |
| 792 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 793 | rect.right += GetSystemMetrics(SM_CXVSCROLL); |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 794 | if (PtInRect( &rect, pt )) return HTVSCROLL; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 795 | } |
| 796 | |
| 797 | /* Check horizontal scroll bar */ |
| 798 | |
| 799 | if (wndPtr->dwStyle & WS_HSCROLL) |
| 800 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 801 | rect.bottom += GetSystemMetrics(SM_CYHSCROLL); |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 802 | if (PtInRect( &rect, pt )) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 803 | { |
| 804 | /* Check size box */ |
| 805 | if ((wndPtr->dwStyle & WS_VSCROLL) && |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 806 | (pt.x >= rect.right - GetSystemMetrics(SM_CXVSCROLL))) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 807 | return HTSIZE; |
| 808 | return HTHSCROLL; |
| 809 | } |
| 810 | } |
| 811 | |
| 812 | /* Check menu bar */ |
| 813 | |
| 814 | if (HAS_MENU(wndPtr)) |
| 815 | { |
| 816 | if ((pt.y < 0) && (pt.x >= 0) && (pt.x < rect.right)) |
| 817 | return HTMENU; |
| 818 | } |
| 819 | |
Francois Boisvert | 5538ec4 | 2000-07-29 00:00:29 +0000 | [diff] [blame] | 820 | /* Has to return HTNOWHERE if nothing was found |
| 821 | Could happen when a window has a customized non client area */ |
| 822 | return HTNOWHERE; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 823 | } |
| 824 | |
| 825 | |
| 826 | /*********************************************************************** |
| 827 | * NC_HandleNCHitTest |
| 828 | * |
| 829 | * Handle a WM_NCHITTEST message. Called from DefWindowProc(). |
| 830 | */ |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 831 | LONG NC_HandleNCHitTest (HWND hwnd , POINT pt) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 832 | { |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 833 | LONG retvalue; |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 834 | WND *wndPtr = WIN_FindWndPtr (hwnd); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 835 | |
| 836 | if (!wndPtr) |
| 837 | return HTERROR; |
| 838 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 839 | if (TWEAK_WineLook == WIN31_LOOK) |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 840 | retvalue = NC_DoNCHitTest (wndPtr, pt); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 841 | else |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 842 | retvalue = NC_DoNCHitTest95 (wndPtr, pt); |
| 843 | WIN_ReleaseWndPtr(wndPtr); |
| 844 | return retvalue; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 845 | } |
| 846 | |
| 847 | |
| 848 | /*********************************************************************** |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 849 | * NC_DrawSysButton |
| 850 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 851 | void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down ) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 852 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 853 | RECT rect; |
| 854 | HDC hdcMem; |
| 855 | HBITMAP hbitmap; |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 856 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 857 | NC_GetInsideRect( hwnd, &rect ); |
| 858 | hdcMem = CreateCompatibleDC( hdc ); |
| 859 | hbitmap = SelectObject( hdcMem, hbitmapClose ); |
| 860 | BitBlt(hdc, rect.left, rect.top, GetSystemMetrics(SM_CXSIZE), GetSystemMetrics(SM_CYSIZE), |
| 861 | hdcMem, (GetWindowLongA(hwnd,GWL_STYLE) & WS_CHILD) ? GetSystemMetrics(SM_CXSIZE) : 0, 0, |
| 862 | down ? NOTSRCCOPY : SRCCOPY ); |
| 863 | SelectObject( hdcMem, hbitmap ); |
| 864 | DeleteDC( hdcMem ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 865 | } |
| 866 | |
| 867 | |
| 868 | /*********************************************************************** |
| 869 | * NC_DrawMaxButton |
| 870 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 871 | static void NC_DrawMaxButton( HWND hwnd, HDC16 hdc, BOOL down ) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 872 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 873 | RECT rect; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 874 | HDC hdcMem; |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 875 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 876 | NC_GetInsideRect( hwnd, &rect ); |
| 877 | hdcMem = CreateCompatibleDC( hdc ); |
| 878 | SelectObject( hdcMem, (IsZoomed(hwnd) |
| 879 | ? (down ? hbitmapRestoreD : hbitmapRestore) |
| 880 | : (down ? hbitmapMaximizeD : hbitmapMaximize)) ); |
| 881 | BitBlt( hdc, rect.right - GetSystemMetrics(SM_CXSIZE) - 1, rect.top, |
| 882 | GetSystemMetrics(SM_CXSIZE) + 1, GetSystemMetrics(SM_CYSIZE), hdcMem, 0, 0, |
| 883 | SRCCOPY ); |
| 884 | DeleteDC( hdcMem ); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 885 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 886 | } |
| 887 | |
| 888 | |
| 889 | /*********************************************************************** |
| 890 | * NC_DrawMinButton |
| 891 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 892 | static void NC_DrawMinButton( HWND hwnd, HDC16 hdc, BOOL down ) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 893 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 894 | RECT rect; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 895 | HDC hdcMem; |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 896 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 897 | NC_GetInsideRect( hwnd, &rect ); |
| 898 | hdcMem = CreateCompatibleDC( hdc ); |
| 899 | SelectObject( hdcMem, (down ? hbitmapMinimizeD : hbitmapMinimize) ); |
| 900 | if (GetWindowLongA(hwnd,GWL_STYLE) & WS_MAXIMIZEBOX) |
| 901 | rect.right -= GetSystemMetrics(SM_CXSIZE)+1; |
| 902 | BitBlt( hdc, rect.right - GetSystemMetrics(SM_CXSIZE) - 1, rect.top, |
| 903 | GetSystemMetrics(SM_CXSIZE) + 1, GetSystemMetrics(SM_CYSIZE), hdcMem, 0, 0, |
| 904 | SRCCOPY ); |
| 905 | DeleteDC( hdcMem ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 906 | } |
| 907 | |
| 908 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 909 | /****************************************************************************** |
| 910 | * |
| 911 | * void NC_DrawSysButton95( |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 912 | * HWND hwnd, |
| 913 | * HDC hdc, |
| 914 | * BOOL down ) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 915 | * |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 916 | * Draws the Win95 system icon. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 917 | * |
| 918 | * Revision history |
| 919 | * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) |
| 920 | * Original implementation from NC_DrawSysButton source. |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 921 | * 11-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de) |
| 922 | * Fixed most bugs. |
| 923 | * |
| 924 | *****************************************************************************/ |
| 925 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 926 | BOOL |
| 927 | NC_DrawSysButton95 (HWND hwnd, HDC hdc, BOOL down) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 928 | { |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 929 | HICON hIcon = NC_IconForWindow( hwnd ); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 930 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 931 | if (hIcon) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 932 | { |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 933 | RECT rect; |
| 934 | NC_GetInsideRect( hwnd, &rect ); |
| 935 | DrawIconEx (hdc, rect.left + 2, rect.top + 2, hIcon, |
| 936 | GetSystemMetrics(SM_CXSMICON), |
| 937 | GetSystemMetrics(SM_CYSMICON), 0, 0, DI_NORMAL); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 938 | } |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 939 | return (hIcon != 0); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 940 | } |
| 941 | |
| 942 | |
| 943 | /****************************************************************************** |
| 944 | * |
| 945 | * void NC_DrawCloseButton95( |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 946 | * HWND hwnd, |
| 947 | * HDC hdc, |
| 948 | * BOOL down, |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 949 | * BOOL bGrayed ) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 950 | * |
| 951 | * Draws the Win95 close button. |
| 952 | * |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 953 | * If bGrayed is true, then draw a disabled Close button |
| 954 | * |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 955 | * Revision history |
| 956 | * 11-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de) |
| 957 | * Original implementation from NC_DrawSysButton95 source. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 958 | * |
| 959 | *****************************************************************************/ |
| 960 | |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 961 | static void NC_DrawCloseButton95 (HWND hwnd, HDC hdc, BOOL down, BOOL bGrayed) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 962 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 963 | RECT rect; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 964 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 965 | NC_GetInsideRect( hwnd, &rect ); |
| 966 | |
| 967 | /* A tool window has a smaller Close button */ |
| 968 | if (GetWindowLongA( hwnd, GWL_EXSTYLE ) & WS_EX_TOOLWINDOW) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 969 | { |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 970 | INT iBmpHeight = 11; /* Windows does not use SM_CXSMSIZE and SM_CYSMSIZE */ |
| 971 | INT iBmpWidth = 11; /* it uses 11x11 for the close button in tool window */ |
| 972 | INT iCaptionHeight = GetSystemMetrics(SM_CYSMCAPTION); |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 973 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 974 | rect.top = rect.top + (iCaptionHeight - 1 - iBmpHeight) / 2; |
| 975 | rect.left = rect.right - (iCaptionHeight + 1 + iBmpWidth) / 2; |
| 976 | rect.bottom = rect.top + iBmpHeight; |
| 977 | rect.right = rect.left + iBmpWidth; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 978 | } |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 979 | else |
| 980 | { |
| 981 | rect.left = rect.right - GetSystemMetrics(SM_CXSIZE) - 1; |
| 982 | rect.bottom = rect.top + GetSystemMetrics(SM_CYSIZE) - 1; |
| 983 | rect.top += 2; |
| 984 | rect.right -= 2; |
| 985 | } |
| 986 | DrawFrameControl( hdc, &rect, DFC_CAPTION, |
| 987 | (DFCS_CAPTIONCLOSE | |
| 988 | (down ? DFCS_PUSHED : 0) | |
| 989 | (bGrayed ? DFCS_INACTIVE : 0)) ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 990 | } |
| 991 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 992 | /****************************************************************************** |
Alexandre Julliard | c1d35cc | 2001-01-24 19:47:57 +0000 | [diff] [blame] | 993 | * NC_DrawMaxButton95 |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 994 | * |
| 995 | * Draws the maximize button for Win95 style windows. |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 996 | * If bGrayed is true, then draw a disabled Maximize button |
Alexandre Julliard | c1d35cc | 2001-01-24 19:47:57 +0000 | [diff] [blame] | 997 | */ |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 998 | static void NC_DrawMaxButton95(HWND hwnd,HDC16 hdc,BOOL down, BOOL bGrayed) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 999 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1000 | RECT rect; |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 1001 | UINT flags = IsZoomed(hwnd) ? DFCS_CAPTIONRESTORE : DFCS_CAPTIONMAX; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1002 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 1003 | NC_GetInsideRect( hwnd, &rect ); |
| 1004 | if (GetWindowLongA( hwnd, GWL_STYLE) & WS_SYSMENU) |
| 1005 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
| 1006 | rect.left = rect.right - GetSystemMetrics(SM_CXSIZE); |
| 1007 | rect.bottom = rect.top + GetSystemMetrics(SM_CYSIZE) - 1; |
| 1008 | rect.top += 2; |
| 1009 | rect.right -= 2; |
| 1010 | if (down) flags |= DFCS_PUSHED; |
| 1011 | if (bGrayed) flags |= DFCS_INACTIVE; |
| 1012 | DrawFrameControl( hdc, &rect, DFC_CAPTION, flags ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1013 | } |
| 1014 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1015 | /****************************************************************************** |
Alexandre Julliard | c1d35cc | 2001-01-24 19:47:57 +0000 | [diff] [blame] | 1016 | * NC_DrawMinButton95 |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1017 | * |
| 1018 | * Draws the minimize button for Win95 style windows. |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1019 | * If bGrayed is true, then draw a disabled Minimize button |
Alexandre Julliard | c1d35cc | 2001-01-24 19:47:57 +0000 | [diff] [blame] | 1020 | */ |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1021 | static void NC_DrawMinButton95(HWND hwnd,HDC16 hdc,BOOL down, BOOL bGrayed) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1022 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1023 | RECT rect; |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 1024 | UINT flags = DFCS_CAPTIONMIN; |
| 1025 | DWORD style = GetWindowLongA( hwnd, GWL_STYLE ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1026 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 1027 | NC_GetInsideRect( hwnd, &rect ); |
| 1028 | if (style & WS_SYSMENU) |
| 1029 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
| 1030 | if (style & (WS_MAXIMIZEBOX|WS_MINIMIZEBOX)) |
| 1031 | rect.right -= GetSystemMetrics(SM_CXSIZE) - 2; |
| 1032 | rect.left = rect.right - GetSystemMetrics(SM_CXSIZE); |
| 1033 | rect.bottom = rect.top + GetSystemMetrics(SM_CYSIZE) - 1; |
| 1034 | rect.top += 2; |
| 1035 | rect.right -= 2; |
| 1036 | if (down) flags |= DFCS_PUSHED; |
| 1037 | if (bGrayed) flags |= DFCS_INACTIVE; |
| 1038 | DrawFrameControl( hdc, &rect, DFC_CAPTION, flags ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1039 | } |
| 1040 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1041 | /*********************************************************************** |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1042 | * NC_DrawFrame |
| 1043 | * |
| 1044 | * Draw a window frame inside the given rectangle, and update the rectangle. |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 1045 | * The correct pen for the frame must be selected in the DC. |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1046 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1047 | static void NC_DrawFrame( HDC hdc, RECT *rect, BOOL dlgFrame, |
| 1048 | BOOL active ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1049 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1050 | INT width, height; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1051 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1052 | if (TWEAK_WineLook != WIN31_LOOK) |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1053 | ERR("Called in Win95 mode. Aiee! Please report this.\n" ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1054 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1055 | if (dlgFrame) |
| 1056 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1057 | width = GetSystemMetrics(SM_CXDLGFRAME) - 1; |
| 1058 | height = GetSystemMetrics(SM_CYDLGFRAME) - 1; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1059 | SelectObject( hdc, GetSysColorBrush(active ? COLOR_ACTIVECAPTION : |
Alexandre Julliard | 02e9008 | 1998-01-04 17:49:09 +0000 | [diff] [blame] | 1060 | COLOR_INACTIVECAPTION) ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1061 | } |
| 1062 | else |
| 1063 | { |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 1064 | width = GetSystemMetrics(SM_CXFRAME) - 2; |
| 1065 | height = GetSystemMetrics(SM_CYFRAME) - 2; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1066 | SelectObject( hdc, GetSysColorBrush(active ? COLOR_ACTIVEBORDER : |
Alexandre Julliard | 02e9008 | 1998-01-04 17:49:09 +0000 | [diff] [blame] | 1067 | COLOR_INACTIVEBORDER) ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1068 | } |
| 1069 | |
| 1070 | /* Draw frame */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1071 | PatBlt( hdc, rect->left, rect->top, |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 1072 | rect->right - rect->left, height, PATCOPY ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1073 | PatBlt( hdc, rect->left, rect->top, |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 1074 | width, rect->bottom - rect->top, PATCOPY ); |
Randy Weems | 0bc73c7 | 1999-03-25 15:49:11 +0000 | [diff] [blame] | 1075 | PatBlt( hdc, rect->left, rect->bottom - 1, |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 1076 | rect->right - rect->left, -height, PATCOPY ); |
Randy Weems | 0bc73c7 | 1999-03-25 15:49:11 +0000 | [diff] [blame] | 1077 | PatBlt( hdc, rect->right - 1, rect->top, |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 1078 | -width, rect->bottom - rect->top, PATCOPY ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1079 | |
| 1080 | if (dlgFrame) |
| 1081 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1082 | InflateRect( rect, -width, -height ); |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 1083 | } |
| 1084 | else |
| 1085 | { |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 1086 | INT decYOff = GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXSIZE) - 1; |
| 1087 | INT decXOff = GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYSIZE) - 1; |
Huw D M Davies | 2d617be | 1998-12-08 09:14:09 +0000 | [diff] [blame] | 1088 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1089 | /* Draw inner rectangle */ |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 1090 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1091 | SelectObject( hdc, GetStockObject(NULL_BRUSH) ); |
| 1092 | Rectangle( hdc, rect->left + width, rect->top + height, |
Huw D M Davies | 2d617be | 1998-12-08 09:14:09 +0000 | [diff] [blame] | 1093 | rect->right - width , rect->bottom - height ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1094 | |
| 1095 | /* Draw the decorations */ |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1096 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1097 | MoveToEx( hdc, rect->left, rect->top + decYOff, NULL ); |
| 1098 | LineTo( hdc, rect->left + width, rect->top + decYOff ); |
| 1099 | MoveToEx( hdc, rect->right - 1, rect->top + decYOff, NULL ); |
| 1100 | LineTo( hdc, rect->right - width - 1, rect->top + decYOff ); |
| 1101 | MoveToEx( hdc, rect->left, rect->bottom - decYOff, NULL ); |
| 1102 | LineTo( hdc, rect->left + width, rect->bottom - decYOff ); |
| 1103 | MoveToEx( hdc, rect->right - 1, rect->bottom - decYOff, NULL ); |
| 1104 | LineTo( hdc, rect->right - width - 1, rect->bottom - decYOff ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1105 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1106 | MoveToEx( hdc, rect->left + decXOff, rect->top, NULL ); |
| 1107 | LineTo( hdc, rect->left + decXOff, rect->top + height); |
| 1108 | MoveToEx( hdc, rect->left + decXOff, rect->bottom - 1, NULL ); |
| 1109 | LineTo( hdc, rect->left + decXOff, rect->bottom - height - 1 ); |
| 1110 | MoveToEx( hdc, rect->right - decXOff, rect->top, NULL ); |
| 1111 | LineTo( hdc, rect->right - decXOff, rect->top + height ); |
| 1112 | MoveToEx( hdc, rect->right - decXOff, rect->bottom - 1, NULL ); |
| 1113 | LineTo( hdc, rect->right - decXOff, rect->bottom - height - 1 ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1114 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1115 | InflateRect( rect, -width - 1, -height - 1 ); |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 1116 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1117 | } |
| 1118 | |
| 1119 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1120 | /****************************************************************************** |
| 1121 | * |
| 1122 | * void NC_DrawFrame95( |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 1123 | * HDC hdc, |
| 1124 | * RECT *rect, |
Bill Medland | cbfbf2a | 2001-07-20 18:36:49 +0000 | [diff] [blame] | 1125 | * BOOL active, |
| 1126 | * DWORD style, |
| 1127 | * DWORD exStyle ) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1128 | * |
| 1129 | * Draw a window frame inside the given rectangle, and update the rectangle. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1130 | * |
| 1131 | * Bugs |
| 1132 | * Many. First, just what IS a frame in Win95? Note that the 3D look |
| 1133 | * on the outer edge is handled by NC_DoNCPaint95. As is the inner |
| 1134 | * edge. The inner rectangle just inside the frame is handled by the |
| 1135 | * Caption code. |
| 1136 | * |
| 1137 | * In short, for most people, this function should be a nop (unless |
| 1138 | * you LIKE thick borders in Win95/NT4.0 -- I've been working with |
| 1139 | * them lately, but just to get this code right). Even so, it doesn't |
| 1140 | * appear to be so. It's being worked on... |
| 1141 | * |
| 1142 | * Revision history |
| 1143 | * 06-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) |
| 1144 | * Original implementation (based on NC_DrawFrame) |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1145 | * 02-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de) |
| 1146 | * Some minor fixes. |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 1147 | * 29-Jun-1999 Ove KÃ¥ven (ovek@arcticnet.no) |
| 1148 | * Fixed a fix or something. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1149 | * |
| 1150 | *****************************************************************************/ |
| 1151 | |
| 1152 | static void NC_DrawFrame95( |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1153 | HDC hdc, |
| 1154 | RECT *rect, |
Bill Medland | cbfbf2a | 2001-07-20 18:36:49 +0000 | [diff] [blame] | 1155 | BOOL active, |
| 1156 | DWORD style, |
| 1157 | DWORD exStyle) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1158 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1159 | INT width, height; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1160 | |
Bill Medland | cbfbf2a | 2001-07-20 18:36:49 +0000 | [diff] [blame] | 1161 | /* Firstly the "thick" frame */ |
| 1162 | if (style & WS_THICKFRAME) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1163 | { |
Bill Medland | cbfbf2a | 2001-07-20 18:36:49 +0000 | [diff] [blame] | 1164 | width = GetSystemMetrics(SM_CXFRAME) - GetSystemMetrics(SM_CXDLGFRAME); |
| 1165 | height = GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYDLGFRAME); |
| 1166 | |
| 1167 | SelectObject( hdc, GetSysColorBrush(active ? COLOR_ACTIVEBORDER : |
| 1168 | COLOR_INACTIVEBORDER) ); |
| 1169 | /* Draw frame */ |
| 1170 | PatBlt( hdc, rect->left, rect->top, |
| 1171 | rect->right - rect->left, height, PATCOPY ); |
| 1172 | PatBlt( hdc, rect->left, rect->top, |
| 1173 | width, rect->bottom - rect->top, PATCOPY ); |
| 1174 | PatBlt( hdc, rect->left, rect->bottom - 1, |
| 1175 | rect->right - rect->left, -height, PATCOPY ); |
| 1176 | PatBlt( hdc, rect->right - 1, rect->top, |
| 1177 | -width, rect->bottom - rect->top, PATCOPY ); |
| 1178 | |
| 1179 | InflateRect( rect, -width, -height ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1180 | } |
| 1181 | |
Bill Medland | cbfbf2a | 2001-07-20 18:36:49 +0000 | [diff] [blame] | 1182 | /* Now the other bit of the frame */ |
| 1183 | if ((style & (WS_BORDER|WS_DLGFRAME)) || |
| 1184 | (exStyle & WS_EX_DLGMODALFRAME)) |
| 1185 | { |
| 1186 | width = GetSystemMetrics(SM_CXDLGFRAME) - GetSystemMetrics(SM_CXEDGE); |
| 1187 | height = GetSystemMetrics(SM_CYDLGFRAME) - GetSystemMetrics(SM_CYEDGE); |
| 1188 | /* This should give a value of 1 that should also work for a border */ |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1189 | |
Bill Medland | cbfbf2a | 2001-07-20 18:36:49 +0000 | [diff] [blame] | 1190 | SelectObject( hdc, GetSysColorBrush( |
| 1191 | (exStyle & (WS_EX_DLGMODALFRAME|WS_EX_CLIENTEDGE)) ? |
| 1192 | COLOR_3DFACE : |
| 1193 | (exStyle & WS_EX_STATICEDGE) ? |
| 1194 | COLOR_WINDOWFRAME : |
| 1195 | (style & (WS_DLGFRAME|WS_THICKFRAME)) ? |
| 1196 | COLOR_3DFACE : |
| 1197 | /* else */ |
| 1198 | COLOR_WINDOWFRAME)); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1199 | |
Bill Medland | cbfbf2a | 2001-07-20 18:36:49 +0000 | [diff] [blame] | 1200 | /* Draw frame */ |
| 1201 | PatBlt( hdc, rect->left, rect->top, |
| 1202 | rect->right - rect->left, height, PATCOPY ); |
| 1203 | PatBlt( hdc, rect->left, rect->top, |
| 1204 | width, rect->bottom - rect->top, PATCOPY ); |
| 1205 | PatBlt( hdc, rect->left, rect->bottom - 1, |
| 1206 | rect->right - rect->left, -height, PATCOPY ); |
| 1207 | PatBlt( hdc, rect->right - 1, rect->top, |
| 1208 | -width, rect->bottom - rect->top, PATCOPY ); |
| 1209 | |
| 1210 | InflateRect( rect, -width, -height ); |
| 1211 | } |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1212 | } |
| 1213 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1214 | |
| 1215 | /*********************************************************************** |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1216 | * NC_DrawCaption |
| 1217 | * |
| 1218 | * Draw the window caption. |
| 1219 | * The correct pen for the window frame must be selected in the DC. |
| 1220 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1221 | static void NC_DrawCaption( HDC hdc, RECT *rect, HWND hwnd, |
| 1222 | DWORD style, BOOL active ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1223 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1224 | RECT r = *rect; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1225 | char buffer[256]; |
| 1226 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1227 | if (!hbitmapClose) |
| 1228 | { |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 1229 | if (!(hbitmapClose = LoadBitmapA( 0, MAKEINTRESOURCEA(OBM_CLOSE) ))) return; |
Alexandre Julliard | 2682bc2 | 2000-11-27 22:03:23 +0000 | [diff] [blame] | 1230 | hbitmapMinimize = LoadBitmapA( 0, MAKEINTRESOURCEA(OBM_REDUCE) ); |
| 1231 | hbitmapMinimizeD = LoadBitmapA( 0, MAKEINTRESOURCEA(OBM_REDUCED) ); |
| 1232 | hbitmapMaximize = LoadBitmapA( 0, MAKEINTRESOURCEA(OBM_ZOOM) ); |
| 1233 | hbitmapMaximizeD = LoadBitmapA( 0, MAKEINTRESOURCEA(OBM_ZOOMD) ); |
| 1234 | hbitmapRestore = LoadBitmapA( 0, MAKEINTRESOURCEA(OBM_RESTORE) ); |
| 1235 | hbitmapRestoreD = LoadBitmapA( 0, MAKEINTRESOURCEA(OBM_RESTORED) ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1236 | } |
| 1237 | |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 1238 | if (GetWindowLongA( hwnd, GWL_EXSTYLE) & WS_EX_DLGMODALFRAME) |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1239 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1240 | HBRUSH hbrushOld = SelectObject(hdc, GetSysColorBrush(COLOR_WINDOW) ); |
| 1241 | PatBlt( hdc, r.left, r.top, 1, r.bottom-r.top+1,PATCOPY ); |
| 1242 | PatBlt( hdc, r.right-1, r.top, 1, r.bottom-r.top+1, PATCOPY ); |
| 1243 | PatBlt( hdc, r.left, r.top-1, r.right-r.left, 1, PATCOPY ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1244 | r.left++; |
| 1245 | r.right--; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1246 | SelectObject( hdc, hbrushOld ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1247 | } |
Alexandre Julliard | b0efe28 | 2000-08-04 04:18:04 +0000 | [diff] [blame] | 1248 | MoveToEx( hdc, r.left, r.bottom, NULL ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1249 | LineTo( hdc, r.right, r.bottom ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1250 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1251 | if (style & WS_SYSMENU) |
| 1252 | { |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1253 | NC_DrawSysButton( hwnd, hdc, FALSE ); |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1254 | r.left += GetSystemMetrics(SM_CXSIZE) + 1; |
Alexandre Julliard | b0efe28 | 2000-08-04 04:18:04 +0000 | [diff] [blame] | 1255 | MoveToEx( hdc, r.left - 1, r.top, NULL ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1256 | LineTo( hdc, r.left - 1, r.bottom ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1257 | } |
| 1258 | if (style & WS_MAXIMIZEBOX) |
| 1259 | { |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1260 | NC_DrawMaxButton( hwnd, hdc, FALSE ); |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1261 | r.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1262 | } |
| 1263 | if (style & WS_MINIMIZEBOX) |
| 1264 | { |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1265 | NC_DrawMinButton( hwnd, hdc, FALSE ); |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1266 | r.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1267 | } |
| 1268 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1269 | FillRect( hdc, &r, GetSysColorBrush(active ? COLOR_ACTIVECAPTION : |
Alexandre Julliard | 02e9008 | 1998-01-04 17:49:09 +0000 | [diff] [blame] | 1270 | COLOR_INACTIVECAPTION) ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1271 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1272 | if (GetWindowTextA( hwnd, buffer, sizeof(buffer) )) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1273 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1274 | if (active) SetTextColor( hdc, GetSysColor( COLOR_CAPTIONTEXT ) ); |
| 1275 | else SetTextColor( hdc, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) ); |
| 1276 | SetBkMode( hdc, TRANSPARENT ); |
| 1277 | DrawTextA( hdc, buffer, -1, &r, |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 1278 | DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_NOPREFIX ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1279 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1280 | } |
| 1281 | |
| 1282 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1283 | /****************************************************************************** |
| 1284 | * |
| 1285 | * NC_DrawCaption95( |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 1286 | * HDC hdc, |
| 1287 | * RECT *rect, |
| 1288 | * HWND hwnd, |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1289 | * DWORD style, |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 1290 | * BOOL active ) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1291 | * |
| 1292 | * Draw the window caption for Win95 style windows. |
| 1293 | * The correct pen for the window frame must be selected in the DC. |
| 1294 | * |
| 1295 | * Bugs |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1296 | * Hey, a function that finally works! Well, almost. |
| 1297 | * It's being worked on. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1298 | * |
| 1299 | * Revision history |
| 1300 | * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) |
| 1301 | * Original implementation. |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1302 | * 02-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de) |
| 1303 | * Some minor fixes. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1304 | * |
| 1305 | *****************************************************************************/ |
| 1306 | |
| 1307 | static void NC_DrawCaption95( |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1308 | HDC hdc, |
| 1309 | RECT *rect, |
| 1310 | HWND hwnd, |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1311 | DWORD style, |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 1312 | DWORD exStyle, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1313 | BOOL active ) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1314 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1315 | RECT r = *rect; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1316 | char buffer[256]; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1317 | HPEN hPrevPen; |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1318 | HMENU hSysMenu; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1319 | |
Bill Medland | cbfbf2a | 2001-07-20 18:36:49 +0000 | [diff] [blame] | 1320 | hPrevPen = SelectObject( hdc, GetSysColorPen( |
| 1321 | ((exStyle & (WS_EX_STATICEDGE|WS_EX_CLIENTEDGE| |
| 1322 | WS_EX_DLGMODALFRAME)) == WS_EX_STATICEDGE) ? |
| 1323 | COLOR_WINDOWFRAME : COLOR_3DFACE) ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1324 | MoveToEx( hdc, r.left, r.bottom - 1, NULL ); |
| 1325 | LineTo( hdc, r.right, r.bottom - 1 ); |
| 1326 | SelectObject( hdc, hPrevPen ); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1327 | r.bottom--; |
| 1328 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1329 | FillRect( hdc, &r, GetSysColorBrush(active ? COLOR_ACTIVECAPTION : |
Alexandre Julliard | 02e9008 | 1998-01-04 17:49:09 +0000 | [diff] [blame] | 1330 | COLOR_INACTIVECAPTION) ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1331 | |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 1332 | if ((style & WS_SYSMENU) && !(exStyle & WS_EX_TOOLWINDOW)) { |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1333 | if (NC_DrawSysButton95 (hwnd, hdc, FALSE)) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1334 | r.left += GetSystemMetrics(SM_CYCAPTION) - 1; |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 1335 | } |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1336 | |
| 1337 | if (style & WS_SYSMENU) |
| 1338 | { |
| 1339 | UINT state; |
| 1340 | |
| 1341 | /* Go get the sysmenu */ |
| 1342 | hSysMenu = GetSystemMenu(hwnd, FALSE); |
| 1343 | state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND); |
| 1344 | |
| 1345 | /* Draw a grayed close button if disabled and a normal one if SC_CLOSE is not there */ |
| 1346 | NC_DrawCloseButton95 (hwnd, hdc, FALSE, |
| 1347 | ((((state & MF_DISABLED) || (state & MF_GRAYED))) && (state != 0xFFFFFFFF))); |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1348 | r.right -= GetSystemMetrics(SM_CYCAPTION) - 1; |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1349 | |
| 1350 | if ((style & WS_MAXIMIZEBOX) || (style & WS_MINIMIZEBOX)) |
| 1351 | { |
| 1352 | /* In win95 the two buttons are always there */ |
| 1353 | /* But if the menu item is not in the menu they're disabled*/ |
| 1354 | |
| 1355 | NC_DrawMaxButton95( hwnd, hdc, FALSE, (!(style & WS_MAXIMIZEBOX))); |
| 1356 | r.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
| 1357 | |
| 1358 | NC_DrawMinButton95( hwnd, hdc, FALSE, (!(style & WS_MINIMIZEBOX))); |
| 1359 | r.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
| 1360 | } |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1361 | } |
| 1362 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1363 | if (GetWindowTextA( hwnd, buffer, sizeof(buffer) )) { |
| 1364 | NONCLIENTMETRICSA nclm; |
| 1365 | HFONT hFont, hOldFont; |
| 1366 | nclm.cbSize = sizeof(NONCLIENTMETRICSA); |
| 1367 | SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 1368 | if (exStyle & WS_EX_TOOLWINDOW) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1369 | hFont = CreateFontIndirectA (&nclm.lfSmCaptionFont); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 1370 | else |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1371 | hFont = CreateFontIndirectA (&nclm.lfCaptionFont); |
| 1372 | hOldFont = SelectObject (hdc, hFont); |
| 1373 | if (active) SetTextColor( hdc, GetSysColor( COLOR_CAPTIONTEXT ) ); |
| 1374 | else SetTextColor( hdc, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) ); |
| 1375 | SetBkMode( hdc, TRANSPARENT ); |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1376 | r.left += 2; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1377 | DrawTextA( hdc, buffer, -1, &r, |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1378 | DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1379 | DeleteObject (SelectObject (hdc, hOldFont)); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1380 | } |
| 1381 | } |
| 1382 | |
| 1383 | |
| 1384 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1385 | /*********************************************************************** |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1386 | * NC_DoNCPaint |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1387 | * |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 1388 | * Paint the non-client area. clip is currently unused. |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1389 | */ |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1390 | static void NC_DoNCPaint( HWND hwnd, HRGN clip, BOOL suppress_menupaint ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1391 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1392 | HDC hdc; |
| 1393 | RECT rect; |
| 1394 | BOOL active; |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1395 | WND *wndPtr; |
| 1396 | DWORD dwStyle, dwExStyle; |
| 1397 | WORD flags; |
| 1398 | RECT rectClient, rectWindow; |
| 1399 | int has_menu; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1400 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1401 | if (!(wndPtr = WIN_GetPtr( hwnd )) || wndPtr == WND_OTHER_PROCESS) return; |
| 1402 | has_menu = HAS_MENU(wndPtr); |
| 1403 | dwStyle = wndPtr->dwStyle; |
| 1404 | dwExStyle = wndPtr->dwExStyle; |
| 1405 | flags = wndPtr->flags; |
| 1406 | rectClient = wndPtr->rectClient; |
| 1407 | rectWindow = wndPtr->rectWindow; |
| 1408 | WIN_ReleasePtr( wndPtr ); |
| 1409 | |
| 1410 | if ( dwStyle & WS_MINIMIZE || |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1411 | !WIN_IsWindowDrawable( hwnd, 0 )) return; /* Nothing to do */ |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1412 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1413 | active = flags & WIN_NCACTIVATED; |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 1414 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1415 | TRACE("%04x %d\n", hwnd, active ); |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 1416 | |
Alex Korobka | 4f1ac05 | 1999-03-28 09:37:57 +0000 | [diff] [blame] | 1417 | if (!(hdc = GetDCEx( hwnd, (clip > 1) ? clip : 0, DCX_USESTYLE | DCX_WINDOW | |
| 1418 | ((clip > 1) ? (DCX_INTERSECTRGN | DCX_KEEPCLIPRGN): 0) ))) return; |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 1419 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1420 | if (ExcludeVisRect16( hdc, rectClient.left-rectWindow.left, |
| 1421 | rectClient.top-rectWindow.top, |
| 1422 | rectClient.right-rectWindow.left, |
| 1423 | rectClient.bottom-rectWindow.top ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1424 | == NULLREGION) |
| 1425 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1426 | ReleaseDC( hwnd, hdc ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1427 | return; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1428 | } |
| 1429 | |
| 1430 | rect.top = rect.left = 0; |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1431 | rect.right = rectWindow.right - rectWindow.left; |
| 1432 | rect.bottom = rectWindow.bottom - rectWindow.top; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1433 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1434 | SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1435 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1436 | if (HAS_ANYFRAME( dwStyle, dwExStyle )) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1437 | { |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 1438 | SelectObject( hdc, GetStockObject(NULL_BRUSH) ); |
| 1439 | Rectangle( hdc, 0, 0, rect.right, rect.bottom ); |
| 1440 | InflateRect( &rect, -1, -1 ); |
| 1441 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1442 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1443 | if (HAS_THICKFRAME( dwStyle, dwExStyle )) |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 1444 | NC_DrawFrame(hdc, &rect, FALSE, active ); |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1445 | else if (HAS_DLGFRAME( dwStyle, dwExStyle )) |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 1446 | NC_DrawFrame( hdc, &rect, TRUE, active ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1447 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1448 | if ((dwStyle & WS_CAPTION) == WS_CAPTION) |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 1449 | { |
| 1450 | RECT r = rect; |
| 1451 | r.bottom = rect.top + GetSystemMetrics(SM_CYSIZE); |
| 1452 | rect.top += GetSystemMetrics(SM_CYSIZE) + GetSystemMetrics(SM_CYBORDER); |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1453 | NC_DrawCaption( hdc, &r, hwnd, dwStyle, active ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1454 | } |
| 1455 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1456 | if (has_menu) |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 1457 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1458 | RECT r = rect; |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1459 | r.bottom = rect.top + GetSystemMetrics(SM_CYMENU); /* default height */ |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 1460 | rect.top += MENU_DrawMenuBar( hdc, &r, hwnd, suppress_menupaint ); |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 1461 | } |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1462 | |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 1463 | /* Draw the scroll-bars */ |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1464 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1465 | if (dwStyle & WS_VSCROLL) |
Alex Korobka | d208584 | 1998-10-18 10:37:46 +0000 | [diff] [blame] | 1466 | SCROLL_DrawScrollBar( hwnd, hdc, SB_VERT, TRUE, TRUE ); |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1467 | if (dwStyle & WS_HSCROLL) |
Alex Korobka | d208584 | 1998-10-18 10:37:46 +0000 | [diff] [blame] | 1468 | SCROLL_DrawScrollBar( hwnd, hdc, SB_HORZ, TRUE, TRUE ); |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 1469 | |
| 1470 | /* Draw the "size-box" */ |
| 1471 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1472 | if ((dwStyle & WS_VSCROLL) && (dwStyle & WS_HSCROLL)) |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 1473 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1474 | RECT r = rect; |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1475 | r.left = r.right - GetSystemMetrics(SM_CXVSCROLL) + 1; |
| 1476 | r.top = r.bottom - GetSystemMetrics(SM_CYHSCROLL) + 1; |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1477 | if(wndPtr->dwStyle & WS_BORDER) { |
| 1478 | r.left++; |
| 1479 | r.top++; |
| 1480 | } |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1481 | FillRect( hdc, &r, GetSysColorBrush(COLOR_SCROLLBAR) ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1482 | } |
| 1483 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1484 | ReleaseDC( hwnd, hdc ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1485 | } |
| 1486 | |
| 1487 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1488 | /****************************************************************************** |
| 1489 | * |
| 1490 | * void NC_DoNCPaint95( |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1491 | * HWND hwnd, |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 1492 | * HRGN clip, |
| 1493 | * BOOL suppress_menupaint ) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1494 | * |
| 1495 | * Paint the non-client area for Win95 windows. The clip region is |
| 1496 | * currently ignored. |
| 1497 | * |
| 1498 | * Bugs |
| 1499 | * grep -E -A10 -B5 \(95\)\|\(Bugs\)\|\(FIXME\) windows/nonclient.c \ |
| 1500 | * misc/tweak.c controls/menu.c # :-) |
| 1501 | * |
| 1502 | * Revision history |
| 1503 | * 03-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) |
| 1504 | * Original implementation |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1505 | * 10-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de) |
| 1506 | * Fixed some bugs. |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 1507 | * 29-Jun-1999 Ove KÃ¥ven (ovek@arcticnet.no) |
| 1508 | * Streamlined window style checks. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1509 | * |
| 1510 | *****************************************************************************/ |
| 1511 | |
Patrik Stridvall | 1ed4ecf | 1999-06-26 14:58:24 +0000 | [diff] [blame] | 1512 | static void NC_DoNCPaint95( |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1513 | HWND hwnd, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1514 | HRGN clip, |
| 1515 | BOOL suppress_menupaint ) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1516 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1517 | HDC hdc; |
Alex Korobka | 4f1ac05 | 1999-03-28 09:37:57 +0000 | [diff] [blame] | 1518 | RECT rfuzz, rect, rectClip; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1519 | BOOL active; |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1520 | WND *wndPtr; |
| 1521 | DWORD dwStyle, dwExStyle; |
| 1522 | WORD flags; |
| 1523 | RECT rectClient, rectWindow; |
| 1524 | int has_menu; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1525 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1526 | if (!(wndPtr = WIN_GetPtr( hwnd )) || wndPtr == WND_OTHER_PROCESS) return; |
| 1527 | has_menu = HAS_MENU(wndPtr); |
| 1528 | dwStyle = wndPtr->dwStyle; |
| 1529 | dwExStyle = wndPtr->dwExStyle; |
| 1530 | flags = wndPtr->flags; |
| 1531 | rectClient = wndPtr->rectClient; |
| 1532 | rectWindow = wndPtr->rectWindow; |
| 1533 | WIN_ReleasePtr( wndPtr ); |
| 1534 | |
| 1535 | if ( dwStyle & WS_MINIMIZE || |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1536 | !WIN_IsWindowDrawable( hwnd, 0 )) return; /* Nothing to do */ |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1537 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1538 | active = flags & WIN_NCACTIVATED; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1539 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1540 | TRACE("%04x %d\n", hwnd, active ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1541 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1542 | /* MSDN docs are pretty idiotic here, they say app CAN use clipRgn in |
| 1543 | the call to GetDCEx implying that it is allowed not to use it either. |
| 1544 | However, the suggested GetDCEx( , DCX_WINDOW | DCX_INTERSECTRGN) |
| 1545 | will cause clipRgn to be deleted after ReleaseDC(). |
| 1546 | Now, how is the "system" supposed to tell what happened? |
Alex Korobka | 4f1ac05 | 1999-03-28 09:37:57 +0000 | [diff] [blame] | 1547 | */ |
| 1548 | |
| 1549 | if (!(hdc = GetDCEx( hwnd, (clip > 1) ? clip : 0, DCX_USESTYLE | DCX_WINDOW | |
| 1550 | ((clip > 1) ?(DCX_INTERSECTRGN | DCX_KEEPCLIPRGN) : 0) ))) return; |
| 1551 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1552 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1553 | if (ExcludeVisRect16( hdc, rectClient.left-rectWindow.left, |
| 1554 | rectClient.top-rectWindow.top, |
| 1555 | rectClient.right-rectWindow.left, |
| 1556 | rectClient.bottom-rectWindow.top ) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1557 | == NULLREGION) |
| 1558 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1559 | ReleaseDC( hwnd, hdc ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1560 | return; |
| 1561 | } |
| 1562 | |
| 1563 | rect.top = rect.left = 0; |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1564 | rect.right = rectWindow.right - rectWindow.left; |
| 1565 | rect.bottom = rectWindow.bottom - rectWindow.top; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1566 | |
Alex Korobka | 4f1ac05 | 1999-03-28 09:37:57 +0000 | [diff] [blame] | 1567 | if( clip > 1 ) |
| 1568 | GetRgnBox( clip, &rectClip ); |
| 1569 | else |
| 1570 | { |
| 1571 | clip = 0; |
| 1572 | rectClip = rect; |
| 1573 | } |
| 1574 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1575 | SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1576 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1577 | if (HAS_STATICOUTERFRAME(dwStyle, dwExStyle)) { |
Bill Medland | cbfbf2a | 2001-07-20 18:36:49 +0000 | [diff] [blame] | 1578 | DrawEdge (hdc, &rect, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST); |
| 1579 | } |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1580 | else if (HAS_BIGFRAME( dwStyle, dwExStyle)) { |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 1581 | DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT | BF_ADJUST); |
| 1582 | } |
Bill Medland | cbfbf2a | 2001-07-20 18:36:49 +0000 | [diff] [blame] | 1583 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1584 | NC_DrawFrame95(hdc, &rect, active, dwStyle, dwExStyle ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1585 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1586 | if ((dwStyle & WS_CAPTION) == WS_CAPTION) |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 1587 | { |
| 1588 | RECT r = rect; |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1589 | if (dwExStyle & WS_EX_TOOLWINDOW) { |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 1590 | r.bottom = rect.top + GetSystemMetrics(SM_CYSMCAPTION); |
| 1591 | rect.top += GetSystemMetrics(SM_CYSMCAPTION); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1592 | } |
Alexandre Julliard | dc4fe77 | 2001-06-04 21:55:17 +0000 | [diff] [blame] | 1593 | else { |
| 1594 | r.bottom = rect.top + GetSystemMetrics(SM_CYCAPTION); |
| 1595 | rect.top += GetSystemMetrics(SM_CYCAPTION); |
| 1596 | } |
| 1597 | if( !clip || IntersectRect( &rfuzz, &r, &rectClip ) ) |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1598 | NC_DrawCaption95 (hdc, &r, hwnd, dwStyle, |
| 1599 | dwExStyle, active); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1600 | } |
| 1601 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1602 | if (has_menu) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1603 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1604 | RECT r = rect; |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1605 | r.bottom = rect.top + GetSystemMetrics(SM_CYMENU); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1606 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1607 | TRACE("Calling DrawMenuBar with rect (%d, %d)-(%d, %d)\n", |
| 1608 | r.left, r.top, r.right, r.bottom); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1609 | |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1610 | rect.top += MENU_DrawMenuBar( hdc, &r, hwnd, suppress_menupaint ) + 1; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1611 | } |
| 1612 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1613 | TRACE("After MenuBar, rect is (%d, %d)-(%d, %d).\n", |
| 1614 | rect.left, rect.top, rect.right, rect.bottom ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1615 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1616 | if (dwExStyle & WS_EX_CLIENTEDGE) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1617 | DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1618 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1619 | /* Draw the scroll-bars */ |
| 1620 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1621 | if (dwStyle & WS_VSCROLL) |
Alex Korobka | d208584 | 1998-10-18 10:37:46 +0000 | [diff] [blame] | 1622 | SCROLL_DrawScrollBar( hwnd, hdc, SB_VERT, TRUE, TRUE ); |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1623 | if (dwStyle & WS_HSCROLL) |
Alex Korobka | d208584 | 1998-10-18 10:37:46 +0000 | [diff] [blame] | 1624 | SCROLL_DrawScrollBar( hwnd, hdc, SB_HORZ, TRUE, TRUE ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1625 | |
| 1626 | /* Draw the "size-box" */ |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1627 | if ((dwStyle & WS_VSCROLL) && (dwStyle & WS_HSCROLL)) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1628 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1629 | RECT r = rect; |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1630 | r.left = r.right - GetSystemMetrics(SM_CXVSCROLL) + 1; |
| 1631 | r.top = r.bottom - GetSystemMetrics(SM_CYHSCROLL) + 1; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1632 | FillRect( hdc, &r, GetSysColorBrush(COLOR_SCROLLBAR) ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1633 | } |
| 1634 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1635 | ReleaseDC( hwnd, hdc ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1636 | } |
| 1637 | |
| 1638 | |
| 1639 | |
Alexandre Julliard | 988ca97 | 1994-06-21 16:15:21 +0000 | [diff] [blame] | 1640 | |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1641 | /*********************************************************************** |
| 1642 | * NC_HandleNCPaint |
| 1643 | * |
| 1644 | * Handle a WM_NCPAINT message. Called from DefWindowProc(). |
| 1645 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1646 | LONG NC_HandleNCPaint( HWND hwnd , HRGN clip) |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1647 | { |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1648 | DWORD dwStyle = GetWindowLongW( hwnd, GWL_STYLE ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1649 | |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1650 | if( dwStyle & WS_VISIBLE ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1651 | { |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1652 | if( dwStyle & WS_MINIMIZE ) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1653 | WINPOS_RedrawIconTitle( hwnd ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1654 | else if (TWEAK_WineLook == WIN31_LOOK) |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1655 | NC_DoNCPaint( hwnd, clip, FALSE ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1656 | else |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1657 | NC_DoNCPaint95( hwnd, clip, FALSE ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1658 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1659 | return 0; |
| 1660 | } |
| 1661 | |
| 1662 | |
| 1663 | /*********************************************************************** |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1664 | * NC_HandleNCActivate |
| 1665 | * |
| 1666 | * Handle a WM_NCACTIVATE message. Called from DefWindowProc(). |
| 1667 | */ |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 1668 | LONG NC_HandleNCActivate( HWND hwnd, WPARAM wParam ) |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1669 | { |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 1670 | WND* wndPtr = WIN_FindWndPtr( hwnd ); |
| 1671 | |
Dmitry Timoshkov | d1e648f | 2001-06-04 02:49:22 +0000 | [diff] [blame] | 1672 | /* Lotus Notes draws menu descriptions in the caption of its main |
| 1673 | * window. When it wants to restore original "system" view, it just |
| 1674 | * sends WM_NCACTIVATE message to itself. Any optimizations here in |
| 1675 | * attempt to minimize redrawings lead to a not restored caption. |
| 1676 | */ |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 1677 | if (wndPtr) |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1678 | { |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1679 | if (wParam) wndPtr->flags |= WIN_NCACTIVATED; |
| 1680 | else wndPtr->flags &= ~WIN_NCACTIVATED; |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1681 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1682 | |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 1683 | if (IsIconic(hwnd)) WINPOS_RedrawIconTitle( hwnd ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1684 | else if (TWEAK_WineLook == WIN31_LOOK) |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1685 | NC_DoNCPaint( hwnd, (HRGN)1, FALSE ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1686 | else |
Gerard Patel | e9b4fd1 | 2001-11-30 23:13:22 +0000 | [diff] [blame] | 1687 | NC_DoNCPaint95( hwnd, (HRGN)1, FALSE ); |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1688 | } |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1689 | return TRUE; |
| 1690 | } |
| 1691 | |
| 1692 | |
| 1693 | /*********************************************************************** |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1694 | * NC_HandleSetCursor |
| 1695 | * |
| 1696 | * Handle a WM_SETCURSOR message. Called from DefWindowProc(). |
| 1697 | */ |
Alexandre Julliard | cb25e25 | 2001-08-08 23:28:42 +0000 | [diff] [blame] | 1698 | LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam ) |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1699 | { |
Alexandre Julliard | 021dd99 | 2001-09-14 21:29:19 +0000 | [diff] [blame] | 1700 | if (hwnd != WIN_GetFullHandle( (HWND)wParam )) |
| 1701 | return 0; /* Don't set the cursor for child windows */ |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1702 | |
| 1703 | switch(LOWORD(lParam)) |
| 1704 | { |
| 1705 | case HTERROR: |
| 1706 | { |
| 1707 | WORD msg = HIWORD( lParam ); |
| 1708 | if ((msg == WM_LBUTTONDOWN) || (msg == WM_MBUTTONDOWN) || |
| 1709 | (msg == WM_RBUTTONDOWN)) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1710 | MessageBeep(0); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1711 | } |
| 1712 | break; |
| 1713 | |
| 1714 | case HTCLIENT: |
| 1715 | { |
Alexandre Julliard | d44e495 | 2001-08-20 18:09:39 +0000 | [diff] [blame] | 1716 | HCURSOR hCursor = GetClassLongA(hwnd, GCL_HCURSOR); |
Gerard Patel | 5773dad | 1999-06-12 14:45:56 +0000 | [diff] [blame] | 1717 | if(hCursor) { |
Alexandre Julliard | d44e495 | 2001-08-20 18:09:39 +0000 | [diff] [blame] | 1718 | SetCursor(hCursor); |
Gerard Patel | 5773dad | 1999-06-12 14:45:56 +0000 | [diff] [blame] | 1719 | return TRUE; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1720 | } |
Gerard Patel | 5773dad | 1999-06-12 14:45:56 +0000 | [diff] [blame] | 1721 | return FALSE; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1722 | } |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1723 | |
| 1724 | case HTLEFT: |
| 1725 | case HTRIGHT: |
Alexandre Julliard | 2682bc2 | 2000-11-27 22:03:23 +0000 | [diff] [blame] | 1726 | return (LONG)SetCursor( LoadCursorA( 0, IDC_SIZEWEA ) ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1727 | |
| 1728 | case HTTOP: |
| 1729 | case HTBOTTOM: |
Alexandre Julliard | 2682bc2 | 2000-11-27 22:03:23 +0000 | [diff] [blame] | 1730 | return (LONG)SetCursor( LoadCursorA( 0, IDC_SIZENSA ) ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1731 | |
| 1732 | case HTTOPLEFT: |
| 1733 | case HTBOTTOMRIGHT: |
Alexandre Julliard | 2682bc2 | 2000-11-27 22:03:23 +0000 | [diff] [blame] | 1734 | return (LONG)SetCursor( LoadCursorA( 0, IDC_SIZENWSEA ) ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1735 | |
| 1736 | case HTTOPRIGHT: |
| 1737 | case HTBOTTOMLEFT: |
Alexandre Julliard | 2682bc2 | 2000-11-27 22:03:23 +0000 | [diff] [blame] | 1738 | return (LONG)SetCursor( LoadCursorA( 0, IDC_SIZENESWA ) ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1739 | } |
| 1740 | |
| 1741 | /* Default cursor: arrow */ |
Alexandre Julliard | 2682bc2 | 2000-11-27 22:03:23 +0000 | [diff] [blame] | 1742 | return (LONG)SetCursor( LoadCursorA( 0, IDC_ARROWA ) ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1743 | } |
| 1744 | |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1745 | /*********************************************************************** |
| 1746 | * NC_GetSysPopupPos |
| 1747 | */ |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 1748 | void NC_GetSysPopupPos( HWND hwnd, RECT* rect ) |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1749 | { |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 1750 | if (IsIconic(hwnd)) GetWindowRect( hwnd, rect ); |
| 1751 | else |
| 1752 | { |
| 1753 | WND *wndPtr = WIN_FindWndPtr( hwnd ); |
| 1754 | if (!wndPtr) return; |
| 1755 | |
| 1756 | NC_GetInsideRect( hwnd, rect ); |
| 1757 | OffsetRect( rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top); |
| 1758 | if (wndPtr->dwStyle & WS_CHILD) |
Alexandre Julliard | 0801ffc | 2001-08-24 00:26:59 +0000 | [diff] [blame] | 1759 | ClientToScreen( GetParent(hwnd), (POINT *)rect ); |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 1760 | if (TWEAK_WineLook == WIN31_LOOK) { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1761 | rect->right = rect->left + GetSystemMetrics(SM_CXSIZE); |
| 1762 | rect->bottom = rect->top + GetSystemMetrics(SM_CYSIZE); |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 1763 | } |
| 1764 | else { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1765 | rect->right = rect->left + GetSystemMetrics(SM_CYCAPTION) - 1; |
| 1766 | rect->bottom = rect->top + GetSystemMetrics(SM_CYCAPTION) - 1; |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 1767 | } |
| 1768 | WIN_ReleaseWndPtr( wndPtr ); |
| 1769 | } |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1770 | } |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1771 | |
| 1772 | /*********************************************************************** |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1773 | * NC_TrackMinMaxBox95 |
| 1774 | * |
| 1775 | * Track a mouse button press on the minimize or maximize box. |
| 1776 | * |
| 1777 | * The big difference between 3.1 and 95 is the disabled button state. |
| 1778 | * In win95 the system button can be disabled, so it can ignore the mouse |
| 1779 | * event. |
| 1780 | * |
| 1781 | */ |
| 1782 | static void NC_TrackMinMaxBox95( HWND hwnd, WORD wParam ) |
| 1783 | { |
| 1784 | MSG msg; |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1785 | HDC hdc = GetWindowDC( hwnd ); |
| 1786 | BOOL pressed = TRUE; |
| 1787 | UINT state; |
| 1788 | DWORD wndStyle = GetWindowLongA( hwnd, GWL_STYLE); |
| 1789 | HMENU hSysMenu = GetSystemMenu(hwnd, FALSE); |
| 1790 | |
| 1791 | void (*paintButton)(HWND, HDC16, BOOL, BOOL); |
| 1792 | |
| 1793 | if (wParam == HTMINBUTTON) |
| 1794 | { |
| 1795 | /* If the style is not present, do nothing */ |
| 1796 | if (!(wndStyle & WS_MINIMIZEBOX)) |
| 1797 | return; |
| 1798 | |
| 1799 | /* Check if the sysmenu item for minimize is there */ |
| 1800 | state = GetMenuState(hSysMenu, SC_MINIMIZE, MF_BYCOMMAND); |
| 1801 | |
| 1802 | paintButton = &NC_DrawMinButton95; |
| 1803 | } |
| 1804 | else |
| 1805 | { |
| 1806 | /* If the style is not present, do nothing */ |
| 1807 | if (!(wndStyle & WS_MAXIMIZEBOX)) |
| 1808 | return; |
| 1809 | |
| 1810 | /* Check if the sysmenu item for maximize is there */ |
| 1811 | state = GetMenuState(hSysMenu, SC_MAXIMIZE, MF_BYCOMMAND); |
| 1812 | |
| 1813 | paintButton = &NC_DrawMaxButton95; |
| 1814 | } |
| 1815 | |
| 1816 | SetCapture( hwnd ); |
| 1817 | |
| 1818 | (*paintButton)( hwnd, hdc, TRUE, FALSE); |
| 1819 | |
Dmitry Timoshkov | 63ba91d | 2000-10-15 00:22:29 +0000 | [diff] [blame] | 1820 | while(1) |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1821 | { |
| 1822 | BOOL oldstate = pressed; |
Alexandre Julliard | bfb4a23 | 2001-08-06 18:05:47 +0000 | [diff] [blame] | 1823 | |
| 1824 | if (!GetMessageW( &msg, 0, WM_MOUSEFIRST, WM_MOUSELAST )) break; |
| 1825 | if (CallMsgFilterW( &msg, MSGF_MAX )) continue; |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1826 | |
Dmitry Timoshkov | 63ba91d | 2000-10-15 00:22:29 +0000 | [diff] [blame] | 1827 | if(msg.message == WM_LBUTTONUP) |
| 1828 | break; |
| 1829 | |
| 1830 | if(msg.message != WM_MOUSEMOVE) |
| 1831 | continue; |
| 1832 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 1833 | pressed = (NC_HandleNCHitTest( hwnd, msg.pt ) == wParam); |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1834 | if (pressed != oldstate) |
| 1835 | (*paintButton)( hwnd, hdc, pressed, FALSE); |
Dmitry Timoshkov | 63ba91d | 2000-10-15 00:22:29 +0000 | [diff] [blame] | 1836 | } |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1837 | |
Dmitry Timoshkov | 63ba91d | 2000-10-15 00:22:29 +0000 | [diff] [blame] | 1838 | if(pressed) |
| 1839 | (*paintButton)(hwnd, hdc, FALSE, FALSE); |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1840 | |
| 1841 | ReleaseCapture(); |
| 1842 | ReleaseDC( hwnd, hdc ); |
| 1843 | |
| 1844 | /* If the item minimize or maximize of the sysmenu are not there */ |
| 1845 | /* or if the style is not present, do nothing */ |
| 1846 | if ((!pressed) || (state == 0xFFFFFFFF)) |
| 1847 | return; |
| 1848 | |
| 1849 | if (wParam == HTMINBUTTON) |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 1850 | SendMessageA( hwnd, WM_SYSCOMMAND, SC_MINIMIZE, MAKELONG(msg.pt.x,msg.pt.y) ); |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1851 | else |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 1852 | SendMessageA( hwnd, WM_SYSCOMMAND, |
| 1853 | IsZoomed(hwnd) ? SC_RESTORE:SC_MAXIMIZE, MAKELONG(msg.pt.x,msg.pt.y) ); |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1854 | } |
| 1855 | |
| 1856 | /*********************************************************************** |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1857 | * NC_TrackMinMaxBox |
| 1858 | * |
| 1859 | * Track a mouse button press on the minimize or maximize box. |
| 1860 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1861 | static void NC_TrackMinMaxBox( HWND hwnd, WORD wParam ) |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1862 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1863 | MSG msg; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1864 | HDC hdc = GetWindowDC( hwnd ); |
| 1865 | BOOL pressed = TRUE; |
| 1866 | void (*paintButton)(HWND, HDC16, BOOL); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1867 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1868 | SetCapture( hwnd ); |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 1869 | |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1870 | if (wParam == HTMINBUTTON) |
| 1871 | paintButton = &NC_DrawMinButton; |
| 1872 | else |
| 1873 | paintButton = &NC_DrawMaxButton; |
| 1874 | |
| 1875 | (*paintButton)( hwnd, hdc, TRUE); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1876 | |
Dmitry Timoshkov | 63ba91d | 2000-10-15 00:22:29 +0000 | [diff] [blame] | 1877 | while(1) |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1878 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1879 | BOOL oldstate = pressed; |
Alexandre Julliard | bfb4a23 | 2001-08-06 18:05:47 +0000 | [diff] [blame] | 1880 | |
| 1881 | if (!GetMessageW( &msg, 0, WM_MOUSEFIRST, WM_MOUSELAST )) break; |
| 1882 | if (CallMsgFilterW( &msg, MSGF_MAX )) continue; |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1883 | |
Dmitry Timoshkov | 63ba91d | 2000-10-15 00:22:29 +0000 | [diff] [blame] | 1884 | if(msg.message == WM_LBUTTONUP) |
| 1885 | break; |
| 1886 | |
| 1887 | if(msg.message != WM_MOUSEMOVE) |
| 1888 | continue; |
| 1889 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 1890 | pressed = (NC_HandleNCHitTest( hwnd, msg.pt ) == wParam); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1891 | if (pressed != oldstate) |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1892 | (*paintButton)( hwnd, hdc, pressed); |
Dmitry Timoshkov | 63ba91d | 2000-10-15 00:22:29 +0000 | [diff] [blame] | 1893 | } |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1894 | |
Dmitry Timoshkov | 63ba91d | 2000-10-15 00:22:29 +0000 | [diff] [blame] | 1895 | if(pressed) |
| 1896 | (*paintButton)( hwnd, hdc, FALSE); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1897 | |
| 1898 | ReleaseCapture(); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1899 | ReleaseDC( hwnd, hdc ); |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1900 | |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1901 | if (!pressed) return; |
| 1902 | |
| 1903 | if (wParam == HTMINBUTTON) |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 1904 | SendMessageA( hwnd, WM_SYSCOMMAND, SC_MINIMIZE, MAKELONG(msg.pt.x,msg.pt.y) ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1905 | else |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 1906 | SendMessageA( hwnd, WM_SYSCOMMAND, |
| 1907 | IsZoomed(hwnd) ? SC_RESTORE:SC_MAXIMIZE, MAKELONG(msg.pt.x,msg.pt.y) ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1908 | } |
| 1909 | |
| 1910 | |
| 1911 | /*********************************************************************** |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1912 | * NC_TrackCloseButton95 |
| 1913 | * |
| 1914 | * Track a mouse button press on the Win95 close button. |
| 1915 | */ |
| 1916 | static void |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1917 | NC_TrackCloseButton95 (HWND hwnd, WORD wParam) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1918 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1919 | MSG msg; |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1920 | HDC hdc; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1921 | BOOL pressed = TRUE; |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1922 | HMENU hSysMenu = GetSystemMenu(hwnd, FALSE); |
| 1923 | UINT state; |
| 1924 | |
| 1925 | if(hSysMenu == 0) |
| 1926 | return; |
| 1927 | |
| 1928 | state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND); |
| 1929 | |
| 1930 | /* If the item close of the sysmenu is disabled or not there do nothing */ |
| 1931 | if((state & MF_DISABLED) || (state & MF_GRAYED) || (state == 0xFFFFFFFF)) |
| 1932 | return; |
| 1933 | |
| 1934 | hdc = GetWindowDC( hwnd ); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1935 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1936 | SetCapture( hwnd ); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1937 | |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1938 | NC_DrawCloseButton95 (hwnd, hdc, TRUE, FALSE); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1939 | |
Dmitry Timoshkov | 63ba91d | 2000-10-15 00:22:29 +0000 | [diff] [blame] | 1940 | while(1) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1941 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1942 | BOOL oldstate = pressed; |
Alexandre Julliard | bfb4a23 | 2001-08-06 18:05:47 +0000 | [diff] [blame] | 1943 | |
| 1944 | if (!GetMessageW( &msg, 0, WM_MOUSEFIRST, WM_MOUSELAST )) break; |
| 1945 | if (CallMsgFilterW( &msg, MSGF_MAX )) continue; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1946 | |
Dmitry Timoshkov | 63ba91d | 2000-10-15 00:22:29 +0000 | [diff] [blame] | 1947 | if(msg.message == WM_LBUTTONUP) |
| 1948 | break; |
| 1949 | |
| 1950 | if(msg.message != WM_MOUSEMOVE) |
| 1951 | continue; |
| 1952 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 1953 | pressed = (NC_HandleNCHitTest( hwnd, msg.pt ) == wParam); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1954 | if (pressed != oldstate) |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1955 | NC_DrawCloseButton95 (hwnd, hdc, pressed, FALSE); |
Dmitry Timoshkov | 63ba91d | 2000-10-15 00:22:29 +0000 | [diff] [blame] | 1956 | } |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1957 | |
Dmitry Timoshkov | 63ba91d | 2000-10-15 00:22:29 +0000 | [diff] [blame] | 1958 | if(pressed) |
| 1959 | NC_DrawCloseButton95 (hwnd, hdc, FALSE, FALSE); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1960 | |
| 1961 | ReleaseCapture(); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1962 | ReleaseDC( hwnd, hdc ); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1963 | if (!pressed) return; |
| 1964 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 1965 | SendMessageA( hwnd, WM_SYSCOMMAND, SC_CLOSE, MAKELONG(msg.pt.x,msg.pt.y) ); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1966 | } |
| 1967 | |
| 1968 | |
| 1969 | /*********************************************************************** |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1970 | * NC_TrackScrollBar |
| 1971 | * |
| 1972 | * Track a mouse button press on the horizontal or vertical scroll-bar. |
| 1973 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1974 | static void NC_TrackScrollBar( HWND hwnd, WPARAM wParam, POINT pt ) |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1975 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1976 | INT scrollbar; |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 1977 | |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1978 | if ((wParam & 0xfff0) == SC_HSCROLL) |
| 1979 | { |
Alexandre Julliard | b662e11 | 2001-10-16 21:52:26 +0000 | [diff] [blame] | 1980 | if ((wParam & 0x0f) != HTHSCROLL) return; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1981 | scrollbar = SB_HORZ; |
| 1982 | } |
| 1983 | else /* SC_VSCROLL */ |
| 1984 | { |
Alexandre Julliard | b662e11 | 2001-10-16 21:52:26 +0000 | [diff] [blame] | 1985 | if ((wParam & 0x0f) != HTVSCROLL) return; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1986 | scrollbar = SB_VERT; |
| 1987 | } |
Alexandre Julliard | b662e11 | 2001-10-16 21:52:26 +0000 | [diff] [blame] | 1988 | SCROLL_TrackScrollBar( hwnd, scrollbar, pt ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1989 | } |
| 1990 | |
Alexandre Julliard | b662e11 | 2001-10-16 21:52:26 +0000 | [diff] [blame] | 1991 | |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1992 | /*********************************************************************** |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1993 | * NC_HandleNCLButtonDown |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1994 | * |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1995 | * Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc(). |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1996 | */ |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 1997 | LONG NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1998 | { |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 1999 | LONG style = GetWindowLongA( hwnd, GWL_STYLE ); |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2000 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2001 | switch(wParam) /* Hit test */ |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 2002 | { |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2003 | case HTCAPTION: |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 2004 | { |
Alexandre Julliard | 0801ffc | 2001-08-24 00:26:59 +0000 | [diff] [blame] | 2005 | HWND top = GetAncestor( hwnd, GA_ROOT ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 2006 | |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 2007 | if( WINPOS_SetActiveWindow(top, TRUE, TRUE) || (GetActiveWindow() == top) ) |
| 2008 | SendMessageW( hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, lParam ); |
| 2009 | break; |
| 2010 | } |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2011 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 2012 | case HTSYSMENU: |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 2013 | if( style & WS_SYSMENU ) |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2014 | { |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 2015 | if( !(style & WS_MINIMIZE) ) |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2016 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2017 | HDC hDC = GetWindowDC(hwnd); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2018 | if (TWEAK_WineLook == WIN31_LOOK) |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2019 | NC_DrawSysButton( hwnd, hDC, TRUE ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2020 | else |
| 2021 | NC_DrawSysButton95( hwnd, hDC, TRUE ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2022 | ReleaseDC( hwnd, hDC ); |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2023 | } |
Alexandre Julliard | cb25e25 | 2001-08-08 23:28:42 +0000 | [diff] [blame] | 2024 | SendMessageW( hwnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU, lParam ); |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2025 | } |
| 2026 | break; |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2027 | |
| 2028 | case HTMENU: |
Alexandre Julliard | cb25e25 | 2001-08-08 23:28:42 +0000 | [diff] [blame] | 2029 | SendMessageW( hwnd, WM_SYSCOMMAND, SC_MOUSEMENU, lParam ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2030 | break; |
| 2031 | |
| 2032 | case HTHSCROLL: |
Alexandre Julliard | cb25e25 | 2001-08-08 23:28:42 +0000 | [diff] [blame] | 2033 | SendMessageW( hwnd, WM_SYSCOMMAND, SC_HSCROLL + HTHSCROLL, lParam ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2034 | break; |
| 2035 | |
| 2036 | case HTVSCROLL: |
Alexandre Julliard | cb25e25 | 2001-08-08 23:28:42 +0000 | [diff] [blame] | 2037 | SendMessageW( hwnd, WM_SYSCOMMAND, SC_VSCROLL + HTVSCROLL, lParam ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2038 | break; |
| 2039 | |
| 2040 | case HTMINBUTTON: |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2041 | case HTMAXBUTTON: |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2042 | if (TWEAK_WineLook == WIN31_LOOK) |
| 2043 | NC_TrackMinMaxBox( hwnd, wParam ); |
| 2044 | else |
| 2045 | NC_TrackMinMaxBox95( hwnd, wParam ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2046 | break; |
| 2047 | |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 2048 | case HTCLOSE: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2049 | if (TWEAK_WineLook >= WIN95_LOOK) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 2050 | NC_TrackCloseButton95 (hwnd, wParam); |
| 2051 | break; |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2052 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2053 | case HTLEFT: |
| 2054 | case HTRIGHT: |
| 2055 | case HTTOP: |
| 2056 | case HTTOPLEFT: |
| 2057 | case HTTOPRIGHT: |
| 2058 | case HTBOTTOM: |
| 2059 | case HTBOTTOMLEFT: |
| 2060 | case HTBOTTOMRIGHT: |
Alexandre Julliard | 7ff1c41 | 1997-05-25 13:58:18 +0000 | [diff] [blame] | 2061 | /* make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU */ |
Alexandre Julliard | cb25e25 | 2001-08-08 23:28:42 +0000 | [diff] [blame] | 2062 | SendMessageW( hwnd, WM_SYSCOMMAND, SC_SIZE + wParam - 2, lParam); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2063 | break; |
| 2064 | |
| 2065 | case HTBORDER: |
| 2066 | break; |
| 2067 | } |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2068 | return 0; |
| 2069 | } |
| 2070 | |
| 2071 | |
| 2072 | /*********************************************************************** |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2073 | * NC_HandleNCLButtonDblClk |
| 2074 | * |
| 2075 | * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc(). |
| 2076 | */ |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 2077 | LONG NC_HandleNCLButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam ) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2078 | { |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 2079 | /* |
| 2080 | * if this is an icon, send a restore since we are handling |
| 2081 | * a double click |
| 2082 | */ |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 2083 | if (IsIconic(hwnd)) |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 2084 | { |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 2085 | SendMessageW( hwnd, WM_SYSCOMMAND, SC_RESTORE, lParam ); |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 2086 | return 0; |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 2087 | } |
| 2088 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2089 | switch(wParam) /* Hit test */ |
| 2090 | { |
| 2091 | case HTCAPTION: |
Alexandre Julliard | 902da69 | 1995-11-05 14:39:02 +0000 | [diff] [blame] | 2092 | /* stop processing if WS_MAXIMIZEBOX is missing */ |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 2093 | if (GetWindowLongA( hwnd, GWL_STYLE ) & WS_MAXIMIZEBOX) |
| 2094 | SendMessageW( hwnd, WM_SYSCOMMAND, |
| 2095 | IsZoomed(hwnd) ? SC_RESTORE : SC_MAXIMIZE, lParam ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2096 | break; |
| 2097 | |
| 2098 | case HTSYSMENU: |
Alexandre Julliard | d44e495 | 2001-08-20 18:09:39 +0000 | [diff] [blame] | 2099 | if (!(GetClassLongW(hwnd, GCL_STYLE) & CS_NOCLOSE)) |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 2100 | SendMessageW( hwnd, WM_SYSCOMMAND, SC_CLOSE, lParam ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 2101 | break; |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 2102 | |
| 2103 | case HTHSCROLL: |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 2104 | SendMessageW( hwnd, WM_SYSCOMMAND, SC_HSCROLL + HTHSCROLL, lParam ); |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 2105 | break; |
| 2106 | |
| 2107 | case HTVSCROLL: |
Alexandre Julliard | de42428 | 2001-08-10 22:51:42 +0000 | [diff] [blame] | 2108 | SendMessageW( hwnd, WM_SYSCOMMAND, SC_VSCROLL + HTVSCROLL, lParam ); |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 2109 | break; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 2110 | } |
| 2111 | return 0; |
| 2112 | } |
| 2113 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2114 | |
| 2115 | /*********************************************************************** |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2116 | * NC_HandleSysCommand |
| 2117 | * |
| 2118 | * Handle a WM_SYSCOMMAND message. Called from DefWindowProc(). |
| 2119 | */ |
Alexandre Julliard | b662e11 | 2001-10-16 21:52:26 +0000 | [diff] [blame] | 2120 | LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam ) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2121 | { |
Alexandre Julliard | b662e11 | 2001-10-16 21:52:26 +0000 | [diff] [blame] | 2122 | TRACE("Handling WM_SYSCOMMAND %x %lx\n", wParam, lParam ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2123 | |
Alexandre Julliard | b662e11 | 2001-10-16 21:52:26 +0000 | [diff] [blame] | 2124 | switch (wParam & 0xfff0) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2125 | { |
| 2126 | case SC_SIZE: |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2127 | case SC_MOVE: |
Alexandre Julliard | 3abeae8 | 2001-05-09 17:21:04 +0000 | [diff] [blame] | 2128 | if (USER_Driver.pSysCommandSizeMove) |
| 2129 | USER_Driver.pSysCommandSizeMove( hwnd, wParam ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2130 | break; |
| 2131 | |
| 2132 | case SC_MINIMIZE: |
Noomen Hamza | d1a1f7d | 1999-10-24 00:02:27 +0000 | [diff] [blame] | 2133 | if (hwnd == GetForegroundWindow()) |
| 2134 | ShowOwnedPopups(hwnd,FALSE); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2135 | ShowWindow( hwnd, SW_MINIMIZE ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2136 | break; |
| 2137 | |
| 2138 | case SC_MAXIMIZE: |
Noomen Hamza | d1a1f7d | 1999-10-24 00:02:27 +0000 | [diff] [blame] | 2139 | if (IsIconic(hwnd) && hwnd == GetForegroundWindow()) |
| 2140 | ShowOwnedPopups(hwnd,TRUE); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2141 | ShowWindow( hwnd, SW_MAXIMIZE ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2142 | break; |
| 2143 | |
| 2144 | case SC_RESTORE: |
Noomen Hamza | d1a1f7d | 1999-10-24 00:02:27 +0000 | [diff] [blame] | 2145 | if (IsIconic(hwnd) && hwnd == GetForegroundWindow()) |
| 2146 | ShowOwnedPopups(hwnd,TRUE); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2147 | ShowWindow( hwnd, SW_RESTORE ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2148 | break; |
| 2149 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2150 | case SC_CLOSE: |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame] | 2151 | return SendMessageA( hwnd, WM_CLOSE, 0, 0 ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2152 | |
| 2153 | case SC_VSCROLL: |
| 2154 | case SC_HSCROLL: |
Alexandre Julliard | b662e11 | 2001-10-16 21:52:26 +0000 | [diff] [blame] | 2155 | { |
| 2156 | POINT pt; |
| 2157 | pt.x = SLOWORD(lParam); |
| 2158 | pt.y = SHIWORD(lParam); |
| 2159 | NC_TrackScrollBar( hwnd, wParam, pt ); |
| 2160 | } |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2161 | break; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2162 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2163 | case SC_MOUSEMENU: |
Alexandre Julliard | b662e11 | 2001-10-16 21:52:26 +0000 | [diff] [blame] | 2164 | { |
| 2165 | POINT pt; |
| 2166 | pt.x = SLOWORD(lParam); |
| 2167 | pt.y = SHIWORD(lParam); |
| 2168 | MENU_TrackMouseMenuBar( hwnd, wParam & 0x000F, pt ); |
| 2169 | } |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2170 | break; |
| 2171 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2172 | case SC_KEYMENU: |
Alexandre Julliard | b662e11 | 2001-10-16 21:52:26 +0000 | [diff] [blame] | 2173 | MENU_TrackKbdMenuBar( hwnd, wParam, LOWORD(lParam) ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2174 | break; |
Alexandre Julliard | b662e11 | 2001-10-16 21:52:26 +0000 | [diff] [blame] | 2175 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2176 | case SC_TASKLIST: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2177 | WinExec( "taskman.exe", SW_SHOWNORMAL ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2178 | break; |
Alexandre Julliard | 3f2abfa | 1994-08-16 15:43:11 +0000 | [diff] [blame] | 2179 | |
| 2180 | case SC_SCREENSAVE: |
| 2181 | if (wParam == SC_ABOUTWINE) |
Alexandre Julliard | 563561e | 2000-01-24 05:46:47 +0000 | [diff] [blame] | 2182 | { |
| 2183 | HMODULE hmodule = LoadLibraryA( "shell32.dll" ); |
| 2184 | if (hmodule) |
| 2185 | { |
| 2186 | FARPROC aboutproc = GetProcAddress( hmodule, "ShellAboutA" ); |
| 2187 | if (aboutproc) aboutproc( hwnd, "Wine", WINE_RELEASE_INFO, 0 ); |
| 2188 | FreeLibrary( hmodule ); |
| 2189 | } |
| 2190 | } |
Uwe Bonnes | 3700777 | 1998-11-01 15:07:24 +0000 | [diff] [blame] | 2191 | else |
| 2192 | if (wParam == SC_PUTMARK) |
Alexandre Julliard | 06c275a | 1999-05-02 14:32:27 +0000 | [diff] [blame] | 2193 | TRACE_(shell)("Mark requested by user\n"); |
Alexandre Julliard | 3f2abfa | 1994-08-16 15:43:11 +0000 | [diff] [blame] | 2194 | break; |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 2195 | |
| 2196 | case SC_HOTKEY: |
| 2197 | case SC_ARRANGE: |
| 2198 | case SC_NEXTWINDOW: |
| 2199 | case SC_PREVWINDOW: |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 2200 | FIXME("unimplemented!\n"); |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 2201 | break; |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2202 | } |
| 2203 | return 0; |
| 2204 | } |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2205 | |
| 2206 | /************************************************************* |
| 2207 | * NC_DrawGrayButton |
| 2208 | * |
| 2209 | * Stub for the grayed button of the caption |
| 2210 | * |
| 2211 | *************************************************************/ |
| 2212 | |
| 2213 | BOOL NC_DrawGrayButton(HDC hdc, int x, int y) |
| 2214 | { |
| 2215 | HBITMAP hMaskBmp; |
| 2216 | HDC hdcMask = CreateCompatibleDC (0); |
| 2217 | HBRUSH hOldBrush; |
| 2218 | |
| 2219 | hMaskBmp = CreateBitmap (12, 10, 1, 1, lpGrayMask); |
| 2220 | |
| 2221 | if(hMaskBmp == 0) |
| 2222 | return FALSE; |
| 2223 | |
| 2224 | SelectObject (hdcMask, hMaskBmp); |
| 2225 | |
| 2226 | /* Draw the grayed bitmap using the mask */ |
| 2227 | hOldBrush = SelectObject (hdc, RGB(128, 128, 128)); |
| 2228 | BitBlt (hdc, x, y, 12, 10, |
| 2229 | hdcMask, 0, 0, 0xB8074A); |
| 2230 | |
| 2231 | /* Clean up */ |
| 2232 | SelectObject (hdc, hOldBrush); |
| 2233 | DeleteObject(hMaskBmp); |
| 2234 | DeleteDC (hdcMask); |
| 2235 | |
| 2236 | return TRUE; |
| 2237 | } |