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 "message.h" |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 14 | #include "user.h" |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 15 | #include "heap.h" |
Alex Korobka | 4f1ac05 | 1999-03-28 09:37:57 +0000 | [diff] [blame] | 16 | #include "dce.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 "dialog.h" |
Alexandre Julliard | 234bc24 | 1994-12-10 13:02:28 +0000 | [diff] [blame] | 19 | #include "menu.h" |
| 20 | #include "winpos.h" |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 21 | #include "hook.h" |
Alexandre Julliard | 234bc24 | 1994-12-10 13:02:28 +0000 | [diff] [blame] | 22 | #include "scroll.h" |
| 23 | #include "nonclient.h" |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 24 | #include "queue.h" |
Alexandre Julliard | fa68b75 | 1995-04-03 16:55:37 +0000 | [diff] [blame] | 25 | #include "selectors.h" |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 26 | #include "tweak.h" |
Alexandre Julliard | 06c275a | 1999-05-02 14:32:27 +0000 | [diff] [blame] | 27 | #include "debugtools.h" |
Alexandre Julliard | d471965 | 1995-12-12 18:49:11 +0000 | [diff] [blame] | 28 | #include "options.h" |
Marcus Meissner | 317af32 | 1999-02-17 13:51:06 +0000 | [diff] [blame] | 29 | #include "shellapi.h" |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 30 | #include "cache.h" |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 31 | #include "bitmap.h" |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 32 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 33 | DEFAULT_DEBUG_CHANNEL(nonclient) |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 34 | DECLARE_DEBUG_CHANNEL(shell) |
| 35 | |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 36 | BOOL NC_DrawGrayButton(HDC hdc, int x, int y); |
| 37 | |
Alexandre Julliard | bf9130a | 1996-10-13 17:45:47 +0000 | [diff] [blame] | 38 | static HBITMAP16 hbitmapClose = 0; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 39 | static HBITMAP16 hbitmapCloseD = 0; |
Alexandre Julliard | bf9130a | 1996-10-13 17:45:47 +0000 | [diff] [blame] | 40 | static HBITMAP16 hbitmapMinimize = 0; |
| 41 | static HBITMAP16 hbitmapMinimizeD = 0; |
| 42 | static HBITMAP16 hbitmapMaximize = 0; |
| 43 | static HBITMAP16 hbitmapMaximizeD = 0; |
| 44 | static HBITMAP16 hbitmapRestore = 0; |
| 45 | static HBITMAP16 hbitmapRestoreD = 0; |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 46 | |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 47 | BYTE lpGrayMask[] = { 0xAA, 0xA0, |
| 48 | 0x55, 0x50, |
| 49 | 0xAA, 0xA0, |
| 50 | 0x55, 0x50, |
| 51 | 0xAA, 0xA0, |
| 52 | 0x55, 0x50, |
| 53 | 0xAA, 0xA0, |
| 54 | 0x55, 0x50, |
| 55 | 0xAA, 0xA0, |
| 56 | 0x55, 0x50}; |
| 57 | |
Alexandre Julliard | 3f2abfa | 1994-08-16 15:43:11 +0000 | [diff] [blame] | 58 | #define SC_ABOUTWINE (SC_SCREENSAVE+1) |
Uwe Bonnes | 3700777 | 1998-11-01 15:07:24 +0000 | [diff] [blame] | 59 | #define SC_PUTMARK (SC_SCREENSAVE+2) |
Alexandre Julliard | 3f2abfa | 1994-08-16 15:43:11 +0000 | [diff] [blame] | 60 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 61 | /* Some useful macros */ |
| 62 | #define HAS_DLGFRAME(style,exStyle) \ |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 63 | (((exStyle) & WS_EX_DLGMODALFRAME) || \ |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 64 | (((style) & WS_DLGFRAME) && !((style) & WS_THICKFRAME))) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 65 | |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 66 | #define HAS_THICKFRAME(style,exStyle) \ |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 67 | (((style) & WS_THICKFRAME) && \ |
Abey George | 48c6eb5 | 1999-09-03 12:33:40 +0000 | [diff] [blame] | 68 | !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME)) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 69 | |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 70 | #define HAS_THINFRAME(style) \ |
| 71 | (((style) & WS_BORDER) || !((style) & (WS_CHILD | WS_POPUP))) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 72 | |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 73 | #define HAS_BIGFRAME(style,exStyle) \ |
| 74 | (((style) & (WS_THICKFRAME | WS_DLGFRAME)) || \ |
| 75 | ((exStyle) & WS_EX_DLGMODALFRAME)) |
Gerard Patel | 5773dad | 1999-06-12 14:45:56 +0000 | [diff] [blame] | 76 | |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 77 | #define HAS_ANYFRAME(style,exStyle) \ |
| 78 | (((style) & (WS_THICKFRAME | WS_DLGFRAME | WS_BORDER)) || \ |
| 79 | ((exStyle) & WS_EX_DLGMODALFRAME) || \ |
| 80 | !((style) & (WS_CHILD | WS_POPUP))) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 81 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 82 | #define HAS_MENU(w) (!((w)->dwStyle & WS_CHILD) && ((w)->wIDmenu != 0)) |
| 83 | |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 84 | #define ON_LEFT_BORDER(hit) \ |
| 85 | (((hit) == HTLEFT) || ((hit) == HTTOPLEFT) || ((hit) == HTBOTTOMLEFT)) |
| 86 | #define ON_RIGHT_BORDER(hit) \ |
| 87 | (((hit) == HTRIGHT) || ((hit) == HTTOPRIGHT) || ((hit) == HTBOTTOMRIGHT)) |
| 88 | #define ON_TOP_BORDER(hit) \ |
| 89 | (((hit) == HTTOP) || ((hit) == HTTOPLEFT) || ((hit) == HTTOPRIGHT)) |
| 90 | #define ON_BOTTOM_BORDER(hit) \ |
| 91 | (((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT)) |
| 92 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 93 | /*********************************************************************** |
Sylvain St-Germain | 00bf381 | 1999-07-24 12:11:22 +0000 | [diff] [blame] | 94 | * WIN_WindowNeedsWMBorder |
| 95 | * |
| 96 | * This method defines the rules for a window to have a WM border, |
| 97 | * caption... It is used for consitency purposes. |
| 98 | */ |
| 99 | BOOL WIN_WindowNeedsWMBorder( DWORD style, DWORD exStyle ) |
| 100 | { |
Francis Beaudet | c9a50fd | 1999-09-10 13:59:24 +0000 | [diff] [blame] | 101 | if (!(style & WS_CHILD) && |
| 102 | Options.managed && |
| 103 | !(exStyle & WS_EX_TOOLWINDOW) && |
| 104 | ( ((style & WS_CAPTION) == WS_CAPTION) || |
| 105 | (style & WS_THICKFRAME))) |
Thuy Nguyen | 46570a9 | 1999-08-07 12:25:32 +0000 | [diff] [blame] | 106 | return TRUE; |
Alexandre Julliard | 1dc551c | 1999-12-11 23:54:59 +0000 | [diff] [blame] | 107 | if (exStyle & WS_EX_TRAYWINDOW) |
| 108 | return TRUE; |
Sylvain St-Germain | 00bf381 | 1999-07-24 12:11:22 +0000 | [diff] [blame] | 109 | return FALSE; |
| 110 | } |
| 111 | |
| 112 | /*********************************************************************** |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 113 | * NC_AdjustRect |
| 114 | * |
| 115 | * Compute the size of the window rectangle from the size of the |
| 116 | * client rectangle. |
| 117 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 118 | static void NC_AdjustRect( LPRECT16 rect, DWORD style, BOOL menu, |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 119 | DWORD exStyle ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 120 | { |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 121 | if (TWEAK_WineLook > WIN31_LOOK) |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 122 | ERR("Called in Win95 mode. Aiee! Please report this.\n" ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 123 | |
Alexandre Julliard | bf9130a | 1996-10-13 17:45:47 +0000 | [diff] [blame] | 124 | if(style & WS_ICONIC) return; |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 125 | /* Decide if the window will be managed (see CreateWindowEx) */ |
Sylvain St-Germain | 00bf381 | 1999-07-24 12:11:22 +0000 | [diff] [blame] | 126 | if (!WIN_WindowNeedsWMBorder(style, exStyle)) |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 127 | { |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 128 | if (HAS_THICKFRAME( style, exStyle )) |
| 129 | InflateRect16( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) ); |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 130 | else |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 131 | if (HAS_DLGFRAME( style, exStyle )) |
| 132 | InflateRect16( rect, GetSystemMetrics(SM_CXDLGFRAME), GetSystemMetrics(SM_CYDLGFRAME) ); |
| 133 | else |
| 134 | if (HAS_THINFRAME( style )) |
| 135 | InflateRect16( rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER)); |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 136 | |
| 137 | if ((style & WS_CAPTION) == WS_CAPTION) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 138 | rect->top -= GetSystemMetrics(SM_CYCAPTION) - GetSystemMetrics(SM_CYBORDER); |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 139 | } |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 140 | if (menu) rect->top -= GetSystemMetrics(SM_CYMENU) + GetSystemMetrics(SM_CYBORDER); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 141 | |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 142 | if (style & WS_VSCROLL) { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 143 | rect->right += GetSystemMetrics(SM_CXVSCROLL) - 1; |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 144 | if(!HAS_ANYFRAME( style, exStyle )) |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 145 | rect->right++; |
| 146 | } |
| 147 | |
| 148 | if (style & WS_HSCROLL) { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 149 | rect->bottom += GetSystemMetrics(SM_CYHSCROLL) - 1; |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 150 | if(!HAS_ANYFRAME( style, exStyle )) |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 151 | rect->bottom++; |
| 152 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 153 | } |
| 154 | |
| 155 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 156 | /****************************************************************************** |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 157 | * NC_AdjustRectOuter95 |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 158 | * |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 159 | * Computes the size of the "outside" parts of the window based on the |
| 160 | * parameters of the client area. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 161 | * |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 162 | + PARAMS |
| 163 | * LPRECT16 rect |
| 164 | * DWORD style |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 165 | * BOOL menu |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 166 | * DWORD exStyle |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 167 | * |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 168 | * NOTES |
| 169 | * "Outer" parts of a window means the whole window frame, caption and |
| 170 | * menu bar. It does not include "inner" parts of the frame like client |
| 171 | * edge, static edge or scroll bars. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 172 | * |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 173 | * Revision history |
| 174 | * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) |
| 175 | * Original (NC_AdjustRect95) cut & paste from NC_AdjustRect |
| 176 | * |
| 177 | * 20-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de) |
| 178 | * Split NC_AdjustRect95 into NC_AdjustRectOuter95 and |
| 179 | * NC_AdjustRectInner95 and added handling of Win95 styles. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 180 | * |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 181 | * 28-Jul-1999 Ove KÃ¥ven (ovek@arcticnet.no) |
| 182 | * Streamlined window style checks. |
| 183 | * |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 184 | *****************************************************************************/ |
| 185 | |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 186 | static void |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 187 | NC_AdjustRectOuter95 (LPRECT16 rect, DWORD style, BOOL menu, DWORD exStyle) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 188 | { |
| 189 | if(style & WS_ICONIC) return; |
| 190 | |
| 191 | /* Decide if the window will be managed (see CreateWindowEx) */ |
Sylvain St-Germain | 00bf381 | 1999-07-24 12:11:22 +0000 | [diff] [blame] | 192 | if (!WIN_WindowNeedsWMBorder(style, exStyle)) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 193 | { |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 194 | if (HAS_THICKFRAME( style, exStyle )) |
| 195 | InflateRect16( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) ); |
| 196 | else |
| 197 | if (HAS_DLGFRAME( style, exStyle )) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 198 | InflateRect16(rect, GetSystemMetrics(SM_CXDLGFRAME), GetSystemMetrics(SM_CYDLGFRAME) ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 199 | else |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 200 | if (HAS_THINFRAME( style )) |
| 201 | InflateRect16( rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER)); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 202 | |
| 203 | if ((style & WS_CAPTION) == WS_CAPTION) |
Jesper Skov | 5c3e457 | 1998-11-01 19:27:22 +0000 | [diff] [blame] | 204 | { |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 205 | if (exStyle & WS_EX_TOOLWINDOW) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 206 | rect->top -= GetSystemMetrics(SM_CYSMCAPTION); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 207 | else |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 208 | rect->top -= GetSystemMetrics(SM_CYCAPTION); |
Jesper Skov | 5c3e457 | 1998-11-01 19:27:22 +0000 | [diff] [blame] | 209 | } |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 210 | } |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 211 | |
| 212 | if (menu) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 213 | rect->top -= GetSystemMetrics(SM_CYMENU); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 214 | } |
| 215 | |
| 216 | |
| 217 | /****************************************************************************** |
| 218 | * NC_AdjustRectInner95 |
| 219 | * |
| 220 | * Computes the size of the "inside" part of the window based on the |
| 221 | * parameters of the client area. |
| 222 | * |
| 223 | + PARAMS |
| 224 | * LPRECT16 rect |
| 225 | * DWORD style |
| 226 | * DWORD exStyle |
| 227 | * |
| 228 | * NOTES |
| 229 | * "Inner" part of a window means the window frame inside of the flat |
| 230 | * window frame. It includes the client edge, the static edge and the |
| 231 | * scroll bars. |
| 232 | * |
| 233 | * Revision history |
| 234 | * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) |
| 235 | * Original (NC_AdjustRect95) cut & paste from NC_AdjustRect |
| 236 | * |
| 237 | * 20-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de) |
| 238 | * Split NC_AdjustRect95 into NC_AdjustRectOuter95 and |
| 239 | * NC_AdjustRectInner95 and added handling of Win95 styles. |
| 240 | * |
| 241 | *****************************************************************************/ |
| 242 | |
| 243 | static void |
| 244 | NC_AdjustRectInner95 (LPRECT16 rect, DWORD style, DWORD exStyle) |
| 245 | { |
| 246 | if(style & WS_ICONIC) return; |
| 247 | |
| 248 | if (exStyle & WS_EX_CLIENTEDGE) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 249 | InflateRect16 (rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 250 | |
| 251 | if (exStyle & WS_EX_STATICEDGE) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 252 | InflateRect16 (rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER)); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 253 | |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 254 | if (style & WS_VSCROLL) rect->right += GetSystemMetrics(SM_CXVSCROLL); |
| 255 | if (style & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 256 | } |
| 257 | |
| 258 | |
Alexandre Julliard | e658d82 | 1997-11-30 17:45:40 +0000 | [diff] [blame] | 259 | /*********************************************************************** |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 260 | * DrawCaption16 [USER.660] Draws a caption bar |
| 261 | * |
| 262 | * PARAMS |
| 263 | * hwnd [I] |
| 264 | * hdc [I] |
| 265 | * lpRect [I] |
| 266 | * uFlags [I] |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 267 | * |
Eric Kohl | d0b79c0 | 1998-10-24 10:45:42 +0000 | [diff] [blame] | 268 | * RETURNS |
| 269 | * Success: |
| 270 | * Failure: |
Alexandre Julliard | e658d82 | 1997-11-30 17:45:40 +0000 | [diff] [blame] | 271 | */ |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 272 | |
| 273 | BOOL16 WINAPI |
Eric Kohl | d0b79c0 | 1998-10-24 10:45:42 +0000 | [diff] [blame] | 274 | DrawCaption16 (HWND16 hwnd, HDC16 hdc, const RECT16 *rect, UINT16 uFlags) |
Alexandre Julliard | a845b88 | 1998-06-01 10:44:35 +0000 | [diff] [blame] | 275 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 276 | RECT rect32; |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 277 | |
Eric Kohl | d0b79c0 | 1998-10-24 10:45:42 +0000 | [diff] [blame] | 278 | if (rect) |
| 279 | CONV_RECT16TO32 (rect, &rect32); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 280 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 281 | return (BOOL16)DrawCaptionTempA (hwnd, hdc, rect ? &rect32 : NULL, |
Eric Kohl | d0b79c0 | 1998-10-24 10:45:42 +0000 | [diff] [blame] | 282 | 0, 0, NULL, uFlags & 0x1F); |
Alexandre Julliard | e658d82 | 1997-11-30 17:45:40 +0000 | [diff] [blame] | 283 | } |
| 284 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 285 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 286 | /*********************************************************************** |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 287 | * DrawCaption [USER32.154] Draws a caption bar |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 288 | * |
| 289 | * PARAMS |
| 290 | * hwnd [I] |
| 291 | * hdc [I] |
| 292 | * lpRect [I] |
| 293 | * uFlags [I] |
| 294 | * |
Eric Kohl | d0b79c0 | 1998-10-24 10:45:42 +0000 | [diff] [blame] | 295 | * RETURNS |
| 296 | * Success: |
| 297 | * Failure: |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 298 | */ |
| 299 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 300 | BOOL WINAPI |
| 301 | DrawCaption (HWND hwnd, HDC hdc, const RECT *lpRect, UINT uFlags) |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 302 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 303 | return DrawCaptionTempA (hwnd, hdc, lpRect, 0, 0, NULL, uFlags & 0x1F); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 304 | } |
| 305 | |
| 306 | |
| 307 | /*********************************************************************** |
| 308 | * DrawCaptionTemp16 [USER.657] |
| 309 | * |
Eric Kohl | d0b79c0 | 1998-10-24 10:45:42 +0000 | [diff] [blame] | 310 | * PARAMS |
| 311 | * |
| 312 | * RETURNS |
| 313 | * Success: |
| 314 | * Failure: |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 315 | */ |
| 316 | |
| 317 | BOOL16 WINAPI |
| 318 | DrawCaptionTemp16 (HWND16 hwnd, HDC16 hdc, const RECT16 *rect, HFONT16 hFont, |
| 319 | HICON16 hIcon, LPCSTR str, UINT16 uFlags) |
| 320 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 321 | RECT rect32; |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 322 | |
Eric Kohl | d0b79c0 | 1998-10-24 10:45:42 +0000 | [diff] [blame] | 323 | if (rect) |
| 324 | CONV_RECT16TO32(rect,&rect32); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 325 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 326 | return (BOOL16)DrawCaptionTempA (hwnd, hdc, rect?&rect32:NULL, hFont, |
Eric Kohl | d0b79c0 | 1998-10-24 10:45:42 +0000 | [diff] [blame] | 327 | hIcon, str, uFlags & 0x1F); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 328 | } |
| 329 | |
| 330 | |
| 331 | /*********************************************************************** |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 332 | * DrawCaptionTempA [USER32.599] |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 333 | * |
Eric Kohl | d0b79c0 | 1998-10-24 10:45:42 +0000 | [diff] [blame] | 334 | * PARAMS |
| 335 | * |
| 336 | * RETURNS |
| 337 | * Success: |
| 338 | * Failure: |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 339 | */ |
| 340 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 341 | BOOL WINAPI |
| 342 | DrawCaptionTempA (HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, |
| 343 | HICON hIcon, LPCSTR str, UINT uFlags) |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 344 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 345 | RECT rc = *rect; |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 346 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 347 | TRACE("(%08x,%08x,%p,%08x,%08x,\"%s\",%08x)\n", |
| 348 | hwnd, hdc, rect, hFont, hIcon, str, uFlags); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 349 | |
| 350 | /* drawing background */ |
| 351 | if (uFlags & DC_INBUTTON) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 352 | FillRect (hdc, &rc, GetSysColorBrush (COLOR_3DFACE)); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 353 | |
| 354 | if (uFlags & DC_ACTIVE) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 355 | HBRUSH hbr = SelectObject (hdc, CACHE_GetPattern55AABrush ()); |
| 356 | PatBlt (hdc, rc.left, rc.top, |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 357 | rc.right-rc.left, rc.bottom-rc.top, 0xFA0089); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 358 | SelectObject (hdc, hbr); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 359 | } |
| 360 | } |
| 361 | else { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 362 | FillRect (hdc, &rc, GetSysColorBrush ((uFlags & DC_ACTIVE) ? |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 363 | COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION)); |
| 364 | } |
| 365 | |
| 366 | |
| 367 | /* drawing icon */ |
| 368 | if ((uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP)) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 369 | POINT pt; |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 370 | |
| 371 | pt.x = rc.left + 2; |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 372 | pt.y = (rc.bottom + rc.top - GetSystemMetrics(SM_CYSMICON)) / 2; |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 373 | |
| 374 | if (hIcon) { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 375 | DrawIconEx (hdc, pt.x, pt.y, hIcon, GetSystemMetrics(SM_CXSMICON), |
| 376 | GetSystemMetrics(SM_CYSMICON), 0, 0, DI_NORMAL); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 377 | } |
| 378 | else { |
Susan Farley | 9ce8382 | 2000-05-23 04:12:23 +0000 | [diff] [blame] | 379 | WND* wndPtr = WIN_FindWndPtr(hwnd); |
| 380 | HICON hAppIcon = (HICON) NC_IconForWindow(wndPtr); |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 381 | DrawIconEx (hdc, pt.x, pt.y, hAppIcon, GetSystemMetrics(SM_CXSMICON), |
| 382 | GetSystemMetrics(SM_CYSMICON), 0, 0, DI_NORMAL); |
Susan Farley | 9ce8382 | 2000-05-23 04:12:23 +0000 | [diff] [blame] | 383 | WIN_ReleaseWndPtr(wndPtr); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 384 | } |
| 385 | |
| 386 | rc.left += (rc.bottom - rc.top); |
| 387 | } |
| 388 | |
| 389 | /* drawing text */ |
| 390 | if (uFlags & DC_TEXT) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 391 | HFONT hOldFont; |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 392 | |
| 393 | if (uFlags & DC_INBUTTON) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 394 | SetTextColor (hdc, GetSysColor (COLOR_BTNTEXT)); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 395 | else if (uFlags & DC_ACTIVE) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 396 | SetTextColor (hdc, GetSysColor (COLOR_CAPTIONTEXT)); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 397 | else |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 398 | SetTextColor (hdc, GetSysColor (COLOR_INACTIVECAPTIONTEXT)); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 399 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 400 | SetBkMode (hdc, TRANSPARENT); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 401 | |
| 402 | if (hFont) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 403 | hOldFont = SelectObject (hdc, hFont); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 404 | else { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 405 | NONCLIENTMETRICSA nclm; |
| 406 | HFONT hNewFont; |
| 407 | nclm.cbSize = sizeof(NONCLIENTMETRICSA); |
| 408 | SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0); |
| 409 | hNewFont = CreateFontIndirectA ((uFlags & DC_SMALLCAP) ? |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 410 | &nclm.lfSmCaptionFont : &nclm.lfCaptionFont); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 411 | hOldFont = SelectObject (hdc, hNewFont); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 412 | } |
| 413 | |
| 414 | if (str) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 415 | DrawTextA (hdc, str, -1, &rc, |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 416 | DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT); |
| 417 | else { |
| 418 | CHAR szText[128]; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 419 | INT nLen; |
| 420 | nLen = GetWindowTextA (hwnd, szText, 128); |
| 421 | DrawTextA (hdc, szText, nLen, &rc, |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 422 | DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT); |
| 423 | } |
| 424 | |
| 425 | if (hFont) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 426 | SelectObject (hdc, hOldFont); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 427 | else |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 428 | DeleteObject (SelectObject (hdc, hOldFont)); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 429 | } |
| 430 | |
| 431 | /* drawing focus ??? */ |
| 432 | if (uFlags & 0x2000) |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 433 | FIXME("undocumented flag (0x2000)!\n"); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 434 | |
| 435 | return 0; |
| 436 | } |
| 437 | |
| 438 | |
| 439 | /*********************************************************************** |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 440 | * DrawCaptionTempW [USER32.602] |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 441 | * |
Eric Kohl | d0b79c0 | 1998-10-24 10:45:42 +0000 | [diff] [blame] | 442 | * PARAMS |
| 443 | * |
| 444 | * RETURNS |
| 445 | * Success: |
| 446 | * Failure: |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 447 | */ |
| 448 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 449 | BOOL WINAPI |
| 450 | DrawCaptionTempW (HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, |
| 451 | HICON hIcon, LPCWSTR str, UINT uFlags) |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 452 | { |
| 453 | LPSTR p = HEAP_strdupWtoA (GetProcessHeap (), 0, str); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 454 | BOOL res = DrawCaptionTempA (hwnd, hdc, rect, hFont, hIcon, p, uFlags); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 455 | HeapFree (GetProcessHeap (), 0, p); |
| 456 | return res; |
| 457 | } |
| 458 | |
| 459 | |
| 460 | /*********************************************************************** |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 461 | * AdjustWindowRect16 (USER.102) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 462 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 463 | BOOL16 WINAPI AdjustWindowRect16( LPRECT16 rect, DWORD style, BOOL16 menu ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 464 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 465 | return AdjustWindowRectEx16( rect, style, menu, 0 ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 466 | } |
| 467 | |
| 468 | |
| 469 | /*********************************************************************** |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 470 | * AdjustWindowRect (USER32.2) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 471 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 472 | BOOL WINAPI AdjustWindowRect( LPRECT rect, DWORD style, BOOL menu ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 473 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 474 | return AdjustWindowRectEx( rect, style, menu, 0 ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 475 | } |
| 476 | |
| 477 | |
| 478 | /*********************************************************************** |
| 479 | * AdjustWindowRectEx16 (USER.454) |
| 480 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 481 | BOOL16 WINAPI AdjustWindowRectEx16( LPRECT16 rect, DWORD style, |
| 482 | BOOL16 menu, DWORD exStyle ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 483 | { |
| 484 | /* Correct the window style */ |
| 485 | |
| 486 | if (!(style & (WS_POPUP | WS_CHILD))) /* Overlapped window */ |
| 487 | style |= WS_CAPTION; |
Alexandre Julliard | 84c70f5 | 1997-05-09 08:40:27 +0000 | [diff] [blame] | 488 | style &= (WS_DLGFRAME | WS_BORDER | WS_THICKFRAME | WS_CHILD); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 489 | exStyle &= (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | |
| 490 | WS_EX_STATICEDGE | WS_EX_TOOLWINDOW); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 491 | if (exStyle & WS_EX_DLGMODALFRAME) style &= ~WS_THICKFRAME; |
| 492 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 493 | TRACE("(%d,%d)-(%d,%d) %08lx %d %08lx\n", |
| 494 | rect->left, rect->top, rect->right, rect->bottom, |
| 495 | style, menu, exStyle ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 496 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 497 | if (TWEAK_WineLook == WIN31_LOOK) |
| 498 | NC_AdjustRect( rect, style, menu, exStyle ); |
| 499 | else { |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 500 | NC_AdjustRectOuter95( rect, style, menu, exStyle ); |
| 501 | NC_AdjustRectInner95( rect, style, exStyle ); |
| 502 | } |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 503 | |
Alexandre Julliard | 7e56f68 | 1996-01-31 19:02:28 +0000 | [diff] [blame] | 504 | return TRUE; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 505 | } |
| 506 | |
| 507 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 508 | /*********************************************************************** |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 509 | * AdjustWindowRectEx (USER32.3) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 510 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 511 | BOOL WINAPI AdjustWindowRectEx( LPRECT rect, DWORD style, |
| 512 | BOOL menu, DWORD exStyle ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 513 | { |
| 514 | RECT16 rect16; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 515 | BOOL ret; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 516 | |
| 517 | CONV_RECT32TO16( rect, &rect16 ); |
| 518 | ret = AdjustWindowRectEx16( &rect16, style, (BOOL16)menu, exStyle ); |
| 519 | CONV_RECT16TO32( &rect16, rect ); |
| 520 | return ret; |
| 521 | } |
| 522 | |
| 523 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 524 | /*********************************************************************** |
| 525 | * NC_HandleNCCalcSize |
| 526 | * |
| 527 | * Handle a WM_NCCALCSIZE message. Called from DefWindowProc(). |
| 528 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 529 | LONG NC_HandleNCCalcSize( WND *pWnd, RECT *winRect ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 530 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 531 | RECT16 tmpRect = { 0, 0, 0, 0 }; |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 532 | LONG result = 0; |
Gerard Patel | 5773dad | 1999-06-12 14:45:56 +0000 | [diff] [blame] | 533 | UINT style = (UINT) GetClassLongA(pWnd->hwndSelf, GCL_STYLE); |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 534 | |
Gerard Patel | 5773dad | 1999-06-12 14:45:56 +0000 | [diff] [blame] | 535 | if (style & CS_VREDRAW) result |= WVR_VREDRAW; |
| 536 | if (style & CS_HREDRAW) result |= WVR_HREDRAW; |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 537 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 538 | if( !( pWnd->dwStyle & WS_MINIMIZE ) ) { |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 539 | if (TWEAK_WineLook == WIN31_LOOK) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 540 | NC_AdjustRect( &tmpRect, pWnd->dwStyle, FALSE, pWnd->dwExStyle ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 541 | else |
| 542 | NC_AdjustRectOuter95( &tmpRect, pWnd->dwStyle, FALSE, pWnd->dwExStyle ); |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 543 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 544 | winRect->left -= tmpRect.left; |
| 545 | winRect->top -= tmpRect.top; |
| 546 | winRect->right -= tmpRect.right; |
| 547 | winRect->bottom -= tmpRect.bottom; |
| 548 | |
| 549 | if (HAS_MENU(pWnd)) { |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 550 | TRACE("Calling GetMenuBarHeight with HWND 0x%x, width %d, " |
| 551 | "at (%d, %d).\n", pWnd->hwndSelf, |
| 552 | winRect->right - winRect->left, |
| 553 | -tmpRect.left, -tmpRect.top ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 554 | |
| 555 | winRect->top += |
| 556 | MENU_GetMenuBarHeight( pWnd->hwndSelf, |
| 557 | winRect->right - winRect->left, |
| 558 | -tmpRect.left, -tmpRect.top ) + 1; |
| 559 | } |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 560 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 561 | if (TWEAK_WineLook > WIN31_LOOK) { |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 562 | SetRect16 (&tmpRect, 0, 0, 0, 0); |
| 563 | NC_AdjustRectInner95 (&tmpRect, pWnd->dwStyle, pWnd->dwExStyle); |
| 564 | winRect->left -= tmpRect.left; |
| 565 | winRect->top -= tmpRect.top; |
| 566 | winRect->right -= tmpRect.right; |
| 567 | winRect->bottom -= tmpRect.bottom; |
| 568 | } |
Mike McCormack | a2bdade | 2000-09-12 23:37:57 +0000 | [diff] [blame] | 569 | |
| 570 | if (winRect->top > winRect->bottom) |
| 571 | winRect->bottom = winRect->top; |
| 572 | |
| 573 | if (winRect->left > winRect->right) |
| 574 | winRect->right = winRect->left; |
Alexandre Julliard | 2d159fb | 1994-07-15 16:04:31 +0000 | [diff] [blame] | 575 | } |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 576 | return result; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 577 | } |
| 578 | |
| 579 | |
| 580 | /*********************************************************************** |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 581 | * NC_GetInsideRect |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 582 | * |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 583 | * Get the 'inside' rectangle of a window, i.e. the whole window rectangle |
| 584 | * but without the borders (if any). |
| 585 | * The rectangle is in window coordinates (for drawing with GetWindowDC()). |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 586 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 587 | static void NC_GetInsideRect( HWND hwnd, RECT *rect ) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 588 | { |
| 589 | WND * wndPtr = WIN_FindWndPtr( hwnd ); |
| 590 | |
| 591 | rect->top = rect->left = 0; |
| 592 | rect->right = wndPtr->rectWindow.right - wndPtr->rectWindow.left; |
| 593 | rect->bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top; |
| 594 | |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 595 | if ((wndPtr->dwStyle & WS_ICONIC) || (wndPtr->flags & WIN_MANAGED)) goto END; |
Alexandre Julliard | 3ed37e0 | 1994-11-07 18:20:42 +0000 | [diff] [blame] | 596 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 597 | /* Remove frame from rectangle */ |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 598 | if (HAS_THICKFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) |
| 599 | InflateRect( rect, -GetSystemMetrics(SM_CXFRAME), -GetSystemMetrics(SM_CYFRAME) ); |
| 600 | else |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 601 | if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 602 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 603 | InflateRect( rect, -GetSystemMetrics(SM_CXDLGFRAME), -GetSystemMetrics(SM_CYDLGFRAME)); |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 604 | /* FIXME: this isn't in NC_AdjustRect? why not? */ |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 605 | if (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 606 | InflateRect( rect, -1, 0 ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 607 | } |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 608 | else |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 609 | if (HAS_THINFRAME( wndPtr->dwStyle )) |
| 610 | InflateRect( rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER) ); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 611 | END: |
| 612 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 613 | return; |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 614 | } |
| 615 | |
| 616 | |
| 617 | /*********************************************************************** |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 618 | * NC_GetInsideRect95 |
| 619 | * |
| 620 | * Get the 'inside' rectangle of a window, i.e. the whole window rectangle |
| 621 | * but without the borders (if any). |
| 622 | * The rectangle is in window coordinates (for drawing with GetWindowDC()). |
| 623 | */ |
| 624 | |
| 625 | static void |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 626 | NC_GetInsideRect95 (HWND hwnd, RECT *rect) |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 627 | { |
| 628 | WND * wndPtr = WIN_FindWndPtr( hwnd ); |
| 629 | |
| 630 | rect->top = rect->left = 0; |
| 631 | rect->right = wndPtr->rectWindow.right - wndPtr->rectWindow.left; |
| 632 | rect->bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top; |
| 633 | |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 634 | if ((wndPtr->dwStyle & WS_ICONIC) || (wndPtr->flags & WIN_MANAGED)) goto END; |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 635 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 636 | /* Remove frame from rectangle */ |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 637 | if (HAS_THICKFRAME (wndPtr->dwStyle, wndPtr->dwExStyle)) |
| 638 | { |
| 639 | InflateRect( rect, -GetSystemMetrics(SM_CXSIZEFRAME), -GetSystemMetrics(SM_CYSIZEFRAME) ); |
| 640 | } |
| 641 | else if (HAS_DLGFRAME (wndPtr->dwStyle, wndPtr->dwExStyle )) |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 642 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 643 | InflateRect( rect, -GetSystemMetrics(SM_CXFIXEDFRAME), -GetSystemMetrics(SM_CYFIXEDFRAME)); |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 644 | } |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 645 | else if (HAS_THINFRAME (wndPtr->dwStyle)) |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 646 | { |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 647 | InflateRect( rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER) ); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 648 | } |
| 649 | |
Francis Beaudet | 1cc0a9a | 1999-09-03 15:00:45 +0000 | [diff] [blame] | 650 | /* We have additional border information if the window |
| 651 | * is a child (but not an MDI child) */ |
| 652 | if ( (wndPtr->dwStyle & WS_CHILD) && |
| 653 | ( (wndPtr->dwExStyle & WS_EX_MDICHILD) == 0 ) ) |
| 654 | { |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 655 | if (wndPtr->dwExStyle & WS_EX_CLIENTEDGE) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 656 | InflateRect (rect, -GetSystemMetrics(SM_CXEDGE), -GetSystemMetrics(SM_CYEDGE)); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 657 | |
| 658 | if (wndPtr->dwExStyle & WS_EX_STATICEDGE) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 659 | InflateRect (rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER)); |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 660 | } |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 661 | END: |
| 662 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 663 | return; |
| 664 | } |
| 665 | |
| 666 | |
| 667 | /*********************************************************************** |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 668 | * NC_DoNCHitTest |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 669 | * |
Andreas Mohr | 260f1a1 | 2000-09-22 20:59:29 +0000 | [diff] [blame] | 670 | * Handle a WM_NCHITTEST message. Called from NC_HandleNCHitTest(). |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 671 | */ |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 672 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 673 | static LONG NC_DoNCHitTest (WND *wndPtr, POINT pt ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 674 | { |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 675 | RECT rect; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 676 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 677 | 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] | 678 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 679 | GetWindowRect(wndPtr->hwndSelf, &rect ); |
| 680 | if (!PtInRect( &rect, pt )) return HTNOWHERE; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 681 | |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 682 | if (wndPtr->dwStyle & WS_MINIMIZE) return HTCAPTION; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 683 | |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 684 | if (!(wndPtr->flags & WIN_MANAGED)) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 685 | { |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 686 | /* Check borders */ |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 687 | if (HAS_THICKFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 688 | { |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 689 | InflateRect( &rect, -GetSystemMetrics(SM_CXFRAME), -GetSystemMetrics(SM_CYFRAME) ); |
| 690 | if (!PtInRect( &rect, pt )) |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 691 | { |
| 692 | /* Check top sizing border */ |
| 693 | if (pt.y < rect.top) |
| 694 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 695 | if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT; |
| 696 | if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT; |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 697 | return HTTOP; |
| 698 | } |
| 699 | /* Check bottom sizing border */ |
| 700 | if (pt.y >= rect.bottom) |
| 701 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 702 | if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT; |
| 703 | if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT; |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 704 | return HTBOTTOM; |
| 705 | } |
| 706 | /* Check left sizing border */ |
| 707 | if (pt.x < rect.left) |
| 708 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 709 | if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT; |
| 710 | if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT; |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 711 | return HTLEFT; |
| 712 | } |
| 713 | /* Check right sizing border */ |
| 714 | if (pt.x >= rect.right) |
| 715 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 716 | if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT; |
| 717 | if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT; |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 718 | return HTRIGHT; |
| 719 | } |
| 720 | } |
| 721 | } |
| 722 | else /* No thick frame */ |
| 723 | { |
| 724 | if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 725 | InflateRect(&rect, -GetSystemMetrics(SM_CXDLGFRAME), -GetSystemMetrics(SM_CYDLGFRAME)); |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 726 | else if (HAS_THINFRAME( wndPtr->dwStyle )) |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 727 | InflateRect(&rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER)); |
| 728 | if (!PtInRect( &rect, pt )) return HTBORDER; |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 729 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 730 | |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 731 | /* Check caption */ |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 732 | |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 733 | if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION) |
| 734 | { |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 735 | rect.top += GetSystemMetrics(SM_CYCAPTION) - GetSystemMetrics(SM_CYBORDER); |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 736 | if (!PtInRect( &rect, pt )) |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 737 | { |
| 738 | /* Check system menu */ |
Francois Methot | bd1908f | 2000-08-28 21:31:23 +0000 | [diff] [blame] | 739 | if ((wndPtr->dwStyle & WS_SYSMENU) && !(wndPtr->dwExStyle & WS_EX_TOOLWINDOW)) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 740 | rect.left += GetSystemMetrics(SM_CXSIZE); |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 741 | if (pt.x <= rect.left) return HTSYSMENU; |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 742 | |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 743 | /* Check maximize box */ |
| 744 | if (wndPtr->dwStyle & WS_MAXIMIZEBOX) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 745 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 746 | |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 747 | if (pt.x >= rect.right) return HTMAXBUTTON; |
| 748 | /* Check minimize box */ |
| 749 | if (wndPtr->dwStyle & WS_MINIMIZEBOX) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 750 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 751 | if (pt.x >= rect.right) return HTMINBUTTON; |
| 752 | return HTCAPTION; |
| 753 | } |
| 754 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 755 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 756 | |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 757 | /* Check client area */ |
| 758 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 759 | ScreenToClient( wndPtr->hwndSelf, &pt ); |
| 760 | GetClientRect( wndPtr->hwndSelf, &rect ); |
| 761 | if (PtInRect( &rect, pt )) return HTCLIENT; |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 762 | |
| 763 | /* Check vertical scroll bar */ |
| 764 | |
| 765 | if (wndPtr->dwStyle & WS_VSCROLL) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 766 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 767 | rect.right += GetSystemMetrics(SM_CXVSCROLL); |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 768 | if (PtInRect( &rect, pt )) return HTVSCROLL; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 769 | } |
| 770 | |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 771 | /* Check horizontal scroll bar */ |
| 772 | |
| 773 | if (wndPtr->dwStyle & WS_HSCROLL) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 774 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 775 | rect.bottom += GetSystemMetrics(SM_CYHSCROLL); |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 776 | if (PtInRect( &rect, pt )) |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 777 | { |
| 778 | /* Check size box */ |
| 779 | if ((wndPtr->dwStyle & WS_VSCROLL) && |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 780 | (pt.x >= rect.right - GetSystemMetrics(SM_CXVSCROLL))) |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 781 | return HTSIZE; |
| 782 | return HTHSCROLL; |
| 783 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 784 | } |
| 785 | |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 786 | /* Check menu bar */ |
| 787 | |
| 788 | if (HAS_MENU(wndPtr)) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 789 | { |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 790 | if ((pt.y < 0) && (pt.x >= 0) && (pt.x < rect.right)) |
| 791 | return HTMENU; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 792 | } |
| 793 | |
Francois Boisvert | 5538ec4 | 2000-07-29 00:00:29 +0000 | [diff] [blame] | 794 | /* Has to return HTNOWHERE if nothing was found |
| 795 | Could happen when a window has a customized non client area */ |
| 796 | return HTNOWHERE; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 797 | } |
| 798 | |
| 799 | |
| 800 | /*********************************************************************** |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 801 | * NC_DoNCHitTest95 |
| 802 | * |
| 803 | * Handle a WM_NCHITTEST message. Called from NC_HandleNCHitTest(). |
| 804 | * |
Alexandre Julliard | 829fe32 | 1998-07-26 14:27:39 +0000 | [diff] [blame] | 805 | * FIXME: Just a modified copy of the Win 3.1 version. |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 806 | */ |
| 807 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 808 | static LONG NC_DoNCHitTest95 (WND *wndPtr, POINT pt ) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 809 | { |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 810 | RECT rect; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 811 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 812 | 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] | 813 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 814 | GetWindowRect(wndPtr->hwndSelf, &rect ); |
| 815 | if (!PtInRect( &rect, pt )) return HTNOWHERE; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 816 | |
| 817 | if (wndPtr->dwStyle & WS_MINIMIZE) return HTCAPTION; |
| 818 | |
| 819 | if (!(wndPtr->flags & WIN_MANAGED)) |
| 820 | { |
| 821 | /* Check borders */ |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 822 | if (HAS_THICKFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 823 | { |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 824 | InflateRect( &rect, -GetSystemMetrics(SM_CXFRAME), -GetSystemMetrics(SM_CYFRAME) ); |
| 825 | if (!PtInRect( &rect, pt )) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 826 | { |
| 827 | /* Check top sizing border */ |
| 828 | if (pt.y < rect.top) |
| 829 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 830 | if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT; |
| 831 | if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 832 | return HTTOP; |
| 833 | } |
| 834 | /* Check bottom sizing border */ |
| 835 | if (pt.y >= rect.bottom) |
| 836 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 837 | if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT; |
| 838 | if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 839 | return HTBOTTOM; |
| 840 | } |
| 841 | /* Check left sizing border */ |
| 842 | if (pt.x < rect.left) |
| 843 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 844 | if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT; |
| 845 | if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 846 | return HTLEFT; |
| 847 | } |
| 848 | /* Check right sizing border */ |
| 849 | if (pt.x >= rect.right) |
| 850 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 851 | if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT; |
| 852 | if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 853 | return HTRIGHT; |
| 854 | } |
| 855 | } |
| 856 | } |
| 857 | else /* No thick frame */ |
| 858 | { |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 859 | if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 860 | InflateRect(&rect, -GetSystemMetrics(SM_CXDLGFRAME), -GetSystemMetrics(SM_CYDLGFRAME)); |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 861 | else if (HAS_THINFRAME( wndPtr->dwStyle )) |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 862 | InflateRect(&rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER)); |
| 863 | if (!PtInRect( &rect, pt )) return HTBORDER; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 864 | } |
| 865 | |
| 866 | /* Check caption */ |
| 867 | |
| 868 | if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION) |
| 869 | { |
| 870 | if (wndPtr->dwExStyle & WS_EX_TOOLWINDOW) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 871 | rect.top += GetSystemMetrics(SM_CYSMCAPTION) - 1; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 872 | else |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 873 | rect.top += GetSystemMetrics(SM_CYCAPTION) - 1; |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 874 | if (!PtInRect( &rect, pt )) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 875 | { |
| 876 | /* Check system menu */ |
Francois Methot | bd1908f | 2000-08-28 21:31:23 +0000 | [diff] [blame] | 877 | if ((wndPtr->dwStyle & WS_SYSMENU) && !(wndPtr->dwExStyle & WS_EX_TOOLWINDOW)) |
Pascal Lessard | ecbf1d9 | 1999-08-21 13:09:16 +0000 | [diff] [blame] | 878 | { |
Susan Farley | 9ce8382 | 2000-05-23 04:12:23 +0000 | [diff] [blame] | 879 | if (NC_IconForWindow(wndPtr)) |
Pascal Lessard | ecbf1d9 | 1999-08-21 13:09:16 +0000 | [diff] [blame] | 880 | rect.left += GetSystemMetrics(SM_CYCAPTION) - 1; |
| 881 | } |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 882 | if (pt.x < rect.left) return HTSYSMENU; |
| 883 | |
| 884 | /* Check close button */ |
| 885 | if (wndPtr->dwStyle & WS_SYSMENU) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 886 | rect.right -= GetSystemMetrics(SM_CYCAPTION) - 1; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 887 | if (pt.x > rect.right) return HTCLOSE; |
| 888 | |
| 889 | /* Check maximize box */ |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 890 | /* In win95 there is automatically a Maximize button when there is a minimize one*/ |
| 891 | if ((wndPtr->dwStyle & WS_MAXIMIZEBOX)|| (wndPtr->dwStyle & WS_MINIMIZEBOX)) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 892 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 893 | if (pt.x > rect.right) return HTMAXBUTTON; |
| 894 | |
| 895 | /* Check minimize box */ |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 896 | /* In win95 there is automatically a Maximize button when there is a Maximize one*/ |
| 897 | if ((wndPtr->dwStyle & WS_MINIMIZEBOX)||(wndPtr->dwStyle & WS_MAXIMIZEBOX)) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 898 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 899 | |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 900 | if (pt.x > rect.right) return HTMINBUTTON; |
| 901 | return HTCAPTION; |
| 902 | } |
| 903 | } |
| 904 | } |
| 905 | |
| 906 | /* Check client area */ |
| 907 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 908 | ScreenToClient( wndPtr->hwndSelf, &pt ); |
| 909 | GetClientRect( wndPtr->hwndSelf, &rect ); |
| 910 | if (PtInRect( &rect, pt )) return HTCLIENT; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 911 | |
| 912 | /* Check vertical scroll bar */ |
| 913 | |
| 914 | if (wndPtr->dwStyle & WS_VSCROLL) |
| 915 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 916 | rect.right += GetSystemMetrics(SM_CXVSCROLL); |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 917 | if (PtInRect( &rect, pt )) return HTVSCROLL; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 918 | } |
| 919 | |
| 920 | /* Check horizontal scroll bar */ |
| 921 | |
| 922 | if (wndPtr->dwStyle & WS_HSCROLL) |
| 923 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 924 | rect.bottom += GetSystemMetrics(SM_CYHSCROLL); |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 925 | if (PtInRect( &rect, pt )) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 926 | { |
| 927 | /* Check size box */ |
| 928 | if ((wndPtr->dwStyle & WS_VSCROLL) && |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 929 | (pt.x >= rect.right - GetSystemMetrics(SM_CXVSCROLL))) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 930 | return HTSIZE; |
| 931 | return HTHSCROLL; |
| 932 | } |
| 933 | } |
| 934 | |
| 935 | /* Check menu bar */ |
| 936 | |
| 937 | if (HAS_MENU(wndPtr)) |
| 938 | { |
| 939 | if ((pt.y < 0) && (pt.x >= 0) && (pt.x < rect.right)) |
| 940 | return HTMENU; |
| 941 | } |
| 942 | |
Francois Boisvert | 5538ec4 | 2000-07-29 00:00:29 +0000 | [diff] [blame] | 943 | /* Has to return HTNOWHERE if nothing was found |
| 944 | Could happen when a window has a customized non client area */ |
| 945 | return HTNOWHERE; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 946 | } |
| 947 | |
| 948 | |
| 949 | /*********************************************************************** |
| 950 | * NC_HandleNCHitTest |
| 951 | * |
| 952 | * Handle a WM_NCHITTEST message. Called from DefWindowProc(). |
| 953 | */ |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 954 | LONG NC_HandleNCHitTest (HWND hwnd , POINT pt) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 955 | { |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 956 | LONG retvalue; |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 957 | WND *wndPtr = WIN_FindWndPtr (hwnd); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 958 | |
| 959 | if (!wndPtr) |
| 960 | return HTERROR; |
| 961 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 962 | if (TWEAK_WineLook == WIN31_LOOK) |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 963 | retvalue = NC_DoNCHitTest (wndPtr, pt); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 964 | else |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 965 | retvalue = NC_DoNCHitTest95 (wndPtr, pt); |
| 966 | WIN_ReleaseWndPtr(wndPtr); |
| 967 | return retvalue; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 968 | } |
| 969 | |
| 970 | |
| 971 | /*********************************************************************** |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 972 | * NC_DrawSysButton |
| 973 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 974 | void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down ) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 975 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 976 | RECT rect; |
| 977 | HDC hdcMem; |
| 978 | HBITMAP hbitmap; |
Alexandre Julliard | 1f57929 | 1994-05-25 16:25:21 +0000 | [diff] [blame] | 979 | WND *wndPtr = WIN_FindWndPtr( hwnd ); |
Alexandre Julliard | 7cbe657 | 1995-01-09 18:21:16 +0000 | [diff] [blame] | 980 | |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 981 | if( !(wndPtr->flags & WIN_MANAGED) ) |
| 982 | { |
| 983 | NC_GetInsideRect( hwnd, &rect ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 984 | hdcMem = CreateCompatibleDC( hdc ); |
| 985 | hbitmap = SelectObject( hdcMem, hbitmapClose ); |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 986 | BitBlt(hdc, rect.left, rect.top, GetSystemMetrics(SM_CXSIZE), GetSystemMetrics(SM_CYSIZE), |
| 987 | hdcMem, (wndPtr->dwStyle & WS_CHILD) ? GetSystemMetrics(SM_CXSIZE) : 0, 0, |
Alexandre Julliard | f0a0e12 | 1999-02-19 16:02:32 +0000 | [diff] [blame] | 988 | down ? NOTSRCCOPY : SRCCOPY ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 989 | SelectObject( hdcMem, hbitmap ); |
| 990 | DeleteDC( hdcMem ); |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 991 | } |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 992 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 993 | } |
| 994 | |
| 995 | |
| 996 | /*********************************************************************** |
| 997 | * NC_DrawMaxButton |
| 998 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 999 | static void NC_DrawMaxButton( HWND hwnd, HDC16 hdc, BOOL down ) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1000 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1001 | RECT rect; |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1002 | WND *wndPtr = WIN_FindWndPtr( hwnd ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1003 | HDC hdcMem; |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1004 | |
| 1005 | if( !(wndPtr->flags & WIN_MANAGED) ) |
| 1006 | { |
| 1007 | NC_GetInsideRect( hwnd, &rect ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1008 | hdcMem = CreateCompatibleDC( hdc ); |
| 1009 | SelectObject( hdcMem, (IsZoomed(hwnd) |
Alexandre Julliard | 7ff1c41 | 1997-05-25 13:58:18 +0000 | [diff] [blame] | 1010 | ? (down ? hbitmapRestoreD : hbitmapRestore) |
Huw D M Davies | 2d617be | 1998-12-08 09:14:09 +0000 | [diff] [blame] | 1011 | : (down ? hbitmapMaximizeD : hbitmapMaximize)) ); |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1012 | BitBlt( hdc, rect.right - GetSystemMetrics(SM_CXSIZE) - 1, rect.top, |
| 1013 | GetSystemMetrics(SM_CXSIZE) + 1, GetSystemMetrics(SM_CYSIZE), hdcMem, 0, 0, |
Huw D M Davies | 2d617be | 1998-12-08 09:14:09 +0000 | [diff] [blame] | 1014 | SRCCOPY ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1015 | DeleteDC( hdcMem ); |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1016 | } |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1017 | WIN_ReleaseWndPtr(wndPtr); |
| 1018 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1019 | } |
| 1020 | |
| 1021 | |
| 1022 | /*********************************************************************** |
| 1023 | * NC_DrawMinButton |
| 1024 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1025 | static void NC_DrawMinButton( HWND hwnd, HDC16 hdc, BOOL down ) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1026 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1027 | RECT rect; |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1028 | WND *wndPtr = WIN_FindWndPtr( hwnd ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1029 | HDC hdcMem; |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1030 | |
| 1031 | if( !(wndPtr->flags & WIN_MANAGED) ) |
| 1032 | { |
| 1033 | NC_GetInsideRect( hwnd, &rect ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1034 | hdcMem = CreateCompatibleDC( hdc ); |
| 1035 | SelectObject( hdcMem, (down ? hbitmapMinimizeD : hbitmapMinimize) ); |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1036 | if (wndPtr->dwStyle & WS_MAXIMIZEBOX) rect.right -= GetSystemMetrics(SM_CXSIZE)+1; |
| 1037 | BitBlt( hdc, rect.right - GetSystemMetrics(SM_CXSIZE) - 1, rect.top, |
| 1038 | GetSystemMetrics(SM_CXSIZE) + 1, GetSystemMetrics(SM_CYSIZE), hdcMem, 0, 0, |
Huw D M Davies | 2d617be | 1998-12-08 09:14:09 +0000 | [diff] [blame] | 1039 | SRCCOPY ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1040 | DeleteDC( hdcMem ); |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1041 | } |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1042 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1043 | } |
| 1044 | |
| 1045 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1046 | /****************************************************************************** |
| 1047 | * |
| 1048 | * void NC_DrawSysButton95( |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 1049 | * HWND hwnd, |
| 1050 | * HDC hdc, |
| 1051 | * BOOL down ) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1052 | * |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1053 | * Draws the Win95 system icon. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1054 | * |
| 1055 | * Revision history |
| 1056 | * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) |
| 1057 | * Original implementation from NC_DrawSysButton source. |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1058 | * 11-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de) |
| 1059 | * Fixed most bugs. |
| 1060 | * |
| 1061 | *****************************************************************************/ |
| 1062 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1063 | BOOL |
| 1064 | NC_DrawSysButton95 (HWND hwnd, HDC hdc, BOOL down) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1065 | { |
| 1066 | WND *wndPtr = WIN_FindWndPtr( hwnd ); |
| 1067 | |
| 1068 | if( !(wndPtr->flags & WIN_MANAGED) ) |
| 1069 | { |
Gerard Patel | 5773dad | 1999-06-12 14:45:56 +0000 | [diff] [blame] | 1070 | HICON hIcon; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1071 | RECT rect; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1072 | |
| 1073 | NC_GetInsideRect95( hwnd, &rect ); |
| 1074 | |
Susan Farley | 9ce8382 | 2000-05-23 04:12:23 +0000 | [diff] [blame] | 1075 | hIcon = NC_IconForWindow( wndPtr ); |
Thuy Nguyen | 46570a9 | 1999-08-07 12:25:32 +0000 | [diff] [blame] | 1076 | |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1077 | if (hIcon) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1078 | DrawIconEx (hdc, rect.left + 2, rect.top + 2, hIcon, |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1079 | GetSystemMetrics(SM_CXSMICON), |
| 1080 | GetSystemMetrics(SM_CYSMICON), |
Alexandre Julliard | 829fe32 | 1998-07-26 14:27:39 +0000 | [diff] [blame] | 1081 | 0, 0, DI_NORMAL); |
| 1082 | |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1083 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1084 | return (hIcon != 0); |
| 1085 | } |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1086 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1087 | return FALSE; |
| 1088 | } |
| 1089 | |
| 1090 | |
| 1091 | /****************************************************************************** |
| 1092 | * |
| 1093 | * void NC_DrawCloseButton95( |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 1094 | * HWND hwnd, |
| 1095 | * HDC hdc, |
| 1096 | * BOOL down, |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1097 | * BOOL bGrayed ) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1098 | * |
| 1099 | * Draws the Win95 close button. |
| 1100 | * |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1101 | * If bGrayed is true, then draw a disabled Close button |
| 1102 | * |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1103 | * Revision history |
| 1104 | * 11-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de) |
| 1105 | * Original implementation from NC_DrawSysButton95 source. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1106 | * |
| 1107 | *****************************************************************************/ |
| 1108 | |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1109 | static void NC_DrawCloseButton95 (HWND hwnd, HDC hdc, BOOL down, BOOL bGrayed) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1110 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1111 | RECT rect; |
| 1112 | HDC hdcMem; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1113 | WND *wndPtr = WIN_FindWndPtr( hwnd ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1114 | |
| 1115 | if( !(wndPtr->flags & WIN_MANAGED) ) |
| 1116 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1117 | BITMAP bmp; |
| 1118 | HBITMAP hBmp, hOldBmp; |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1119 | |
| 1120 | NC_GetInsideRect95( hwnd, &rect ); |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1121 | |
Alexandre Julliard | 16e9237 | 2000-05-18 00:12:23 +0000 | [diff] [blame] | 1122 | /* A tool window has a smaller Close button */ |
| 1123 | if(wndPtr->dwExStyle & WS_EX_TOOLWINDOW) |
| 1124 | { |
| 1125 | RECT toolRect; |
| 1126 | INT iBmpHeight = 11; /* Windows does not use SM_CXSMSIZE and SM_CYSMSIZE */ |
| 1127 | INT iBmpWidth = 11; /* it uses 11x11 for the close button in tool window */ |
| 1128 | INT iCaptionHeight = GetSystemMetrics(SM_CYSMCAPTION); |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1129 | |
Alexandre Julliard | 16e9237 | 2000-05-18 00:12:23 +0000 | [diff] [blame] | 1130 | toolRect.top = rect.top + (iCaptionHeight - 1 - iBmpHeight) / 2; |
| 1131 | toolRect.left = rect.right - (iCaptionHeight + 1 + iBmpWidth) / 2; |
| 1132 | toolRect.bottom = toolRect.top + iBmpHeight; |
| 1133 | toolRect.right = toolRect.left + iBmpWidth; |
| 1134 | DrawFrameControl(hdc,&toolRect, |
| 1135 | DFC_CAPTION,DFCS_CAPTIONCLOSE | |
| 1136 | down ? DFCS_PUSHED : 0 | |
| 1137 | bGrayed ? DFCS_INACTIVE : 0); |
| 1138 | } |
| 1139 | else |
| 1140 | { |
| 1141 | hdcMem = CreateCompatibleDC( hdc ); |
| 1142 | hBmp = down ? hbitmapCloseD : hbitmapClose; |
| 1143 | hOldBmp = SelectObject (hdcMem, hBmp); |
| 1144 | GetObjectA (hBmp, sizeof(BITMAP), &bmp); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1145 | |
Alexandre Julliard | 16e9237 | 2000-05-18 00:12:23 +0000 | [diff] [blame] | 1146 | BitBlt (hdc, rect.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2, |
| 1147 | rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2, |
| 1148 | bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY); |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1149 | |
Alexandre Julliard | 16e9237 | 2000-05-18 00:12:23 +0000 | [diff] [blame] | 1150 | if(bGrayed) |
| 1151 | NC_DrawGrayButton(hdc,rect.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2 + 2, |
| 1152 | rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2); |
| 1153 | |
| 1154 | SelectObject (hdcMem, hOldBmp); |
| 1155 | DeleteDC (hdcMem); |
| 1156 | } |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1157 | } |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1158 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1159 | } |
| 1160 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1161 | /****************************************************************************** |
| 1162 | * |
| 1163 | * NC_DrawMaxButton95( |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 1164 | * HWND hwnd, |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1165 | * HDC16 hdc, |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 1166 | * BOOL down |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1167 | * BOOL bGrayed ) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1168 | * |
| 1169 | * Draws the maximize button for Win95 style windows. |
| 1170 | * |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1171 | * If bGrayed is true, then draw a disabled Maximize button |
| 1172 | * |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1173 | * Bugs |
| 1174 | * Many. Spacing might still be incorrect. Need to fit a close |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1175 | * button between the max button and the edge. |
| 1176 | * Should scale the image with the title bar. And more... |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1177 | * |
| 1178 | * Revision history |
| 1179 | * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) |
| 1180 | * Original implementation. |
| 1181 | * |
| 1182 | *****************************************************************************/ |
| 1183 | |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1184 | static void NC_DrawMaxButton95(HWND hwnd,HDC16 hdc,BOOL down, BOOL bGrayed) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1185 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1186 | RECT rect; |
| 1187 | HDC hdcMem; |
Noomen Hamza | bfd0228 | 1999-01-20 14:03:49 +0000 | [diff] [blame] | 1188 | WND *wndPtr = WIN_FindWndPtr( hwnd ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1189 | |
Noomen Hamza | bfd0228 | 1999-01-20 14:03:49 +0000 | [diff] [blame] | 1190 | if( !(wndPtr->flags & WIN_MANAGED)) |
| 1191 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1192 | BITMAP bmp; |
| 1193 | HBITMAP hBmp,hOldBmp; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1194 | |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1195 | NC_GetInsideRect95( hwnd, &rect ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1196 | hdcMem = CreateCompatibleDC( hdc ); |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1197 | hBmp = IsZoomed(hwnd) ? |
| 1198 | (down ? hbitmapRestoreD : hbitmapRestore ) : |
| 1199 | (down ? hbitmapMaximizeD: hbitmapMaximize); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1200 | hOldBmp=SelectObject( hdcMem, hBmp ); |
| 1201 | GetObjectA (hBmp, sizeof(BITMAP), &bmp); |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1202 | |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1203 | if (wndPtr->dwStyle & WS_SYSMENU) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1204 | rect.right -= GetSystemMetrics(SM_CYCAPTION) + 1; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1205 | |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1206 | BitBlt( hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2, |
| 1207 | rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2, |
Noomen Hamza | bfd0228 | 1999-01-20 14:03:49 +0000 | [diff] [blame] | 1208 | bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY ); |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1209 | |
| 1210 | if(bGrayed) |
| 1211 | NC_DrawGrayButton(hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2, |
| 1212 | rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2); |
| 1213 | |
| 1214 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1215 | SelectObject (hdcMem, hOldBmp); |
| 1216 | DeleteDC( hdcMem ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1217 | } |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1218 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1219 | } |
| 1220 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1221 | /****************************************************************************** |
| 1222 | * |
| 1223 | * NC_DrawMinButton95( |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 1224 | * HWND hwnd, |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1225 | * HDC16 hdc, |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 1226 | * BOOL down, |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1227 | * BOOL bGrayed ) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1228 | * |
| 1229 | * Draws the minimize button for Win95 style windows. |
| 1230 | * |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1231 | * If bGrayed is true, then draw a disabled Minimize button |
| 1232 | * |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1233 | * Bugs |
| 1234 | * Many. Spacing is still incorrect. Should scale the image with the |
| 1235 | * title bar. And more... |
| 1236 | * |
| 1237 | * Revision history |
| 1238 | * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) |
| 1239 | * Original implementation. |
| 1240 | * |
| 1241 | *****************************************************************************/ |
| 1242 | |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1243 | static void NC_DrawMinButton95(HWND hwnd,HDC16 hdc,BOOL down, BOOL bGrayed) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1244 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1245 | RECT rect; |
| 1246 | HDC hdcMem; |
Noomen Hamza | bfd0228 | 1999-01-20 14:03:49 +0000 | [diff] [blame] | 1247 | WND *wndPtr = WIN_FindWndPtr( hwnd ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1248 | |
Noomen Hamza | bfd0228 | 1999-01-20 14:03:49 +0000 | [diff] [blame] | 1249 | if( !(wndPtr->flags & WIN_MANAGED)) |
| 1250 | |
| 1251 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1252 | BITMAP bmp; |
| 1253 | HBITMAP hBmp,hOldBmp; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1254 | |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1255 | NC_GetInsideRect95( hwnd, &rect ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1256 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1257 | hdcMem = CreateCompatibleDC( hdc ); |
Noomen Hamza | bfd0228 | 1999-01-20 14:03:49 +0000 | [diff] [blame] | 1258 | hBmp = down ? hbitmapMinimizeD : hbitmapMinimize; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1259 | hOldBmp= SelectObject( hdcMem, hBmp ); |
| 1260 | GetObjectA (hBmp, sizeof(BITMAP), &bmp); |
Noomen Hamza | bfd0228 | 1999-01-20 14:03:49 +0000 | [diff] [blame] | 1261 | |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1262 | if (wndPtr->dwStyle & WS_SYSMENU) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1263 | rect.right -= GetSystemMetrics(SM_CYCAPTION) + 1; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1264 | |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1265 | /* In win 95 there is always a Maximize box when there is a Minimize one */ |
| 1266 | if ((wndPtr->dwStyle & WS_MAXIMIZEBOX) || (wndPtr->dwStyle & WS_MINIMIZEBOX)) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1267 | rect.right += -1 - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1268 | |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1269 | BitBlt( hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2, |
| 1270 | rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2, |
Noomen Hamza | bfd0228 | 1999-01-20 14:03:49 +0000 | [diff] [blame] | 1271 | bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY ); |
| 1272 | |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1273 | if(bGrayed) |
| 1274 | NC_DrawGrayButton(hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2, |
| 1275 | rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2); |
| 1276 | |
| 1277 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1278 | SelectObject (hdcMem, hOldBmp); |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1279 | DeleteDC( hdcMem ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1280 | } |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1281 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1282 | } |
| 1283 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1284 | /*********************************************************************** |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1285 | * NC_DrawFrame |
| 1286 | * |
| 1287 | * Draw a window frame inside the given rectangle, and update the rectangle. |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 1288 | * The correct pen for the frame must be selected in the DC. |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1289 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1290 | static void NC_DrawFrame( HDC hdc, RECT *rect, BOOL dlgFrame, |
| 1291 | BOOL active ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1292 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1293 | INT width, height; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1294 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1295 | if (TWEAK_WineLook != WIN31_LOOK) |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1296 | ERR("Called in Win95 mode. Aiee! Please report this.\n" ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1297 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1298 | if (dlgFrame) |
| 1299 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1300 | width = GetSystemMetrics(SM_CXDLGFRAME) - 1; |
| 1301 | height = GetSystemMetrics(SM_CYDLGFRAME) - 1; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1302 | SelectObject( hdc, GetSysColorBrush(active ? COLOR_ACTIVECAPTION : |
Alexandre Julliard | 02e9008 | 1998-01-04 17:49:09 +0000 | [diff] [blame] | 1303 | COLOR_INACTIVECAPTION) ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1304 | } |
| 1305 | else |
| 1306 | { |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 1307 | width = GetSystemMetrics(SM_CXFRAME) - 2; |
| 1308 | height = GetSystemMetrics(SM_CYFRAME) - 2; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1309 | SelectObject( hdc, GetSysColorBrush(active ? COLOR_ACTIVEBORDER : |
Alexandre Julliard | 02e9008 | 1998-01-04 17:49:09 +0000 | [diff] [blame] | 1310 | COLOR_INACTIVEBORDER) ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1311 | } |
| 1312 | |
| 1313 | /* Draw frame */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1314 | PatBlt( hdc, rect->left, rect->top, |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 1315 | rect->right - rect->left, height, PATCOPY ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1316 | PatBlt( hdc, rect->left, rect->top, |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 1317 | width, rect->bottom - rect->top, PATCOPY ); |
Randy Weems | 0bc73c7 | 1999-03-25 15:49:11 +0000 | [diff] [blame] | 1318 | PatBlt( hdc, rect->left, rect->bottom - 1, |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 1319 | rect->right - rect->left, -height, PATCOPY ); |
Randy Weems | 0bc73c7 | 1999-03-25 15:49:11 +0000 | [diff] [blame] | 1320 | PatBlt( hdc, rect->right - 1, rect->top, |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 1321 | -width, rect->bottom - rect->top, PATCOPY ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1322 | |
| 1323 | if (dlgFrame) |
| 1324 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1325 | InflateRect( rect, -width, -height ); |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 1326 | } |
| 1327 | else |
| 1328 | { |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 1329 | INT decYOff = GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXSIZE) - 1; |
| 1330 | INT decXOff = GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYSIZE) - 1; |
Huw D M Davies | 2d617be | 1998-12-08 09:14:09 +0000 | [diff] [blame] | 1331 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1332 | /* Draw inner rectangle */ |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 1333 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1334 | SelectObject( hdc, GetStockObject(NULL_BRUSH) ); |
| 1335 | Rectangle( hdc, rect->left + width, rect->top + height, |
Huw D M Davies | 2d617be | 1998-12-08 09:14:09 +0000 | [diff] [blame] | 1336 | rect->right - width , rect->bottom - height ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1337 | |
| 1338 | /* Draw the decorations */ |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1339 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1340 | MoveToEx( hdc, rect->left, rect->top + decYOff, NULL ); |
| 1341 | LineTo( hdc, rect->left + width, rect->top + decYOff ); |
| 1342 | MoveToEx( hdc, rect->right - 1, rect->top + decYOff, NULL ); |
| 1343 | LineTo( hdc, rect->right - width - 1, rect->top + decYOff ); |
| 1344 | MoveToEx( hdc, rect->left, rect->bottom - decYOff, NULL ); |
| 1345 | LineTo( hdc, rect->left + width, rect->bottom - decYOff ); |
| 1346 | MoveToEx( hdc, rect->right - 1, rect->bottom - decYOff, NULL ); |
| 1347 | LineTo( hdc, rect->right - width - 1, rect->bottom - decYOff ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1348 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1349 | MoveToEx( hdc, rect->left + decXOff, rect->top, NULL ); |
| 1350 | LineTo( hdc, rect->left + decXOff, rect->top + height); |
| 1351 | MoveToEx( hdc, rect->left + decXOff, rect->bottom - 1, NULL ); |
| 1352 | LineTo( hdc, rect->left + decXOff, rect->bottom - height - 1 ); |
| 1353 | MoveToEx( hdc, rect->right - decXOff, rect->top, NULL ); |
| 1354 | LineTo( hdc, rect->right - decXOff, rect->top + height ); |
| 1355 | MoveToEx( hdc, rect->right - decXOff, rect->bottom - 1, NULL ); |
| 1356 | LineTo( hdc, rect->right - decXOff, rect->bottom - height - 1 ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1357 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1358 | InflateRect( rect, -width - 1, -height - 1 ); |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 1359 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1360 | } |
| 1361 | |
| 1362 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1363 | /****************************************************************************** |
| 1364 | * |
| 1365 | * void NC_DrawFrame95( |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 1366 | * HDC hdc, |
| 1367 | * RECT *rect, |
| 1368 | * BOOL dlgFrame, |
| 1369 | * BOOL active ) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1370 | * |
| 1371 | * Draw a window frame inside the given rectangle, and update the rectangle. |
| 1372 | * The correct pen for the frame must be selected in the DC. |
| 1373 | * |
| 1374 | * Bugs |
| 1375 | * Many. First, just what IS a frame in Win95? Note that the 3D look |
| 1376 | * on the outer edge is handled by NC_DoNCPaint95. As is the inner |
| 1377 | * edge. The inner rectangle just inside the frame is handled by the |
| 1378 | * Caption code. |
| 1379 | * |
| 1380 | * In short, for most people, this function should be a nop (unless |
| 1381 | * you LIKE thick borders in Win95/NT4.0 -- I've been working with |
| 1382 | * them lately, but just to get this code right). Even so, it doesn't |
| 1383 | * appear to be so. It's being worked on... |
| 1384 | * |
| 1385 | * Revision history |
| 1386 | * 06-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) |
| 1387 | * Original implementation (based on NC_DrawFrame) |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1388 | * 02-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de) |
| 1389 | * Some minor fixes. |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 1390 | * 29-Jun-1999 Ove KÃ¥ven (ovek@arcticnet.no) |
| 1391 | * Fixed a fix or something. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1392 | * |
| 1393 | *****************************************************************************/ |
| 1394 | |
| 1395 | static void NC_DrawFrame95( |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1396 | HDC hdc, |
| 1397 | RECT *rect, |
| 1398 | BOOL dlgFrame, |
| 1399 | BOOL active ) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1400 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1401 | INT width, height; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1402 | |
| 1403 | if (dlgFrame) |
| 1404 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1405 | width = GetSystemMetrics(SM_CXDLGFRAME) - GetSystemMetrics(SM_CXEDGE); |
| 1406 | height = GetSystemMetrics(SM_CYDLGFRAME) - GetSystemMetrics(SM_CYEDGE); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1407 | } |
| 1408 | else |
| 1409 | { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1410 | width = GetSystemMetrics(SM_CXFRAME) - GetSystemMetrics(SM_CXEDGE); |
| 1411 | height = GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYEDGE); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1412 | } |
| 1413 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1414 | SelectObject( hdc, GetSysColorBrush(active ? COLOR_ACTIVEBORDER : |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1415 | COLOR_INACTIVEBORDER) ); |
| 1416 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1417 | /* Draw frame */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1418 | PatBlt( hdc, rect->left, rect->top, |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1419 | rect->right - rect->left, height, PATCOPY ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1420 | PatBlt( hdc, rect->left, rect->top, |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1421 | width, rect->bottom - rect->top, PATCOPY ); |
Randy Weems | 0bc73c7 | 1999-03-25 15:49:11 +0000 | [diff] [blame] | 1422 | PatBlt( hdc, rect->left, rect->bottom - 1, |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1423 | rect->right - rect->left, -height, PATCOPY ); |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 1424 | PatBlt( hdc, rect->right - 1, rect->top, |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1425 | -width, rect->bottom - rect->top, PATCOPY ); |
| 1426 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1427 | InflateRect( rect, -width, -height ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1428 | } |
| 1429 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1430 | /*********************************************************************** |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1431 | * NC_DrawMovingFrame |
| 1432 | * |
| 1433 | * Draw the frame used when moving or resizing window. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1434 | * |
| 1435 | * FIXME: This causes problems in Win95 mode. (why?) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1436 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1437 | static void NC_DrawMovingFrame( HDC hdc, RECT *rect, BOOL thickframe ) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1438 | { |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1439 | if (thickframe) |
| 1440 | { |
| 1441 | RECT16 r16; |
| 1442 | CONV_RECT32TO16( rect, &r16 ); |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1443 | FastWindowFrame16( hdc, &r16, GetSystemMetrics(SM_CXFRAME), |
| 1444 | GetSystemMetrics(SM_CYFRAME), PATINVERT ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1445 | } |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1446 | else DrawFocusRect( hdc, rect ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1447 | } |
| 1448 | |
| 1449 | |
| 1450 | /*********************************************************************** |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1451 | * NC_DrawCaption |
| 1452 | * |
| 1453 | * Draw the window caption. |
| 1454 | * The correct pen for the window frame must be selected in the DC. |
| 1455 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1456 | static void NC_DrawCaption( HDC hdc, RECT *rect, HWND hwnd, |
| 1457 | DWORD style, BOOL active ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1458 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1459 | RECT r = *rect; |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1460 | WND * wndPtr = WIN_FindWndPtr( hwnd ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1461 | char buffer[256]; |
| 1462 | |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1463 | if (wndPtr->flags & WIN_MANAGED) |
| 1464 | { |
| 1465 | WIN_ReleaseWndPtr(wndPtr); |
| 1466 | return; |
| 1467 | } |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1468 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1469 | if (!hbitmapClose) |
| 1470 | { |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1471 | if (!(hbitmapClose = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_CLOSE) ))) |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1472 | { |
| 1473 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1474 | return; |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1475 | } |
Francois Boisvert | 308c6af | 1999-02-18 10:37:17 +0000 | [diff] [blame] | 1476 | hbitmapCloseD = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_CLOSED) ); |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1477 | hbitmapMinimize = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_REDUCE) ); |
| 1478 | hbitmapMinimizeD = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_REDUCED) ); |
| 1479 | hbitmapMaximize = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_ZOOM) ); |
| 1480 | hbitmapMaximizeD = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_ZOOMD) ); |
| 1481 | hbitmapRestore = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_RESTORE) ); |
| 1482 | hbitmapRestoreD = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_RESTORED) ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 1483 | } |
| 1484 | |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1485 | if (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME) |
| 1486 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1487 | HBRUSH hbrushOld = SelectObject(hdc, GetSysColorBrush(COLOR_WINDOW) ); |
| 1488 | PatBlt( hdc, r.left, r.top, 1, r.bottom-r.top+1,PATCOPY ); |
| 1489 | PatBlt( hdc, r.right-1, r.top, 1, r.bottom-r.top+1, PATCOPY ); |
| 1490 | 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] | 1491 | r.left++; |
| 1492 | r.right--; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1493 | SelectObject( hdc, hbrushOld ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1494 | } |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1495 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | b0efe28 | 2000-08-04 04:18:04 +0000 | [diff] [blame] | 1496 | MoveToEx( hdc, r.left, r.bottom, NULL ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1497 | LineTo( hdc, r.right, r.bottom ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1498 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1499 | if (style & WS_SYSMENU) |
| 1500 | { |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1501 | NC_DrawSysButton( hwnd, hdc, FALSE ); |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1502 | r.left += GetSystemMetrics(SM_CXSIZE) + 1; |
Alexandre Julliard | b0efe28 | 2000-08-04 04:18:04 +0000 | [diff] [blame] | 1503 | MoveToEx( hdc, r.left - 1, r.top, NULL ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1504 | LineTo( hdc, r.left - 1, r.bottom ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1505 | } |
| 1506 | if (style & WS_MAXIMIZEBOX) |
| 1507 | { |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1508 | NC_DrawMaxButton( hwnd, hdc, FALSE ); |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1509 | r.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1510 | } |
| 1511 | if (style & WS_MINIMIZEBOX) |
| 1512 | { |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1513 | NC_DrawMinButton( hwnd, hdc, FALSE ); |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1514 | r.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1515 | } |
| 1516 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1517 | FillRect( hdc, &r, GetSysColorBrush(active ? COLOR_ACTIVECAPTION : |
Alexandre Julliard | 02e9008 | 1998-01-04 17:49:09 +0000 | [diff] [blame] | 1518 | COLOR_INACTIVECAPTION) ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1519 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1520 | if (GetWindowTextA( hwnd, buffer, sizeof(buffer) )) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1521 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1522 | if (active) SetTextColor( hdc, GetSysColor( COLOR_CAPTIONTEXT ) ); |
| 1523 | else SetTextColor( hdc, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) ); |
| 1524 | SetBkMode( hdc, TRANSPARENT ); |
| 1525 | DrawTextA( hdc, buffer, -1, &r, |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 1526 | DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_NOPREFIX ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1527 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1528 | } |
| 1529 | |
| 1530 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1531 | /****************************************************************************** |
| 1532 | * |
| 1533 | * NC_DrawCaption95( |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 1534 | * HDC hdc, |
| 1535 | * RECT *rect, |
| 1536 | * HWND hwnd, |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1537 | * DWORD style, |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 1538 | * BOOL active ) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1539 | * |
| 1540 | * Draw the window caption for Win95 style windows. |
| 1541 | * The correct pen for the window frame must be selected in the DC. |
| 1542 | * |
| 1543 | * Bugs |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1544 | * Hey, a function that finally works! Well, almost. |
| 1545 | * It's being worked on. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1546 | * |
| 1547 | * Revision history |
| 1548 | * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) |
| 1549 | * Original implementation. |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1550 | * 02-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de) |
| 1551 | * Some minor fixes. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1552 | * |
| 1553 | *****************************************************************************/ |
| 1554 | |
| 1555 | static void NC_DrawCaption95( |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1556 | HDC hdc, |
| 1557 | RECT *rect, |
| 1558 | HWND hwnd, |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1559 | DWORD style, |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 1560 | DWORD exStyle, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1561 | BOOL active ) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1562 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1563 | RECT r = *rect; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1564 | WND *wndPtr = WIN_FindWndPtr( hwnd ); |
| 1565 | char buffer[256]; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1566 | HPEN hPrevPen; |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1567 | HMENU hSysMenu; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1568 | |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1569 | if (wndPtr->flags & WIN_MANAGED) |
| 1570 | { |
| 1571 | WIN_ReleaseWndPtr(wndPtr); |
| 1572 | return; |
| 1573 | } |
| 1574 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1575 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1576 | hPrevPen = SelectObject( hdc, GetSysColorPen(COLOR_3DFACE) ); |
| 1577 | MoveToEx( hdc, r.left, r.bottom - 1, NULL ); |
| 1578 | LineTo( hdc, r.right, r.bottom - 1 ); |
| 1579 | SelectObject( hdc, hPrevPen ); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1580 | r.bottom--; |
| 1581 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1582 | FillRect( hdc, &r, GetSysColorBrush(active ? COLOR_ACTIVECAPTION : |
Alexandre Julliard | 02e9008 | 1998-01-04 17:49:09 +0000 | [diff] [blame] | 1583 | COLOR_INACTIVECAPTION) ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1584 | |
| 1585 | if (!hbitmapClose) { |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1586 | if (!(hbitmapClose = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_CLOSE) ))) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1587 | return; |
Francois Boisvert | 308c6af | 1999-02-18 10:37:17 +0000 | [diff] [blame] | 1588 | hbitmapCloseD = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_CLOSED)); |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1589 | hbitmapMinimize = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_REDUCE) ); |
| 1590 | hbitmapMinimizeD = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_REDUCED) ); |
| 1591 | hbitmapMaximize = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_ZOOM) ); |
| 1592 | hbitmapMaximizeD = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_ZOOMD) ); |
| 1593 | hbitmapRestore = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_RESTORE) ); |
| 1594 | hbitmapRestoreD = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_RESTORED) ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1595 | } |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1596 | |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 1597 | if ((style & WS_SYSMENU) && !(exStyle & WS_EX_TOOLWINDOW)) { |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1598 | if (NC_DrawSysButton95 (hwnd, hdc, FALSE)) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1599 | r.left += GetSystemMetrics(SM_CYCAPTION) - 1; |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 1600 | } |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1601 | |
| 1602 | if (style & WS_SYSMENU) |
| 1603 | { |
| 1604 | UINT state; |
| 1605 | |
| 1606 | /* Go get the sysmenu */ |
| 1607 | hSysMenu = GetSystemMenu(hwnd, FALSE); |
| 1608 | state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND); |
| 1609 | |
| 1610 | /* Draw a grayed close button if disabled and a normal one if SC_CLOSE is not there */ |
| 1611 | NC_DrawCloseButton95 (hwnd, hdc, FALSE, |
| 1612 | ((((state & MF_DISABLED) || (state & MF_GRAYED))) && (state != 0xFFFFFFFF))); |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1613 | r.right -= GetSystemMetrics(SM_CYCAPTION) - 1; |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 1614 | |
| 1615 | if ((style & WS_MAXIMIZEBOX) || (style & WS_MINIMIZEBOX)) |
| 1616 | { |
| 1617 | /* In win95 the two buttons are always there */ |
| 1618 | /* But if the menu item is not in the menu they're disabled*/ |
| 1619 | |
| 1620 | NC_DrawMaxButton95( hwnd, hdc, FALSE, (!(style & WS_MAXIMIZEBOX))); |
| 1621 | r.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
| 1622 | |
| 1623 | NC_DrawMinButton95( hwnd, hdc, FALSE, (!(style & WS_MINIMIZEBOX))); |
| 1624 | r.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
| 1625 | } |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1626 | } |
| 1627 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1628 | if (GetWindowTextA( hwnd, buffer, sizeof(buffer) )) { |
| 1629 | NONCLIENTMETRICSA nclm; |
| 1630 | HFONT hFont, hOldFont; |
| 1631 | nclm.cbSize = sizeof(NONCLIENTMETRICSA); |
| 1632 | SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 1633 | if (exStyle & WS_EX_TOOLWINDOW) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1634 | hFont = CreateFontIndirectA (&nclm.lfSmCaptionFont); |
Eric Kohl | 8e517b5 | 1998-10-11 13:06:35 +0000 | [diff] [blame] | 1635 | else |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1636 | hFont = CreateFontIndirectA (&nclm.lfCaptionFont); |
| 1637 | hOldFont = SelectObject (hdc, hFont); |
| 1638 | if (active) SetTextColor( hdc, GetSysColor( COLOR_CAPTIONTEXT ) ); |
| 1639 | else SetTextColor( hdc, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) ); |
| 1640 | SetBkMode( hdc, TRANSPARENT ); |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1641 | r.left += 2; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1642 | DrawTextA( hdc, buffer, -1, &r, |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1643 | DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1644 | DeleteObject (SelectObject (hdc, hOldFont)); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1645 | } |
| 1646 | } |
| 1647 | |
| 1648 | |
| 1649 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1650 | /*********************************************************************** |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1651 | * NC_DoNCPaint |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1652 | * |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 1653 | * Paint the non-client area. clip is currently unused. |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1654 | */ |
Patrik Stridvall | 1ed4ecf | 1999-06-26 14:58:24 +0000 | [diff] [blame] | 1655 | static void NC_DoNCPaint( WND* wndPtr, HRGN clip, BOOL suppress_menupaint ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1656 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1657 | HDC hdc; |
| 1658 | RECT rect; |
| 1659 | BOOL active; |
| 1660 | HWND hwnd = wndPtr->hwndSelf; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1661 | |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1662 | if ( wndPtr->dwStyle & WS_MINIMIZE || |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1663 | !WIN_IsWindowDrawable( wndPtr, 0 )) return; /* Nothing to do */ |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1664 | |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 1665 | active = wndPtr->flags & WIN_NCACTIVATED; |
| 1666 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1667 | TRACE("%04x %d\n", hwnd, active ); |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 1668 | |
Alex Korobka | 4f1ac05 | 1999-03-28 09:37:57 +0000 | [diff] [blame] | 1669 | if (!(hdc = GetDCEx( hwnd, (clip > 1) ? clip : 0, DCX_USESTYLE | DCX_WINDOW | |
| 1670 | ((clip > 1) ? (DCX_INTERSECTRGN | DCX_KEEPCLIPRGN): 0) ))) return; |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 1671 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1672 | if (ExcludeVisRect16( hdc, wndPtr->rectClient.left-wndPtr->rectWindow.left, |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1673 | wndPtr->rectClient.top-wndPtr->rectWindow.top, |
| 1674 | wndPtr->rectClient.right-wndPtr->rectWindow.left, |
| 1675 | wndPtr->rectClient.bottom-wndPtr->rectWindow.top ) |
| 1676 | == NULLREGION) |
| 1677 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1678 | ReleaseDC( hwnd, hdc ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1679 | return; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1680 | } |
| 1681 | |
| 1682 | rect.top = rect.left = 0; |
| 1683 | rect.right = wndPtr->rectWindow.right - wndPtr->rectWindow.left; |
| 1684 | rect.bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top; |
| 1685 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1686 | SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1687 | |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 1688 | if (!(wndPtr->flags & WIN_MANAGED)) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1689 | { |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 1690 | if (HAS_ANYFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) |
| 1691 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1692 | SelectObject( hdc, GetStockObject(NULL_BRUSH) ); |
| 1693 | Rectangle( hdc, 0, 0, rect.right, rect.bottom ); |
| 1694 | InflateRect( &rect, -1, -1 ); |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 1695 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1696 | |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 1697 | if (HAS_THICKFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 1698 | NC_DrawFrame(hdc, &rect, FALSE, active ); |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 1699 | else if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) |
| 1700 | NC_DrawFrame( hdc, &rect, TRUE, active ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1701 | |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 1702 | if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION) |
| 1703 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1704 | RECT r = rect; |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1705 | r.bottom = rect.top + GetSystemMetrics(SM_CYSIZE); |
| 1706 | rect.top += GetSystemMetrics(SM_CYSIZE) + GetSystemMetrics(SM_CYBORDER); |
Alexandre Julliard | 0c126c7 | 1996-02-18 18:44:41 +0000 | [diff] [blame] | 1707 | NC_DrawCaption( hdc, &r, hwnd, wndPtr->dwStyle, active ); |
| 1708 | } |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1709 | } |
| 1710 | |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 1711 | if (HAS_MENU(wndPtr)) |
| 1712 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1713 | RECT r = rect; |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1714 | r.bottom = rect.top + GetSystemMetrics(SM_CYMENU); /* default height */ |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 1715 | rect.top += MENU_DrawMenuBar( hdc, &r, hwnd, suppress_menupaint ); |
Alexandre Julliard | f720725 | 1994-07-23 07:57:48 +0000 | [diff] [blame] | 1716 | } |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1717 | |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 1718 | /* Draw the scroll-bars */ |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1719 | |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 1720 | if (wndPtr->dwStyle & WS_VSCROLL) |
Alex Korobka | d208584 | 1998-10-18 10:37:46 +0000 | [diff] [blame] | 1721 | SCROLL_DrawScrollBar( hwnd, hdc, SB_VERT, TRUE, TRUE ); |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 1722 | if (wndPtr->dwStyle & WS_HSCROLL) |
Alex Korobka | d208584 | 1998-10-18 10:37:46 +0000 | [diff] [blame] | 1723 | SCROLL_DrawScrollBar( hwnd, hdc, SB_HORZ, TRUE, TRUE ); |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 1724 | |
| 1725 | /* Draw the "size-box" */ |
| 1726 | |
| 1727 | if ((wndPtr->dwStyle & WS_VSCROLL) && (wndPtr->dwStyle & WS_HSCROLL)) |
| 1728 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1729 | RECT r = rect; |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1730 | r.left = r.right - GetSystemMetrics(SM_CXVSCROLL) + 1; |
| 1731 | r.top = r.bottom - GetSystemMetrics(SM_CYHSCROLL) + 1; |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1732 | if(wndPtr->dwStyle & WS_BORDER) { |
| 1733 | r.left++; |
| 1734 | r.top++; |
| 1735 | } |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1736 | FillRect( hdc, &r, GetSysColorBrush(COLOR_SCROLLBAR) ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1737 | } |
| 1738 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1739 | ReleaseDC( hwnd, hdc ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1740 | } |
| 1741 | |
| 1742 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1743 | /****************************************************************************** |
| 1744 | * |
| 1745 | * void NC_DoNCPaint95( |
| 1746 | * WND *wndPtr, |
Patrik Stridvall | 2d6457c | 2000-03-28 20:22:59 +0000 | [diff] [blame] | 1747 | * HRGN clip, |
| 1748 | * BOOL suppress_menupaint ) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1749 | * |
| 1750 | * Paint the non-client area for Win95 windows. The clip region is |
| 1751 | * currently ignored. |
| 1752 | * |
| 1753 | * Bugs |
| 1754 | * grep -E -A10 -B5 \(95\)\|\(Bugs\)\|\(FIXME\) windows/nonclient.c \ |
| 1755 | * misc/tweak.c controls/menu.c # :-) |
| 1756 | * |
| 1757 | * Revision history |
| 1758 | * 03-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) |
| 1759 | * Original implementation |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1760 | * 10-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de) |
| 1761 | * Fixed some bugs. |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 1762 | * 29-Jun-1999 Ove KÃ¥ven (ovek@arcticnet.no) |
| 1763 | * Streamlined window style checks. |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1764 | * |
| 1765 | *****************************************************************************/ |
| 1766 | |
Patrik Stridvall | 1ed4ecf | 1999-06-26 14:58:24 +0000 | [diff] [blame] | 1767 | static void NC_DoNCPaint95( |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1768 | WND *wndPtr, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1769 | HRGN clip, |
| 1770 | BOOL suppress_menupaint ) |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1771 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1772 | HDC hdc; |
Alex Korobka | 4f1ac05 | 1999-03-28 09:37:57 +0000 | [diff] [blame] | 1773 | RECT rfuzz, rect, rectClip; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1774 | BOOL active; |
| 1775 | HWND hwnd = wndPtr->hwndSelf; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1776 | |
| 1777 | if ( wndPtr->dwStyle & WS_MINIMIZE || |
| 1778 | !WIN_IsWindowDrawable( wndPtr, 0 )) return; /* Nothing to do */ |
| 1779 | |
| 1780 | active = wndPtr->flags & WIN_NCACTIVATED; |
| 1781 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1782 | TRACE("%04x %d\n", hwnd, active ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1783 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1784 | /* MSDN docs are pretty idiotic here, they say app CAN use clipRgn in |
| 1785 | the call to GetDCEx implying that it is allowed not to use it either. |
| 1786 | However, the suggested GetDCEx( , DCX_WINDOW | DCX_INTERSECTRGN) |
| 1787 | will cause clipRgn to be deleted after ReleaseDC(). |
| 1788 | Now, how is the "system" supposed to tell what happened? |
Alex Korobka | 4f1ac05 | 1999-03-28 09:37:57 +0000 | [diff] [blame] | 1789 | */ |
| 1790 | |
| 1791 | if (!(hdc = GetDCEx( hwnd, (clip > 1) ? clip : 0, DCX_USESTYLE | DCX_WINDOW | |
| 1792 | ((clip > 1) ?(DCX_INTERSECTRGN | DCX_KEEPCLIPRGN) : 0) ))) return; |
| 1793 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1794 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1795 | if (ExcludeVisRect16( hdc, wndPtr->rectClient.left-wndPtr->rectWindow.left, |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1796 | wndPtr->rectClient.top-wndPtr->rectWindow.top, |
| 1797 | wndPtr->rectClient.right-wndPtr->rectWindow.left, |
| 1798 | wndPtr->rectClient.bottom-wndPtr->rectWindow.top ) |
| 1799 | == NULLREGION) |
| 1800 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1801 | ReleaseDC( hwnd, hdc ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1802 | return; |
| 1803 | } |
| 1804 | |
| 1805 | rect.top = rect.left = 0; |
| 1806 | rect.right = wndPtr->rectWindow.right - wndPtr->rectWindow.left; |
| 1807 | rect.bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top; |
| 1808 | |
Alex Korobka | 4f1ac05 | 1999-03-28 09:37:57 +0000 | [diff] [blame] | 1809 | if( clip > 1 ) |
| 1810 | GetRgnBox( clip, &rectClip ); |
| 1811 | else |
| 1812 | { |
| 1813 | clip = 0; |
| 1814 | rectClip = rect; |
| 1815 | } |
| 1816 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1817 | SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1818 | |
| 1819 | if(!(wndPtr->flags & WIN_MANAGED)) { |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 1820 | if (HAS_BIGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle)) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1821 | DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT | BF_ADJUST); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1822 | } |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 1823 | if (HAS_THICKFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) |
| 1824 | NC_DrawFrame95(hdc, &rect, FALSE, active ); |
| 1825 | else if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) |
| 1826 | NC_DrawFrame95( hdc, &rect, TRUE, active ); |
| 1827 | else if (HAS_THINFRAME( wndPtr->dwStyle )) { |
Gerard Patel | 5773dad | 1999-06-12 14:45:56 +0000 | [diff] [blame] | 1828 | SelectObject( hdc, GetStockObject(NULL_BRUSH) ); |
| 1829 | Rectangle( hdc, 0, 0, rect.right, rect.bottom ); |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 1830 | } |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1831 | |
| 1832 | if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION) |
| 1833 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1834 | RECT r = rect; |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1835 | if (wndPtr->dwExStyle & WS_EX_TOOLWINDOW) { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1836 | r.bottom = rect.top + GetSystemMetrics(SM_CYSMCAPTION); |
| 1837 | rect.top += GetSystemMetrics(SM_CYSMCAPTION); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1838 | } |
| 1839 | else { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1840 | r.bottom = rect.top + GetSystemMetrics(SM_CYCAPTION); |
| 1841 | rect.top += GetSystemMetrics(SM_CYCAPTION); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1842 | } |
Alex Korobka | 4f1ac05 | 1999-03-28 09:37:57 +0000 | [diff] [blame] | 1843 | if( !clip || IntersectRect( &rfuzz, &r, &rectClip ) ) |
| 1844 | NC_DrawCaption95 (hdc, &r, hwnd, wndPtr->dwStyle, |
| 1845 | wndPtr->dwExStyle, active); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1846 | } |
| 1847 | } |
| 1848 | |
| 1849 | if (HAS_MENU(wndPtr)) |
| 1850 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1851 | RECT r = rect; |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1852 | r.bottom = rect.top + GetSystemMetrics(SM_CYMENU); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1853 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1854 | TRACE("Calling DrawMenuBar with rect (%d, %d)-(%d, %d)\n", |
| 1855 | r.left, r.top, r.right, r.bottom); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1856 | |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1857 | rect.top += MENU_DrawMenuBar( hdc, &r, hwnd, suppress_menupaint ) + 1; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1858 | } |
| 1859 | |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 1860 | TRACE("After MenuBar, rect is (%d, %d)-(%d, %d).\n", |
| 1861 | rect.left, rect.top, rect.right, rect.bottom ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1862 | |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1863 | if (wndPtr->dwExStyle & WS_EX_CLIENTEDGE) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1864 | DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1865 | |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 1866 | if (wndPtr->dwExStyle & WS_EX_STATICEDGE) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1867 | DrawEdge (hdc, &rect, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST); |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 1868 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1869 | /* Draw the scroll-bars */ |
| 1870 | |
| 1871 | if (wndPtr->dwStyle & WS_VSCROLL) |
Alex Korobka | d208584 | 1998-10-18 10:37:46 +0000 | [diff] [blame] | 1872 | SCROLL_DrawScrollBar( hwnd, hdc, SB_VERT, TRUE, TRUE ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1873 | if (wndPtr->dwStyle & WS_HSCROLL) |
Alex Korobka | d208584 | 1998-10-18 10:37:46 +0000 | [diff] [blame] | 1874 | SCROLL_DrawScrollBar( hwnd, hdc, SB_HORZ, TRUE, TRUE ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1875 | |
| 1876 | /* Draw the "size-box" */ |
| 1877 | if ((wndPtr->dwStyle & WS_VSCROLL) && (wndPtr->dwStyle & WS_HSCROLL)) |
| 1878 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1879 | RECT r = rect; |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 1880 | r.left = r.right - GetSystemMetrics(SM_CXVSCROLL) + 1; |
| 1881 | r.top = r.bottom - GetSystemMetrics(SM_CYHSCROLL) + 1; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1882 | FillRect( hdc, &r, GetSysColorBrush(COLOR_SCROLLBAR) ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1883 | } |
| 1884 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1885 | ReleaseDC( hwnd, hdc ); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 1886 | } |
| 1887 | |
| 1888 | |
| 1889 | |
Alexandre Julliard | 988ca97 | 1994-06-21 16:15:21 +0000 | [diff] [blame] | 1890 | |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1891 | /*********************************************************************** |
| 1892 | * NC_HandleNCPaint |
| 1893 | * |
| 1894 | * Handle a WM_NCPAINT message. Called from DefWindowProc(). |
| 1895 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1896 | LONG NC_HandleNCPaint( HWND hwnd , HRGN clip) |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1897 | { |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1898 | WND* wndPtr = WIN_FindWndPtr( hwnd ); |
| 1899 | |
| 1900 | if( wndPtr && wndPtr->dwStyle & WS_VISIBLE ) |
| 1901 | { |
| 1902 | if( wndPtr->dwStyle & WS_MINIMIZE ) |
| 1903 | WINPOS_RedrawIconTitle( hwnd ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1904 | else if (TWEAK_WineLook == WIN31_LOOK) |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1905 | NC_DoNCPaint( wndPtr, clip, FALSE ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1906 | else |
| 1907 | NC_DoNCPaint95( wndPtr, clip, FALSE ); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1908 | } |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1909 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1910 | return 0; |
| 1911 | } |
| 1912 | |
| 1913 | |
| 1914 | /*********************************************************************** |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1915 | * NC_HandleNCActivate |
| 1916 | * |
| 1917 | * Handle a WM_NCACTIVATE message. Called from DefWindowProc(). |
| 1918 | */ |
Alexandre Julliard | 530ee84 | 1996-10-23 16:59:13 +0000 | [diff] [blame] | 1919 | LONG NC_HandleNCActivate( WND *wndPtr, WPARAM16 wParam ) |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1920 | { |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1921 | WORD wStateChange; |
Alexandre Julliard | d471965 | 1995-12-12 18:49:11 +0000 | [diff] [blame] | 1922 | |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1923 | if( wParam ) wStateChange = !(wndPtr->flags & WIN_NCACTIVATED); |
| 1924 | else wStateChange = wndPtr->flags & WIN_NCACTIVATED; |
Alexandre Julliard | d471965 | 1995-12-12 18:49:11 +0000 | [diff] [blame] | 1925 | |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1926 | if( wStateChange ) |
| 1927 | { |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1928 | if (wParam) wndPtr->flags |= WIN_NCACTIVATED; |
| 1929 | else wndPtr->flags &= ~WIN_NCACTIVATED; |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1930 | |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 1931 | if( wndPtr->dwStyle & WS_MINIMIZE ) |
| 1932 | WINPOS_RedrawIconTitle( wndPtr->hwndSelf ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1933 | else if (TWEAK_WineLook == WIN31_LOOK) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1934 | NC_DoNCPaint( wndPtr, (HRGN)1, FALSE ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1935 | else |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1936 | NC_DoNCPaint95( wndPtr, (HRGN)1, FALSE ); |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1937 | } |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 1938 | return TRUE; |
| 1939 | } |
| 1940 | |
| 1941 | |
| 1942 | /*********************************************************************** |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1943 | * NC_HandleSetCursor |
| 1944 | * |
| 1945 | * Handle a WM_SETCURSOR message. Called from DefWindowProc(). |
| 1946 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1947 | LONG NC_HandleSetCursor( HWND hwnd, WPARAM16 wParam, LPARAM lParam ) |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1948 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1949 | if (hwnd != (HWND)wParam) return 0; /* Don't set the cursor for child windows */ |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1950 | |
| 1951 | switch(LOWORD(lParam)) |
| 1952 | { |
| 1953 | case HTERROR: |
| 1954 | { |
| 1955 | WORD msg = HIWORD( lParam ); |
| 1956 | if ((msg == WM_LBUTTONDOWN) || (msg == WM_MBUTTONDOWN) || |
| 1957 | (msg == WM_RBUTTONDOWN)) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1958 | MessageBeep(0); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1959 | } |
| 1960 | break; |
| 1961 | |
| 1962 | case HTCLIENT: |
| 1963 | { |
Gerard Patel | 5773dad | 1999-06-12 14:45:56 +0000 | [diff] [blame] | 1964 | HICON16 hCursor = (HICON16) GetClassWord(hwnd, GCW_HCURSOR); |
| 1965 | if(hCursor) { |
| 1966 | SetCursor16(hCursor); |
| 1967 | return TRUE; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1968 | } |
Gerard Patel | 5773dad | 1999-06-12 14:45:56 +0000 | [diff] [blame] | 1969 | return FALSE; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1970 | } |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1971 | |
| 1972 | case HTLEFT: |
| 1973 | case HTRIGHT: |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1974 | return (LONG)SetCursor16( LoadCursor16( 0, IDC_SIZEWE16 ) ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1975 | |
| 1976 | case HTTOP: |
| 1977 | case HTBOTTOM: |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1978 | return (LONG)SetCursor16( LoadCursor16( 0, IDC_SIZENS16 ) ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1979 | |
| 1980 | case HTTOPLEFT: |
| 1981 | case HTBOTTOMRIGHT: |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1982 | return (LONG)SetCursor16( LoadCursor16( 0, IDC_SIZENWSE16 ) ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1983 | |
| 1984 | case HTTOPRIGHT: |
| 1985 | case HTBOTTOMLEFT: |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1986 | return (LONG)SetCursor16( LoadCursor16( 0, IDC_SIZENESW16 ) ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1987 | } |
| 1988 | |
| 1989 | /* Default cursor: arrow */ |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 1990 | return (LONG)SetCursor16( LoadCursor16( 0, IDC_ARROW16 ) ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 1991 | } |
| 1992 | |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1993 | /*********************************************************************** |
| 1994 | * NC_GetSysPopupPos |
| 1995 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1996 | BOOL NC_GetSysPopupPos( WND* wndPtr, RECT* rect ) |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 1997 | { |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 1998 | if( wndPtr->hSysMenu ) |
| 1999 | { |
| 2000 | if( wndPtr->dwStyle & WS_MINIMIZE ) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2001 | GetWindowRect( wndPtr->hwndSelf, rect ); |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 2002 | else |
| 2003 | { |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2004 | if (TWEAK_WineLook == WIN31_LOOK) |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 2005 | NC_GetInsideRect( wndPtr->hwndSelf, rect ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2006 | else |
| 2007 | NC_GetInsideRect95( wndPtr->hwndSelf, rect ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2008 | OffsetRect( rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top); |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 2009 | if (wndPtr->dwStyle & WS_CHILD) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2010 | ClientToScreen( wndPtr->parent->hwndSelf, (POINT *)rect ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2011 | if (TWEAK_WineLook == WIN31_LOOK) { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 2012 | rect->right = rect->left + GetSystemMetrics(SM_CXSIZE); |
| 2013 | rect->bottom = rect->top + GetSystemMetrics(SM_CYSIZE); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 2014 | } |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2015 | else { |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 2016 | rect->right = rect->left + GetSystemMetrics(SM_CYCAPTION) - 1; |
| 2017 | rect->bottom = rect->top + GetSystemMetrics(SM_CYCAPTION) - 1; |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2018 | } |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 2019 | } |
| 2020 | return TRUE; |
| 2021 | } |
| 2022 | return FALSE; |
Alexandre Julliard | 1e37a18 | 1996-08-18 16:21:52 +0000 | [diff] [blame] | 2023 | } |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2024 | |
| 2025 | /*********************************************************************** |
| 2026 | * NC_StartSizeMove |
| 2027 | * |
| 2028 | * Initialisation of a move or resize, when initiatied from a menu choice. |
| 2029 | * Return hit test code for caption or sizing border. |
| 2030 | */ |
Alexandre Julliard | 7ff1c41 | 1997-05-25 13:58:18 +0000 | [diff] [blame] | 2031 | static LONG NC_StartSizeMove( WND* wndPtr, WPARAM16 wParam, |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2032 | POINT *capturePoint ) |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2033 | { |
| 2034 | LONG hittest = 0; |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2035 | POINT pt; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2036 | MSG msg; |
Noomen Hamza | e3e54cd | 1999-06-26 10:31:44 +0000 | [diff] [blame] | 2037 | RECT rectWindow; |
| 2038 | |
| 2039 | GetWindowRect(wndPtr->hwndSelf,&rectWindow); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2040 | |
| 2041 | if ((wParam & 0xfff0) == SC_MOVE) |
| 2042 | { |
| 2043 | /* Move pointer at the center of the caption */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2044 | RECT rect; |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2045 | if (TWEAK_WineLook == WIN31_LOOK) |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 2046 | NC_GetInsideRect( wndPtr->hwndSelf, &rect ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2047 | else |
| 2048 | NC_GetInsideRect95( wndPtr->hwndSelf, &rect ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2049 | if (wndPtr->dwStyle & WS_SYSMENU) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 2050 | rect.left += GetSystemMetrics(SM_CXSIZE) + 1; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2051 | if (wndPtr->dwStyle & WS_MINIMIZEBOX) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 2052 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2053 | if (wndPtr->dwStyle & WS_MAXIMIZEBOX) |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 2054 | rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; |
Noomen Hamza | e3e54cd | 1999-06-26 10:31:44 +0000 | [diff] [blame] | 2055 | pt.x = rectWindow.left + (rect.right - rect.left) / 2; |
| 2056 | pt.y = rectWindow.top + rect.top + GetSystemMetrics(SM_CYSIZE)/2; |
Alexandre Julliard | 7ff1c41 | 1997-05-25 13:58:18 +0000 | [diff] [blame] | 2057 | hittest = HTCAPTION; |
| 2058 | *capturePoint = pt; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2059 | } |
| 2060 | else /* SC_SIZE */ |
| 2061 | { |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2062 | while(!hittest) |
| 2063 | { |
Ulrich Weigand | 2faf2cf | 1999-12-10 03:47:13 +0000 | [diff] [blame] | 2064 | MSG_InternalGetMessage( QMSG_WIN32A, &msg, 0, 0, MSGF_SIZE, PM_REMOVE, FALSE, NULL ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2065 | switch(msg.message) |
| 2066 | { |
| 2067 | case WM_MOUSEMOVE: |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2068 | hittest = NC_HandleNCHitTest( wndPtr->hwndSelf, msg.pt ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2069 | if ((hittest < HTLEFT) || (hittest > HTBOTTOMRIGHT)) |
| 2070 | hittest = 0; |
| 2071 | break; |
| 2072 | |
| 2073 | case WM_LBUTTONUP: |
| 2074 | return 0; |
| 2075 | |
| 2076 | case WM_KEYDOWN: |
| 2077 | switch(msg.wParam) |
| 2078 | { |
| 2079 | case VK_UP: |
| 2080 | hittest = HTTOP; |
Noomen Hamza | e3e54cd | 1999-06-26 10:31:44 +0000 | [diff] [blame] | 2081 | pt.x =(rectWindow.left+rectWindow.right)/2; |
| 2082 | pt.y = rectWindow.top + GetSystemMetrics(SM_CYFRAME) / 2; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2083 | break; |
| 2084 | case VK_DOWN: |
| 2085 | hittest = HTBOTTOM; |
Noomen Hamza | e3e54cd | 1999-06-26 10:31:44 +0000 | [diff] [blame] | 2086 | pt.x =(rectWindow.left+rectWindow.right)/2; |
| 2087 | pt.y = rectWindow.bottom - GetSystemMetrics(SM_CYFRAME) / 2; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2088 | break; |
| 2089 | case VK_LEFT: |
| 2090 | hittest = HTLEFT; |
Noomen Hamza | e3e54cd | 1999-06-26 10:31:44 +0000 | [diff] [blame] | 2091 | pt.x = rectWindow.left + GetSystemMetrics(SM_CXFRAME) / 2; |
| 2092 | pt.y =(rectWindow.top+rectWindow.bottom)/2; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2093 | break; |
| 2094 | case VK_RIGHT: |
| 2095 | hittest = HTRIGHT; |
Noomen Hamza | e3e54cd | 1999-06-26 10:31:44 +0000 | [diff] [blame] | 2096 | pt.x = rectWindow.right - GetSystemMetrics(SM_CXFRAME) / 2; |
| 2097 | pt.y =(rectWindow.top+rectWindow.bottom)/2; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2098 | break; |
| 2099 | case VK_RETURN: |
| 2100 | case VK_ESCAPE: return 0; |
| 2101 | } |
| 2102 | } |
| 2103 | } |
Alexandre Julliard | 7ff1c41 | 1997-05-25 13:58:18 +0000 | [diff] [blame] | 2104 | *capturePoint = pt; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2105 | } |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2106 | SetCursorPos( pt.x, pt.y ); |
Alexandre Julliard | 7ff1c41 | 1997-05-25 13:58:18 +0000 | [diff] [blame] | 2107 | NC_HandleSetCursor( wndPtr->hwndSelf, |
| 2108 | wndPtr->hwndSelf, MAKELONG( hittest, WM_MOUSEMOVE )); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2109 | return hittest; |
| 2110 | } |
| 2111 | |
| 2112 | |
| 2113 | /*********************************************************************** |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2114 | * NC_DoSizeMove |
| 2115 | * |
Stephane Lussier | b3a99de | 1999-02-09 15:35:12 +0000 | [diff] [blame] | 2116 | * Perform SC_MOVE and SC_SIZE commands. ` |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2117 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2118 | static void NC_DoSizeMove( HWND hwnd, WORD wParam ) |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2119 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2120 | MSG msg; |
Dmitry Timoshkov | 9b1e1dc | 2000-08-14 17:20:25 +0000 | [diff] [blame] | 2121 | RECT sizingRect, mouseRect, origRect; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2122 | HDC hdc; |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 2123 | LONG hittest = (LONG)(wParam & 0x0f); |
| 2124 | HCURSOR16 hDragCursor = 0, hOldCursor = 0; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2125 | POINT minTrack, maxTrack; |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2126 | POINT capturePoint, pt; |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 2127 | WND * wndPtr = WIN_FindWndPtr( hwnd ); |
Ove Kaaven | 60c78f1 | 1999-07-03 15:40:29 +0000 | [diff] [blame] | 2128 | BOOL thickframe = HAS_THICKFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2129 | BOOL iconic = wndPtr->dwStyle & WS_MINIMIZE; |
| 2130 | BOOL moved = FALSE; |
NF Stevens | 08aaa5d | 1998-10-22 11:35:04 +0000 | [diff] [blame] | 2131 | DWORD dwPoint = GetMessagePos (); |
Dmitry Timoshkov | 9b1e1dc | 2000-08-14 17:20:25 +0000 | [diff] [blame] | 2132 | BOOL DragFullWindows = FALSE; |
| 2133 | int iWndsLocks; |
| 2134 | |
| 2135 | SystemParametersInfoA(SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2136 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2137 | pt.x = SLOWORD(dwPoint); |
| 2138 | pt.y = SHIWORD(dwPoint); |
| 2139 | capturePoint = pt; |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2140 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2141 | if (IsZoomed(hwnd) || !IsWindowVisible(hwnd) || |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 2142 | (wndPtr->flags & WIN_MANAGED)) goto END; |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2143 | |
| 2144 | if ((wParam & 0xfff0) == SC_MOVE) |
| 2145 | { |
Alexandre Julliard | 7ff1c41 | 1997-05-25 13:58:18 +0000 | [diff] [blame] | 2146 | if (!hittest) |
| 2147 | hittest = NC_StartSizeMove( wndPtr, wParam, &capturePoint ); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 2148 | if (!hittest) goto END; |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2149 | } |
| 2150 | else /* SC_SIZE */ |
| 2151 | { |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 2152 | if (!thickframe) goto END; |
Alexandre Julliard | 7ff1c41 | 1997-05-25 13:58:18 +0000 | [diff] [blame] | 2153 | if ( hittest && hittest != HTSYSMENU ) hittest += 2; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2154 | else |
| 2155 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2156 | SetCapture(hwnd); |
Alexandre Julliard | 7ff1c41 | 1997-05-25 13:58:18 +0000 | [diff] [blame] | 2157 | hittest = NC_StartSizeMove( wndPtr, wParam, &capturePoint ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2158 | if (!hittest) |
| 2159 | { |
| 2160 | ReleaseCapture(); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 2161 | goto END; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2162 | } |
| 2163 | } |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2164 | } |
| 2165 | |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2166 | /* Get min/max info */ |
| 2167 | |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 2168 | WINPOS_GetMinMaxInfo( wndPtr, NULL, NULL, &minTrack, &maxTrack ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2169 | sizingRect = wndPtr->rectWindow; |
Dmitry Timoshkov | 9b1e1dc | 2000-08-14 17:20:25 +0000 | [diff] [blame] | 2170 | origRect = sizingRect; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2171 | if (wndPtr->dwStyle & WS_CHILD) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2172 | GetClientRect( wndPtr->parent->hwndSelf, &mouseRect ); |
Alexandre Julliard | 7ff1c41 | 1997-05-25 13:58:18 +0000 | [diff] [blame] | 2173 | else |
Marcus Meissner | ddca315 | 1999-05-22 11:33:23 +0000 | [diff] [blame] | 2174 | SetRect(&mouseRect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2175 | if (ON_LEFT_BORDER(hittest)) |
| 2176 | { |
Francois Gouget | 6d77d3a | 2000-03-25 21:44:35 +0000 | [diff] [blame] | 2177 | mouseRect.left = max( mouseRect.left, sizingRect.right-maxTrack.x ); |
| 2178 | mouseRect.right = min( mouseRect.right, sizingRect.right-minTrack.x ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2179 | } |
| 2180 | else if (ON_RIGHT_BORDER(hittest)) |
| 2181 | { |
Francois Gouget | 6d77d3a | 2000-03-25 21:44:35 +0000 | [diff] [blame] | 2182 | mouseRect.left = max( mouseRect.left, sizingRect.left+minTrack.x ); |
| 2183 | mouseRect.right = min( mouseRect.right, sizingRect.left+maxTrack.x ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2184 | } |
| 2185 | if (ON_TOP_BORDER(hittest)) |
| 2186 | { |
Francois Gouget | 6d77d3a | 2000-03-25 21:44:35 +0000 | [diff] [blame] | 2187 | mouseRect.top = max( mouseRect.top, sizingRect.bottom-maxTrack.y ); |
| 2188 | mouseRect.bottom = min( mouseRect.bottom,sizingRect.bottom-minTrack.y); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2189 | } |
| 2190 | else if (ON_BOTTOM_BORDER(hittest)) |
| 2191 | { |
Francois Gouget | 6d77d3a | 2000-03-25 21:44:35 +0000 | [diff] [blame] | 2192 | mouseRect.top = max( mouseRect.top, sizingRect.top+minTrack.y ); |
| 2193 | mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2194 | } |
NF Stevens | 08aaa5d | 1998-10-22 11:35:04 +0000 | [diff] [blame] | 2195 | if (wndPtr->dwStyle & WS_CHILD) |
| 2196 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2197 | MapWindowPoints( wndPtr->parent->hwndSelf, 0, |
| 2198 | (LPPOINT)&mouseRect, 2 ); |
NF Stevens | 08aaa5d | 1998-10-22 11:35:04 +0000 | [diff] [blame] | 2199 | } |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2200 | SendMessageA( hwnd, WM_ENTERSIZEMOVE, 0, 0 ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2201 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2202 | if (GetCapture() != hwnd) SetCapture( hwnd ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2203 | |
Alexandre Julliard | 3ed37e0 | 1994-11-07 18:20:42 +0000 | [diff] [blame] | 2204 | if (wndPtr->dwStyle & WS_CHILD) |
| 2205 | { |
| 2206 | /* Retrieve a default cache DC (without using the window style) */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2207 | hdc = GetDCEx( wndPtr->parent->hwndSelf, 0, DCX_CACHE ); |
Alexandre Julliard | 3ed37e0 | 1994-11-07 18:20:42 +0000 | [diff] [blame] | 2208 | } |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2209 | else |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 2210 | { /* Grab the server only when moving top-level windows without desktop */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2211 | hdc = GetDC( 0 ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2212 | } |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 2213 | |
Patrik Stridvall | e35d636 | 1998-12-07 09:13:40 +0000 | [diff] [blame] | 2214 | wndPtr->pDriver->pPreSizeMove(wndPtr); |
| 2215 | |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2216 | if( iconic ) /* create a cursor for dragging */ |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 2217 | { |
Gerard Patel | 5773dad | 1999-06-12 14:45:56 +0000 | [diff] [blame] | 2218 | HICON16 hIcon = GetClassWord(wndPtr->hwndSelf, GCW_HICON); |
| 2219 | if(!hIcon) hIcon = (HICON16) SendMessage16( hwnd, WM_QUERYDRAGICON, 0, 0L); |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2220 | if( hIcon ) hDragCursor = CURSORICON_IconToCursor( hIcon, TRUE ); |
| 2221 | if( !hDragCursor ) iconic = FALSE; |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 2222 | } |
| 2223 | |
Chris Morgan | 3621964 | 2000-05-14 23:43:29 +0000 | [diff] [blame] | 2224 | /* invert frame if WIN31_LOOK to indicate mouse click on caption */ |
| 2225 | if( !iconic && TWEAK_WineLook == WIN31_LOOK ) |
Dmitry Timoshkov | 9b1e1dc | 2000-08-14 17:20:25 +0000 | [diff] [blame] | 2226 | if(!DragFullWindows) |
Chris Morgan | 3621964 | 2000-05-14 23:43:29 +0000 | [diff] [blame] | 2227 | NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2228 | |
| 2229 | while(1) |
| 2230 | { |
Alexandre Julliard | 7d654eb | 1996-02-25 11:36:22 +0000 | [diff] [blame] | 2231 | int dx = 0, dy = 0; |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2232 | |
Ulrich Weigand | 2faf2cf | 1999-12-10 03:47:13 +0000 | [diff] [blame] | 2233 | MSG_InternalGetMessage( QMSG_WIN32A, &msg, 0, 0, MSGF_SIZE, PM_REMOVE, FALSE, NULL ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2234 | |
| 2235 | /* Exit on button-up, Return, or Esc */ |
| 2236 | if ((msg.message == WM_LBUTTONUP) || |
| 2237 | ((msg.message == WM_KEYDOWN) && |
| 2238 | ((msg.wParam == VK_RETURN) || (msg.wParam == VK_ESCAPE)))) break; |
| 2239 | |
Alexandre Julliard | c192ba2 | 2000-05-29 21:25:10 +0000 | [diff] [blame] | 2240 | if (msg.message == WM_PAINT) |
| 2241 | { |
Dmitry Timoshkov | 9b1e1dc | 2000-08-14 17:20:25 +0000 | [diff] [blame] | 2242 | if(!iconic && !DragFullWindows) NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); |
Alexandre Julliard | c192ba2 | 2000-05-29 21:25:10 +0000 | [diff] [blame] | 2243 | UpdateWindow( msg.hwnd ); |
Dmitry Timoshkov | 9b1e1dc | 2000-08-14 17:20:25 +0000 | [diff] [blame] | 2244 | if(!iconic && !DragFullWindows) NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); |
Alexandre Julliard | c192ba2 | 2000-05-29 21:25:10 +0000 | [diff] [blame] | 2245 | continue; |
| 2246 | } |
Dmitry Timoshkov | 9b1e1dc | 2000-08-14 17:20:25 +0000 | [diff] [blame] | 2247 | |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2248 | if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE)) |
| 2249 | continue; /* We are not interested in other messages */ |
| 2250 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2251 | pt = msg.pt; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2252 | |
| 2253 | if (msg.message == WM_KEYDOWN) switch(msg.wParam) |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2254 | { |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2255 | case VK_UP: pt.y -= 8; break; |
| 2256 | case VK_DOWN: pt.y += 8; break; |
| 2257 | case VK_LEFT: pt.x -= 8; break; |
| 2258 | case VK_RIGHT: pt.x += 8; break; |
| 2259 | } |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2260 | |
Francois Gouget | 6d77d3a | 2000-03-25 21:44:35 +0000 | [diff] [blame] | 2261 | pt.x = max( pt.x, mouseRect.left ); |
| 2262 | pt.x = min( pt.x, mouseRect.right ); |
| 2263 | pt.y = max( pt.y, mouseRect.top ); |
| 2264 | pt.y = min( pt.y, mouseRect.bottom ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2265 | |
| 2266 | dx = pt.x - capturePoint.x; |
| 2267 | dy = pt.y - capturePoint.y; |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2268 | |
| 2269 | if (dx || dy) |
| 2270 | { |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2271 | if( !moved ) |
| 2272 | { |
| 2273 | moved = TRUE; |
Chris Morgan | 3621964 | 2000-05-14 23:43:29 +0000 | [diff] [blame] | 2274 | |
| 2275 | if( iconic ) /* ok, no system popup tracking */ |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2276 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2277 | hOldCursor = SetCursor(hDragCursor); |
| 2278 | ShowCursor( TRUE ); |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2279 | WINPOS_ShowIconTitle( wndPtr, FALSE ); |
Chris Morgan | 3621964 | 2000-05-14 23:43:29 +0000 | [diff] [blame] | 2280 | } else if(TWEAK_WineLook != WIN31_LOOK) |
| 2281 | { |
Dmitry Timoshkov | 9b1e1dc | 2000-08-14 17:20:25 +0000 | [diff] [blame] | 2282 | if(!DragFullWindows) |
Chris Morgan | 3621964 | 2000-05-14 23:43:29 +0000 | [diff] [blame] | 2283 | NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); |
| 2284 | } |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2285 | } |
| 2286 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2287 | if (msg.message == WM_KEYDOWN) SetCursorPos( pt.x, pt.y ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2288 | else |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2289 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2290 | RECT newRect = sizingRect; |
Aric Stewart | 4467550 | 2000-05-05 18:28:10 +0000 | [diff] [blame] | 2291 | WPARAM wpSizingHit = 0; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2292 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2293 | if (hittest == HTCAPTION) OffsetRect( &newRect, dx, dy ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2294 | if (ON_LEFT_BORDER(hittest)) newRect.left += dx; |
| 2295 | else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx; |
| 2296 | if (ON_TOP_BORDER(hittest)) newRect.top += dy; |
| 2297 | else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy; |
Dmitry Timoshkov | 9b1e1dc | 2000-08-14 17:20:25 +0000 | [diff] [blame] | 2298 | if(!iconic && !DragFullWindows) NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2299 | capturePoint = pt; |
Aric Stewart | 4467550 | 2000-05-05 18:28:10 +0000 | [diff] [blame] | 2300 | |
| 2301 | /* determine the hit location */ |
| 2302 | if (hittest >= HTLEFT && hittest <= HTBOTTOMRIGHT) |
| 2303 | wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT); |
| 2304 | SendMessageA( hwnd, WM_SIZING, wpSizingHit, (LPARAM)&newRect ); |
| 2305 | |
Dmitry Timoshkov | 9b1e1dc | 2000-08-14 17:20:25 +0000 | [diff] [blame] | 2306 | if (!iconic) |
| 2307 | { |
| 2308 | if(!DragFullWindows) |
| 2309 | NC_DrawMovingFrame( hdc, &newRect, thickframe ); |
| 2310 | else { |
| 2311 | /* To avoid any deadlocks, all the locks on the windows |
| 2312 | structures must be suspended before the SetWindowPos */ |
| 2313 | iWndsLocks = WIN_SuspendWndsLock(); |
| 2314 | SetWindowPos( hwnd, 0, newRect.left, newRect.top, |
| 2315 | newRect.right - newRect.left, |
| 2316 | newRect.bottom - newRect.top, |
| 2317 | ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 ); |
| 2318 | WIN_RestoreWndsLock(iWndsLocks); |
| 2319 | } |
| 2320 | } |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2321 | sizingRect = newRect; |
| 2322 | } |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2323 | } |
| 2324 | } |
| 2325 | |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2326 | ReleaseCapture(); |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 2327 | if( iconic ) |
| 2328 | { |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2329 | if( moved ) /* restore cursors, show icon title later on */ |
| 2330 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2331 | ShowCursor( FALSE ); |
| 2332 | SetCursor( hOldCursor ); |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2333 | } |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2334 | DestroyCursor( hDragCursor ); |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 2335 | } |
Chris Morgan | 3621964 | 2000-05-14 23:43:29 +0000 | [diff] [blame] | 2336 | else if(moved || TWEAK_WineLook == WIN31_LOOK) |
Dmitry Timoshkov | 9b1e1dc | 2000-08-14 17:20:25 +0000 | [diff] [blame] | 2337 | if(!DragFullWindows) |
Chris Morgan | 3621964 | 2000-05-14 23:43:29 +0000 | [diff] [blame] | 2338 | NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); |
Alexandre Julliard | 7d654eb | 1996-02-25 11:36:22 +0000 | [diff] [blame] | 2339 | |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 2340 | if (wndPtr->dwStyle & WS_CHILD) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2341 | ReleaseDC( wndPtr->parent->hwndSelf, hdc ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2342 | else |
Chris Morgan | 3621964 | 2000-05-14 23:43:29 +0000 | [diff] [blame] | 2343 | ReleaseDC( 0, hdc ); |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 2344 | |
Patrik Stridvall | e35d636 | 1998-12-07 09:13:40 +0000 | [diff] [blame] | 2345 | wndPtr->pDriver->pPostSizeMove(wndPtr); |
| 2346 | |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 2347 | if (HOOK_IsHooked( WH_CBT )) |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 2348 | { |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2349 | RECT16* pr = SEGPTR_NEW(RECT16); |
| 2350 | if( pr ) |
| 2351 | { |
| 2352 | CONV_RECT32TO16( &sizingRect, pr ); |
| 2353 | if( HOOK_CallHooks16( WH_CBT, HCBT_MOVESIZE, hwnd, |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 2354 | (LPARAM)SEGPTR_GET(pr)) ) |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2355 | sizingRect = wndPtr->rectWindow; |
| 2356 | else |
| 2357 | CONV_RECT16TO32( pr, &sizingRect ); |
| 2358 | SEGPTR_FREE(pr); |
| 2359 | } |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 2360 | } |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2361 | SendMessageA( hwnd, WM_EXITSIZEMOVE, 0, 0 ); |
| 2362 | SendMessageA( hwnd, WM_SETVISIBLE, !IsIconic16(hwnd), 0L); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2363 | |
Noomen Hamza | c01509c | 1999-07-04 15:54:11 +0000 | [diff] [blame] | 2364 | /* window moved or resized */ |
| 2365 | if (moved) |
Alexandre Julliard | 7d654eb | 1996-02-25 11:36:22 +0000 | [diff] [blame] | 2366 | { |
Dmitry Timoshkov | 9b1e1dc | 2000-08-14 17:20:25 +0000 | [diff] [blame] | 2367 | /* To avoid any deadlocks, all the locks on the windows |
| 2368 | structures must be suspended before the SetWindowPos */ |
| 2369 | iWndsLocks = WIN_SuspendWndsLock(); |
| 2370 | |
Noomen Hamza | c01509c | 1999-07-04 15:54:11 +0000 | [diff] [blame] | 2371 | /* if the moving/resizing isn't canceled call SetWindowPos |
| 2372 | * with the new position or the new size of the window |
| 2373 | */ |
| 2374 | if (!((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) ) |
| 2375 | { |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 2376 | /* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */ |
Dmitry Timoshkov | 9b1e1dc | 2000-08-14 17:20:25 +0000 | [diff] [blame] | 2377 | if(!DragFullWindows) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2378 | SetWindowPos( hwnd, 0, sizingRect.left, sizingRect.top, |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 2379 | sizingRect.right - sizingRect.left, |
| 2380 | sizingRect.bottom - sizingRect.top, |
| 2381 | ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 ); |
Noomen Hamza | c01509c | 1999-07-04 15:54:11 +0000 | [diff] [blame] | 2382 | } |
Dmitry Timoshkov | 9b1e1dc | 2000-08-14 17:20:25 +0000 | [diff] [blame] | 2383 | else { /* restore previous size/position */ |
| 2384 | if(DragFullWindows) |
| 2385 | SetWindowPos( hwnd, 0, origRect.left, origRect.top, |
| 2386 | origRect.right - origRect.left, |
| 2387 | origRect.bottom - origRect.top, |
| 2388 | ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 ); |
| 2389 | } |
| 2390 | |
| 2391 | WIN_RestoreWndsLock(iWndsLocks); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 2392 | } |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2393 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2394 | if( IsWindow(hwnd) ) |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2395 | if( wndPtr->dwStyle & WS_MINIMIZE ) |
| 2396 | { |
| 2397 | /* Single click brings up the system menu when iconized */ |
| 2398 | |
| 2399 | if( !moved ) |
| 2400 | { |
| 2401 | if( wndPtr->dwStyle & WS_SYSMENU ) |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2402 | SendMessageA( hwnd, WM_SYSCOMMAND, |
| 2403 | SC_MOUSEMENU + HTSYSMENU, MAKELONG(pt.x,pt.y)); |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2404 | } |
| 2405 | else WINPOS_ShowIconTitle( wndPtr, TRUE ); |
| 2406 | } |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 2407 | |
| 2408 | END: |
| 2409 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2410 | } |
| 2411 | |
| 2412 | |
| 2413 | /*********************************************************************** |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2414 | * NC_TrackMinMaxBox95 |
| 2415 | * |
| 2416 | * Track a mouse button press on the minimize or maximize box. |
| 2417 | * |
| 2418 | * The big difference between 3.1 and 95 is the disabled button state. |
| 2419 | * In win95 the system button can be disabled, so it can ignore the mouse |
| 2420 | * event. |
| 2421 | * |
| 2422 | */ |
| 2423 | static void NC_TrackMinMaxBox95( HWND hwnd, WORD wParam ) |
| 2424 | { |
| 2425 | MSG msg; |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2426 | HDC hdc = GetWindowDC( hwnd ); |
| 2427 | BOOL pressed = TRUE; |
| 2428 | UINT state; |
| 2429 | DWORD wndStyle = GetWindowLongA( hwnd, GWL_STYLE); |
| 2430 | HMENU hSysMenu = GetSystemMenu(hwnd, FALSE); |
| 2431 | |
| 2432 | void (*paintButton)(HWND, HDC16, BOOL, BOOL); |
| 2433 | |
| 2434 | if (wParam == HTMINBUTTON) |
| 2435 | { |
| 2436 | /* If the style is not present, do nothing */ |
| 2437 | if (!(wndStyle & WS_MINIMIZEBOX)) |
| 2438 | return; |
| 2439 | |
| 2440 | /* Check if the sysmenu item for minimize is there */ |
| 2441 | state = GetMenuState(hSysMenu, SC_MINIMIZE, MF_BYCOMMAND); |
| 2442 | |
| 2443 | paintButton = &NC_DrawMinButton95; |
| 2444 | } |
| 2445 | else |
| 2446 | { |
| 2447 | /* If the style is not present, do nothing */ |
| 2448 | if (!(wndStyle & WS_MAXIMIZEBOX)) |
| 2449 | return; |
| 2450 | |
| 2451 | /* Check if the sysmenu item for maximize is there */ |
| 2452 | state = GetMenuState(hSysMenu, SC_MAXIMIZE, MF_BYCOMMAND); |
| 2453 | |
| 2454 | paintButton = &NC_DrawMaxButton95; |
| 2455 | } |
| 2456 | |
| 2457 | SetCapture( hwnd ); |
| 2458 | |
| 2459 | (*paintButton)( hwnd, hdc, TRUE, FALSE); |
| 2460 | |
| 2461 | do |
| 2462 | { |
| 2463 | BOOL oldstate = pressed; |
Ulrich Weigand | 2faf2cf | 1999-12-10 03:47:13 +0000 | [diff] [blame] | 2464 | MSG_InternalGetMessage( QMSG_WIN32A, &msg, 0, 0, 0, PM_REMOVE, FALSE, NULL ); |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2465 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2466 | pressed = (NC_HandleNCHitTest( hwnd, msg.pt ) == wParam); |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2467 | if (pressed != oldstate) |
| 2468 | (*paintButton)( hwnd, hdc, pressed, FALSE); |
| 2469 | } while (msg.message != WM_LBUTTONUP); |
| 2470 | |
| 2471 | (*paintButton)( hwnd, hdc, FALSE, FALSE); |
| 2472 | |
| 2473 | ReleaseCapture(); |
| 2474 | ReleaseDC( hwnd, hdc ); |
| 2475 | |
| 2476 | /* If the item minimize or maximize of the sysmenu are not there */ |
| 2477 | /* or if the style is not present, do nothing */ |
| 2478 | if ((!pressed) || (state == 0xFFFFFFFF)) |
| 2479 | return; |
| 2480 | |
| 2481 | if (wParam == HTMINBUTTON) |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2482 | 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] | 2483 | else |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2484 | SendMessageA( hwnd, WM_SYSCOMMAND, |
| 2485 | 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] | 2486 | } |
| 2487 | |
| 2488 | /*********************************************************************** |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2489 | * NC_TrackMinMaxBox |
| 2490 | * |
| 2491 | * Track a mouse button press on the minimize or maximize box. |
| 2492 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2493 | static void NC_TrackMinMaxBox( HWND hwnd, WORD wParam ) |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2494 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2495 | MSG msg; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2496 | HDC hdc = GetWindowDC( hwnd ); |
| 2497 | BOOL pressed = TRUE; |
| 2498 | void (*paintButton)(HWND, HDC16, BOOL); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2499 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2500 | SetCapture( hwnd ); |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2501 | |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2502 | if (wParam == HTMINBUTTON) |
| 2503 | paintButton = &NC_DrawMinButton; |
| 2504 | else |
| 2505 | paintButton = &NC_DrawMaxButton; |
| 2506 | |
| 2507 | (*paintButton)( hwnd, hdc, TRUE); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2508 | |
| 2509 | do |
| 2510 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2511 | BOOL oldstate = pressed; |
Ulrich Weigand | 2faf2cf | 1999-12-10 03:47:13 +0000 | [diff] [blame] | 2512 | MSG_InternalGetMessage( QMSG_WIN32A, &msg, 0, 0, 0, PM_REMOVE, FALSE, NULL ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2513 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2514 | pressed = (NC_HandleNCHitTest( hwnd, msg.pt ) == wParam); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2515 | if (pressed != oldstate) |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2516 | (*paintButton)( hwnd, hdc, pressed); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2517 | } while (msg.message != WM_LBUTTONUP); |
| 2518 | |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2519 | (*paintButton)( hwnd, hdc, FALSE); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2520 | |
| 2521 | ReleaseCapture(); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2522 | ReleaseDC( hwnd, hdc ); |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2523 | |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2524 | if (!pressed) return; |
| 2525 | |
| 2526 | if (wParam == HTMINBUTTON) |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2527 | 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] | 2528 | else |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2529 | SendMessageA( hwnd, WM_SYSCOMMAND, |
| 2530 | 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] | 2531 | } |
| 2532 | |
| 2533 | |
| 2534 | /*********************************************************************** |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 2535 | * NC_TrackCloseButton95 |
| 2536 | * |
| 2537 | * Track a mouse button press on the Win95 close button. |
| 2538 | */ |
| 2539 | static void |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2540 | NC_TrackCloseButton95 (HWND hwnd, WORD wParam) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 2541 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2542 | MSG msg; |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2543 | HDC hdc; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2544 | BOOL pressed = TRUE; |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2545 | HMENU hSysMenu = GetSystemMenu(hwnd, FALSE); |
| 2546 | UINT state; |
| 2547 | |
| 2548 | if(hSysMenu == 0) |
| 2549 | return; |
| 2550 | |
| 2551 | state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND); |
| 2552 | |
| 2553 | /* If the item close of the sysmenu is disabled or not there do nothing */ |
| 2554 | if((state & MF_DISABLED) || (state & MF_GRAYED) || (state == 0xFFFFFFFF)) |
| 2555 | return; |
| 2556 | |
| 2557 | hdc = GetWindowDC( hwnd ); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 2558 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2559 | SetCapture( hwnd ); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 2560 | |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2561 | NC_DrawCloseButton95 (hwnd, hdc, TRUE, FALSE); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 2562 | |
| 2563 | do |
| 2564 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2565 | BOOL oldstate = pressed; |
Ulrich Weigand | 2faf2cf | 1999-12-10 03:47:13 +0000 | [diff] [blame] | 2566 | MSG_InternalGetMessage( QMSG_WIN32A, &msg, 0, 0, 0, PM_REMOVE, FALSE, NULL ); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 2567 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2568 | pressed = (NC_HandleNCHitTest( hwnd, msg.pt ) == wParam); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 2569 | if (pressed != oldstate) |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2570 | NC_DrawCloseButton95 (hwnd, hdc, pressed, FALSE); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 2571 | } while (msg.message != WM_LBUTTONUP); |
| 2572 | |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2573 | NC_DrawCloseButton95 (hwnd, hdc, FALSE, FALSE); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 2574 | |
| 2575 | ReleaseCapture(); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2576 | ReleaseDC( hwnd, hdc ); |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 2577 | if (!pressed) return; |
| 2578 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2579 | 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] | 2580 | } |
| 2581 | |
| 2582 | |
| 2583 | /*********************************************************************** |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2584 | * NC_TrackScrollBar |
| 2585 | * |
| 2586 | * Track a mouse button press on the horizontal or vertical scroll-bar. |
| 2587 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2588 | static void NC_TrackScrollBar( HWND hwnd, WPARAM wParam, POINT pt ) |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2589 | { |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 2590 | MSG16 *msg; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2591 | INT scrollbar; |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 2592 | WND *wndPtr = WIN_FindWndPtr( hwnd ); |
| 2593 | |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2594 | if ((wParam & 0xfff0) == SC_HSCROLL) |
| 2595 | { |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 2596 | if ((wParam & 0x0f) != HTHSCROLL) goto END; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2597 | scrollbar = SB_HORZ; |
| 2598 | } |
| 2599 | else /* SC_VSCROLL */ |
| 2600 | { |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 2601 | if ((wParam & 0x0f) != HTVSCROLL) goto END; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2602 | scrollbar = SB_VERT; |
| 2603 | } |
| 2604 | |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 2605 | if (!(msg = SEGPTR_NEW(MSG16))) goto END; |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 2606 | pt.x -= wndPtr->rectWindow.left; |
| 2607 | pt.y -= wndPtr->rectWindow.top; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2608 | SetCapture( hwnd ); |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 2609 | SCROLL_HandleScrollEvent( hwnd, scrollbar, WM_LBUTTONDOWN, pt ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2610 | |
| 2611 | do |
| 2612 | { |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 2613 | GetMessage16( SEGPTR_GET(msg), 0, 0, 0 ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 2614 | switch(msg->message) |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2615 | { |
| 2616 | case WM_LBUTTONUP: |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2617 | case WM_MOUSEMOVE: |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 2618 | case WM_SYSTIMER: |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 2619 | pt.x = LOWORD(msg->lParam) + wndPtr->rectClient.left - |
Alexandre Julliard | 902da69 | 1995-11-05 14:39:02 +0000 | [diff] [blame] | 2620 | wndPtr->rectWindow.left; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 2621 | pt.y = HIWORD(msg->lParam) + wndPtr->rectClient.top - |
Alexandre Julliard | 902da69 | 1995-11-05 14:39:02 +0000 | [diff] [blame] | 2622 | wndPtr->rectWindow.top; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 2623 | SCROLL_HandleScrollEvent( hwnd, scrollbar, msg->message, pt ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2624 | break; |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 2625 | default: |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 2626 | TranslateMessage16( msg ); |
| 2627 | DispatchMessage16( msg ); |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 2628 | break; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2629 | } |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2630 | if (!IsWindow( hwnd )) |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 2631 | { |
| 2632 | ReleaseCapture(); |
| 2633 | break; |
| 2634 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 2635 | } while (msg->message != WM_LBUTTONUP); |
| 2636 | SEGPTR_FREE(msg); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 2637 | END: |
| 2638 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2639 | } |
| 2640 | |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2641 | /*********************************************************************** |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2642 | * NC_HandleNCLButtonDown |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 2643 | * |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2644 | * Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc(). |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 2645 | */ |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2646 | LONG NC_HandleNCLButtonDown( WND* pWnd, WPARAM16 wParam, LPARAM lParam ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 2647 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2648 | HWND hwnd = pWnd->hwndSelf; |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2649 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2650 | switch(wParam) /* Hit test */ |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 2651 | { |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2652 | case HTCAPTION: |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2653 | hwnd = WIN_GetTopParent(hwnd); |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 2654 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2655 | if( WINPOS_SetActiveWindow(hwnd, TRUE, TRUE) || (GetActiveWindow() == hwnd) ) |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2656 | SendMessage16( pWnd->hwndSelf, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, lParam ); |
| 2657 | break; |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2658 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 2659 | case HTSYSMENU: |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2660 | if( pWnd->dwStyle & WS_SYSMENU ) |
| 2661 | { |
| 2662 | if( !(pWnd->dwStyle & WS_MINIMIZE) ) |
| 2663 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2664 | HDC hDC = GetWindowDC(hwnd); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2665 | if (TWEAK_WineLook == WIN31_LOOK) |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2666 | NC_DrawSysButton( hwnd, hDC, TRUE ); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2667 | else |
| 2668 | NC_DrawSysButton95( hwnd, hDC, TRUE ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2669 | ReleaseDC( hwnd, hDC ); |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2670 | } |
| 2671 | SendMessage16( hwnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU, lParam ); |
| 2672 | } |
| 2673 | break; |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2674 | |
| 2675 | case HTMENU: |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 2676 | SendMessage16( hwnd, WM_SYSCOMMAND, SC_MOUSEMENU, lParam ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2677 | break; |
| 2678 | |
| 2679 | case HTHSCROLL: |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 2680 | SendMessage16( hwnd, WM_SYSCOMMAND, SC_HSCROLL + HTHSCROLL, lParam ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2681 | break; |
| 2682 | |
| 2683 | case HTVSCROLL: |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 2684 | SendMessage16( hwnd, WM_SYSCOMMAND, SC_VSCROLL + HTVSCROLL, lParam ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2685 | break; |
| 2686 | |
| 2687 | case HTMINBUTTON: |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2688 | case HTMAXBUTTON: |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2689 | if (TWEAK_WineLook == WIN31_LOOK) |
| 2690 | NC_TrackMinMaxBox( hwnd, wParam ); |
| 2691 | else |
| 2692 | NC_TrackMinMaxBox95( hwnd, wParam ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2693 | break; |
| 2694 | |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 2695 | case HTCLOSE: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2696 | if (TWEAK_WineLook >= WIN95_LOOK) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 2697 | NC_TrackCloseButton95 (hwnd, wParam); |
| 2698 | break; |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2699 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2700 | case HTLEFT: |
| 2701 | case HTRIGHT: |
| 2702 | case HTTOP: |
| 2703 | case HTTOPLEFT: |
| 2704 | case HTTOPRIGHT: |
| 2705 | case HTBOTTOM: |
| 2706 | case HTBOTTOMLEFT: |
| 2707 | case HTBOTTOMRIGHT: |
Alexandre Julliard | 7ff1c41 | 1997-05-25 13:58:18 +0000 | [diff] [blame] | 2708 | /* make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU */ |
| 2709 | SendMessage16( hwnd, WM_SYSCOMMAND, SC_SIZE + wParam - 2, lParam); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2710 | break; |
| 2711 | |
| 2712 | case HTBORDER: |
| 2713 | break; |
| 2714 | } |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2715 | return 0; |
| 2716 | } |
| 2717 | |
| 2718 | |
| 2719 | /*********************************************************************** |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2720 | * NC_HandleNCLButtonDblClk |
| 2721 | * |
| 2722 | * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc(). |
| 2723 | */ |
Alexandre Julliard | 530ee84 | 1996-10-23 16:59:13 +0000 | [diff] [blame] | 2724 | LONG NC_HandleNCLButtonDblClk( WND *pWnd, WPARAM16 wParam, LPARAM lParam ) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2725 | { |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 2726 | /* |
| 2727 | * if this is an icon, send a restore since we are handling |
| 2728 | * a double click |
| 2729 | */ |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 2730 | if (pWnd->dwStyle & WS_MINIMIZE) |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 2731 | { |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 2732 | SendMessage16( pWnd->hwndSelf, WM_SYSCOMMAND, SC_RESTORE, lParam ); |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 2733 | return 0; |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 2734 | } |
| 2735 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2736 | switch(wParam) /* Hit test */ |
| 2737 | { |
| 2738 | case HTCAPTION: |
Alexandre Julliard | 902da69 | 1995-11-05 14:39:02 +0000 | [diff] [blame] | 2739 | /* stop processing if WS_MAXIMIZEBOX is missing */ |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 2740 | if (pWnd->dwStyle & WS_MAXIMIZEBOX) |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 2741 | SendMessage16( pWnd->hwndSelf, WM_SYSCOMMAND, |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 2742 | (pWnd->dwStyle & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE, |
| 2743 | lParam ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2744 | break; |
| 2745 | |
| 2746 | case HTSYSMENU: |
Gerard Patel | 5773dad | 1999-06-12 14:45:56 +0000 | [diff] [blame] | 2747 | if (!(GetClassWord(pWnd->hwndSelf, GCW_STYLE) & CS_NOCLOSE)) |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 2748 | SendMessage16( pWnd->hwndSelf, WM_SYSCOMMAND, SC_CLOSE, lParam ); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 2749 | break; |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 2750 | |
| 2751 | case HTHSCROLL: |
| 2752 | SendMessage16( pWnd->hwndSelf, WM_SYSCOMMAND, SC_HSCROLL + HTHSCROLL, |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2753 | lParam ); |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 2754 | break; |
| 2755 | |
| 2756 | case HTVSCROLL: |
| 2757 | SendMessage16( pWnd->hwndSelf, WM_SYSCOMMAND, SC_VSCROLL + HTVSCROLL, |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 2758 | lParam ); |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 2759 | break; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 2760 | } |
| 2761 | return 0; |
| 2762 | } |
| 2763 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2764 | |
| 2765 | /*********************************************************************** |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2766 | * NC_HandleSysCommand |
| 2767 | * |
| 2768 | * Handle a WM_SYSCOMMAND message. Called from DefWindowProc(). |
| 2769 | */ |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2770 | LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT pt ) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2771 | { |
| 2772 | WND *wndPtr = WIN_FindWndPtr( hwnd ); |
Alexandre Julliard | 7ff1c41 | 1997-05-25 13:58:18 +0000 | [diff] [blame] | 2773 | UINT16 uCommand = wParam & 0xFFF0; |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2774 | |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2775 | 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] | 2776 | |
Alexandre Julliard | 7ff1c41 | 1997-05-25 13:58:18 +0000 | [diff] [blame] | 2777 | if (wndPtr->dwStyle & WS_CHILD && uCommand != SC_KEYMENU ) |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2778 | ScreenToClient( wndPtr->parent->hwndSelf, &pt ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2779 | |
Alexandre Julliard | 7ff1c41 | 1997-05-25 13:58:18 +0000 | [diff] [blame] | 2780 | switch (uCommand) |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2781 | { |
| 2782 | case SC_SIZE: |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2783 | case SC_MOVE: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2784 | NC_DoSizeMove( hwnd, wParam ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2785 | break; |
| 2786 | |
| 2787 | case SC_MINIMIZE: |
Noomen Hamza | d1a1f7d | 1999-10-24 00:02:27 +0000 | [diff] [blame] | 2788 | if (hwnd == GetForegroundWindow()) |
| 2789 | ShowOwnedPopups(hwnd,FALSE); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2790 | ShowWindow( hwnd, SW_MINIMIZE ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2791 | break; |
| 2792 | |
| 2793 | case SC_MAXIMIZE: |
Noomen Hamza | d1a1f7d | 1999-10-24 00:02:27 +0000 | [diff] [blame] | 2794 | if (IsIconic(hwnd) && hwnd == GetForegroundWindow()) |
| 2795 | ShowOwnedPopups(hwnd,TRUE); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2796 | ShowWindow( hwnd, SW_MAXIMIZE ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2797 | break; |
| 2798 | |
| 2799 | case SC_RESTORE: |
Noomen Hamza | d1a1f7d | 1999-10-24 00:02:27 +0000 | [diff] [blame] | 2800 | if (IsIconic(hwnd) && hwnd == GetForegroundWindow()) |
| 2801 | ShowOwnedPopups(hwnd,TRUE); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2802 | ShowWindow( hwnd, SW_RESTORE ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2803 | break; |
| 2804 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2805 | case SC_CLOSE: |
Francois Boisvert | 3a3cd9f | 1999-03-28 12:42:52 +0000 | [diff] [blame] | 2806 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2807 | return SendMessageA( hwnd, WM_CLOSE, 0, 0 ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2808 | |
| 2809 | case SC_VSCROLL: |
| 2810 | case SC_HSCROLL: |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2811 | NC_TrackScrollBar( hwnd, wParam, pt ); |
Alexandre Julliard | dba420a | 1994-02-02 06:48:31 +0000 | [diff] [blame] | 2812 | break; |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2813 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2814 | case SC_MOUSEMENU: |
Alexandre Julliard | 83f52d1 | 2000-09-26 22:20:14 +0000 | [diff] [blame^] | 2815 | MENU_TrackMouseMenuBar( wndPtr, wParam & 0x000F, pt ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2816 | break; |
| 2817 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2818 | case SC_KEYMENU: |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 2819 | MENU_TrackKbdMenuBar( wndPtr , wParam , pt.x ); |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 2820 | break; |
| 2821 | |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2822 | case SC_TASKLIST: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2823 | WinExec( "taskman.exe", SW_SHOWNORMAL ); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2824 | break; |
Alexandre Julliard | 3f2abfa | 1994-08-16 15:43:11 +0000 | [diff] [blame] | 2825 | |
| 2826 | case SC_SCREENSAVE: |
| 2827 | if (wParam == SC_ABOUTWINE) |
Alexandre Julliard | 563561e | 2000-01-24 05:46:47 +0000 | [diff] [blame] | 2828 | { |
| 2829 | HMODULE hmodule = LoadLibraryA( "shell32.dll" ); |
| 2830 | if (hmodule) |
| 2831 | { |
| 2832 | FARPROC aboutproc = GetProcAddress( hmodule, "ShellAboutA" ); |
| 2833 | if (aboutproc) aboutproc( hwnd, "Wine", WINE_RELEASE_INFO, 0 ); |
| 2834 | FreeLibrary( hmodule ); |
| 2835 | } |
| 2836 | } |
Uwe Bonnes | 3700777 | 1998-11-01 15:07:24 +0000 | [diff] [blame] | 2837 | else |
| 2838 | if (wParam == SC_PUTMARK) |
Alexandre Julliard | 06c275a | 1999-05-02 14:32:27 +0000 | [diff] [blame] | 2839 | TRACE_(shell)("Mark requested by user\n"); |
Alexandre Julliard | 3f2abfa | 1994-08-16 15:43:11 +0000 | [diff] [blame] | 2840 | break; |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 2841 | |
| 2842 | case SC_HOTKEY: |
| 2843 | case SC_ARRANGE: |
| 2844 | case SC_NEXTWINDOW: |
| 2845 | case SC_PREVWINDOW: |
Dimitrie O. Paun | dd03cc1 | 1999-12-08 03:56:23 +0000 | [diff] [blame] | 2846 | FIXME("unimplemented!\n"); |
Alexandre Julliard | 9ea19e5 | 1997-01-01 17:29:55 +0000 | [diff] [blame] | 2847 | break; |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2848 | } |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 2849 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | 86a8d0f | 1994-01-18 23:04:40 +0000 | [diff] [blame] | 2850 | return 0; |
| 2851 | } |
Pascal Lessard | d814bb6 | 1999-07-31 13:02:02 +0000 | [diff] [blame] | 2852 | |
| 2853 | /************************************************************* |
| 2854 | * NC_DrawGrayButton |
| 2855 | * |
| 2856 | * Stub for the grayed button of the caption |
| 2857 | * |
| 2858 | *************************************************************/ |
| 2859 | |
| 2860 | BOOL NC_DrawGrayButton(HDC hdc, int x, int y) |
| 2861 | { |
| 2862 | HBITMAP hMaskBmp; |
| 2863 | HDC hdcMask = CreateCompatibleDC (0); |
| 2864 | HBRUSH hOldBrush; |
| 2865 | |
| 2866 | hMaskBmp = CreateBitmap (12, 10, 1, 1, lpGrayMask); |
| 2867 | |
| 2868 | if(hMaskBmp == 0) |
| 2869 | return FALSE; |
| 2870 | |
| 2871 | SelectObject (hdcMask, hMaskBmp); |
| 2872 | |
| 2873 | /* Draw the grayed bitmap using the mask */ |
| 2874 | hOldBrush = SelectObject (hdc, RGB(128, 128, 128)); |
| 2875 | BitBlt (hdc, x, y, 12, 10, |
| 2876 | hdcMask, 0, 0, 0xB8074A); |
| 2877 | |
| 2878 | /* Clean up */ |
| 2879 | SelectObject (hdc, hOldBrush); |
| 2880 | DeleteObject(hMaskBmp); |
| 2881 | DeleteDC (hdcMask); |
| 2882 | |
| 2883 | return TRUE; |
| 2884 | } |
Susan Farley | 9ce8382 | 2000-05-23 04:12:23 +0000 | [diff] [blame] | 2885 | |
| 2886 | HICON16 NC_IconForWindow(WND *wndPtr) |
| 2887 | { |
| 2888 | HICON16 hIcon = (HICON) GetClassLongA(wndPtr->hwndSelf, GCL_HICONSM); |
| 2889 | if(!hIcon) hIcon = (HICON) GetClassLongA(wndPtr->hwndSelf, GCL_HICON); |
| 2890 | |
| 2891 | /* If there is no hIcon specified and this is a modal dialog, */ |
| 2892 | /* get the default one. */ |
| 2893 | if (!hIcon && (wndPtr->dwStyle & DS_MODALFRAME)) |
| 2894 | hIcon = LoadImageA(0, MAKEINTRESOURCEA(OIC_WINEICON), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR); |
| 2895 | |
| 2896 | return hIcon; |
| 2897 | } |