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