| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Property Sheets |
| 3 | * |
| 4 | * Copyright 1998 Francis Beaudet |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 5 | * Copyright 1999 Thuy Nguyen |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 6 | * Copyright 2004 Maxime Bellenge |
| Filip Navara | 99423d4 | 2004-09-14 01:06:44 +0000 | [diff] [blame] | 7 | * Copyright 2004 Filip Navara |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 8 | * |
| Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 9 | * This library is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU Lesser General Public |
| 11 | * License as published by the Free Software Foundation; either |
| 12 | * version 2.1 of the License, or (at your option) any later version. |
| 13 | * |
| 14 | * This library is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * Lesser General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU Lesser General Public |
| 20 | * License along with this library; if not, write to the Free Software |
| Jonathan Ernst | 360a3f9 | 2006-05-18 14:49:52 +0200 | [diff] [blame] | 21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
| Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 22 | * |
| Filip Navara | 99423d4 | 2004-09-14 01:06:44 +0000 | [diff] [blame] | 23 | * This code was audited for completeness against the documented features |
| 24 | * of Comctl32.dll version 6.0 on Sep. 12, 2004, by Filip Navara. |
| 25 | * |
| 26 | * Unless otherwise noted, we believe this code to be complete, as per |
| 27 | * the specification mentioned above. |
| 28 | * If you discover missing features, or bugs, please note them below. |
| 29 | * |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 30 | * TODO: |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 31 | * - Tab order |
| Filip Navara | 99423d4 | 2004-09-14 01:06:44 +0000 | [diff] [blame] | 32 | * - Wizard 97 header resizing |
| 33 | * - Enforcing of minimal wizard size |
| 34 | * - Messages: |
| Filip Navara | 99423d4 | 2004-09-14 01:06:44 +0000 | [diff] [blame] | 35 | * o PSM_INSERTPAGE |
| Filip Navara | 99423d4 | 2004-09-14 01:06:44 +0000 | [diff] [blame] | 36 | * o PSM_RECALCPAGESIZES |
| 37 | * o PSM_SETHEADERSUBTITLE |
| 38 | * o PSM_SETHEADERTITLE |
| Filip Navara | 67c8cb2 | 2004-09-20 19:13:36 +0000 | [diff] [blame] | 39 | * o WM_HELP |
| 40 | * o WM_CONTEXTMENU |
| Filip Navara | 99423d4 | 2004-09-14 01:06:44 +0000 | [diff] [blame] | 41 | * - Notifications: |
| 42 | * o PSN_GETOBJECT |
| 43 | * o PSN_QUERYINITIALFOCUS |
| 44 | * o PSN_TRANSLATEACCELERATOR |
| 45 | * - Styles: |
| Filip Navara | 99423d4 | 2004-09-14 01:06:44 +0000 | [diff] [blame] | 46 | * o PSH_RTLREADING |
| Filip Navara | 99423d4 | 2004-09-14 01:06:44 +0000 | [diff] [blame] | 47 | * o PSH_STRETCHWATERMARK |
| 48 | * o PSH_USEPAGELANG |
| Filip Navara | 99423d4 | 2004-09-14 01:06:44 +0000 | [diff] [blame] | 49 | * o PSH_USEPSTARTPAGE |
| 50 | * - Page styles: |
| 51 | * o PSP_USEFUSIONCONTEXT |
| 52 | * o PSP_USEREFPARENT |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 53 | */ |
| 54 | |
| Alexandre Julliard | e37c6e1 | 2003-09-05 23:08:26 +0000 | [diff] [blame] | 55 | #include <stdarg.h> |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 56 | #include <string.h> |
| Michael Stefaniuc | f3d1893 | 2002-10-23 20:19:22 +0000 | [diff] [blame] | 57 | |
| Dimitrie O. Paun | 297f3d8 | 2003-01-07 20:36:20 +0000 | [diff] [blame] | 58 | #define NONAMELESSUNION |
| 59 | #define NONAMELESSSTRUCT |
| Alexandre Julliard | e37c6e1 | 2003-09-05 23:08:26 +0000 | [diff] [blame] | 60 | #include "windef.h" |
| Marcus Meissner | 3480e4a | 1999-03-16 10:53:11 +0000 | [diff] [blame] | 61 | #include "winbase.h" |
| Alexandre Julliard | e37c6e1 | 2003-09-05 23:08:26 +0000 | [diff] [blame] | 62 | #include "wingdi.h" |
| 63 | #include "winuser.h" |
| 64 | #include "winnls.h" |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 65 | #include "commctrl.h" |
| Alexandre Julliard | 0666444 | 1999-02-11 16:22:12 +0000 | [diff] [blame] | 66 | #include "prsht.h" |
| Eric Kohl | 654ee2c | 1999-05-22 10:52:31 +0000 | [diff] [blame] | 67 | #include "comctl32.h" |
| Frank Richter | 5c3f6bc | 2005-07-18 10:31:06 +0000 | [diff] [blame] | 68 | #include "uxtheme.h" |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 69 | |
| Michael Stefaniuc | f3d1893 | 2002-10-23 20:19:22 +0000 | [diff] [blame] | 70 | #include "wine/debug.h" |
| 71 | #include "wine/unicode.h" |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 72 | |
| 73 | /****************************************************************************** |
| 74 | * Data structures |
| 75 | */ |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 76 | #include "pshpack2.h" |
| 77 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 78 | typedef struct |
| 79 | { |
| 80 | WORD dlgVer; |
| 81 | WORD signature; |
| 82 | DWORD helpID; |
| 83 | DWORD exStyle; |
| 84 | DWORD style; |
| 85 | } MyDLGTEMPLATEEX; |
| 86 | |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 87 | typedef struct |
| 88 | { |
| 89 | DWORD helpid; |
| 90 | DWORD exStyle; |
| 91 | DWORD style; |
| 92 | short x; |
| 93 | short y; |
| Andreas Mohr | 1e6258f | 2002-11-25 02:45:19 +0000 | [diff] [blame] | 94 | short cx; |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 95 | short cy; |
| 96 | DWORD id; |
| 97 | } MyDLGITEMTEMPLATEEX; |
| 98 | #include "poppack.h" |
| 99 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 100 | typedef struct tagPropPageInfo |
| 101 | { |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 102 | HPROPSHEETPAGE hpage; /* to keep track of pages not passed to PropertySheet */ |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 103 | HWND hwndPage; |
| 104 | BOOL isDirty; |
| 105 | LPCWSTR pszText; |
| 106 | BOOL hasHelp; |
| 107 | BOOL useCallback; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 108 | BOOL hasIcon; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 109 | } PropPageInfo; |
| 110 | |
| 111 | typedef struct tagPropSheetInfo |
| 112 | { |
| Slava Monich | 5b0ace1 | 2000-07-08 12:48:13 +0000 | [diff] [blame] | 113 | HWND hwnd; |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 114 | PROPSHEETHEADERW ppshheader; |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 115 | BOOL unicode; |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 116 | LPWSTR strPropertiesFor; |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 117 | int nPages; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 118 | int active_page; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 119 | BOOL isModeless; |
| 120 | BOOL hasHelp; |
| 121 | BOOL hasApply; |
| Thomas Weidenmueller | 6ea26b5 | 2005-07-15 09:59:04 +0000 | [diff] [blame] | 122 | BOOL hasFinish; |
| Lei Zhang | e3b80a0 | 2007-06-26 00:22:19 -0700 | [diff] [blame] | 123 | BOOL usePropPage; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 124 | BOOL useCallback; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 125 | BOOL activeValid; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 126 | PropPageInfo* proppage; |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 127 | HFONT hFont; |
| 128 | HFONT hFontBold; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 129 | int width; |
| 130 | int height; |
| Thuy Nguyen | 85411af | 1999-08-14 15:51:10 +0000 | [diff] [blame] | 131 | HIMAGELIST hImageList; |
| Huw Davies | 2e301ce | 2005-06-15 19:12:57 +0000 | [diff] [blame] | 132 | BOOL ended; |
| Huw Davies | 6d0b86a | 2006-11-02 12:21:53 +0000 | [diff] [blame] | 133 | INT result; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 134 | } PropSheetInfo; |
| 135 | |
| 136 | typedef struct |
| 137 | { |
| 138 | int x; |
| 139 | int y; |
| 140 | } PADDING_INFO; |
| 141 | |
| 142 | /****************************************************************************** |
| 143 | * Defines and global variables |
| 144 | */ |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 145 | |
| Dmitry Timoshkov | 154e54e | 2006-05-05 22:59:20 +0900 | [diff] [blame] | 146 | static const WCHAR PropSheetInfoStr[] = |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 147 | {'P','r','o','p','e','r','t','y','S','h','e','e','t','I','n','f','o',0 }; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 148 | |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 149 | #define PSP_INTERNAL_UNICODE 0x80000000 |
| 150 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 151 | #define MAX_CAPTION_LENGTH 255 |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 152 | #define MAX_TABTEXT_LENGTH 255 |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 153 | #define MAX_BUTTONTEXT_LENGTH 64 |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 154 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 155 | #define INTRNL_ANY_WIZARD (PSH_WIZARD | PSH_WIZARD97_OLD | PSH_WIZARD97_NEW | PSH_WIZARD_LITE) |
| 156 | |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 157 | /* Wizard metrics specified in DLUs */ |
| 158 | #define WIZARD_PADDING 7 |
| 159 | #define WIZARD_HEADER_HEIGHT 36 |
| 160 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 161 | /****************************************************************************** |
| 162 | * Prototypes |
| 163 | */ |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 164 | static PADDING_INFO PROPSHEET_GetPaddingInfo(HWND hwndDlg); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 165 | static void PROPSHEET_SetTitleW(HWND hwndDlg, DWORD dwStyle, LPCWSTR lpszText); |
| Pierre Mageau | 89ab9f0 | 1999-10-13 15:54:08 +0000 | [diff] [blame] | 166 | static BOOL PROPSHEET_CanSetCurSel(HWND hwndDlg); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 167 | static BOOL PROPSHEET_SetCurSel(HWND hwndDlg, |
| 168 | int index, |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 169 | int skipdir, |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 170 | HPROPSHEETPAGE hpage); |
| Andrew Talbot | abf4d3b | 2007-03-31 17:43:35 +0100 | [diff] [blame] | 171 | static int PROPSHEET_GetPageIndex(HPROPSHEETPAGE hpage, const PropSheetInfo* psInfo); |
| Andreas Mohr | d511177 | 2000-08-26 20:28:02 +0000 | [diff] [blame] | 172 | static PADDING_INFO PROPSHEET_GetPaddingInfoWizard(HWND hwndDlg, const PropSheetInfo* psInfo); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 173 | static BOOL PROPSHEET_DoCommand(HWND hwnd, WORD wID); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 174 | |
| Dmitry Timoshkov | 154e54e | 2006-05-05 22:59:20 +0900 | [diff] [blame] | 175 | static INT_PTR CALLBACK |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 176 | PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); |
| 177 | |
| Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 178 | WINE_DEFAULT_DEBUG_CHANNEL(propsheet); |
| Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 179 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 180 | #define add_flag(a) if (dwFlags & a) {strcat(string, #a );strcat(string," ");} |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 181 | /****************************************************************************** |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 182 | * PROPSHEET_UnImplementedFlags |
| 183 | * |
| 184 | * Document use of flags we don't implement yet. |
| 185 | */ |
| 186 | static VOID PROPSHEET_UnImplementedFlags(DWORD dwFlags) |
| 187 | { |
| 188 | CHAR string[256]; |
| 189 | |
| 190 | string[0] = '\0'; |
| 191 | |
| 192 | /* |
| 193 | * unhandled header flags: |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 194 | * PSH_RTLREADING 0x00000800 |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 195 | * PSH_STRETCHWATERMARK 0x00040000 |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 196 | * PSH_USEPAGELANG 0x00200000 |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 197 | */ |
| 198 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 199 | add_flag(PSH_RTLREADING); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 200 | add_flag(PSH_STRETCHWATERMARK); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 201 | add_flag(PSH_USEPAGELANG); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 202 | if (string[0] != '\0') |
| 203 | FIXME("%s\n", string); |
| 204 | } |
| Dimitrie O. Paun | 00df897 | 2002-04-02 19:16:08 +0000 | [diff] [blame] | 205 | #undef add_flag |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 206 | |
| 207 | /****************************************************************************** |
| Guy L. Albertelli | f9731a4 | 2002-06-13 19:10:28 +0000 | [diff] [blame] | 208 | * PROPSHEET_GetPageRect |
| 209 | * |
| 210 | * Retrieve rect from tab control and map into the dialog for SetWindowPos |
| 211 | */ |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 212 | static void PROPSHEET_GetPageRect(const PropSheetInfo * psInfo, HWND hwndDlg, |
| 213 | RECT *rc, LPCPROPSHEETPAGEW ppshpage) |
| Guy L. Albertelli | f9731a4 | 2002-06-13 19:10:28 +0000 | [diff] [blame] | 214 | { |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 215 | if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) { |
| 216 | HWND hwndChild; |
| 217 | RECT r; |
| Guy L. Albertelli | f9731a4 | 2002-06-13 19:10:28 +0000 | [diff] [blame] | 218 | |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 219 | if (((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) && |
| 220 | (psInfo->ppshheader.dwFlags & PSH_HEADER) && |
| 221 | !(ppshpage->dwFlags & PSP_HIDEHEADER)) || |
| 222 | (psInfo->ppshheader.dwFlags & PSH_WIZARD)) |
| 223 | { |
| 224 | rc->left = rc->top = WIZARD_PADDING; |
| 225 | } |
| 226 | else |
| 227 | { |
| 228 | rc->left = rc->top = 0; |
| 229 | } |
| 230 | rc->right = psInfo->width - rc->left; |
| 231 | rc->bottom = psInfo->height - rc->top; |
| 232 | MapDialogRect(hwndDlg, rc); |
| 233 | |
| 234 | if ((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) && |
| 235 | (psInfo->ppshheader.dwFlags & PSH_HEADER) && |
| 236 | !(ppshpage->dwFlags & PSP_HIDEHEADER)) |
| 237 | { |
| 238 | hwndChild = GetDlgItem(hwndDlg, IDC_SUNKEN_LINEHEADER); |
| 239 | GetClientRect(hwndChild, &r); |
| 240 | MapWindowPoints(hwndChild, hwndDlg, (LPPOINT) &r, 2); |
| 241 | rc->top += r.bottom + 1; |
| 242 | } |
| 243 | } else { |
| 244 | HWND hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL); |
| 245 | GetClientRect(hwndTabCtrl, rc); |
| 246 | SendMessageW(hwndTabCtrl, TCM_ADJUSTRECT, FALSE, (LPARAM)rc); |
| 247 | MapWindowPoints(hwndTabCtrl, hwndDlg, (LPPOINT)rc, 2); |
| 248 | } |
| Guy L. Albertelli | f9731a4 | 2002-06-13 19:10:28 +0000 | [diff] [blame] | 249 | } |
| 250 | |
| 251 | /****************************************************************************** |
| Sander van Leeuwen | d919c27 | 2002-05-14 18:38:07 +0000 | [diff] [blame] | 252 | * PROPSHEET_FindPageByResId |
| 253 | * |
| 254 | * Find page index corresponding to page resource id. |
| 255 | */ |
| Andrew Talbot | abf4d3b | 2007-03-31 17:43:35 +0100 | [diff] [blame] | 256 | static INT PROPSHEET_FindPageByResId(const PropSheetInfo * psInfo, LRESULT resId) |
| Sander van Leeuwen | d919c27 | 2002-05-14 18:38:07 +0000 | [diff] [blame] | 257 | { |
| 258 | INT i; |
| 259 | |
| 260 | for (i = 0; i < psInfo->nPages; i++) |
| 261 | { |
| 262 | LPCPROPSHEETPAGEA lppsp = (LPCPROPSHEETPAGEA)psInfo->proppage[i].hpage; |
| 263 | |
| 264 | /* Fixme: if resource ID is a string shall we use strcmp ??? */ |
| 265 | if (lppsp->u.pszTemplate == (LPVOID)resId) |
| 266 | break; |
| 267 | } |
| 268 | |
| 269 | return i; |
| 270 | } |
| 271 | |
| 272 | /****************************************************************************** |
| Guy L. Albertelli | 7f9baba | 2002-05-14 03:48:48 +0000 | [diff] [blame] | 273 | * PROPSHEET_AtoW |
| 274 | * |
| 275 | * Convert ASCII to Unicode since all data is saved as Unicode. |
| 276 | */ |
| 277 | static void PROPSHEET_AtoW(LPCWSTR *tostr, LPCSTR frstr) |
| 278 | { |
| 279 | INT len; |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 280 | WCHAR *to; |
| Guy L. Albertelli | 7f9baba | 2002-05-14 03:48:48 +0000 | [diff] [blame] | 281 | |
| 282 | TRACE("<%s>\n", frstr); |
| 283 | len = MultiByteToWideChar(CP_ACP, 0, frstr, -1, 0, 0); |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 284 | to = Alloc(len * sizeof(WCHAR)); |
| 285 | MultiByteToWideChar(CP_ACP, 0, frstr, -1, to, len); |
| 286 | *tostr = to; |
| Guy L. Albertelli | 7f9baba | 2002-05-14 03:48:48 +0000 | [diff] [blame] | 287 | } |
| 288 | |
| 289 | /****************************************************************************** |
| Lei Zhang | f4dd14a | 2007-06-26 00:14:03 -0700 | [diff] [blame] | 290 | * PROPSHEET_CollectSheetInfoCommon |
| 291 | * |
| 292 | * Common code for PROPSHEET_CollectSheetInfoA/W |
| 293 | */ |
| 294 | static void PROPSHEET_CollectSheetInfoCommon(PropSheetInfo * psInfo, DWORD dwFlags) |
| 295 | { |
| 296 | PROPSHEET_UnImplementedFlags(dwFlags); |
| 297 | |
| 298 | psInfo->hasHelp = dwFlags & PSH_HASHELP; |
| 299 | psInfo->hasApply = !(dwFlags & PSH_NOAPPLYNOW); |
| 300 | psInfo->hasFinish = dwFlags & PSH_WIZARDHASFINISH; |
| 301 | psInfo->isModeless = dwFlags & PSH_MODELESS; |
| Lei Zhang | e3b80a0 | 2007-06-26 00:22:19 -0700 | [diff] [blame] | 302 | psInfo->usePropPage = dwFlags & PSH_PROPSHEETPAGE; |
| Lei Zhang | f4dd14a | 2007-06-26 00:14:03 -0700 | [diff] [blame] | 303 | if (psInfo->active_page < 0 || psInfo->active_page >= psInfo->nPages) |
| 304 | psInfo->active_page = 0; |
| 305 | |
| 306 | psInfo->result = 0; |
| 307 | psInfo->hImageList = 0; |
| 308 | psInfo->activeValid = FALSE; |
| 309 | } |
| 310 | |
| 311 | /****************************************************************************** |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 312 | * PROPSHEET_CollectSheetInfoA |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 313 | * |
| 314 | * Collect relevant data. |
| 315 | */ |
| Lei Zhang | f4dd14a | 2007-06-26 00:14:03 -0700 | [diff] [blame] | 316 | static void PROPSHEET_CollectSheetInfoA(LPCPROPSHEETHEADERA lppsh, |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 317 | PropSheetInfo * psInfo) |
| 318 | { |
| Slava Monich | 5b0ace1 | 2000-07-08 12:48:13 +0000 | [diff] [blame] | 319 | DWORD dwSize = min(lppsh->dwSize,sizeof(PROPSHEETHEADERA)); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 320 | DWORD dwFlags = lppsh->dwFlags; |
| Eric Kohl | d68d501 | 1999-01-24 19:14:58 +0000 | [diff] [blame] | 321 | |
| Lionel Ulmer | 5e36ae5 | 2003-01-03 03:06:42 +0000 | [diff] [blame] | 322 | psInfo->useCallback = (dwFlags & PSH_USECALLBACK )&& (lppsh->pfnCallback); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 323 | |
| Slava Monich | 5b0ace1 | 2000-07-08 12:48:13 +0000 | [diff] [blame] | 324 | memcpy(&psInfo->ppshheader,lppsh,dwSize); |
| Michael Ploujnikov | 1c16d83 | 2006-10-13 09:34:21 -0400 | [diff] [blame] | 325 | TRACE("\n** PROPSHEETHEADER **\ndwSize\t\t%d\ndwFlags\t\t%08x\nhwndParent\t%p\nhInstance\t%p\npszCaption\t'%s'\nnPages\t\t%d\npfnCallback\t%p\n", |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 326 | lppsh->dwSize, lppsh->dwFlags, lppsh->hwndParent, lppsh->hInstance, |
| 327 | debugstr_a(lppsh->pszCaption), lppsh->nPages, lppsh->pfnCallback); |
| 328 | |
| Pavel Roskin | 5b7f03c | 2003-10-02 04:26:53 +0000 | [diff] [blame] | 329 | if (lppsh->dwFlags & INTRNL_ANY_WIZARD) |
| 330 | psInfo->ppshheader.pszCaption = NULL; |
| 331 | else |
| Alexandre Julliard | 5f728ca | 2001-07-24 21:45:22 +0000 | [diff] [blame] | 332 | { |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 333 | if (!IS_INTRESOURCE(lppsh->pszCaption)) |
| Pavel Roskin | 5b7f03c | 2003-10-02 04:26:53 +0000 | [diff] [blame] | 334 | { |
| Filip Navara | c846f88 | 2004-07-21 21:17:59 +0000 | [diff] [blame] | 335 | int len = MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, NULL, 0); |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 336 | WCHAR *caption = Alloc( len*sizeof (WCHAR) ); |
| 337 | |
| 338 | MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, caption, len); |
| 339 | psInfo->ppshheader.pszCaption = caption; |
| Pavel Roskin | 5b7f03c | 2003-10-02 04:26:53 +0000 | [diff] [blame] | 340 | } |
| Alexandre Julliard | 5f728ca | 2001-07-24 21:45:22 +0000 | [diff] [blame] | 341 | } |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 342 | psInfo->nPages = lppsh->nPages; |
| Alexandre Julliard | 638f169 | 1999-01-17 16:32:32 +0000 | [diff] [blame] | 343 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 344 | if (dwFlags & PSH_USEPSTARTPAGE) |
| 345 | { |
| Francois Gouget | 6b6ed72 | 2004-01-27 00:01:43 +0000 | [diff] [blame] | 346 | TRACE("PSH_USEPSTARTPAGE is on\n"); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 347 | psInfo->active_page = 0; |
| 348 | } |
| 349 | else |
| 350 | psInfo->active_page = lppsh->u2.nStartPage; |
| Alexandre Julliard | 638f169 | 1999-01-17 16:32:32 +0000 | [diff] [blame] | 351 | |
| Lei Zhang | f4dd14a | 2007-06-26 00:14:03 -0700 | [diff] [blame] | 352 | PROPSHEET_CollectSheetInfoCommon(psInfo, dwFlags); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 353 | } |
| Alexandre Julliard | 638f169 | 1999-01-17 16:32:32 +0000 | [diff] [blame] | 354 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 355 | /****************************************************************************** |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 356 | * PROPSHEET_CollectSheetInfoW |
| 357 | * |
| 358 | * Collect relevant data. |
| 359 | */ |
| Lei Zhang | f4dd14a | 2007-06-26 00:14:03 -0700 | [diff] [blame] | 360 | static void PROPSHEET_CollectSheetInfoW(LPCPROPSHEETHEADERW lppsh, |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 361 | PropSheetInfo * psInfo) |
| 362 | { |
| 363 | DWORD dwSize = min(lppsh->dwSize,sizeof(PROPSHEETHEADERW)); |
| 364 | DWORD dwFlags = lppsh->dwFlags; |
| 365 | |
| Lionel Ulmer | 5e36ae5 | 2003-01-03 03:06:42 +0000 | [diff] [blame] | 366 | psInfo->useCallback = (dwFlags & PSH_USECALLBACK) && (lppsh->pfnCallback); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 367 | |
| 368 | memcpy(&psInfo->ppshheader,lppsh,dwSize); |
| Francois Gouget | aab5e58 | 2007-01-18 11:40:15 +0100 | [diff] [blame] | 369 | TRACE("\n** PROPSHEETHEADER **\ndwSize\t\t%d\ndwFlags\t\t%08x\nhwndParent\t%p\nhInstance\t%p\npszCaption\t%s\nnPages\t\t%d\npfnCallback\t%p\n", |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 370 | lppsh->dwSize, lppsh->dwFlags, lppsh->hwndParent, lppsh->hInstance, debugstr_w(lppsh->pszCaption), lppsh->nPages, lppsh->pfnCallback); |
| 371 | |
| Pavel Roskin | 5b7f03c | 2003-10-02 04:26:53 +0000 | [diff] [blame] | 372 | if (lppsh->dwFlags & INTRNL_ANY_WIZARD) |
| 373 | psInfo->ppshheader.pszCaption = NULL; |
| 374 | else |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 375 | { |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 376 | if (!IS_INTRESOURCE(lppsh->pszCaption)) |
| Pavel Roskin | 5b7f03c | 2003-10-02 04:26:53 +0000 | [diff] [blame] | 377 | { |
| 378 | int len = strlenW(lppsh->pszCaption); |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 379 | WCHAR *caption = Alloc( (len+1)*sizeof(WCHAR) ); |
| 380 | |
| 381 | psInfo->ppshheader.pszCaption = strcpyW( caption, lppsh->pszCaption ); |
| Pavel Roskin | 5b7f03c | 2003-10-02 04:26:53 +0000 | [diff] [blame] | 382 | } |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 383 | } |
| 384 | psInfo->nPages = lppsh->nPages; |
| 385 | |
| 386 | if (dwFlags & PSH_USEPSTARTPAGE) |
| 387 | { |
| Francois Gouget | 6b6ed72 | 2004-01-27 00:01:43 +0000 | [diff] [blame] | 388 | TRACE("PSH_USEPSTARTPAGE is on\n"); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 389 | psInfo->active_page = 0; |
| 390 | } |
| 391 | else |
| 392 | psInfo->active_page = lppsh->u2.nStartPage; |
| 393 | |
| Lei Zhang | f4dd14a | 2007-06-26 00:14:03 -0700 | [diff] [blame] | 394 | PROPSHEET_CollectSheetInfoCommon(psInfo, dwFlags); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 395 | } |
| 396 | |
| 397 | /****************************************************************************** |
| Guy L. Albertelli | 7f9baba | 2002-05-14 03:48:48 +0000 | [diff] [blame] | 398 | * PROPSHEET_CollectPageInfo |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 399 | * |
| 400 | * Collect property sheet data. |
| 401 | * With code taken from DIALOG_ParseTemplate32. |
| 402 | */ |
| Dmitry Timoshkov | 154e54e | 2006-05-05 22:59:20 +0900 | [diff] [blame] | 403 | static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp, |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 404 | PropSheetInfo * psInfo, |
| Aric Stewart | 7d947c1 | 2007-09-13 07:53:45 -0500 | [diff] [blame] | 405 | int index, BOOL resize) |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 406 | { |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 407 | const DLGTEMPLATE* pTemplate; |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 408 | const WORD* p; |
| 409 | DWORD dwFlags; |
| 410 | int width, height; |
| 411 | |
| Thomas Weidenmueller | c9b7442 | 2005-08-27 09:59:09 +0000 | [diff] [blame] | 412 | if (!lppsp) |
| 413 | return FALSE; |
| 414 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 415 | TRACE("\n"); |
| 416 | psInfo->proppage[index].hpage = (HPROPSHEETPAGE)lppsp; |
| 417 | psInfo->proppage[index].hwndPage = 0; |
| 418 | psInfo->proppage[index].isDirty = FALSE; |
| 419 | |
| 420 | /* |
| 421 | * Process property page flags. |
| 422 | */ |
| 423 | dwFlags = lppsp->dwFlags; |
| 424 | psInfo->proppage[index].useCallback = (dwFlags & PSP_USECALLBACK) && (lppsp->pfnCallback); |
| 425 | psInfo->proppage[index].hasHelp = dwFlags & PSP_HASHELP; |
| 426 | psInfo->proppage[index].hasIcon = dwFlags & (PSP_USEHICON | PSP_USEICONID); |
| 427 | |
| 428 | /* as soon as we have a page with the help flag, set the sheet flag on */ |
| 429 | if (psInfo->proppage[index].hasHelp) |
| 430 | psInfo->hasHelp = TRUE; |
| 431 | |
| 432 | /* |
| 433 | * Process page template. |
| 434 | */ |
| 435 | if (dwFlags & PSP_DLGINDIRECT) |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 436 | pTemplate = lppsp->u.pResource; |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 437 | else if(dwFlags & PSP_INTERNAL_UNICODE ) |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 438 | { |
| 439 | HRSRC hResource = FindResourceW(lppsp->hInstance, |
| 440 | lppsp->u.pszTemplate, |
| Alexandre Julliard | cf52644 | 2003-09-10 03:56:47 +0000 | [diff] [blame] | 441 | (LPWSTR)RT_DIALOG); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 442 | HGLOBAL hTemplate = LoadResource(lppsp->hInstance, |
| 443 | hResource); |
| Michael Stefaniuc | 6060ca9 | 2008-10-23 23:52:45 +0200 | [diff] [blame] | 444 | pTemplate = LockResource(hTemplate); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 445 | } |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 446 | else |
| 447 | { |
| 448 | HRSRC hResource = FindResourceA(lppsp->hInstance, |
| Andrew Talbot | cc90540 | 2006-08-30 19:40:52 +0100 | [diff] [blame] | 449 | (LPCSTR)lppsp->u.pszTemplate, |
| Alexandre Julliard | cf52644 | 2003-09-10 03:56:47 +0000 | [diff] [blame] | 450 | (LPSTR)RT_DIALOG); |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 451 | HGLOBAL hTemplate = LoadResource(lppsp->hInstance, |
| 452 | hResource); |
| Michael Stefaniuc | 6060ca9 | 2008-10-23 23:52:45 +0200 | [diff] [blame] | 453 | pTemplate = LockResource(hTemplate); |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 454 | } |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 455 | |
| 456 | /* |
| 457 | * Extract the size of the page and the caption. |
| 458 | */ |
| 459 | if (!pTemplate) |
| 460 | return FALSE; |
| 461 | |
| 462 | p = (const WORD *)pTemplate; |
| 463 | |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 464 | if (((const MyDLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF) |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 465 | { |
| Andreas Mohr | 1e6258f | 2002-11-25 02:45:19 +0000 | [diff] [blame] | 466 | /* DLGTEMPLATEEX (not defined in any std. header file) */ |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 467 | |
| 468 | p++; /* dlgVer */ |
| 469 | p++; /* signature */ |
| 470 | p += 2; /* help ID */ |
| 471 | p += 2; /* ext style */ |
| 472 | p += 2; /* style */ |
| 473 | } |
| 474 | else |
| 475 | { |
| Andreas Mohr | 1e6258f | 2002-11-25 02:45:19 +0000 | [diff] [blame] | 476 | /* DLGTEMPLATE */ |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 477 | |
| 478 | p += 2; /* style */ |
| 479 | p += 2; /* ext style */ |
| 480 | } |
| 481 | |
| 482 | p++; /* nb items */ |
| 483 | p++; /* x */ |
| 484 | p++; /* y */ |
| 485 | width = (WORD)*p; p++; |
| 486 | height = (WORD)*p; p++; |
| 487 | |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 488 | /* Special calculation for interior wizard pages so the largest page is |
| 489 | * calculated correctly. We need to add all the padding and space occupied |
| 490 | * by the header so the width and height sums up to the whole wizard client |
| 491 | * area. */ |
| 492 | if ((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) && |
| 493 | (psInfo->ppshheader.dwFlags & PSH_HEADER) && |
| 494 | !(dwFlags & PSP_HIDEHEADER)) |
| 495 | { |
| 496 | height += 2 * WIZARD_PADDING + WIZARD_HEADER_HEIGHT; |
| 497 | width += 2 * WIZARD_PADDING; |
| 498 | } |
| 499 | if (psInfo->ppshheader.dwFlags & PSH_WIZARD) |
| 500 | { |
| 501 | height += 2 * WIZARD_PADDING; |
| 502 | width += 2 * WIZARD_PADDING; |
| 503 | } |
| 504 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 505 | /* remember the largest width and height */ |
| Aric Stewart | 7d947c1 | 2007-09-13 07:53:45 -0500 | [diff] [blame] | 506 | if (resize) |
| 507 | { |
| 508 | if (width > psInfo->width) |
| 509 | psInfo->width = width; |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 510 | |
| Aric Stewart | 7d947c1 | 2007-09-13 07:53:45 -0500 | [diff] [blame] | 511 | if (height > psInfo->height) |
| 512 | psInfo->height = height; |
| 513 | } |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 514 | |
| 515 | /* menu */ |
| 516 | switch ((WORD)*p) |
| 517 | { |
| 518 | case 0x0000: |
| 519 | p++; |
| 520 | break; |
| 521 | case 0xffff: |
| 522 | p += 2; |
| 523 | break; |
| 524 | default: |
| Andrew Talbot | 863ffb7 | 2007-12-31 22:16:08 +0000 | [diff] [blame] | 525 | p += lstrlenW( p ) + 1; |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 526 | break; |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 527 | } |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 528 | |
| 529 | /* class */ |
| 530 | switch ((WORD)*p) |
| 531 | { |
| 532 | case 0x0000: |
| 533 | p++; |
| 534 | break; |
| 535 | case 0xffff: |
| 536 | p += 2; |
| 537 | break; |
| 538 | default: |
| Andrew Talbot | 863ffb7 | 2007-12-31 22:16:08 +0000 | [diff] [blame] | 539 | p += lstrlenW( p ) + 1; |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 540 | break; |
| 541 | } |
| 542 | |
| 543 | /* Extract the caption */ |
| Andrew Talbot | 863ffb7 | 2007-12-31 22:16:08 +0000 | [diff] [blame] | 544 | psInfo->proppage[index].pszText = p; |
| 545 | TRACE("Tab %d %s\n",index,debugstr_w( p )); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 546 | |
| 547 | if (dwFlags & PSP_USETITLE) |
| 548 | { |
| 549 | WCHAR szTitle[256]; |
| 550 | const WCHAR *pTitle; |
| Francois Gouget | ebf0eb3 | 2004-04-20 00:34:52 +0000 | [diff] [blame] | 551 | static const WCHAR pszNull[] = { '(','n','u','l','l',')',0 }; |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 552 | WCHAR *text; |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 553 | int len; |
| 554 | |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 555 | if (IS_INTRESOURCE( lppsp->pszTitle )) |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 556 | { |
| Rob Shearman | fd291ed | 2008-02-15 10:05:36 +0000 | [diff] [blame] | 557 | if (!LoadStringW( lppsp->hInstance, (DWORD_PTR)lppsp->pszTitle,szTitle,sizeof(szTitle)/sizeof(szTitle[0]) )) |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 558 | { |
| 559 | pTitle = pszNull; |
| 560 | FIXME("Could not load resource #%04x?\n",LOWORD(lppsp->pszTitle)); |
| 561 | } |
| 562 | else |
| 563 | pTitle = szTitle; |
| 564 | } |
| 565 | else |
| 566 | pTitle = lppsp->pszTitle; |
| 567 | |
| Maciek Kaliszewski | 2ad82e1 | 2002-05-28 22:41:19 +0000 | [diff] [blame] | 568 | len = strlenW(pTitle); |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 569 | text = Alloc( (len+1)*sizeof (WCHAR) ); |
| 570 | psInfo->proppage[index].pszText = strcpyW( text, pTitle); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 571 | } |
| 572 | |
| 573 | /* |
| 574 | * Build the image list for icons |
| 575 | */ |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 576 | if ((dwFlags & PSP_USEHICON) || (dwFlags & PSP_USEICONID)) |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 577 | { |
| 578 | HICON hIcon; |
| 579 | int icon_cx = GetSystemMetrics(SM_CXSMICON); |
| 580 | int icon_cy = GetSystemMetrics(SM_CYSMICON); |
| 581 | |
| 582 | if (dwFlags & PSP_USEICONID) |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 583 | hIcon = LoadImageW(lppsp->hInstance, lppsp->u2.pszIcon, IMAGE_ICON, |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 584 | icon_cx, icon_cy, LR_DEFAULTCOLOR); |
| 585 | else |
| 586 | hIcon = lppsp->u2.hIcon; |
| 587 | |
| 588 | if ( hIcon ) |
| 589 | { |
| 590 | if (psInfo->hImageList == 0 ) |
| 591 | psInfo->hImageList = ImageList_Create(icon_cx, icon_cy, ILC_COLOR, 1, 1); |
| 592 | |
| 593 | ImageList_AddIcon(psInfo->hImageList, hIcon); |
| 594 | } |
| 595 | |
| 596 | } |
| 597 | |
| 598 | return TRUE; |
| 599 | } |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 600 | |
| 601 | /****************************************************************************** |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 602 | * PROPSHEET_CreateDialog |
| 603 | * |
| 604 | * Creates the actual property sheet. |
| 605 | */ |
| James Hawkins | cd073a6 | 2006-10-11 11:18:02 -0700 | [diff] [blame] | 606 | static INT_PTR PROPSHEET_CreateDialog(PropSheetInfo* psInfo) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 607 | { |
| 608 | LRESULT ret; |
| 609 | LPCVOID template; |
| Thuy Nguyen | 143fc51 | 1999-09-04 11:09:20 +0000 | [diff] [blame] | 610 | LPVOID temp = 0; |
| Bertho Stultiens | d1895a7 | 1999-04-25 18:31:35 +0000 | [diff] [blame] | 611 | HRSRC hRes; |
| Thuy Nguyen | 143fc51 | 1999-09-04 11:09:20 +0000 | [diff] [blame] | 612 | DWORD resSize; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 613 | WORD resID = IDD_PROPSHEET; |
| 614 | |
| Detlef Riekenberg | 51db7f0 | 2010-10-05 00:29:49 +0200 | [diff] [blame] | 615 | TRACE("(%p)\n", psInfo); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 616 | if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 617 | resID = IDD_WIZARD; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 618 | |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 619 | if( psInfo->unicode ) |
| 620 | { |
| 621 | if(!(hRes = FindResourceW(COMCTL32_hModule, |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 622 | MAKEINTRESOURCEW(resID), |
| Alexandre Julliard | cf52644 | 2003-09-10 03:56:47 +0000 | [diff] [blame] | 623 | (LPWSTR)RT_DIALOG))) |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 624 | return -1; |
| 625 | } |
| 626 | else |
| 627 | { |
| 628 | if(!(hRes = FindResourceA(COMCTL32_hModule, |
| 629 | MAKEINTRESOURCEA(resID), |
| Alexandre Julliard | cf52644 | 2003-09-10 03:56:47 +0000 | [diff] [blame] | 630 | (LPSTR)RT_DIALOG))) |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 631 | return -1; |
| 632 | } |
| Bertho Stultiens | d1895a7 | 1999-04-25 18:31:35 +0000 | [diff] [blame] | 633 | |
| Andrew Talbot | 863ffb7 | 2007-12-31 22:16:08 +0000 | [diff] [blame] | 634 | if(!(template = LoadResource(COMCTL32_hModule, hRes))) |
| Adam Gundy | 1af319d | 2003-03-07 20:29:58 +0000 | [diff] [blame] | 635 | return -1; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 636 | |
| Thuy Nguyen | 143fc51 | 1999-09-04 11:09:20 +0000 | [diff] [blame] | 637 | /* |
| 638 | * Make a copy of the dialog template. |
| 639 | */ |
| 640 | resSize = SizeofResource(COMCTL32_hModule, hRes); |
| 641 | |
| Dimitrie O. Paun | 7de279a | 2003-09-22 21:32:33 +0000 | [diff] [blame] | 642 | temp = Alloc(resSize); |
| Thuy Nguyen | 143fc51 | 1999-09-04 11:09:20 +0000 | [diff] [blame] | 643 | |
| 644 | if (!temp) |
| Adam Gundy | 1af319d | 2003-03-07 20:29:58 +0000 | [diff] [blame] | 645 | return -1; |
| Thuy Nguyen | 143fc51 | 1999-09-04 11:09:20 +0000 | [diff] [blame] | 646 | |
| 647 | memcpy(temp, template, resSize); |
| 648 | |
| Filip Navara | 67c8cb2 | 2004-09-20 19:13:36 +0000 | [diff] [blame] | 649 | if (psInfo->ppshheader.dwFlags & PSH_NOCONTEXTHELP) |
| 650 | { |
| 651 | if (((MyDLGTEMPLATEEX*)temp)->signature == 0xFFFF) |
| 652 | ((MyDLGTEMPLATEEX*)temp)->style &= ~DS_CONTEXTHELP; |
| 653 | else |
| 654 | ((DLGTEMPLATE*)temp)->style &= ~DS_CONTEXTHELP; |
| 655 | } |
| 656 | if ((psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) && |
| 657 | (psInfo->ppshheader.dwFlags & PSH_WIZARDCONTEXTHELP)) |
| 658 | { |
| 659 | if (((MyDLGTEMPLATEEX*)temp)->signature == 0xFFFF) |
| 660 | ((MyDLGTEMPLATEEX*)temp)->style |= DS_CONTEXTHELP; |
| 661 | else |
| 662 | ((DLGTEMPLATE*)temp)->style |= DS_CONTEXTHELP; |
| 663 | } |
| 664 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 665 | if (psInfo->useCallback) |
| Slava Monich | 5b0ace1 | 2000-07-08 12:48:13 +0000 | [diff] [blame] | 666 | (*(psInfo->ppshheader.pfnCallback))(0, PSCB_PRECREATE, (LPARAM)temp); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 667 | |
| Filip Navara | 67c8cb2 | 2004-09-20 19:13:36 +0000 | [diff] [blame] | 668 | /* NOTE: MSDN states "Returns a positive value if successful, or -1 |
| 669 | * otherwise for modal property sheets.", but this is wrong. The |
| 670 | * actual return value is either TRUE (success), FALSE (cancel) or |
| 671 | * -1 (error). */ |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 672 | if( psInfo->unicode ) |
| 673 | { |
| Frank Richter | 9e57091 | 2005-08-30 10:07:17 +0000 | [diff] [blame] | 674 | ret = (INT_PTR)CreateDialogIndirectParamW(psInfo->ppshheader.hInstance, |
| Michael Stefaniuc | da6d792 | 2009-02-13 10:21:25 +0100 | [diff] [blame] | 675 | temp, psInfo->ppshheader.hwndParent, |
| 676 | PROPSHEET_DialogProc, (LPARAM)psInfo); |
| Huw Davies | 2e301ce | 2005-06-15 19:12:57 +0000 | [diff] [blame] | 677 | if ( !ret ) ret = -1; |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 678 | } |
| 679 | else |
| 680 | { |
| Frank Richter | 9e57091 | 2005-08-30 10:07:17 +0000 | [diff] [blame] | 681 | ret = (INT_PTR)CreateDialogIndirectParamA(psInfo->ppshheader.hInstance, |
| Michael Stefaniuc | da6d792 | 2009-02-13 10:21:25 +0100 | [diff] [blame] | 682 | temp, psInfo->ppshheader.hwndParent, |
| 683 | PROPSHEET_DialogProc, (LPARAM)psInfo); |
| Huw Davies | 2e301ce | 2005-06-15 19:12:57 +0000 | [diff] [blame] | 684 | if ( !ret ) ret = -1; |
| Adam Gundy | 1af319d | 2003-03-07 20:29:58 +0000 | [diff] [blame] | 685 | } |
| Alexandre Julliard | 49556bc | 2000-11-29 18:38:24 +0000 | [diff] [blame] | 686 | |
| Dimitrie O. Paun | 7de279a | 2003-09-22 21:32:33 +0000 | [diff] [blame] | 687 | Free(temp); |
| Thuy Nguyen | 143fc51 | 1999-09-04 11:09:20 +0000 | [diff] [blame] | 688 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 689 | return ret; |
| 690 | } |
| 691 | |
| 692 | /****************************************************************************** |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 693 | * PROPSHEET_SizeMismatch |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 694 | * |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 695 | * Verify that the tab control and the "largest" property sheet page dlg. template |
| 696 | * match in size. |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 697 | */ |
| Andrew Talbot | abf4d3b | 2007-03-31 17:43:35 +0100 | [diff] [blame] | 698 | static BOOL PROPSHEET_SizeMismatch(HWND hwndDlg, const PropSheetInfo* psInfo) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 699 | { |
| 700 | HWND hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL); |
| 701 | RECT rcOrigTab, rcPage; |
| 702 | |
| 703 | /* |
| 704 | * Original tab size. |
| 705 | */ |
| 706 | GetClientRect(hwndTabCtrl, &rcOrigTab); |
| Lei Zhang | 3980401 | 2008-01-24 15:06:37 -0800 | [diff] [blame] | 707 | TRACE("orig tab %s\n", wine_dbgstr_rect(&rcOrigTab)); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 708 | |
| 709 | /* |
| 710 | * Biggest page size. |
| 711 | */ |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 712 | rcPage.left = 0; |
| 713 | rcPage.top = 0; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 714 | rcPage.right = psInfo->width; |
| 715 | rcPage.bottom = psInfo->height; |
| 716 | |
| 717 | MapDialogRect(hwndDlg, &rcPage); |
| Lei Zhang | 3980401 | 2008-01-24 15:06:37 -0800 | [diff] [blame] | 718 | TRACE("biggest page %s\n", wine_dbgstr_rect(&rcPage)); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 719 | |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 720 | if ( (rcPage.right - rcPage.left) != (rcOrigTab.right - rcOrigTab.left) ) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 721 | return TRUE; |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 722 | if ( (rcPage.bottom - rcPage.top) != (rcOrigTab.bottom - rcOrigTab.top) ) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 723 | return TRUE; |
| 724 | |
| 725 | return FALSE; |
| 726 | } |
| 727 | |
| 728 | /****************************************************************************** |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 729 | * PROPSHEET_AdjustSize |
| 730 | * |
| 731 | * Resizes the property sheet and the tab control to fit the largest page. |
| 732 | */ |
| 733 | static BOOL PROPSHEET_AdjustSize(HWND hwndDlg, PropSheetInfo* psInfo) |
| 734 | { |
| 735 | HWND hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL); |
| 736 | HWND hwndButton = GetDlgItem(hwndDlg, IDOK); |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 737 | RECT rc,tabRect; |
| Vitaliy Margolen | edbea60 | 2009-01-30 09:06:03 -0700 | [diff] [blame] | 738 | int buttonHeight; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 739 | PADDING_INFO padding = PROPSHEET_GetPaddingInfo(hwndDlg); |
| Alexandre Julliard | 49556bc | 2000-11-29 18:38:24 +0000 | [diff] [blame] | 740 | RECT units; |
| Vitaliy Margolen | c80fdb8 | 2009-02-08 15:43:00 -0700 | [diff] [blame] | 741 | LONG style; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 742 | |
| 743 | /* Get the height of buttons */ |
| 744 | GetClientRect(hwndButton, &rc); |
| 745 | buttonHeight = rc.bottom; |
| 746 | |
| 747 | /* |
| 748 | * Biggest page size. |
| 749 | */ |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 750 | rc.left = 0; |
| 751 | rc.top = 0; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 752 | rc.right = psInfo->width; |
| 753 | rc.bottom = psInfo->height; |
| 754 | |
| 755 | MapDialogRect(hwndDlg, &rc); |
| 756 | |
| Alexandre Julliard | 49556bc | 2000-11-29 18:38:24 +0000 | [diff] [blame] | 757 | /* retrieve the dialog units */ |
| 758 | units.left = units.right = 4; |
| 759 | units.top = units.bottom = 8; |
| 760 | MapDialogRect(hwndDlg, &units); |
| 761 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 762 | /* |
| 763 | * Resize the tab control. |
| 764 | */ |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 765 | GetClientRect(hwndTabCtrl,&tabRect); |
| 766 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 767 | SendMessageW(hwndTabCtrl, TCM_ADJUSTRECT, FALSE, (LPARAM)&tabRect); |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 768 | |
| 769 | if ((rc.bottom - rc.top) < (tabRect.bottom - tabRect.top)) |
| 770 | { |
| 771 | rc.bottom = rc.top + tabRect.bottom - tabRect.top; |
| Alexandre Julliard | 49556bc | 2000-11-29 18:38:24 +0000 | [diff] [blame] | 772 | psInfo->height = MulDiv((rc.bottom - rc.top),8,units.top); |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 773 | } |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 774 | |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 775 | if ((rc.right - rc.left) < (tabRect.right - tabRect.left)) |
| 776 | { |
| 777 | rc.right = rc.left + tabRect.right - tabRect.left; |
| Alexandre Julliard | 49556bc | 2000-11-29 18:38:24 +0000 | [diff] [blame] | 778 | psInfo->width = MulDiv((rc.right - rc.left),4,units.left); |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 779 | } |
| 780 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 781 | SendMessageW(hwndTabCtrl, TCM_ADJUSTRECT, TRUE, (LPARAM)&rc); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 782 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 783 | rc.right -= rc.left; |
| 784 | rc.bottom -= rc.top; |
| Michael Ploujnikov | 1c16d83 | 2006-10-13 09:34:21 -0400 | [diff] [blame] | 785 | TRACE("setting tab %p, rc (0,0)-(%d,%d)\n", |
| Frank Richter | 9e57091 | 2005-08-30 10:07:17 +0000 | [diff] [blame] | 786 | hwndTabCtrl, rc.right, rc.bottom); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 787 | SetWindowPos(hwndTabCtrl, 0, 0, 0, rc.right, rc.bottom, |
| 788 | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); |
| 789 | |
| 790 | GetClientRect(hwndTabCtrl, &rc); |
| 791 | |
| Lei Zhang | 3980401 | 2008-01-24 15:06:37 -0800 | [diff] [blame] | 792 | TRACE("tab client rc %s\n", wine_dbgstr_rect(&rc)); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 793 | |
| Vitaliy Margolen | edbea60 | 2009-01-30 09:06:03 -0700 | [diff] [blame] | 794 | rc.right += (padding.x * 2); |
| 795 | rc.bottom += buttonHeight + (3 * padding.y); |
| 796 | |
| Vitaliy Margolen | c80fdb8 | 2009-02-08 15:43:00 -0700 | [diff] [blame] | 797 | style = GetWindowLongW(hwndDlg, GWL_STYLE); |
| 798 | if (!(style & WS_CHILD)) |
| 799 | AdjustWindowRect(&rc, style, FALSE); |
| Vitaliy Margolen | edbea60 | 2009-01-30 09:06:03 -0700 | [diff] [blame] | 800 | |
| 801 | rc.right -= rc.left; |
| 802 | rc.bottom -= rc.top; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 803 | |
| 804 | /* |
| 805 | * Resize the property sheet. |
| 806 | */ |
| Michael Ploujnikov | 1c16d83 | 2006-10-13 09:34:21 -0400 | [diff] [blame] | 807 | TRACE("setting dialog %p, rc (0,0)-(%d,%d)\n", |
| Frank Richter | 9e57091 | 2005-08-30 10:07:17 +0000 | [diff] [blame] | 808 | hwndDlg, rc.right, rc.bottom); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 809 | SetWindowPos(hwndDlg, 0, 0, 0, rc.right, rc.bottom, |
| 810 | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 811 | return TRUE; |
| 812 | } |
| 813 | |
| 814 | /****************************************************************************** |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 815 | * PROPSHEET_AdjustSizeWizard |
| 816 | * |
| 817 | * Resizes the property sheet to fit the largest page. |
| 818 | */ |
| Andrew Talbot | abf4d3b | 2007-03-31 17:43:35 +0100 | [diff] [blame] | 819 | static BOOL PROPSHEET_AdjustSizeWizard(HWND hwndDlg, const PropSheetInfo* psInfo) |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 820 | { |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 821 | HWND hwndLine = GetDlgItem(hwndDlg, IDC_SUNKEN_LINE); |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 822 | RECT rc, lineRect, dialogRect; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 823 | |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 824 | /* Biggest page size */ |
| 825 | rc.left = 0; |
| 826 | rc.top = 0; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 827 | rc.right = psInfo->width; |
| 828 | rc.bottom = psInfo->height; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 829 | MapDialogRect(hwndDlg, &rc); |
| 830 | |
| Lei Zhang | 3980401 | 2008-01-24 15:06:37 -0800 | [diff] [blame] | 831 | TRACE("Biggest page %s\n", wine_dbgstr_rect(&rc)); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 832 | |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 833 | /* Add space for the buttons row */ |
| 834 | GetWindowRect(hwndLine, &lineRect); |
| 835 | MapWindowPoints(NULL, hwndDlg, (LPPOINT)&lineRect, 2); |
| 836 | GetClientRect(hwndDlg, &dialogRect); |
| 837 | rc.bottom += dialogRect.bottom - lineRect.top - 1; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 838 | |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 839 | /* Convert the client coordinates to window coordinates */ |
| 840 | AdjustWindowRect(&rc, GetWindowLongW(hwndDlg, GWL_STYLE), FALSE); |
| 841 | |
| 842 | /* Resize the property sheet */ |
| Michael Ploujnikov | 1c16d83 | 2006-10-13 09:34:21 -0400 | [diff] [blame] | 843 | TRACE("setting dialog %p, rc (0,0)-(%d,%d)\n", |
| Frank Richter | 9e57091 | 2005-08-30 10:07:17 +0000 | [diff] [blame] | 844 | hwndDlg, rc.right, rc.bottom); |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 845 | SetWindowPos(hwndDlg, 0, 0, 0, rc.right - rc.left, rc.bottom - rc.top, |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 846 | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 847 | |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 848 | return TRUE; |
| 849 | } |
| 850 | |
| 851 | /****************************************************************************** |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 852 | * PROPSHEET_AdjustButtons |
| 853 | * |
| 854 | * Adjusts the buttons' positions. |
| 855 | */ |
| Andrew Talbot | abf4d3b | 2007-03-31 17:43:35 +0100 | [diff] [blame] | 856 | static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, const PropSheetInfo* psInfo) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 857 | { |
| 858 | HWND hwndButton = GetDlgItem(hwndParent, IDOK); |
| 859 | RECT rcSheet; |
| 860 | int x, y; |
| 861 | int num_buttons = 2; |
| 862 | int buttonWidth, buttonHeight; |
| 863 | PADDING_INFO padding = PROPSHEET_GetPaddingInfo(hwndParent); |
| 864 | |
| 865 | if (psInfo->hasApply) |
| 866 | num_buttons++; |
| 867 | |
| 868 | if (psInfo->hasHelp) |
| 869 | num_buttons++; |
| 870 | |
| 871 | /* |
| 872 | * Obtain the size of the buttons. |
| 873 | */ |
| 874 | GetClientRect(hwndButton, &rcSheet); |
| 875 | buttonWidth = rcSheet.right; |
| 876 | buttonHeight = rcSheet.bottom; |
| 877 | |
| 878 | /* |
| 879 | * Get the size of the property sheet. |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 880 | */ |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 881 | GetClientRect(hwndParent, &rcSheet); |
| 882 | |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 883 | /* |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 884 | * All buttons will be at this y coordinate. |
| 885 | */ |
| 886 | y = rcSheet.bottom - (padding.y + buttonHeight); |
| 887 | |
| 888 | /* |
| Zach Gorman | 9b68d0f | 2004-08-16 23:17:44 +0000 | [diff] [blame] | 889 | * Position OK button and make it default. |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 890 | */ |
| 891 | hwndButton = GetDlgItem(hwndParent, IDOK); |
| 892 | |
| 893 | x = rcSheet.right - ((padding.x + buttonWidth) * num_buttons); |
| 894 | |
| 895 | SetWindowPos(hwndButton, 0, x, y, 0, 0, |
| 896 | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); |
| 897 | |
| Dimitrie O. Paun | 2fbd839 | 2005-03-23 10:23:23 +0000 | [diff] [blame] | 898 | SendMessageW(hwndParent, DM_SETDEFID, IDOK, 0); |
| Zach Gorman | 9b68d0f | 2004-08-16 23:17:44 +0000 | [diff] [blame] | 899 | |
| 900 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 901 | /* |
| 902 | * Position Cancel button. |
| 903 | */ |
| 904 | hwndButton = GetDlgItem(hwndParent, IDCANCEL); |
| 905 | |
| Jan de Mooij | 2f8e5da | 2009-08-31 14:09:00 +0200 | [diff] [blame] | 906 | x += padding.x + buttonWidth; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 907 | |
| 908 | SetWindowPos(hwndButton, 0, x, y, 0, 0, |
| 909 | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); |
| 910 | |
| 911 | /* |
| 912 | * Position Apply button. |
| 913 | */ |
| 914 | hwndButton = GetDlgItem(hwndParent, IDC_APPLY_BUTTON); |
| 915 | |
| Jan de Mooij | 2f8e5da | 2009-08-31 14:09:00 +0200 | [diff] [blame] | 916 | if(psInfo->hasApply) |
| 917 | x += padding.x + buttonWidth; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 918 | else |
| 919 | ShowWindow(hwndButton, SW_HIDE); |
| 920 | |
| Jan de Mooij | 2f8e5da | 2009-08-31 14:09:00 +0200 | [diff] [blame] | 921 | SetWindowPos(hwndButton, 0, x, y, 0, 0, |
| 922 | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); |
| 923 | EnableWindow(hwndButton, FALSE); |
| 924 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 925 | /* |
| 926 | * Position Help button. |
| 927 | */ |
| 928 | hwndButton = GetDlgItem(hwndParent, IDHELP); |
| 929 | |
| Jan de Mooij | 2f8e5da | 2009-08-31 14:09:00 +0200 | [diff] [blame] | 930 | x += padding.x + buttonWidth; |
| 931 | SetWindowPos(hwndButton, 0, x, y, 0, 0, |
| 932 | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 933 | |
| Jan de Mooij | 2f8e5da | 2009-08-31 14:09:00 +0200 | [diff] [blame] | 934 | if(!psInfo->hasHelp) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 935 | ShowWindow(hwndButton, SW_HIDE); |
| 936 | |
| 937 | return TRUE; |
| 938 | } |
| 939 | |
| 940 | /****************************************************************************** |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 941 | * PROPSHEET_AdjustButtonsWizard |
| 942 | * |
| 943 | * Adjusts the buttons' positions. |
| 944 | */ |
| 945 | static BOOL PROPSHEET_AdjustButtonsWizard(HWND hwndParent, |
| Andrew Talbot | abf4d3b | 2007-03-31 17:43:35 +0100 | [diff] [blame] | 946 | const PropSheetInfo* psInfo) |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 947 | { |
| 948 | HWND hwndButton = GetDlgItem(hwndParent, IDCANCEL); |
| 949 | HWND hwndLine = GetDlgItem(hwndParent, IDC_SUNKEN_LINE); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 950 | HWND hwndLineHeader = GetDlgItem(hwndParent, IDC_SUNKEN_LINEHEADER); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 951 | RECT rcSheet; |
| 952 | int x, y; |
| 953 | int num_buttons = 3; |
| 954 | int buttonWidth, buttonHeight, lineHeight, lineWidth; |
| Andreas Mohr | d511177 | 2000-08-26 20:28:02 +0000 | [diff] [blame] | 955 | PADDING_INFO padding = PROPSHEET_GetPaddingInfoWizard(hwndParent, psInfo); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 956 | |
| 957 | if (psInfo->hasHelp) |
| 958 | num_buttons++; |
| Thomas Weidenmueller | 6ea26b5 | 2005-07-15 09:59:04 +0000 | [diff] [blame] | 959 | if (psInfo->hasFinish) |
| 960 | num_buttons++; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 961 | |
| 962 | /* |
| 963 | * Obtain the size of the buttons. |
| 964 | */ |
| 965 | GetClientRect(hwndButton, &rcSheet); |
| 966 | buttonWidth = rcSheet.right; |
| 967 | buttonHeight = rcSheet.bottom; |
| 968 | |
| 969 | GetClientRect(hwndLine, &rcSheet); |
| 970 | lineHeight = rcSheet.bottom; |
| 971 | |
| 972 | /* |
| 973 | * Get the size of the property sheet. |
| 974 | */ |
| 975 | GetClientRect(hwndParent, &rcSheet); |
| 976 | |
| 977 | /* |
| 978 | * All buttons will be at this y coordinate. |
| 979 | */ |
| 980 | y = rcSheet.bottom - (padding.y + buttonHeight); |
| Thomas Weidenmueller | 6ea26b5 | 2005-07-15 09:59:04 +0000 | [diff] [blame] | 981 | |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 982 | /* |
| 983 | * Position the Back button. |
| 984 | */ |
| 985 | hwndButton = GetDlgItem(hwndParent, IDC_BACK_BUTTON); |
| 986 | |
| Thomas Weidenmueller | 6ea26b5 | 2005-07-15 09:59:04 +0000 | [diff] [blame] | 987 | x = rcSheet.right - ((padding.x + buttonWidth) * (num_buttons - 1)) - buttonWidth; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 988 | |
| 989 | SetWindowPos(hwndButton, 0, x, y, 0, 0, |
| 990 | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); |
| 991 | |
| 992 | /* |
| Thomas Weidenmueller | 6ea26b5 | 2005-07-15 09:59:04 +0000 | [diff] [blame] | 993 | * Position the Next button. |
| 994 | */ |
| 995 | hwndButton = GetDlgItem(hwndParent, IDC_NEXT_BUTTON); |
| 996 | |
| 997 | x += buttonWidth; |
| 998 | |
| 999 | SetWindowPos(hwndButton, 0, x, y, 0, 0, |
| 1000 | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); |
| 1001 | |
| 1002 | /* |
| 1003 | * Position the Finish button. |
| 1004 | */ |
| 1005 | hwndButton = GetDlgItem(hwndParent, IDC_FINISH_BUTTON); |
| 1006 | |
| 1007 | if (psInfo->hasFinish) |
| 1008 | x += padding.x + buttonWidth; |
| 1009 | |
| 1010 | SetWindowPos(hwndButton, 0, x, y, 0, 0, |
| 1011 | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); |
| 1012 | |
| 1013 | if (!psInfo->hasFinish) |
| 1014 | ShowWindow(hwndButton, SW_HIDE); |
| 1015 | |
| 1016 | /* |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1017 | * Position the Cancel button. |
| 1018 | */ |
| 1019 | hwndButton = GetDlgItem(hwndParent, IDCANCEL); |
| 1020 | |
| Thomas Weidenmueller | 6ea26b5 | 2005-07-15 09:59:04 +0000 | [diff] [blame] | 1021 | x += padding.x + buttonWidth; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1022 | |
| 1023 | SetWindowPos(hwndButton, 0, x, y, 0, 0, |
| 1024 | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); |
| 1025 | |
| 1026 | /* |
| 1027 | * Position Help button. |
| 1028 | */ |
| 1029 | hwndButton = GetDlgItem(hwndParent, IDHELP); |
| 1030 | |
| 1031 | if (psInfo->hasHelp) |
| 1032 | { |
| Thomas Weidenmueller | 6ea26b5 | 2005-07-15 09:59:04 +0000 | [diff] [blame] | 1033 | x += padding.x + buttonWidth; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1034 | |
| 1035 | SetWindowPos(hwndButton, 0, x, y, 0, 0, |
| 1036 | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); |
| 1037 | } |
| 1038 | else |
| 1039 | ShowWindow(hwndButton, SW_HIDE); |
| 1040 | |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 1041 | if (psInfo->ppshheader.dwFlags & |
| 1042 | (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW | PSH_WIZARD_LITE)) |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 1043 | padding.x = 0; |
| 1044 | |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1045 | /* |
| 1046 | * Position and resize the sunken line. |
| 1047 | */ |
| 1048 | x = padding.x; |
| 1049 | y = rcSheet.bottom - ((padding.y * 2) + buttonHeight + lineHeight); |
| 1050 | |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1051 | lineWidth = rcSheet.right - (padding.x * 2); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1052 | SetWindowPos(hwndLine, 0, x, y, lineWidth, 2, |
| 1053 | SWP_NOZORDER | SWP_NOACTIVATE); |
| 1054 | |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 1055 | /* |
| 1056 | * Position and resize the header sunken line. |
| 1057 | */ |
| 1058 | |
| 1059 | SetWindowPos(hwndLineHeader, 0, 0, 0, rcSheet.right, 2, |
| 1060 | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); |
| 1061 | if (!(psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW))) |
| 1062 | ShowWindow(hwndLineHeader, SW_HIDE); |
| 1063 | |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1064 | return TRUE; |
| 1065 | } |
| 1066 | |
| 1067 | /****************************************************************************** |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1068 | * PROPSHEET_GetPaddingInfo |
| 1069 | * |
| 1070 | * Returns the layout information. |
| 1071 | */ |
| 1072 | static PADDING_INFO PROPSHEET_GetPaddingInfo(HWND hwndDlg) |
| 1073 | { |
| 1074 | HWND hwndTab = GetDlgItem(hwndDlg, IDC_TABCONTROL); |
| 1075 | RECT rcTab; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1076 | PADDING_INFO padding; |
| 1077 | |
| 1078 | GetWindowRect(hwndTab, &rcTab); |
| Alexandre Julliard | a37e597 | 2010-10-05 14:04:01 +0200 | [diff] [blame] | 1079 | MapWindowPoints( 0, hwndDlg, (POINT *)&rcTab, 2 ); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1080 | |
| Alexandre Julliard | a37e597 | 2010-10-05 14:04:01 +0200 | [diff] [blame] | 1081 | padding.x = rcTab.left; |
| 1082 | padding.y = rcTab.top; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1083 | |
| 1084 | return padding; |
| 1085 | } |
| 1086 | |
| 1087 | /****************************************************************************** |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1088 | * PROPSHEET_GetPaddingInfoWizard |
| 1089 | * |
| 1090 | * Returns the layout information. |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1091 | * Vertical spacing is the distance between the line and the buttons. |
| Andreas Mohr | d511177 | 2000-08-26 20:28:02 +0000 | [diff] [blame] | 1092 | * Do NOT use the Help button to gather padding information when it isn't mapped |
| 1093 | * (PSH_HASHELP), as app writers aren't forced to supply correct coordinates |
| 1094 | * for it in this case ! |
| 1095 | * FIXME: I'm not sure about any other coordinate problems with these evil |
| 1096 | * buttons. Fix it in case additional problems appear or maybe calculate |
| 1097 | * a padding in a completely different way, as this is somewhat messy. |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1098 | */ |
| Andreas Mohr | d511177 | 2000-08-26 20:28:02 +0000 | [diff] [blame] | 1099 | static PADDING_INFO PROPSHEET_GetPaddingInfoWizard(HWND hwndDlg, const PropSheetInfo* |
| 1100 | psInfo) |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1101 | { |
| 1102 | PADDING_INFO padding; |
| 1103 | RECT rc; |
| 1104 | HWND hwndControl; |
| Andreas Mohr | d511177 | 2000-08-26 20:28:02 +0000 | [diff] [blame] | 1105 | INT idButton; |
| 1106 | POINT ptButton, ptLine; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1107 | |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1108 | TRACE("\n"); |
| Andreas Mohr | d511177 | 2000-08-26 20:28:02 +0000 | [diff] [blame] | 1109 | if (psInfo->hasHelp) |
| 1110 | { |
| 1111 | idButton = IDHELP; |
| 1112 | } |
| 1113 | else |
| 1114 | { |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 1115 | if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) |
| Andreas Mohr | d511177 | 2000-08-26 20:28:02 +0000 | [diff] [blame] | 1116 | { |
| 1117 | idButton = IDC_NEXT_BUTTON; |
| 1118 | } |
| 1119 | else |
| 1120 | { |
| 1121 | /* hopefully this is ok */ |
| 1122 | idButton = IDCANCEL; |
| 1123 | } |
| 1124 | } |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 1125 | |
| Andreas Mohr | d511177 | 2000-08-26 20:28:02 +0000 | [diff] [blame] | 1126 | hwndControl = GetDlgItem(hwndDlg, idButton); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1127 | GetWindowRect(hwndControl, &rc); |
| Alexandre Julliard | a37e597 | 2010-10-05 14:04:01 +0200 | [diff] [blame] | 1128 | MapWindowPoints( 0, hwndDlg, (POINT *)&rc, 2 ); |
| Andreas Mohr | d511177 | 2000-08-26 20:28:02 +0000 | [diff] [blame] | 1129 | ptButton.x = rc.left; |
| 1130 | ptButton.y = rc.top; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1131 | |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1132 | /* Line */ |
| 1133 | hwndControl = GetDlgItem(hwndDlg, IDC_SUNKEN_LINE); |
| 1134 | GetWindowRect(hwndControl, &rc); |
| Alexandre Julliard | a37e597 | 2010-10-05 14:04:01 +0200 | [diff] [blame] | 1135 | MapWindowPoints( 0, hwndDlg, (POINT *)&rc, 2 ); |
| Juan Lang | 9a3647a | 2004-03-13 19:24:04 +0000 | [diff] [blame] | 1136 | ptLine.x = rc.left; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1137 | ptLine.y = rc.bottom; |
| 1138 | |
| Andreas Mohr | d511177 | 2000-08-26 20:28:02 +0000 | [diff] [blame] | 1139 | padding.y = ptButton.y - ptLine.y; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1140 | |
| Andreas Mohr | d511177 | 2000-08-26 20:28:02 +0000 | [diff] [blame] | 1141 | if (padding.y < 0) |
| 1142 | ERR("padding negative ! Please report this !\n"); |
| 1143 | |
| 1144 | /* this is most probably not correct, but the best we have now */ |
| 1145 | padding.x = padding.y; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1146 | return padding; |
| 1147 | } |
| 1148 | |
| 1149 | /****************************************************************************** |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1150 | * PROPSHEET_CreateTabControl |
| 1151 | * |
| 1152 | * Insert the tabs in the tab control. |
| 1153 | */ |
| 1154 | static BOOL PROPSHEET_CreateTabControl(HWND hwndParent, |
| Andrew Talbot | abf4d3b | 2007-03-31 17:43:35 +0100 | [diff] [blame] | 1155 | const PropSheetInfo * psInfo) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1156 | { |
| 1157 | HWND hwndTabCtrl = GetDlgItem(hwndParent, IDC_TABCONTROL); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 1158 | TCITEMW item; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1159 | int i, nTabs; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1160 | int iImage = 0; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1161 | |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1162 | TRACE("\n"); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1163 | item.mask = TCIF_TEXT; |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 1164 | item.cchTextMax = MAX_TABTEXT_LENGTH; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1165 | |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 1166 | nTabs = psInfo->nPages; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1167 | |
| Thuy Nguyen | 85411af | 1999-08-14 15:51:10 +0000 | [diff] [blame] | 1168 | /* |
| 1169 | * Set the image list for icons. |
| 1170 | */ |
| 1171 | if (psInfo->hImageList) |
| 1172 | { |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 1173 | SendMessageW(hwndTabCtrl, TCM_SETIMAGELIST, 0, (LPARAM)psInfo->hImageList); |
| Thuy Nguyen | 85411af | 1999-08-14 15:51:10 +0000 | [diff] [blame] | 1174 | } |
| 1175 | |
| Juan Lang | 9a3647a | 2004-03-13 19:24:04 +0000 | [diff] [blame] | 1176 | SendMessageW(GetDlgItem(hwndTabCtrl, IDC_TABCONTROL), WM_SETREDRAW, 0, 0); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1177 | for (i = 0; i < nTabs; i++) |
| 1178 | { |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1179 | if ( psInfo->proppage[i].hasIcon ) |
| 1180 | { |
| 1181 | item.mask |= TCIF_IMAGE; |
| 1182 | item.iImage = iImage++; |
| 1183 | } |
| 1184 | else |
| 1185 | { |
| 1186 | item.mask &= ~TCIF_IMAGE; |
| 1187 | } |
| Thuy Nguyen | 85411af | 1999-08-14 15:51:10 +0000 | [diff] [blame] | 1188 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 1189 | item.pszText = (LPWSTR) psInfo->proppage[i].pszText; |
| Michael Stefaniuc | 9dd502a | 2009-12-27 23:51:33 +0100 | [diff] [blame] | 1190 | SendMessageW(hwndTabCtrl, TCM_INSERTITEMW, i, (LPARAM)&item); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1191 | } |
| Juan Lang | 9a3647a | 2004-03-13 19:24:04 +0000 | [diff] [blame] | 1192 | SendMessageW(GetDlgItem(hwndTabCtrl, IDC_TABCONTROL), WM_SETREDRAW, 1, 0); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1193 | |
| 1194 | return TRUE; |
| 1195 | } |
| Filip Navara | 8a8a66c | 2004-09-13 19:17:00 +0000 | [diff] [blame] | 1196 | |
| 1197 | /****************************************************************************** |
| 1198 | * PROPSHEET_WizardSubclassProc |
| 1199 | * |
| Austin English | c2a7914 | 2008-01-23 16:05:21 -0600 | [diff] [blame] | 1200 | * Subclassing window procedure for wizard exterior pages to prevent drawing |
| Filip Navara | 8a8a66c | 2004-09-13 19:17:00 +0000 | [diff] [blame] | 1201 | * background and so drawing above the watermark. |
| 1202 | */ |
| Mike McCormack | 882bc4d | 2005-06-09 09:50:56 +0000 | [diff] [blame] | 1203 | static LRESULT CALLBACK |
| Filip Navara | 8a8a66c | 2004-09-13 19:17:00 +0000 | [diff] [blame] | 1204 | PROPSHEET_WizardSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uID, DWORD_PTR dwRef) |
| 1205 | { |
| 1206 | switch (uMsg) |
| 1207 | { |
| 1208 | case WM_ERASEBKGND: |
| 1209 | return TRUE; |
| 1210 | |
| 1211 | case WM_CTLCOLORSTATIC: |
| 1212 | SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW)); |
| 1213 | return (INT_PTR)GetSysColorBrush(COLOR_WINDOW); |
| 1214 | } |
| 1215 | |
| 1216 | return DefSubclassProc(hwnd, uMsg, wParam, lParam); |
| 1217 | } |
| 1218 | |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1219 | /* |
| 1220 | * Get the size of an in-memory Template |
| 1221 | * |
| 1222 | *( Based on the code of PROPSHEET_CollectPageInfo) |
| Andreas Mohr | 1e6258f | 2002-11-25 02:45:19 +0000 | [diff] [blame] | 1223 | * See also dialog.c/DIALOG_ParseTemplate32(). |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1224 | */ |
| 1225 | |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 1226 | static UINT GetTemplateSize(const DLGTEMPLATE* pTemplate) |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1227 | |
| 1228 | { |
| 1229 | const WORD* p = (const WORD *)pTemplate; |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 1230 | BOOL istemplateex = (((const MyDLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF); |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1231 | WORD nrofitems; |
| Alexandre Julliard | 03e2b33 | 2006-06-13 14:09:16 +0200 | [diff] [blame] | 1232 | UINT ret; |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1233 | |
| 1234 | if (istemplateex) |
| 1235 | { |
| Andreas Mohr | 1e6258f | 2002-11-25 02:45:19 +0000 | [diff] [blame] | 1236 | /* DLGTEMPLATEEX (not defined in any std. header file) */ |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1237 | |
| Andreas Mohr | 1e6258f | 2002-11-25 02:45:19 +0000 | [diff] [blame] | 1238 | TRACE("is DLGTEMPLATEEX\n"); |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1239 | p++; /* dlgVer */ |
| 1240 | p++; /* signature */ |
| 1241 | p += 2; /* help ID */ |
| 1242 | p += 2; /* ext style */ |
| 1243 | p += 2; /* style */ |
| 1244 | } |
| 1245 | else |
| 1246 | { |
| Andreas Mohr | 1e6258f | 2002-11-25 02:45:19 +0000 | [diff] [blame] | 1247 | /* DLGTEMPLATE */ |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1248 | |
| Andreas Mohr | 1e6258f | 2002-11-25 02:45:19 +0000 | [diff] [blame] | 1249 | TRACE("is DLGTEMPLATE\n"); |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1250 | p += 2; /* style */ |
| 1251 | p += 2; /* ext style */ |
| 1252 | } |
| 1253 | |
| 1254 | nrofitems = (WORD)*p; p++; /* nb items */ |
| 1255 | p++; /* x */ |
| 1256 | p++; /* y */ |
| 1257 | p++; /* width */ |
| 1258 | p++; /* height */ |
| 1259 | |
| 1260 | /* menu */ |
| 1261 | switch ((WORD)*p) |
| 1262 | { |
| 1263 | case 0x0000: |
| 1264 | p++; |
| 1265 | break; |
| 1266 | case 0xffff: |
| 1267 | p += 2; |
| 1268 | break; |
| 1269 | default: |
| Andrew Talbot | 863ffb7 | 2007-12-31 22:16:08 +0000 | [diff] [blame] | 1270 | TRACE("menu %s\n",debugstr_w( p )); |
| 1271 | p += lstrlenW( p ) + 1; |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1272 | break; |
| 1273 | } |
| 1274 | |
| 1275 | /* class */ |
| 1276 | switch ((WORD)*p) |
| 1277 | { |
| 1278 | case 0x0000: |
| 1279 | p++; |
| 1280 | break; |
| 1281 | case 0xffff: |
| Andreas Mohr | 1e6258f | 2002-11-25 02:45:19 +0000 | [diff] [blame] | 1282 | p += 2; /* 0xffff plus predefined window class ordinal value */ |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1283 | break; |
| 1284 | default: |
| Andrew Talbot | 863ffb7 | 2007-12-31 22:16:08 +0000 | [diff] [blame] | 1285 | TRACE("class %s\n",debugstr_w( p )); |
| 1286 | p += lstrlenW( p ) + 1; |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1287 | break; |
| 1288 | } |
| 1289 | |
| Andreas Mohr | 1e6258f | 2002-11-25 02:45:19 +0000 | [diff] [blame] | 1290 | /* title */ |
| Andrew Talbot | 863ffb7 | 2007-12-31 22:16:08 +0000 | [diff] [blame] | 1291 | TRACE("title %s\n",debugstr_w( p )); |
| 1292 | p += lstrlenW( p ) + 1; |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1293 | |
| Andreas Mohr | 1e6258f | 2002-11-25 02:45:19 +0000 | [diff] [blame] | 1294 | /* font, if DS_SETFONT set */ |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 1295 | if ((DS_SETFONT & ((istemplateex)? ((const MyDLGTEMPLATEEX*)pTemplate)->style : |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1296 | pTemplate->style))) |
| 1297 | { |
| 1298 | p+=(istemplateex)?3:1; |
| Andrew Talbot | 863ffb7 | 2007-12-31 22:16:08 +0000 | [diff] [blame] | 1299 | TRACE("font %s\n",debugstr_w( p )); |
| 1300 | p += lstrlenW( p ) + 1; /* the font name */ |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1301 | } |
| 1302 | |
| Andreas Mohr | 1e6258f | 2002-11-25 02:45:19 +0000 | [diff] [blame] | 1303 | /* now process the DLGITEMTEMPLATE(EX) structs (plus custom data) |
| 1304 | * that are following the DLGTEMPLATE(EX) data */ |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1305 | TRACE("%d items\n",nrofitems); |
| 1306 | while (nrofitems > 0) |
| 1307 | { |
| Frank Richter | 9e57091 | 2005-08-30 10:07:17 +0000 | [diff] [blame] | 1308 | p = (WORD*)(((DWORD_PTR)p + 3) & ~3); /* DWORD align */ |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1309 | |
| Andreas Mohr | 1e6258f | 2002-11-25 02:45:19 +0000 | [diff] [blame] | 1310 | /* skip header */ |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1311 | p += (istemplateex ? sizeof(MyDLGITEMTEMPLATEEX) : sizeof(DLGITEMTEMPLATE))/sizeof(WORD); |
| 1312 | |
| Andreas Mohr | 1e6258f | 2002-11-25 02:45:19 +0000 | [diff] [blame] | 1313 | /* check class */ |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1314 | switch ((WORD)*p) |
| 1315 | { |
| 1316 | case 0x0000: |
| 1317 | p++; |
| 1318 | break; |
| 1319 | case 0xffff: |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 1320 | TRACE("class ordinal 0x%08x\n",*(const DWORD*)p); |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1321 | p += 2; |
| 1322 | break; |
| 1323 | default: |
| Andrew Talbot | 863ffb7 | 2007-12-31 22:16:08 +0000 | [diff] [blame] | 1324 | TRACE("class %s\n",debugstr_w( p )); |
| 1325 | p += lstrlenW( p ) + 1; |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1326 | break; |
| 1327 | } |
| Andreas Mohr | 1e6258f | 2002-11-25 02:45:19 +0000 | [diff] [blame] | 1328 | |
| 1329 | /* check title text */ |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1330 | switch ((WORD)*p) |
| 1331 | { |
| 1332 | case 0x0000: |
| 1333 | p++; |
| 1334 | break; |
| 1335 | case 0xffff: |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 1336 | TRACE("text ordinal 0x%08x\n",*(const DWORD*)p); |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1337 | p += 2; |
| 1338 | break; |
| 1339 | default: |
| Andrew Talbot | 863ffb7 | 2007-12-31 22:16:08 +0000 | [diff] [blame] | 1340 | TRACE("text %s\n",debugstr_w( p )); |
| 1341 | p += lstrlenW( p ) + 1; |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1342 | break; |
| 1343 | } |
| Mike McCormack | 8b42441 | 2004-08-26 18:11:43 +0000 | [diff] [blame] | 1344 | p += *p / sizeof(WORD) + 1; /* Skip extra data */ |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1345 | --nrofitems; |
| 1346 | } |
| 1347 | |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 1348 | ret = (p - (const WORD*)pTemplate) * sizeof(WORD); |
| Alexandre Julliard | 03e2b33 | 2006-06-13 14:09:16 +0200 | [diff] [blame] | 1349 | TRACE("%p %p size 0x%08x\n", p, pTemplate, ret); |
| 1350 | return ret; |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1351 | } |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1352 | |
| 1353 | /****************************************************************************** |
| 1354 | * PROPSHEET_CreatePage |
| 1355 | * |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 1356 | * Creates a page. |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1357 | */ |
| Dmitry Timoshkov | 9965390 | 2000-11-09 20:25:27 +0000 | [diff] [blame] | 1358 | static BOOL PROPSHEET_CreatePage(HWND hwndParent, |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1359 | int index, |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 1360 | const PropSheetInfo * psInfo, |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 1361 | LPCPROPSHEETPAGEW ppshpage) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1362 | { |
| Mikhail Maroukhine | 6443d87 | 2010-03-26 20:49:09 +0600 | [diff] [blame] | 1363 | const DLGTEMPLATE* pTemplate; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1364 | HWND hwndPage; |
| Dmitry Timoshkov | 9965390 | 2000-11-09 20:25:27 +0000 | [diff] [blame] | 1365 | DWORD resSize; |
| Mikhail Maroukhine | 6443d87 | 2010-03-26 20:49:09 +0600 | [diff] [blame] | 1366 | DLGTEMPLATE* pTemplateCopy = NULL; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1367 | |
| Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1368 | TRACE("index %d\n", index); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1369 | |
| Sander van Leeuwen | d919c27 | 2002-05-14 18:38:07 +0000 | [diff] [blame] | 1370 | if (ppshpage == NULL) |
| 1371 | { |
| 1372 | return FALSE; |
| 1373 | } |
| 1374 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1375 | if (ppshpage->dwFlags & PSP_DLGINDIRECT) |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1376 | { |
| Mikhail Maroukhine | 6443d87 | 2010-03-26 20:49:09 +0600 | [diff] [blame] | 1377 | pTemplate = ppshpage->u.pResource; |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1378 | resSize = GetTemplateSize(pTemplate); |
| 1379 | } |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 1380 | else if(ppshpage->dwFlags & PSP_INTERNAL_UNICODE) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1381 | { |
| Dmitry Timoshkov | 9965390 | 2000-11-09 20:25:27 +0000 | [diff] [blame] | 1382 | HRSRC hResource; |
| 1383 | HANDLE hTemplate; |
| 1384 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 1385 | hResource = FindResourceW(ppshpage->hInstance, |
| Peter Hunnisett | 565b008 | 2000-09-19 02:43:00 +0000 | [diff] [blame] | 1386 | ppshpage->u.pszTemplate, |
| Alexandre Julliard | cf52644 | 2003-09-10 03:56:47 +0000 | [diff] [blame] | 1387 | (LPWSTR)RT_DIALOG); |
| Dmitry Timoshkov | 9965390 | 2000-11-09 20:25:27 +0000 | [diff] [blame] | 1388 | if(!hResource) |
| 1389 | return FALSE; |
| 1390 | |
| 1391 | resSize = SizeofResource(ppshpage->hInstance, hResource); |
| 1392 | |
| 1393 | hTemplate = LoadResource(ppshpage->hInstance, hResource); |
| 1394 | if(!hTemplate) |
| 1395 | return FALSE; |
| 1396 | |
| Michael Stefaniuc | 6060ca9 | 2008-10-23 23:52:45 +0200 | [diff] [blame] | 1397 | pTemplate = LockResource(hTemplate); |
| Dmitry Timoshkov | 9965390 | 2000-11-09 20:25:27 +0000 | [diff] [blame] | 1398 | /* |
| 1399 | * Make a copy of the dialog template to make it writable |
| 1400 | */ |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1401 | } |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 1402 | else |
| 1403 | { |
| 1404 | HRSRC hResource; |
| 1405 | HANDLE hTemplate; |
| 1406 | |
| 1407 | hResource = FindResourceA(ppshpage->hInstance, |
| Andrew Talbot | cc90540 | 2006-08-30 19:40:52 +0100 | [diff] [blame] | 1408 | (LPCSTR)ppshpage->u.pszTemplate, |
| Alexandre Julliard | cf52644 | 2003-09-10 03:56:47 +0000 | [diff] [blame] | 1409 | (LPSTR)RT_DIALOG); |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 1410 | if(!hResource) |
| 1411 | return FALSE; |
| 1412 | |
| 1413 | resSize = SizeofResource(ppshpage->hInstance, hResource); |
| 1414 | |
| 1415 | hTemplate = LoadResource(ppshpage->hInstance, hResource); |
| 1416 | if(!hTemplate) |
| 1417 | return FALSE; |
| 1418 | |
| Michael Stefaniuc | 6060ca9 | 2008-10-23 23:52:45 +0200 | [diff] [blame] | 1419 | pTemplate = LockResource(hTemplate); |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 1420 | /* |
| 1421 | * Make a copy of the dialog template to make it writable |
| 1422 | */ |
| 1423 | } |
| Mikhail Maroukhine | 6443d87 | 2010-03-26 20:49:09 +0600 | [diff] [blame] | 1424 | pTemplateCopy = Alloc(resSize); |
| 1425 | if (!pTemplateCopy) |
| Uwe Bonnes | e14cfc4 | 2002-10-13 17:54:48 +0000 | [diff] [blame] | 1426 | return FALSE; |
| 1427 | |
| Mikhail Maroukhine | 6443d87 | 2010-03-26 20:49:09 +0600 | [diff] [blame] | 1428 | TRACE("copying pTemplate %p into pTemplateCopy %p (%d)\n", pTemplate, pTemplateCopy, resSize); |
| 1429 | memcpy(pTemplateCopy, pTemplate, resSize); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1430 | |
| Mikhail Maroukhine | 6443d87 | 2010-03-26 20:49:09 +0600 | [diff] [blame] | 1431 | if (((MyDLGTEMPLATEEX*)pTemplateCopy)->signature == 0xFFFF) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1432 | { |
| Mikhail Maroukhine | 6443d87 | 2010-03-26 20:49:09 +0600 | [diff] [blame] | 1433 | ((MyDLGTEMPLATEEX*)pTemplateCopy)->style |= WS_CHILD | WS_TABSTOP | DS_CONTROL; |
| 1434 | ((MyDLGTEMPLATEEX*)pTemplateCopy)->style &= ~DS_MODALFRAME; |
| 1435 | ((MyDLGTEMPLATEEX*)pTemplateCopy)->style &= ~WS_CAPTION; |
| 1436 | ((MyDLGTEMPLATEEX*)pTemplateCopy)->style &= ~WS_SYSMENU; |
| 1437 | ((MyDLGTEMPLATEEX*)pTemplateCopy)->style &= ~WS_POPUP; |
| 1438 | ((MyDLGTEMPLATEEX*)pTemplateCopy)->style &= ~WS_DISABLED; |
| 1439 | ((MyDLGTEMPLATEEX*)pTemplateCopy)->style &= ~WS_VISIBLE; |
| 1440 | ((MyDLGTEMPLATEEX*)pTemplateCopy)->style &= ~WS_THICKFRAME; |
| Zach Gorman | be3d407 | 2004-08-16 19:50:44 +0000 | [diff] [blame] | 1441 | |
| Mikhail Maroukhine | 6443d87 | 2010-03-26 20:49:09 +0600 | [diff] [blame] | 1442 | ((MyDLGTEMPLATEEX*)pTemplateCopy)->exStyle |= WS_EX_CONTROLPARENT; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1443 | } |
| 1444 | else |
| 1445 | { |
| Mikhail Maroukhine | 6443d87 | 2010-03-26 20:49:09 +0600 | [diff] [blame] | 1446 | pTemplateCopy->style |= WS_CHILD | WS_TABSTOP | DS_CONTROL; |
| 1447 | pTemplateCopy->style &= ~DS_MODALFRAME; |
| 1448 | pTemplateCopy->style &= ~WS_CAPTION; |
| 1449 | pTemplateCopy->style &= ~WS_SYSMENU; |
| 1450 | pTemplateCopy->style &= ~WS_POPUP; |
| 1451 | pTemplateCopy->style &= ~WS_DISABLED; |
| 1452 | pTemplateCopy->style &= ~WS_VISIBLE; |
| 1453 | pTemplateCopy->style &= ~WS_THICKFRAME; |
| Zach Gorman | be3d407 | 2004-08-16 19:50:44 +0000 | [diff] [blame] | 1454 | |
| Mikhail Maroukhine | 6443d87 | 2010-03-26 20:49:09 +0600 | [diff] [blame] | 1455 | pTemplateCopy->dwExtendedStyle |= WS_EX_CONTROLPARENT; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1456 | } |
| 1457 | |
| 1458 | if (psInfo->proppage[index].useCallback) |
| Huw Davies | e63e39f | 2003-11-04 04:23:00 +0000 | [diff] [blame] | 1459 | (*(ppshpage->pfnCallback))(0, PSPCB_CREATE, |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 1460 | (LPPROPSHEETPAGEW)ppshpage); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1461 | |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 1462 | if(ppshpage->dwFlags & PSP_INTERNAL_UNICODE) |
| 1463 | hwndPage = CreateDialogIndirectParamW(ppshpage->hInstance, |
| Mikhail Maroukhine | 6443d87 | 2010-03-26 20:49:09 +0600 | [diff] [blame] | 1464 | pTemplateCopy, |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 1465 | hwndParent, |
| 1466 | ppshpage->pfnDlgProc, |
| 1467 | (LPARAM)ppshpage); |
| 1468 | else |
| 1469 | hwndPage = CreateDialogIndirectParamA(ppshpage->hInstance, |
| Mikhail Maroukhine | 6443d87 | 2010-03-26 20:49:09 +0600 | [diff] [blame] | 1470 | pTemplateCopy, |
| Marcus Meissner | 3f28432 | 1999-05-08 15:38:57 +0000 | [diff] [blame] | 1471 | hwndParent, |
| 1472 | ppshpage->pfnDlgProc, |
| Marcus Meissner | 4a3b0e3 | 1999-05-08 18:28:13 +0000 | [diff] [blame] | 1473 | (LPARAM)ppshpage); |
| Dmitry Timoshkov | 9965390 | 2000-11-09 20:25:27 +0000 | [diff] [blame] | 1474 | /* Free a no more needed copy */ |
| Mikhail Maroukhine | 6443d87 | 2010-03-26 20:49:09 +0600 | [diff] [blame] | 1475 | Free(pTemplateCopy); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1476 | |
| Matt Chapman | c286ca0 | 2004-02-25 01:24:22 +0000 | [diff] [blame] | 1477 | psInfo->proppage[index].hwndPage = hwndPage; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1478 | |
| Filip Navara | 8a8a66c | 2004-09-13 19:17:00 +0000 | [diff] [blame] | 1479 | /* Subclass exterior wizard pages */ |
| 1480 | if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) && |
| 1481 | (psInfo->ppshheader.dwFlags & PSH_WATERMARK) && |
| 1482 | (ppshpage->dwFlags & PSP_HIDEHEADER)) |
| 1483 | { |
| 1484 | SetWindowSubclass(hwndPage, PROPSHEET_WizardSubclassProc, 1, |
| 1485 | (DWORD_PTR)ppshpage); |
| 1486 | } |
| Frank Richter | 5c3f6bc | 2005-07-18 10:31:06 +0000 | [diff] [blame] | 1487 | if (!(psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD)) |
| 1488 | EnableThemeDialogTexture (hwndPage, ETDT_ENABLETAB); |
| Filip Navara | 8a8a66c | 2004-09-13 19:17:00 +0000 | [diff] [blame] | 1489 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1490 | return TRUE; |
| 1491 | } |
| 1492 | |
| 1493 | /****************************************************************************** |
| Eric Kohl | bea0555 | 2004-08-09 19:48:04 +0000 | [diff] [blame] | 1494 | * PROPSHEET_LoadWizardBitmaps |
| 1495 | * |
| 1496 | * Loads the watermark and header bitmaps for a wizard. |
| 1497 | */ |
| 1498 | static VOID PROPSHEET_LoadWizardBitmaps(PropSheetInfo *psInfo) |
| 1499 | { |
| 1500 | if (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) |
| 1501 | { |
| 1502 | /* if PSH_USEHBMWATERMARK is not set, load the resource from pszbmWatermark |
| 1503 | and put the HBITMAP in hbmWatermark. Thus all the rest of the code always |
| 1504 | considers hbmWatermark as valid. */ |
| 1505 | if ((psInfo->ppshheader.dwFlags & PSH_WATERMARK) && |
| 1506 | !(psInfo->ppshheader.dwFlags & PSH_USEHBMWATERMARK)) |
| 1507 | { |
| Andrew Talbot | 1bf787d | 2007-12-01 16:14:50 +0000 | [diff] [blame] | 1508 | psInfo->ppshheader.u4.hbmWatermark = |
| Frank Richter | 9e57091 | 2005-08-30 10:07:17 +0000 | [diff] [blame] | 1509 | CreateMappedBitmap(psInfo->ppshheader.hInstance, (INT_PTR)psInfo->ppshheader.u4.pszbmWatermark, 0, NULL, 0); |
| Eric Kohl | bea0555 | 2004-08-09 19:48:04 +0000 | [diff] [blame] | 1510 | } |
| 1511 | |
| 1512 | /* Same behavior as for watermarks */ |
| 1513 | if ((psInfo->ppshheader.dwFlags & PSH_HEADER) && |
| 1514 | !(psInfo->ppshheader.dwFlags & PSH_USEHBMHEADER)) |
| 1515 | { |
| Andrew Talbot | 1bf787d | 2007-12-01 16:14:50 +0000 | [diff] [blame] | 1516 | psInfo->ppshheader.u5.hbmHeader = |
| Frank Richter | 9e57091 | 2005-08-30 10:07:17 +0000 | [diff] [blame] | 1517 | CreateMappedBitmap(psInfo->ppshheader.hInstance, (INT_PTR)psInfo->ppshheader.u5.pszbmHeader, 0, NULL, 0); |
| Eric Kohl | bea0555 | 2004-08-09 19:48:04 +0000 | [diff] [blame] | 1518 | } |
| 1519 | } |
| 1520 | } |
| 1521 | |
| 1522 | |
| 1523 | /****************************************************************************** |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1524 | * PROPSHEET_ShowPage |
| 1525 | * |
| 1526 | * Displays or creates the specified page. |
| 1527 | */ |
| 1528 | static BOOL PROPSHEET_ShowPage(HWND hwndDlg, int index, PropSheetInfo * psInfo) |
| 1529 | { |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1530 | HWND hwndTabCtrl; |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 1531 | HWND hwndLineHeader; |
| Andrew Eikum | ac34e22 | 2009-08-13 17:36:35 -0500 | [diff] [blame] | 1532 | HWND control; |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 1533 | LPCPROPSHEETPAGEW ppshpage; |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1534 | |
| 1535 | TRACE("active_page %d, index %d\n", psInfo->active_page, index); |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 1536 | if (index == psInfo->active_page) |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 1537 | { |
| Jim Aston | fd018cc | 2000-02-26 18:28:38 +0000 | [diff] [blame] | 1538 | if (GetTopWindow(hwndDlg) != psInfo->proppage[index].hwndPage) |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 1539 | SetWindowPos(psInfo->proppage[index].hwndPage, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 1540 | return TRUE; |
| 1541 | } |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1542 | |
| Filip Navara | 002d911 | 2004-09-07 19:31:50 +0000 | [diff] [blame] | 1543 | ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[index].hpage; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1544 | if (psInfo->proppage[index].hwndPage == 0) |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 1545 | { |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1546 | PROPSHEET_CreatePage(hwndDlg, index, psInfo, ppshpage); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1547 | } |
| 1548 | |
| Dmitry Timoshkov | 34cf29e | 2006-05-05 22:58:26 +0900 | [diff] [blame] | 1549 | if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) |
| Filip Navara | 9a0f5ed | 2004-08-09 22:54:14 +0000 | [diff] [blame] | 1550 | { |
| 1551 | PROPSHEET_SetTitleW(hwndDlg, psInfo->ppshheader.dwFlags, |
| 1552 | psInfo->proppage[index].pszText); |
| Andrew Eikum | ac34e22 | 2009-08-13 17:36:35 -0500 | [diff] [blame] | 1553 | |
| 1554 | control = GetNextDlgTabItem(psInfo->proppage[index].hwndPage, NULL, FALSE); |
| 1555 | if(control != NULL) |
| 1556 | SetFocus(control); |
| Filip Navara | 9a0f5ed | 2004-08-09 22:54:14 +0000 | [diff] [blame] | 1557 | } |
| Pavel Roskin | 5b7f03c | 2003-10-02 04:26:53 +0000 | [diff] [blame] | 1558 | |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 1559 | if (psInfo->active_page != -1) |
| 1560 | ShowWindow(psInfo->proppage[psInfo->active_page].hwndPage, SW_HIDE); |
| 1561 | |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1562 | ShowWindow(psInfo->proppage[index].hwndPage, SW_SHOW); |
| 1563 | |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1564 | /* Synchronize current selection with tab control |
| 1565 | * It seems to be needed even in case of PSH_WIZARD (no tab controls there) */ |
| 1566 | hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 1567 | SendMessageW(hwndTabCtrl, TCM_SETCURSEL, index, 0); |
| Jim Aston | fd018cc | 2000-02-26 18:28:38 +0000 | [diff] [blame] | 1568 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1569 | psInfo->active_page = index; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1570 | psInfo->activeValid = TRUE; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1571 | |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 1572 | if (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW) ) |
| 1573 | { |
| 1574 | hwndLineHeader = GetDlgItem(hwndDlg, IDC_SUNKEN_LINEHEADER); |
| 1575 | ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[index].hpage; |
| 1576 | |
| 1577 | if ((ppshpage->dwFlags & PSP_HIDEHEADER) || (!(psInfo->ppshheader.dwFlags & PSH_HEADER)) ) |
| 1578 | ShowWindow(hwndLineHeader, SW_HIDE); |
| 1579 | else |
| 1580 | ShowWindow(hwndLineHeader, SW_SHOW); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 1581 | } |
| 1582 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1583 | return TRUE; |
| 1584 | } |
| 1585 | |
| 1586 | /****************************************************************************** |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1587 | * PROPSHEET_Back |
| 1588 | */ |
| 1589 | static BOOL PROPSHEET_Back(HWND hwndDlg) |
| 1590 | { |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1591 | PSHNOTIFY psn; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1592 | HWND hwndPage; |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 1593 | PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 1594 | LRESULT result; |
| Sander van Leeuwen | d919c27 | 2002-05-14 18:38:07 +0000 | [diff] [blame] | 1595 | int idx; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1596 | |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1597 | TRACE("active_page %d\n", psInfo->active_page); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1598 | if (psInfo->active_page < 0) |
| Adrian Thurston | 7d487c9 | 1999-11-13 20:49:12 +0000 | [diff] [blame] | 1599 | return FALSE; |
| 1600 | |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1601 | psn.hdr.code = PSN_WIZBACK; |
| 1602 | psn.hdr.hwndFrom = hwndDlg; |
| 1603 | psn.hdr.idFrom = 0; |
| 1604 | psn.lParam = 0; |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 1605 | |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1606 | hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; |
| 1607 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 1608 | result = SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 1609 | if (result == -1) |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1610 | return FALSE; |
| Sander van Leeuwen | d919c27 | 2002-05-14 18:38:07 +0000 | [diff] [blame] | 1611 | else if (result == 0) |
| 1612 | idx = psInfo->active_page - 1; |
| 1613 | else |
| 1614 | idx = PROPSHEET_FindPageByResId(psInfo, result); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1615 | |
| Sander van Leeuwen | d919c27 | 2002-05-14 18:38:07 +0000 | [diff] [blame] | 1616 | if (idx >= 0 && idx < psInfo->nPages) |
| Pierre Mageau | 89ab9f0 | 1999-10-13 15:54:08 +0000 | [diff] [blame] | 1617 | { |
| Sander van Leeuwen | d919c27 | 2002-05-14 18:38:07 +0000 | [diff] [blame] | 1618 | if (PROPSHEET_CanSetCurSel(hwndDlg)) |
| Andrew Eikum | ac34e22 | 2009-08-13 17:36:35 -0500 | [diff] [blame] | 1619 | { |
| 1620 | SetFocus(GetDlgItem(hwndDlg, IDC_BACK_BUTTON)); |
| 1621 | SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0); |
| Sander van Leeuwen | d919c27 | 2002-05-14 18:38:07 +0000 | [diff] [blame] | 1622 | PROPSHEET_SetCurSel(hwndDlg, idx, -1, 0); |
| Andrew Eikum | ac34e22 | 2009-08-13 17:36:35 -0500 | [diff] [blame] | 1623 | } |
| Pierre Mageau | 89ab9f0 | 1999-10-13 15:54:08 +0000 | [diff] [blame] | 1624 | } |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1625 | return TRUE; |
| 1626 | } |
| 1627 | |
| 1628 | /****************************************************************************** |
| 1629 | * PROPSHEET_Next |
| 1630 | */ |
| 1631 | static BOOL PROPSHEET_Next(HWND hwndDlg) |
| 1632 | { |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1633 | PSHNOTIFY psn; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1634 | HWND hwndPage; |
| 1635 | LRESULT msgResult = 0; |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 1636 | PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Sander van Leeuwen | d919c27 | 2002-05-14 18:38:07 +0000 | [diff] [blame] | 1637 | int idx; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1638 | |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1639 | TRACE("active_page %d\n", psInfo->active_page); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1640 | if (psInfo->active_page < 0) |
| Adrian Thurston | 7d487c9 | 1999-11-13 20:49:12 +0000 | [diff] [blame] | 1641 | return FALSE; |
| 1642 | |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1643 | psn.hdr.code = PSN_WIZNEXT; |
| 1644 | psn.hdr.hwndFrom = hwndDlg; |
| 1645 | psn.hdr.idFrom = 0; |
| 1646 | psn.lParam = 0; |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 1647 | |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1648 | hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; |
| 1649 | |
| Dimitrie O. Paun | 2fbd839 | 2005-03-23 10:23:23 +0000 | [diff] [blame] | 1650 | msgResult = SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1651 | if (msgResult == -1) |
| 1652 | return FALSE; |
| Sander van Leeuwen | d919c27 | 2002-05-14 18:38:07 +0000 | [diff] [blame] | 1653 | else if (msgResult == 0) |
| 1654 | idx = psInfo->active_page + 1; |
| 1655 | else |
| 1656 | idx = PROPSHEET_FindPageByResId(psInfo, msgResult); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1657 | |
| Sander van Leeuwen | d919c27 | 2002-05-14 18:38:07 +0000 | [diff] [blame] | 1658 | if (idx < psInfo->nPages ) |
| Pierre Mageau | 89ab9f0 | 1999-10-13 15:54:08 +0000 | [diff] [blame] | 1659 | { |
| Sander van Leeuwen | d919c27 | 2002-05-14 18:38:07 +0000 | [diff] [blame] | 1660 | if (PROPSHEET_CanSetCurSel(hwndDlg) != FALSE) |
| Andrew Eikum | ac34e22 | 2009-08-13 17:36:35 -0500 | [diff] [blame] | 1661 | { |
| 1662 | SetFocus(GetDlgItem(hwndDlg, IDC_NEXT_BUTTON)); |
| 1663 | SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0); |
| Sander van Leeuwen | d919c27 | 2002-05-14 18:38:07 +0000 | [diff] [blame] | 1664 | PROPSHEET_SetCurSel(hwndDlg, idx, 1, 0); |
| Andrew Eikum | ac34e22 | 2009-08-13 17:36:35 -0500 | [diff] [blame] | 1665 | } |
| Pierre Mageau | 89ab9f0 | 1999-10-13 15:54:08 +0000 | [diff] [blame] | 1666 | } |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1667 | |
| 1668 | return TRUE; |
| 1669 | } |
| 1670 | |
| 1671 | /****************************************************************************** |
| 1672 | * PROPSHEET_Finish |
| 1673 | */ |
| 1674 | static BOOL PROPSHEET_Finish(HWND hwndDlg) |
| 1675 | { |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1676 | PSHNOTIFY psn; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1677 | HWND hwndPage; |
| 1678 | LRESULT msgResult = 0; |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 1679 | PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1680 | |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1681 | TRACE("active_page %d\n", psInfo->active_page); |
| Adrian Thurston | 7d487c9 | 1999-11-13 20:49:12 +0000 | [diff] [blame] | 1682 | if (psInfo->active_page < 0) |
| 1683 | return FALSE; |
| 1684 | |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1685 | psn.hdr.code = PSN_WIZFINISH; |
| 1686 | psn.hdr.hwndFrom = hwndDlg; |
| 1687 | psn.hdr.idFrom = 0; |
| 1688 | psn.lParam = 0; |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 1689 | |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1690 | hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; |
| 1691 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 1692 | msgResult = SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1693 | |
| 1694 | TRACE("msg result %ld\n", msgResult); |
| 1695 | |
| 1696 | if (msgResult != 0) |
| 1697 | return FALSE; |
| 1698 | |
| Huw Davies | a6e2fe5 | 2006-11-20 12:21:17 +0000 | [diff] [blame] | 1699 | if (psInfo->result == 0) |
| 1700 | psInfo->result = IDOK; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1701 | if (psInfo->isModeless) |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1702 | psInfo->activeValid = FALSE; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1703 | else |
| Huw Davies | 2e301ce | 2005-06-15 19:12:57 +0000 | [diff] [blame] | 1704 | psInfo->ended = TRUE; |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1705 | |
| 1706 | return TRUE; |
| 1707 | } |
| 1708 | |
| 1709 | /****************************************************************************** |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1710 | * PROPSHEET_Apply |
| 1711 | */ |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1712 | static BOOL PROPSHEET_Apply(HWND hwndDlg, LPARAM lParam) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1713 | { |
| 1714 | int i; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1715 | HWND hwndPage; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1716 | PSHNOTIFY psn; |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 1717 | PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1718 | |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1719 | TRACE("active_page %d\n", psInfo->active_page); |
| Adrian Thurston | 7d487c9 | 1999-11-13 20:49:12 +0000 | [diff] [blame] | 1720 | if (psInfo->active_page < 0) |
| 1721 | return FALSE; |
| 1722 | |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1723 | psn.hdr.hwndFrom = hwndDlg; |
| 1724 | psn.hdr.idFrom = 0; |
| 1725 | psn.lParam = 0; |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 1726 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1727 | |
| 1728 | /* |
| 1729 | * Send PSN_KILLACTIVE to the current page. |
| 1730 | */ |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1731 | psn.hdr.code = PSN_KILLACTIVE; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1732 | |
| 1733 | hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; |
| 1734 | |
| Dimitrie O. Paun | 2fbd839 | 2005-03-23 10:23:23 +0000 | [diff] [blame] | 1735 | if (SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn) != FALSE) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1736 | return FALSE; |
| 1737 | |
| 1738 | /* |
| 1739 | * Send PSN_APPLY to all pages. |
| 1740 | */ |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1741 | psn.hdr.code = PSN_APPLY; |
| 1742 | psn.lParam = lParam; |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 1743 | |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 1744 | for (i = 0; i < psInfo->nPages; i++) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1745 | { |
| 1746 | hwndPage = psInfo->proppage[i].hwndPage; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1747 | if (hwndPage) |
| 1748 | { |
| Dimitrie O. Paun | 2fbd839 | 2005-03-23 10:23:23 +0000 | [diff] [blame] | 1749 | switch (SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn)) |
| Eric Pouech | a89063e | 2003-02-24 20:40:45 +0000 | [diff] [blame] | 1750 | { |
| 1751 | case PSNRET_INVALID: |
| 1752 | PROPSHEET_ShowPage(hwndDlg, i, psInfo); |
| 1753 | /* fall through */ |
| 1754 | case PSNRET_INVALID_NOCHANGEPAGE: |
| 1755 | return FALSE; |
| 1756 | } |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1757 | } |
| 1758 | } |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1759 | |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1760 | if(lParam) |
| 1761 | { |
| 1762 | psInfo->activeValid = FALSE; |
| 1763 | } |
| 1764 | else if(psInfo->active_page >= 0) |
| 1765 | { |
| 1766 | psn.hdr.code = PSN_SETACTIVE; |
| 1767 | psn.lParam = 0; |
| 1768 | hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; |
| Dimitrie O. Paun | 2fbd839 | 2005-03-23 10:23:23 +0000 | [diff] [blame] | 1769 | SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1770 | } |
| 1771 | |
| 1772 | return TRUE; |
| 1773 | } |
| 1774 | |
| 1775 | /****************************************************************************** |
| 1776 | * PROPSHEET_Cancel |
| 1777 | */ |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1778 | static void PROPSHEET_Cancel(HWND hwndDlg, LPARAM lParam) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1779 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 1780 | PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Adrian Thurston | 7d487c9 | 1999-11-13 20:49:12 +0000 | [diff] [blame] | 1781 | HWND hwndPage; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1782 | PSHNOTIFY psn; |
| 1783 | int i; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1784 | |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1785 | TRACE("active_page %d\n", psInfo->active_page); |
| Adrian Thurston | 7d487c9 | 1999-11-13 20:49:12 +0000 | [diff] [blame] | 1786 | if (psInfo->active_page < 0) |
| 1787 | return; |
| 1788 | |
| 1789 | hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1790 | psn.hdr.code = PSN_QUERYCANCEL; |
| 1791 | psn.hdr.hwndFrom = hwndDlg; |
| 1792 | psn.hdr.idFrom = 0; |
| 1793 | psn.lParam = 0; |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 1794 | |
| Dimitrie O. Paun | 2fbd839 | 2005-03-23 10:23:23 +0000 | [diff] [blame] | 1795 | if (SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn)) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1796 | return; |
| 1797 | |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1798 | psn.hdr.code = PSN_RESET; |
| 1799 | psn.lParam = lParam; |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 1800 | |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1801 | for (i = 0; i < psInfo->nPages; i++) |
| 1802 | { |
| 1803 | hwndPage = psInfo->proppage[i].hwndPage; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1804 | |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1805 | if (hwndPage) |
| Dimitrie O. Paun | 2fbd839 | 2005-03-23 10:23:23 +0000 | [diff] [blame] | 1806 | SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1807 | } |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1808 | |
| 1809 | if (psInfo->isModeless) |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1810 | { |
| 1811 | /* makes PSM_GETCURRENTPAGEHWND return NULL */ |
| 1812 | psInfo->activeValid = FALSE; |
| 1813 | } |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1814 | else |
| Huw Davies | 2e301ce | 2005-06-15 19:12:57 +0000 | [diff] [blame] | 1815 | psInfo->ended = TRUE; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1816 | } |
| 1817 | |
| 1818 | /****************************************************************************** |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 1819 | * PROPSHEET_Help |
| 1820 | */ |
| 1821 | static void PROPSHEET_Help(HWND hwndDlg) |
| 1822 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 1823 | PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Adrian Thurston | 7d487c9 | 1999-11-13 20:49:12 +0000 | [diff] [blame] | 1824 | HWND hwndPage; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1825 | PSHNOTIFY psn; |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 1826 | |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1827 | TRACE("active_page %d\n", psInfo->active_page); |
| Adrian Thurston | 7d487c9 | 1999-11-13 20:49:12 +0000 | [diff] [blame] | 1828 | if (psInfo->active_page < 0) |
| 1829 | return; |
| 1830 | |
| 1831 | hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1832 | psn.hdr.code = PSN_HELP; |
| 1833 | psn.hdr.hwndFrom = hwndDlg; |
| 1834 | psn.hdr.idFrom = 0; |
| 1835 | psn.lParam = 0; |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 1836 | |
| Dimitrie O. Paun | 2fbd839 | 2005-03-23 10:23:23 +0000 | [diff] [blame] | 1837 | SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 1838 | } |
| 1839 | |
| 1840 | /****************************************************************************** |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1841 | * PROPSHEET_Changed |
| 1842 | */ |
| 1843 | static void PROPSHEET_Changed(HWND hwndDlg, HWND hwndDirtyPage) |
| 1844 | { |
| 1845 | int i; |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 1846 | PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1847 | |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1848 | TRACE("\n"); |
| Marcus Meissner | 623c0d6 | 1999-07-03 16:01:42 +0000 | [diff] [blame] | 1849 | if (!psInfo) return; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1850 | /* |
| 1851 | * Set the dirty flag of this page. |
| 1852 | */ |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 1853 | for (i = 0; i < psInfo->nPages; i++) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1854 | { |
| 1855 | if (psInfo->proppage[i].hwndPage == hwndDirtyPage) |
| 1856 | psInfo->proppage[i].isDirty = TRUE; |
| 1857 | } |
| 1858 | |
| 1859 | /* |
| 1860 | * Enable the Apply button. |
| 1861 | */ |
| 1862 | if (psInfo->hasApply) |
| 1863 | { |
| 1864 | HWND hwndApplyBtn = GetDlgItem(hwndDlg, IDC_APPLY_BUTTON); |
| 1865 | |
| 1866 | EnableWindow(hwndApplyBtn, TRUE); |
| 1867 | } |
| 1868 | } |
| 1869 | |
| 1870 | /****************************************************************************** |
| 1871 | * PROPSHEET_UnChanged |
| 1872 | */ |
| 1873 | static void PROPSHEET_UnChanged(HWND hwndDlg, HWND hwndCleanPage) |
| 1874 | { |
| 1875 | int i; |
| 1876 | BOOL noPageDirty = TRUE; |
| 1877 | HWND hwndApplyBtn = GetDlgItem(hwndDlg, IDC_APPLY_BUTTON); |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 1878 | PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1879 | |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1880 | TRACE("\n"); |
| Adrian Thurston | a0240ca | 1999-10-23 18:59:01 +0000 | [diff] [blame] | 1881 | if ( !psInfo ) return; |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 1882 | for (i = 0; i < psInfo->nPages; i++) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1883 | { |
| 1884 | /* set the specified page as clean */ |
| 1885 | if (psInfo->proppage[i].hwndPage == hwndCleanPage) |
| 1886 | psInfo->proppage[i].isDirty = FALSE; |
| 1887 | |
| 1888 | /* look to see if there's any dirty pages */ |
| 1889 | if (psInfo->proppage[i].isDirty) |
| 1890 | noPageDirty = FALSE; |
| 1891 | } |
| 1892 | |
| 1893 | /* |
| 1894 | * Disable Apply button. |
| 1895 | */ |
| 1896 | if (noPageDirty) |
| 1897 | EnableWindow(hwndApplyBtn, FALSE); |
| 1898 | } |
| 1899 | |
| 1900 | /****************************************************************************** |
| 1901 | * PROPSHEET_PressButton |
| 1902 | */ |
| 1903 | static void PROPSHEET_PressButton(HWND hwndDlg, int buttonID) |
| 1904 | { |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1905 | TRACE("buttonID %d\n", buttonID); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1906 | switch (buttonID) |
| 1907 | { |
| 1908 | case PSBTN_APPLYNOW: |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 1909 | PROPSHEET_DoCommand(hwndDlg, IDC_APPLY_BUTTON); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1910 | break; |
| 1911 | case PSBTN_BACK: |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1912 | PROPSHEET_Back(hwndDlg); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1913 | break; |
| 1914 | case PSBTN_CANCEL: |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 1915 | PROPSHEET_DoCommand(hwndDlg, IDCANCEL); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1916 | break; |
| 1917 | case PSBTN_FINISH: |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1918 | PROPSHEET_Finish(hwndDlg); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1919 | break; |
| 1920 | case PSBTN_HELP: |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 1921 | PROPSHEET_DoCommand(hwndDlg, IDHELP); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1922 | break; |
| 1923 | case PSBTN_NEXT: |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 1924 | PROPSHEET_Next(hwndDlg); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1925 | break; |
| 1926 | case PSBTN_OK: |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 1927 | PROPSHEET_DoCommand(hwndDlg, IDOK); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1928 | break; |
| 1929 | default: |
| Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1930 | FIXME("Invalid button index %d\n", buttonID); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1931 | } |
| 1932 | } |
| 1933 | |
| Pierre Mageau | 89ab9f0 | 1999-10-13 15:54:08 +0000 | [diff] [blame] | 1934 | |
| 1935 | /************************************************************************* |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 1936 | * BOOL PROPSHEET_CanSetCurSel [Internal] |
| Pierre Mageau | 89ab9f0 | 1999-10-13 15:54:08 +0000 | [diff] [blame] | 1937 | * |
| Andreas Mohr | a6d83eb | 2000-12-27 04:02:46 +0000 | [diff] [blame] | 1938 | * Test whether the current page can be changed by sending a PSN_KILLACTIVE |
| Pierre Mageau | 89ab9f0 | 1999-10-13 15:54:08 +0000 | [diff] [blame] | 1939 | * |
| 1940 | * PARAMS |
| 1941 | * hwndDlg [I] handle to a Dialog hWnd |
| 1942 | * |
| 1943 | * RETURNS |
| 1944 | * TRUE if Current Selection can change |
| 1945 | * |
| 1946 | * NOTES |
| 1947 | */ |
| 1948 | static BOOL PROPSHEET_CanSetCurSel(HWND hwndDlg) |
| 1949 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 1950 | PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Pierre Mageau | 89ab9f0 | 1999-10-13 15:54:08 +0000 | [diff] [blame] | 1951 | HWND hwndPage; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1952 | PSHNOTIFY psn; |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1953 | BOOL res = FALSE; |
| Thuy Nguyen | 709b083 | 1999-10-31 02:24:29 +0000 | [diff] [blame] | 1954 | |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1955 | if (!psInfo) |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1956 | { |
| 1957 | res = FALSE; |
| 1958 | goto end; |
| 1959 | } |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1960 | |
| Michael Stefaniuc | 02b4103 | 2010-05-25 10:06:33 +0200 | [diff] [blame] | 1961 | TRACE("active_page %d\n", psInfo->active_page); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1962 | if (psInfo->active_page < 0) |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1963 | { |
| 1964 | res = TRUE; |
| 1965 | goto end; |
| 1966 | } |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1967 | |
| Pierre Mageau | 89ab9f0 | 1999-10-13 15:54:08 +0000 | [diff] [blame] | 1968 | /* |
| 1969 | * Notify the current page. |
| 1970 | */ |
| 1971 | hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1972 | psn.hdr.code = PSN_KILLACTIVE; |
| 1973 | psn.hdr.hwndFrom = hwndDlg; |
| 1974 | psn.hdr.idFrom = 0; |
| 1975 | psn.lParam = 0; |
| Pierre Mageau | 89ab9f0 | 1999-10-13 15:54:08 +0000 | [diff] [blame] | 1976 | |
| Dimitrie O. Paun | 2fbd839 | 2005-03-23 10:23:23 +0000 | [diff] [blame] | 1977 | res = !SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1978 | |
| 1979 | end: |
| 1980 | TRACE("<-- %d\n", res); |
| 1981 | return res; |
| Pierre Mageau | 89ab9f0 | 1999-10-13 15:54:08 +0000 | [diff] [blame] | 1982 | } |
| 1983 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1984 | /****************************************************************************** |
| 1985 | * PROPSHEET_SetCurSel |
| 1986 | */ |
| 1987 | static BOOL PROPSHEET_SetCurSel(HWND hwndDlg, |
| 1988 | int index, |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 1989 | int skipdir, |
| 1990 | HPROPSHEETPAGE hpage |
| 1991 | ) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1992 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 1993 | PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1994 | HWND hwndHelp = GetDlgItem(hwndDlg, IDHELP); |
| Guy L. Albertelli | 176f5cf | 2002-06-28 17:31:57 +0000 | [diff] [blame] | 1995 | HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1996 | |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 1997 | TRACE("index %d, skipdir %d, hpage %p\n", index, skipdir, hpage); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 1998 | /* hpage takes precedence over index */ |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 1999 | if (hpage != NULL) |
| Thuy Nguyen | 4083d9a | 1999-07-24 10:16:53 +0000 | [diff] [blame] | 2000 | index = PROPSHEET_GetPageIndex(hpage, psInfo); |
| 2001 | |
| Adrian Thurston | 7d487c9 | 1999-11-13 20:49:12 +0000 | [diff] [blame] | 2002 | if (index < 0 || index >= psInfo->nPages) |
| 2003 | { |
| 2004 | TRACE("Could not find page to select!\n"); |
| 2005 | return FALSE; |
| Thuy Nguyen | 4083d9a | 1999-07-24 10:16:53 +0000 | [diff] [blame] | 2006 | } |
| 2007 | |
| Aric Stewart | 2a8463b | 2007-03-30 11:35:12 -0500 | [diff] [blame] | 2008 | /* unset active page while doing this transition. */ |
| 2009 | if (psInfo->active_page != -1) |
| 2010 | ShowWindow(psInfo->proppage[psInfo->active_page].hwndPage, SW_HIDE); |
| 2011 | psInfo->active_page = -1; |
| 2012 | |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 2013 | while (1) { |
| Jim Aston | fd018cc | 2000-02-26 18:28:38 +0000 | [diff] [blame] | 2014 | int result; |
| 2015 | PSHNOTIFY psn; |
| Filip Navara | 32b23b3 | 2004-09-07 20:28:14 +0000 | [diff] [blame] | 2016 | RECT rc; |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 2017 | LPCPROPSHEETPAGEW ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[index].hpage; |
| Jim Aston | fd018cc | 2000-02-26 18:28:38 +0000 | [diff] [blame] | 2018 | |
| Guy L. Albertelli | 176f5cf | 2002-06-28 17:31:57 +0000 | [diff] [blame] | 2019 | if (hwndTabControl) |
| 2020 | SendMessageW(hwndTabControl, TCM_SETCURSEL, index, 0); |
| 2021 | |
| Jim Aston | fd018cc | 2000-02-26 18:28:38 +0000 | [diff] [blame] | 2022 | psn.hdr.code = PSN_SETACTIVE; |
| 2023 | psn.hdr.hwndFrom = hwndDlg; |
| 2024 | psn.hdr.idFrom = 0; |
| 2025 | psn.lParam = 0; |
| 2026 | |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 2027 | if (!psInfo->proppage[index].hwndPage) { |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 2028 | PROPSHEET_CreatePage(hwndDlg, index, psInfo, ppshpage); |
| 2029 | } |
| Jim Aston | fd018cc | 2000-02-26 18:28:38 +0000 | [diff] [blame] | 2030 | |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 2031 | /* Resize the property sheet page to the fit in the Tab control |
| 2032 | * (for regular property sheets) or to fit in the client area (for |
| 2033 | * wizards). |
| 2034 | * NOTE: The resizing happens every time the page is selected and |
| Filip Navara | 32b23b3 | 2004-09-07 20:28:14 +0000 | [diff] [blame] | 2035 | * not only when it's created (some applications depend on it). */ |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 2036 | PROPSHEET_GetPageRect(psInfo, hwndDlg, &rc, ppshpage); |
| Lei Zhang | 3980401 | 2008-01-24 15:06:37 -0800 | [diff] [blame] | 2037 | TRACE("setting page %p, rc (%s) w=%d, h=%d\n", |
| 2038 | psInfo->proppage[index].hwndPage, wine_dbgstr_rect(&rc), |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 2039 | rc.right - rc.left, rc.bottom - rc.top); |
| 2040 | SetWindowPos(psInfo->proppage[index].hwndPage, HWND_TOP, |
| 2041 | rc.left, rc.top, |
| 2042 | rc.right - rc.left, rc.bottom - rc.top, 0); |
| Filip Navara | 32b23b3 | 2004-09-07 20:28:14 +0000 | [diff] [blame] | 2043 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2044 | result = SendMessageW(psInfo->proppage[index].hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 2045 | if (!result) |
| 2046 | break; |
| 2047 | if (result == -1) { |
| 2048 | index+=skipdir; |
| 2049 | if (index < 0) { |
| 2050 | index = 0; |
| Huw Davies | f94159c | 2003-11-03 22:15:39 +0000 | [diff] [blame] | 2051 | WARN("Tried to skip before first property sheet page!\n"); |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 2052 | break; |
| 2053 | } |
| 2054 | if (index >= psInfo->nPages) { |
| Huw Davies | f94159c | 2003-11-03 22:15:39 +0000 | [diff] [blame] | 2055 | WARN("Tried to skip after last property sheet page!\n"); |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 2056 | index = psInfo->nPages-1; |
| 2057 | break; |
| 2058 | } |
| 2059 | } |
| Sander van Leeuwen | d919c27 | 2002-05-14 18:38:07 +0000 | [diff] [blame] | 2060 | else if (result != 0) |
| 2061 | { |
| Huw Davies | f94159c | 2003-11-03 22:15:39 +0000 | [diff] [blame] | 2062 | int old_index = index; |
| 2063 | index = PROPSHEET_FindPageByResId(psInfo, result); |
| 2064 | if(index >= psInfo->nPages) { |
| 2065 | index = old_index; |
| Detlef Riekenberg | efb13b2 | 2007-12-07 21:01:34 +0100 | [diff] [blame] | 2066 | WARN("Tried to skip to nonexistent page by res id\n"); |
| Huw Davies | f94159c | 2003-11-03 22:15:39 +0000 | [diff] [blame] | 2067 | break; |
| 2068 | } |
| 2069 | continue; |
| Sander van Leeuwen | d919c27 | 2002-05-14 18:38:07 +0000 | [diff] [blame] | 2070 | } |
| Jim Aston | fd018cc | 2000-02-26 18:28:38 +0000 | [diff] [blame] | 2071 | } |
| Huw Davies | d1be762 | 2006-07-31 15:28:17 +0100 | [diff] [blame] | 2072 | |
| 2073 | /* Invalidate the header area */ |
| 2074 | if ( (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) && |
| 2075 | (psInfo->ppshheader.dwFlags & PSH_HEADER) ) |
| 2076 | { |
| 2077 | HWND hwndLineHeader = GetDlgItem(hwndDlg, IDC_SUNKEN_LINEHEADER); |
| 2078 | RECT r; |
| 2079 | |
| 2080 | GetClientRect(hwndLineHeader, &r); |
| 2081 | MapWindowPoints(hwndLineHeader, hwndDlg, (LPPOINT) &r, 2); |
| 2082 | SetRect(&r, 0, 0, r.right + 1, r.top - 1); |
| 2083 | |
| 2084 | InvalidateRect(hwndDlg, &r, TRUE); |
| 2085 | } |
| 2086 | |
| Jim Aston | fd018cc | 2000-02-26 18:28:38 +0000 | [diff] [blame] | 2087 | /* |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2088 | * Display the new page. |
| 2089 | */ |
| 2090 | PROPSHEET_ShowPage(hwndDlg, index, psInfo); |
| 2091 | |
| 2092 | if (psInfo->proppage[index].hasHelp) |
| 2093 | EnableWindow(hwndHelp, TRUE); |
| 2094 | else |
| 2095 | EnableWindow(hwndHelp, FALSE); |
| 2096 | |
| 2097 | return TRUE; |
| 2098 | } |
| 2099 | |
| 2100 | /****************************************************************************** |
| Andriy Palamarchuk | a6affaa | 2002-08-26 21:47:06 +0000 | [diff] [blame] | 2101 | * PROPSHEET_SetCurSelId |
| 2102 | * |
| 2103 | * Selects the page, specified by resource id. |
| 2104 | */ |
| 2105 | static void PROPSHEET_SetCurSelId(HWND hwndDlg, int id) |
| 2106 | { |
| 2107 | int idx; |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2108 | PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Andriy Palamarchuk | a6affaa | 2002-08-26 21:47:06 +0000 | [diff] [blame] | 2109 | |
| 2110 | idx = PROPSHEET_FindPageByResId(psInfo, id); |
| 2111 | if (idx < psInfo->nPages ) |
| 2112 | { |
| 2113 | if (PROPSHEET_CanSetCurSel(hwndDlg) != FALSE) |
| 2114 | PROPSHEET_SetCurSel(hwndDlg, idx, 1, 0); |
| 2115 | } |
| 2116 | } |
| 2117 | |
| 2118 | /****************************************************************************** |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2119 | * PROPSHEET_SetTitleA |
| 2120 | */ |
| 2121 | static void PROPSHEET_SetTitleA(HWND hwndDlg, DWORD dwStyle, LPCSTR lpszText) |
| 2122 | { |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 2123 | if(!IS_INTRESOURCE(lpszText)) |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2124 | { |
| 2125 | WCHAR szTitle[256]; |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 2126 | MultiByteToWideChar(CP_ACP, 0, lpszText, -1, |
| Marcus Meissner | bd7ec9a | 2005-09-12 22:07:53 +0000 | [diff] [blame] | 2127 | szTitle, sizeof(szTitle)/sizeof(WCHAR)); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2128 | PROPSHEET_SetTitleW(hwndDlg, dwStyle, szTitle); |
| 2129 | } |
| 2130 | else |
| 2131 | { |
| 2132 | PROPSHEET_SetTitleW(hwndDlg, dwStyle, (LPCWSTR)lpszText); |
| 2133 | } |
| 2134 | } |
| Eric Pouech | e72a9b6 | 1999-11-07 05:28:32 +0000 | [diff] [blame] | 2135 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2136 | /****************************************************************************** |
| 2137 | * PROPSHEET_SetTitleW |
| 2138 | */ |
| 2139 | static void PROPSHEET_SetTitleW(HWND hwndDlg, DWORD dwStyle, LPCWSTR lpszText) |
| 2140 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2141 | PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| 2142 | WCHAR szTitle[256]; |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2143 | |
| Francois Gouget | aab5e58 | 2007-01-18 11:40:15 +0100 | [diff] [blame] | 2144 | TRACE("%s (style %08x)\n", debugstr_w(lpszText), dwStyle); |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 2145 | if (IS_INTRESOURCE(lpszText)) { |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 2146 | if (!LoadStringW(psInfo->ppshheader.hInstance, |
| Rob Shearman | fd291ed | 2008-02-15 10:05:36 +0000 | [diff] [blame] | 2147 | LOWORD(lpszText), szTitle, sizeof(szTitle)/sizeof(szTitle[0]))) |
| Eric Pouech | e72a9b6 | 1999-11-07 05:28:32 +0000 | [diff] [blame] | 2148 | return; |
| 2149 | lpszText = szTitle; |
| 2150 | } |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2151 | if (dwStyle & PSH_PROPTITLE) |
| 2152 | { |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2153 | WCHAR* dest; |
| 2154 | int lentitle = strlenW(lpszText); |
| 2155 | int lenprop = strlenW(psInfo->strPropertiesFor); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2156 | |
| Dimitrie O. Paun | 7de279a | 2003-09-22 21:32:33 +0000 | [diff] [blame] | 2157 | dest = Alloc( (lentitle + lenprop + 1)*sizeof (WCHAR)); |
| Mikołaj Zalewski | 7ce1bb8 | 2006-07-12 19:16:10 +0200 | [diff] [blame] | 2158 | wsprintfW(dest, psInfo->strPropertiesFor, lpszText); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2159 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2160 | SetWindowTextW(hwndDlg, dest); |
| Dimitrie O. Paun | 7de279a | 2003-09-22 21:32:33 +0000 | [diff] [blame] | 2161 | Free(dest); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2162 | } |
| 2163 | else |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2164 | SetWindowTextW(hwndDlg, lpszText); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2165 | } |
| 2166 | |
| 2167 | /****************************************************************************** |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 2168 | * PROPSHEET_SetFinishTextA |
| 2169 | */ |
| 2170 | static void PROPSHEET_SetFinishTextA(HWND hwndDlg, LPCSTR lpszText) |
| 2171 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2172 | PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 2173 | HWND hwndButton = GetDlgItem(hwndDlg, IDC_FINISH_BUTTON); |
| 2174 | |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 2175 | TRACE("'%s'\n", lpszText); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 2176 | /* Set text, show and enable the Finish button */ |
| 2177 | SetWindowTextA(hwndButton, lpszText); |
| 2178 | ShowWindow(hwndButton, SW_SHOW); |
| 2179 | EnableWindow(hwndButton, TRUE); |
| 2180 | |
| 2181 | /* Make it default pushbutton */ |
| Dimitrie O. Paun | 2fbd839 | 2005-03-23 10:23:23 +0000 | [diff] [blame] | 2182 | SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 2183 | |
| 2184 | /* Hide Back button */ |
| 2185 | hwndButton = GetDlgItem(hwndDlg, IDC_BACK_BUTTON); |
| 2186 | ShowWindow(hwndButton, SW_HIDE); |
| 2187 | |
| Thomas Weidenmueller | 6ea26b5 | 2005-07-15 09:59:04 +0000 | [diff] [blame] | 2188 | if (!psInfo->hasFinish) |
| 2189 | { |
| 2190 | /* Hide Next button */ |
| 2191 | hwndButton = GetDlgItem(hwndDlg, IDC_NEXT_BUTTON); |
| 2192 | ShowWindow(hwndButton, SW_HIDE); |
| 2193 | } |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 2194 | } |
| 2195 | |
| 2196 | /****************************************************************************** |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2197 | * PROPSHEET_SetFinishTextW |
| 2198 | */ |
| 2199 | static void PROPSHEET_SetFinishTextW(HWND hwndDlg, LPCWSTR lpszText) |
| 2200 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2201 | PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2202 | HWND hwndButton = GetDlgItem(hwndDlg, IDC_FINISH_BUTTON); |
| 2203 | |
| Francois Gouget | aab5e58 | 2007-01-18 11:40:15 +0100 | [diff] [blame] | 2204 | TRACE("%s\n", debugstr_w(lpszText)); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2205 | /* Set text, show and enable the Finish button */ |
| 2206 | SetWindowTextW(hwndButton, lpszText); |
| 2207 | ShowWindow(hwndButton, SW_SHOW); |
| 2208 | EnableWindow(hwndButton, TRUE); |
| 2209 | |
| 2210 | /* Make it default pushbutton */ |
| 2211 | SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); |
| 2212 | |
| 2213 | /* Hide Back button */ |
| 2214 | hwndButton = GetDlgItem(hwndDlg, IDC_BACK_BUTTON); |
| 2215 | ShowWindow(hwndButton, SW_HIDE); |
| 2216 | |
| Thomas Weidenmueller | 6ea26b5 | 2005-07-15 09:59:04 +0000 | [diff] [blame] | 2217 | if (!psInfo->hasFinish) |
| 2218 | { |
| 2219 | /* Hide Next button */ |
| 2220 | hwndButton = GetDlgItem(hwndDlg, IDC_NEXT_BUTTON); |
| 2221 | ShowWindow(hwndButton, SW_HIDE); |
| 2222 | } |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2223 | } |
| 2224 | |
| 2225 | /****************************************************************************** |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2226 | * PROPSHEET_QuerySiblings |
| 2227 | */ |
| 2228 | static LRESULT PROPSHEET_QuerySiblings(HWND hwndDlg, |
| 2229 | WPARAM wParam, LPARAM lParam) |
| 2230 | { |
| 2231 | int i = 0; |
| 2232 | HWND hwndPage; |
| 2233 | LRESULT msgResult = 0; |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2234 | PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2235 | |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2236 | while ((i < psInfo->nPages) && (msgResult == 0)) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2237 | { |
| 2238 | hwndPage = psInfo->proppage[i].hwndPage; |
| Dimitrie O. Paun | 2fbd839 | 2005-03-23 10:23:23 +0000 | [diff] [blame] | 2239 | msgResult = SendMessageW(hwndPage, PSM_QUERYSIBLINGS, wParam, lParam); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2240 | i++; |
| 2241 | } |
| 2242 | |
| 2243 | return msgResult; |
| 2244 | } |
| 2245 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2246 | |
| 2247 | /****************************************************************************** |
| 2248 | * PROPSHEET_AddPage |
| 2249 | */ |
| 2250 | static BOOL PROPSHEET_AddPage(HWND hwndDlg, |
| 2251 | HPROPSHEETPAGE hpage) |
| 2252 | { |
| Thomas Weidenmueller | 3faa66e | 2005-12-31 13:12:19 +0100 | [diff] [blame] | 2253 | PropPageInfo * ppi; |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2254 | PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2255 | HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2256 | TCITEMW item; |
| 2257 | LPCPROPSHEETPAGEW ppsp = (LPCPROPSHEETPAGEW)hpage; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2258 | |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 2259 | TRACE("hpage %p\n", hpage); |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2260 | /* |
| 2261 | * Allocate and fill in a new PropPageInfo entry. |
| 2262 | */ |
| Michael Stefaniuc | b723e6f | 2008-10-23 23:52:10 +0200 | [diff] [blame] | 2263 | ppi = ReAlloc(psInfo->proppage, sizeof(PropPageInfo) * (psInfo->nPages + 1)); |
| Thomas Weidenmueller | 3faa66e | 2005-12-31 13:12:19 +0100 | [diff] [blame] | 2264 | if (!ppi) |
| 2265 | return FALSE; |
| 2266 | |
| 2267 | psInfo->proppage = ppi; |
| Aric Stewart | 7d947c1 | 2007-09-13 07:53:45 -0500 | [diff] [blame] | 2268 | if (!PROPSHEET_CollectPageInfo(ppsp, psInfo, psInfo->nPages, FALSE)) |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 2269 | return FALSE; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2270 | |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2271 | psInfo->proppage[psInfo->nPages].hpage = hpage; |
| 2272 | |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2273 | if (ppsp->dwFlags & PSP_PREMATURE) |
| 2274 | { |
| 2275 | /* Create the page but don't show it */ |
| 2276 | PROPSHEET_CreatePage(hwndDlg, psInfo->nPages, psInfo, ppsp); |
| 2277 | } |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2278 | |
| 2279 | /* |
| 2280 | * Add a new tab to the tab control. |
| 2281 | */ |
| 2282 | item.mask = TCIF_TEXT; |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2283 | item.pszText = (LPWSTR) psInfo->proppage[psInfo->nPages].pszText; |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2284 | item.cchTextMax = MAX_TABTEXT_LENGTH; |
| 2285 | |
| Guy L. Albertelli | 6c7769e | 2002-06-14 23:26:37 +0000 | [diff] [blame] | 2286 | if (psInfo->hImageList) |
| 2287 | { |
| 2288 | SendMessageW(hwndTabControl, TCM_SETIMAGELIST, 0, (LPARAM)psInfo->hImageList); |
| 2289 | } |
| 2290 | |
| 2291 | if ( psInfo->proppage[psInfo->nPages].hasIcon ) |
| 2292 | { |
| 2293 | item.mask |= TCIF_IMAGE; |
| 2294 | item.iImage = psInfo->nPages; |
| 2295 | } |
| 2296 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2297 | SendMessageW(hwndTabControl, TCM_INSERTITEMW, psInfo->nPages + 1, |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2298 | (LPARAM)&item); |
| 2299 | |
| 2300 | psInfo->nPages++; |
| 2301 | |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2302 | /* If it is the only page - show it */ |
| 2303 | if(psInfo->nPages == 1) |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 2304 | PROPSHEET_SetCurSel(hwndDlg, 0, 1, 0); |
| Thuy Nguyen | ac514e1 | 1999-10-31 18:29:47 +0000 | [diff] [blame] | 2305 | return TRUE; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2306 | } |
| 2307 | |
| 2308 | /****************************************************************************** |
| 2309 | * PROPSHEET_RemovePage |
| 2310 | */ |
| 2311 | static BOOL PROPSHEET_RemovePage(HWND hwndDlg, |
| 2312 | int index, |
| 2313 | HPROPSHEETPAGE hpage) |
| 2314 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2315 | PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2316 | HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL); |
| Marcus Meissner | 3cdb3f2 | 1999-10-13 12:31:52 +0000 | [diff] [blame] | 2317 | PropPageInfo* oldPages; |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2318 | |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 2319 | TRACE("index %d, hpage %p\n", index, hpage); |
| Marcus Meissner | 3cdb3f2 | 1999-10-13 12:31:52 +0000 | [diff] [blame] | 2320 | if (!psInfo) { |
| Marcus Meissner | 3cdb3f2 | 1999-10-13 12:31:52 +0000 | [diff] [blame] | 2321 | return FALSE; |
| 2322 | } |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2323 | /* |
| 2324 | * hpage takes precedence over index. |
| 2325 | */ |
| 2326 | if (hpage != 0) |
| 2327 | { |
| 2328 | index = PROPSHEET_GetPageIndex(hpage, psInfo); |
| Ulrich Czekalla | 6966c65 | 1999-10-23 23:59:47 +0000 | [diff] [blame] | 2329 | } |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2330 | |
| Andreas Mohr | d511177 | 2000-08-26 20:28:02 +0000 | [diff] [blame] | 2331 | /* Make sure that index is within range */ |
| Ulrich Czekalla | 6966c65 | 1999-10-23 23:59:47 +0000 | [diff] [blame] | 2332 | if (index < 0 || index >= psInfo->nPages) |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2333 | { |
| Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2334 | TRACE("Could not find page to remove!\n"); |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2335 | return FALSE; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2336 | } |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2337 | |
| Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2338 | TRACE("total pages %d removing page %d active page %d\n", |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2339 | psInfo->nPages, index, psInfo->active_page); |
| 2340 | /* |
| 2341 | * Check if we're removing the active page. |
| 2342 | */ |
| 2343 | if (index == psInfo->active_page) |
| 2344 | { |
| 2345 | if (psInfo->nPages > 1) |
| 2346 | { |
| 2347 | if (index > 0) |
| 2348 | { |
| 2349 | /* activate previous page */ |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 2350 | PROPSHEET_SetCurSel(hwndDlg, index - 1, -1, 0); |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2351 | } |
| 2352 | else |
| 2353 | { |
| 2354 | /* activate the next page */ |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 2355 | PROPSHEET_SetCurSel(hwndDlg, index + 1, 1, 0); |
| Noomen Hamza | 6ce3425 | 2000-06-07 02:01:28 +0000 | [diff] [blame] | 2356 | psInfo->active_page = index; |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2357 | } |
| 2358 | } |
| 2359 | else |
| 2360 | { |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2361 | psInfo->active_page = -1; |
| 2362 | if (!psInfo->isModeless) |
| 2363 | { |
| Huw Davies | 2e301ce | 2005-06-15 19:12:57 +0000 | [diff] [blame] | 2364 | psInfo->ended = TRUE; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2365 | return TRUE; |
| 2366 | } |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2367 | } |
| 2368 | } |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2369 | else if (index < psInfo->active_page) |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2370 | psInfo->active_page--; |
| 2371 | |
| Filip Navara | 8a8a66c | 2004-09-13 19:17:00 +0000 | [diff] [blame] | 2372 | /* Unsubclass the page dialog window */ |
| 2373 | if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD) && |
| 2374 | (psInfo->ppshheader.dwFlags & PSH_WATERMARK) && |
| 2375 | ((PROPSHEETPAGEW*)psInfo->proppage[index].hpage)->dwFlags & PSP_HIDEHEADER)) |
| 2376 | { |
| 2377 | RemoveWindowSubclass(psInfo->proppage[index].hwndPage, |
| 2378 | PROPSHEET_WizardSubclassProc, 1); |
| 2379 | } |
| 2380 | |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2381 | /* Destroy page dialog window */ |
| 2382 | DestroyWindow(psInfo->proppage[index].hwndPage); |
| 2383 | |
| 2384 | /* Free page resources */ |
| 2385 | if(psInfo->proppage[index].hpage) |
| 2386 | { |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2387 | PROPSHEETPAGEW* psp = (PROPSHEETPAGEW*)psInfo->proppage[index].hpage; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2388 | |
| Michael Stefaniuc | 22ecd7a | 2007-03-07 21:55:31 +0100 | [diff] [blame] | 2389 | if (psp->dwFlags & PSP_USETITLE) |
| Dimitrie O. Paun | 8df71a6 | 2005-03-25 20:49:00 +0000 | [diff] [blame] | 2390 | Free ((LPVOID)psInfo->proppage[index].pszText); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2391 | |
| 2392 | DestroyPropertySheetPage(psInfo->proppage[index].hpage); |
| 2393 | } |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 2394 | |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2395 | /* Remove the tab */ |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2396 | SendMessageW(hwndTabControl, TCM_DELETEITEM, index, 0); |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2397 | |
| Matt Chapman | c286ca0 | 2004-02-25 01:24:22 +0000 | [diff] [blame] | 2398 | oldPages = psInfo->proppage; |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2399 | psInfo->nPages--; |
| Dimitrie O. Paun | 7de279a | 2003-09-22 21:32:33 +0000 | [diff] [blame] | 2400 | psInfo->proppage = Alloc(sizeof(PropPageInfo) * psInfo->nPages); |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2401 | |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 2402 | if (index > 0) |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2403 | memcpy(&psInfo->proppage[0], &oldPages[0], index * sizeof(PropPageInfo)); |
| 2404 | |
| 2405 | if (index < psInfo->nPages) |
| 2406 | memcpy(&psInfo->proppage[index], &oldPages[index + 1], |
| 2407 | (psInfo->nPages - index) * sizeof(PropPageInfo)); |
| 2408 | |
| Dimitrie O. Paun | 7de279a | 2003-09-22 21:32:33 +0000 | [diff] [blame] | 2409 | Free(oldPages); |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2410 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2411 | return FALSE; |
| 2412 | } |
| 2413 | |
| 2414 | /****************************************************************************** |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 2415 | * PROPSHEET_SetWizButtons |
| 2416 | * |
| 2417 | * This code will work if (and assumes that) the Next button is on top of the |
| 2418 | * Finish button. ie. Finish comes after Next in the Z order. |
| 2419 | * This means make sure the dialog template reflects this. |
| 2420 | * |
| 2421 | */ |
| 2422 | static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags) |
| 2423 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2424 | PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2425 | HWND hwndBack = GetDlgItem(hwndDlg, IDC_BACK_BUTTON); |
| 2426 | HWND hwndNext = GetDlgItem(hwndDlg, IDC_NEXT_BUTTON); |
| 2427 | HWND hwndFinish = GetDlgItem(hwndDlg, IDC_FINISH_BUTTON); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 2428 | |
| Michael Ploujnikov | 1c16d83 | 2006-10-13 09:34:21 -0400 | [diff] [blame] | 2429 | TRACE("%d\n", dwFlags); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 2430 | |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2431 | EnableWindow(hwndBack, FALSE); |
| 2432 | EnableWindow(hwndNext, FALSE); |
| 2433 | EnableWindow(hwndFinish, FALSE); |
| 2434 | |
| Robert Shearman | a247e69 | 2006-05-20 15:31:10 +0100 | [diff] [blame] | 2435 | /* set the default pushbutton to an enabled button */ |
| 2436 | if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH)) |
| 2437 | SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); |
| 2438 | else if (dwFlags & PSWIZB_NEXT) |
| 2439 | SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0); |
| 2440 | else if (dwFlags & PSWIZB_BACK) |
| 2441 | SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0); |
| 2442 | else |
| 2443 | SendMessageW(hwndDlg, DM_SETDEFID, IDCANCEL, 0); |
| 2444 | |
| 2445 | |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 2446 | if (dwFlags & PSWIZB_BACK) |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2447 | EnableWindow(hwndBack, TRUE); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 2448 | |
| 2449 | if (dwFlags & PSWIZB_NEXT) |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2450 | EnableWindow(hwndNext, TRUE); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 2451 | |
| Thomas Weidenmueller | 6ea26b5 | 2005-07-15 09:59:04 +0000 | [diff] [blame] | 2452 | if (!psInfo->hasFinish) |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 2453 | { |
| Thomas Weidenmueller | 6ea26b5 | 2005-07-15 09:59:04 +0000 | [diff] [blame] | 2454 | if ((dwFlags & PSWIZB_FINISH) || (dwFlags & PSWIZB_DISABLEDFINISH)) |
| 2455 | { |
| 2456 | /* Hide the Next button */ |
| 2457 | ShowWindow(hwndNext, SW_HIDE); |
| 2458 | |
| 2459 | /* Show the Finish button */ |
| 2460 | ShowWindow(hwndFinish, SW_SHOW); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 2461 | |
| Thomas Weidenmueller | 6ea26b5 | 2005-07-15 09:59:04 +0000 | [diff] [blame] | 2462 | if (!(dwFlags & PSWIZB_DISABLEDFINISH)) |
| Thomas Weidenmueller | 6ea26b5 | 2005-07-15 09:59:04 +0000 | [diff] [blame] | 2463 | EnableWindow(hwndFinish, TRUE); |
| Thomas Weidenmueller | 6ea26b5 | 2005-07-15 09:59:04 +0000 | [diff] [blame] | 2464 | } |
| Robert Shearman | 2682ff4 | 2006-05-20 15:31:01 +0100 | [diff] [blame] | 2465 | else |
| 2466 | { |
| 2467 | /* Hide the Finish button */ |
| 2468 | ShowWindow(hwndFinish, SW_HIDE); |
| 2469 | /* Show the Next button */ |
| 2470 | ShowWindow(hwndNext, SW_SHOW); |
| 2471 | } |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 2472 | } |
| Thomas Weidenmueller | 6ea26b5 | 2005-07-15 09:59:04 +0000 | [diff] [blame] | 2473 | else if (!(dwFlags & PSWIZB_DISABLEDFINISH)) |
| 2474 | EnableWindow(hwndFinish, TRUE); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 2475 | } |
| 2476 | |
| 2477 | /****************************************************************************** |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 2478 | * PROPSHEET_InsertPage |
| 2479 | */ |
| 2480 | static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, HPROPSHEETPAGE hpage) |
| 2481 | { |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 2482 | if (IS_INTRESOURCE(hpageInsertAfter)) |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 2483 | FIXME("(%p, %d, %p): stub\n", hwndDlg, LOWORD(hpageInsertAfter), hpage); |
| 2484 | else |
| 2485 | FIXME("(%p, %p, %p): stub\n", hwndDlg, hpageInsertAfter, hpage); |
| 2486 | return FALSE; |
| 2487 | } |
| 2488 | |
| 2489 | /****************************************************************************** |
| 2490 | * PROPSHEET_SetHeaderTitleW |
| 2491 | */ |
| 2492 | static void PROPSHEET_SetHeaderTitleW(HWND hwndDlg, int iPageIndex, LPCWSTR pszHeaderTitle) |
| 2493 | { |
| 2494 | FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_w(pszHeaderTitle)); |
| 2495 | } |
| 2496 | |
| 2497 | /****************************************************************************** |
| 2498 | * PROPSHEET_SetHeaderTitleA |
| 2499 | */ |
| 2500 | static void PROPSHEET_SetHeaderTitleA(HWND hwndDlg, int iPageIndex, LPCSTR pszHeaderTitle) |
| 2501 | { |
| 2502 | FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_a(pszHeaderTitle)); |
| 2503 | } |
| 2504 | |
| 2505 | /****************************************************************************** |
| 2506 | * PROPSHEET_SetHeaderSubTitleW |
| 2507 | */ |
| 2508 | static void PROPSHEET_SetHeaderSubTitleW(HWND hwndDlg, int iPageIndex, LPCWSTR pszHeaderSubTitle) |
| 2509 | { |
| 2510 | FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_w(pszHeaderSubTitle)); |
| 2511 | } |
| 2512 | |
| 2513 | /****************************************************************************** |
| 2514 | * PROPSHEET_SetHeaderSubTitleA |
| 2515 | */ |
| 2516 | static void PROPSHEET_SetHeaderSubTitleA(HWND hwndDlg, int iPageIndex, LPCSTR pszHeaderSubTitle) |
| 2517 | { |
| 2518 | FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_a(pszHeaderSubTitle)); |
| 2519 | } |
| 2520 | |
| 2521 | /****************************************************************************** |
| 2522 | * PROPSHEET_HwndToIndex |
| 2523 | */ |
| 2524 | static LRESULT PROPSHEET_HwndToIndex(HWND hwndDlg, HWND hPageDlg) |
| 2525 | { |
| Robert Shearman | 0d9f93a | 2004-07-12 23:48:11 +0000 | [diff] [blame] | 2526 | int index; |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2527 | PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Robert Shearman | 0d9f93a | 2004-07-12 23:48:11 +0000 | [diff] [blame] | 2528 | |
| 2529 | TRACE("(%p, %p)\n", hwndDlg, hPageDlg); |
| 2530 | |
| 2531 | for (index = 0; index < psInfo->nPages; index++) |
| 2532 | if (psInfo->proppage[index].hwndPage == hPageDlg) |
| 2533 | return index; |
| Robert Shearman | 0d9f93a | 2004-07-12 23:48:11 +0000 | [diff] [blame] | 2534 | WARN("%p not found\n", hPageDlg); |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 2535 | return -1; |
| 2536 | } |
| 2537 | |
| 2538 | /****************************************************************************** |
| 2539 | * PROPSHEET_IndexToHwnd |
| 2540 | */ |
| 2541 | static LRESULT PROPSHEET_IndexToHwnd(HWND hwndDlg, int iPageIndex) |
| 2542 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2543 | PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Marcus Meissner | e5a5e72 | 2004-08-02 18:24:58 +0000 | [diff] [blame] | 2544 | TRACE("(%p, %d)\n", hwndDlg, iPageIndex); |
| Ričardas Barkauskas | a8f89a2 | 2009-10-17 19:11:29 +0300 | [diff] [blame] | 2545 | if (!psInfo) |
| 2546 | return 0; |
| Marcus Meissner | e5a5e72 | 2004-08-02 18:24:58 +0000 | [diff] [blame] | 2547 | if (iPageIndex<0 || iPageIndex>=psInfo->nPages) { |
| 2548 | WARN("%d out of range.\n", iPageIndex); |
| 2549 | return 0; |
| 2550 | } |
| 2551 | return (LRESULT)psInfo->proppage[iPageIndex].hwndPage; |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 2552 | } |
| 2553 | |
| 2554 | /****************************************************************************** |
| 2555 | * PROPSHEET_PageToIndex |
| 2556 | */ |
| 2557 | static LRESULT PROPSHEET_PageToIndex(HWND hwndDlg, HPROPSHEETPAGE hPage) |
| 2558 | { |
| Filip Navara | 67c8cb2 | 2004-09-20 19:13:36 +0000 | [diff] [blame] | 2559 | int index; |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2560 | PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Filip Navara | 67c8cb2 | 2004-09-20 19:13:36 +0000 | [diff] [blame] | 2561 | |
| 2562 | TRACE("(%p, %p)\n", hwndDlg, hPage); |
| 2563 | |
| 2564 | for (index = 0; index < psInfo->nPages; index++) |
| 2565 | if (psInfo->proppage[index].hpage == hPage) |
| 2566 | return index; |
| 2567 | WARN("%p not found\n", hPage); |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 2568 | return -1; |
| 2569 | } |
| 2570 | |
| 2571 | /****************************************************************************** |
| 2572 | * PROPSHEET_IndexToPage |
| 2573 | */ |
| 2574 | static LRESULT PROPSHEET_IndexToPage(HWND hwndDlg, int iPageIndex) |
| 2575 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2576 | PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Filip Navara | 67c8cb2 | 2004-09-20 19:13:36 +0000 | [diff] [blame] | 2577 | TRACE("(%p, %d)\n", hwndDlg, iPageIndex); |
| 2578 | if (iPageIndex<0 || iPageIndex>=psInfo->nPages) { |
| 2579 | WARN("%d out of range.\n", iPageIndex); |
| 2580 | return 0; |
| 2581 | } |
| 2582 | return (LRESULT)psInfo->proppage[iPageIndex].hpage; |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 2583 | } |
| 2584 | |
| 2585 | /****************************************************************************** |
| 2586 | * PROPSHEET_IdToIndex |
| 2587 | */ |
| 2588 | static LRESULT PROPSHEET_IdToIndex(HWND hwndDlg, int iPageId) |
| 2589 | { |
| Thomas Weidenmueller | 2e7f3ad | 2005-07-15 11:42:18 +0000 | [diff] [blame] | 2590 | int index; |
| 2591 | LPCPROPSHEETPAGEW psp; |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2592 | PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Thomas Weidenmueller | 2e7f3ad | 2005-07-15 11:42:18 +0000 | [diff] [blame] | 2593 | TRACE("(%p, %d)\n", hwndDlg, iPageId); |
| 2594 | for (index = 0; index < psInfo->nPages; index++) { |
| 2595 | psp = (LPCPROPSHEETPAGEW)psInfo->proppage[index].hpage; |
| Frank Richter | 9e57091 | 2005-08-30 10:07:17 +0000 | [diff] [blame] | 2596 | if (psp->u.pszTemplate == MAKEINTRESOURCEW(iPageId)) |
| Thomas Weidenmueller | 2e7f3ad | 2005-07-15 11:42:18 +0000 | [diff] [blame] | 2597 | return index; |
| 2598 | } |
| 2599 | |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 2600 | return -1; |
| 2601 | } |
| 2602 | |
| 2603 | /****************************************************************************** |
| 2604 | * PROPSHEET_IndexToId |
| 2605 | */ |
| 2606 | static LRESULT PROPSHEET_IndexToId(HWND hwndDlg, int iPageIndex) |
| 2607 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2608 | PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Filip Navara | 67c8cb2 | 2004-09-20 19:13:36 +0000 | [diff] [blame] | 2609 | LPCPROPSHEETPAGEW psp; |
| 2610 | TRACE("(%p, %d)\n", hwndDlg, iPageIndex); |
| 2611 | if (iPageIndex<0 || iPageIndex>=psInfo->nPages) { |
| 2612 | WARN("%d out of range.\n", iPageIndex); |
| 2613 | return 0; |
| 2614 | } |
| 2615 | psp = (LPCPROPSHEETPAGEW)psInfo->proppage[iPageIndex].hpage; |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 2616 | if (psp->dwFlags & PSP_DLGINDIRECT || !IS_INTRESOURCE(psp->u.pszTemplate)) { |
| Filip Navara | 67c8cb2 | 2004-09-20 19:13:36 +0000 | [diff] [blame] | 2617 | return 0; |
| 2618 | } |
| 2619 | return (LRESULT)psp->u.pszTemplate; |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 2620 | } |
| 2621 | |
| 2622 | /****************************************************************************** |
| 2623 | * PROPSHEET_GetResult |
| 2624 | */ |
| 2625 | static LRESULT PROPSHEET_GetResult(HWND hwndDlg) |
| 2626 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2627 | PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); |
| Huw Davies | c18af41 | 2006-11-02 12:26:22 +0000 | [diff] [blame] | 2628 | return psInfo->result; |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 2629 | } |
| 2630 | |
| 2631 | /****************************************************************************** |
| 2632 | * PROPSHEET_RecalcPageSizes |
| 2633 | */ |
| 2634 | static BOOL PROPSHEET_RecalcPageSizes(HWND hwndDlg) |
| 2635 | { |
| 2636 | FIXME("(%p): stub\n", hwndDlg); |
| 2637 | return FALSE; |
| 2638 | } |
| 2639 | |
| 2640 | /****************************************************************************** |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2641 | * PROPSHEET_GetPageIndex |
| 2642 | * |
| 2643 | * Given a HPROPSHEETPAGE, returns the index of the corresponding page from |
| 2644 | * the array of PropPageInfo. |
| 2645 | */ |
| Andrew Talbot | abf4d3b | 2007-03-31 17:43:35 +0100 | [diff] [blame] | 2646 | static int PROPSHEET_GetPageIndex(HPROPSHEETPAGE hpage, const PropSheetInfo* psInfo) |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2647 | { |
| 2648 | BOOL found = FALSE; |
| 2649 | int index = 0; |
| 2650 | |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 2651 | TRACE("hpage %p\n", hpage); |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2652 | while ((index < psInfo->nPages) && (found == FALSE)) |
| 2653 | { |
| 2654 | if (psInfo->proppage[index].hpage == hpage) |
| 2655 | found = TRUE; |
| 2656 | else |
| 2657 | index++; |
| 2658 | } |
| 2659 | |
| 2660 | if (found == FALSE) |
| 2661 | index = -1; |
| 2662 | |
| 2663 | return index; |
| 2664 | } |
| 2665 | |
| 2666 | /****************************************************************************** |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2667 | * PROPSHEET_CleanUp |
| 2668 | */ |
| 2669 | static void PROPSHEET_CleanUp(HWND hwndDlg) |
| 2670 | { |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2671 | int i; |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2672 | PropSheetInfo* psInfo = RemovePropW(hwndDlg, PropSheetInfoStr); |
| Thuy Nguyen | 85411af | 1999-08-14 15:51:10 +0000 | [diff] [blame] | 2673 | |
| 2674 | TRACE("\n"); |
| Lawson Whitney | a77f8d3 | 2001-12-19 18:46:49 +0000 | [diff] [blame] | 2675 | if (!psInfo) return; |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 2676 | if (!IS_INTRESOURCE(psInfo->ppshheader.pszCaption)) |
| Dimitrie O. Paun | 8df71a6 | 2005-03-25 20:49:00 +0000 | [diff] [blame] | 2677 | Free ((LPVOID)psInfo->ppshheader.pszCaption); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2678 | |
| 2679 | for (i = 0; i < psInfo->nPages; i++) |
| 2680 | { |
| 2681 | PROPSHEETPAGEA* psp = (PROPSHEETPAGEA*)psInfo->proppage[i].hpage; |
| 2682 | |
| Filip Navara | 8a8a66c | 2004-09-13 19:17:00 +0000 | [diff] [blame] | 2683 | /* Unsubclass the page dialog window */ |
| 2684 | if((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_NEW | PSH_WIZARD97_OLD)) && |
| 2685 | (psInfo->ppshheader.dwFlags & PSH_WATERMARK) && |
| 2686 | (psp->dwFlags & PSP_HIDEHEADER)) |
| 2687 | { |
| 2688 | RemoveWindowSubclass(psInfo->proppage[i].hwndPage, |
| 2689 | PROPSHEET_WizardSubclassProc, 1); |
| 2690 | } |
| 2691 | |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2692 | if(psInfo->proppage[i].hwndPage) |
| 2693 | DestroyWindow(psInfo->proppage[i].hwndPage); |
| 2694 | |
| 2695 | if(psp) |
| 2696 | { |
| Michael Stefaniuc | 22ecd7a | 2007-03-07 21:55:31 +0100 | [diff] [blame] | 2697 | if (psp->dwFlags & PSP_USETITLE) |
| Dimitrie O. Paun | 8df71a6 | 2005-03-25 20:49:00 +0000 | [diff] [blame] | 2698 | Free ((LPVOID)psInfo->proppage[i].pszText); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2699 | |
| 2700 | DestroyPropertySheetPage(psInfo->proppage[i].hpage); |
| 2701 | } |
| 2702 | } |
| 2703 | |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 2704 | DeleteObject(psInfo->hFont); |
| 2705 | DeleteObject(psInfo->hFontBold); |
| 2706 | /* If we created the bitmaps, destroy them */ |
| 2707 | if ((psInfo->ppshheader.dwFlags & PSH_WATERMARK) && |
| 2708 | (!(psInfo->ppshheader.dwFlags & PSH_USEHBMWATERMARK)) ) |
| 2709 | DeleteObject(psInfo->ppshheader.u4.hbmWatermark); |
| 2710 | if ((psInfo->ppshheader.dwFlags & PSH_HEADER) && |
| 2711 | (!(psInfo->ppshheader.dwFlags & PSH_USEHBMHEADER)) ) |
| 2712 | DeleteObject(psInfo->ppshheader.u5.hbmHeader); |
| 2713 | |
| Dimitrie O. Paun | 7de279a | 2003-09-22 21:32:33 +0000 | [diff] [blame] | 2714 | Free(psInfo->proppage); |
| 2715 | Free(psInfo->strPropertiesFor); |
| Thuy Nguyen | 85411af | 1999-08-14 15:51:10 +0000 | [diff] [blame] | 2716 | ImageList_Destroy(psInfo->hImageList); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2717 | |
| Michael Stefaniuc | da6d792 | 2009-02-13 10:21:25 +0100 | [diff] [blame] | 2718 | GlobalFree(psInfo); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2719 | } |
| 2720 | |
| Andrew Talbot | abf4d3b | 2007-03-31 17:43:35 +0100 | [diff] [blame] | 2721 | static INT do_loop(const PropSheetInfo *psInfo) |
| Huw Davies | 2e301ce | 2005-06-15 19:12:57 +0000 | [diff] [blame] | 2722 | { |
| 2723 | MSG msg; |
| 2724 | INT ret = -1; |
| 2725 | HWND hwnd = psInfo->hwnd; |
| 2726 | |
| 2727 | while(IsWindow(hwnd) && !psInfo->ended && (ret = GetMessageW(&msg, NULL, 0, 0))) |
| 2728 | { |
| 2729 | if(ret == -1) |
| 2730 | break; |
| 2731 | |
| 2732 | if(!IsDialogMessageW(hwnd, &msg)) |
| 2733 | { |
| 2734 | TranslateMessage(&msg); |
| 2735 | DispatchMessageW(&msg); |
| 2736 | } |
| 2737 | } |
| 2738 | |
| 2739 | if(ret == 0) |
| 2740 | { |
| 2741 | PostQuitMessage(msg.wParam); |
| 2742 | ret = -1; |
| 2743 | } |
| 2744 | |
| Huw Davies | 6d0b86a | 2006-11-02 12:21:53 +0000 | [diff] [blame] | 2745 | if(ret != -1) |
| 2746 | ret = psInfo->result; |
| 2747 | |
| Huw Davies | 2e301ce | 2005-06-15 19:12:57 +0000 | [diff] [blame] | 2748 | DestroyWindow(hwnd); |
| 2749 | return ret; |
| 2750 | } |
| 2751 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2752 | /****************************************************************************** |
| Lei Zhang | 0cbee49 | 2007-06-25 23:56:24 -0700 | [diff] [blame] | 2753 | * PROPSHEET_PropertySheet |
| 2754 | * |
| 2755 | * Common code between PropertySheetA/W |
| 2756 | */ |
| 2757 | static INT_PTR PROPSHEET_PropertySheet(PropSheetInfo* psInfo, BOOL unicode) |
| 2758 | { |
| 2759 | INT_PTR bRet = 0; |
| Vincent Povirk | 2893294 | 2008-07-08 16:43:03 -0500 | [diff] [blame] | 2760 | HWND parent = NULL; |
| Lei Zhang | 0cbee49 | 2007-06-25 23:56:24 -0700 | [diff] [blame] | 2761 | if (psInfo->active_page >= psInfo->nPages) psInfo->active_page = 0; |
| 2762 | TRACE("startpage: %d of %d pages\n", psInfo->active_page, psInfo->nPages); |
| 2763 | |
| 2764 | psInfo->unicode = unicode; |
| 2765 | psInfo->ended = FALSE; |
| 2766 | |
| Vincent Povirk | 2893294 | 2008-07-08 16:43:03 -0500 | [diff] [blame] | 2767 | if(!psInfo->isModeless) |
| 2768 | { |
| 2769 | parent = psInfo->ppshheader.hwndParent; |
| 2770 | if (parent) EnableWindow(parent, FALSE); |
| 2771 | } |
| Lei Zhang | 0cbee49 | 2007-06-25 23:56:24 -0700 | [diff] [blame] | 2772 | bRet = PROPSHEET_CreateDialog(psInfo); |
| 2773 | if(!psInfo->isModeless) |
| 2774 | { |
| Lei Zhang | 0cbee49 | 2007-06-25 23:56:24 -0700 | [diff] [blame] | 2775 | bRet = do_loop(psInfo); |
| 2776 | if (parent) EnableWindow(parent, TRUE); |
| 2777 | } |
| 2778 | return bRet; |
| 2779 | } |
| 2780 | |
| 2781 | /****************************************************************************** |
| Patrik Stridvall | 4325554 | 2002-08-09 01:07:29 +0000 | [diff] [blame] | 2782 | * PropertySheet (COMCTL32.@) |
| 2783 | * PropertySheetA (COMCTL32.@) |
| Robert Shearman | 57cc6f5 | 2004-02-27 04:40:08 +0000 | [diff] [blame] | 2784 | * |
| 2785 | * Creates a property sheet in the specified property sheet header. |
| 2786 | * |
| 2787 | * RETURNS |
| 2788 | * Modal property sheets: Positive if successful or -1 otherwise. |
| 2789 | * Modeless property sheets: Property sheet handle. |
| 2790 | * Or: |
| 2791 | *| ID_PSREBOOTSYSTEM - The user must reboot the computer for the changes to take effect. |
| 2792 | *| ID_PSRESTARTWINDOWS - The user must restart Windows for the changes to take effect. |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 2793 | */ |
| Frank Richter | 9e57091 | 2005-08-30 10:07:17 +0000 | [diff] [blame] | 2794 | INT_PTR WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh) |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 2795 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2796 | PropSheetInfo* psInfo = GlobalAlloc(GPTR, sizeof(PropSheetInfo)); |
| Rolf Kalbermatter | 6c79930 | 2002-12-16 22:43:58 +0000 | [diff] [blame] | 2797 | UINT i, n; |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 2798 | const BYTE* pByte; |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 2799 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2800 | TRACE("(%p)\n", lppsh); |
| 2801 | |
| 2802 | PROPSHEET_CollectSheetInfoA(lppsh, psInfo); |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2803 | |
| Michael Stefaniuc | b723e6f | 2008-10-23 23:52:10 +0200 | [diff] [blame] | 2804 | psInfo->proppage = Alloc(sizeof(PropPageInfo) * lppsh->nPages); |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 2805 | pByte = (const BYTE*) psInfo->ppshheader.u3.ppsp; |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2806 | |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 2807 | for (n = i = 0; i < lppsh->nPages; i++, n++) |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2808 | { |
| Lei Zhang | e3b80a0 | 2007-06-26 00:22:19 -0700 | [diff] [blame] | 2809 | if (!psInfo->usePropPage) |
| Slava Monich | 5b0ace1 | 2000-07-08 12:48:13 +0000 | [diff] [blame] | 2810 | psInfo->proppage[n].hpage = psInfo->ppshheader.u3.phpage[i]; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2811 | else |
| 2812 | { |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 2813 | psInfo->proppage[n].hpage = CreatePropertySheetPageA((LPCPROPSHEETPAGEA)pByte); |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 2814 | pByte += ((LPCPROPSHEETPAGEA)pByte)->dwSize; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2815 | } |
| 2816 | |
| Guy L. Albertelli | 7f9baba | 2002-05-14 03:48:48 +0000 | [diff] [blame] | 2817 | if (!PROPSHEET_CollectPageInfo((LPCPROPSHEETPAGEW)psInfo->proppage[n].hpage, |
| Aric Stewart | 7d947c1 | 2007-09-13 07:53:45 -0500 | [diff] [blame] | 2818 | psInfo, n, TRUE)) |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 2819 | { |
| Lei Zhang | e3b80a0 | 2007-06-26 00:22:19 -0700 | [diff] [blame] | 2820 | if (psInfo->usePropPage) |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 2821 | DestroyPropertySheetPage(psInfo->proppage[n].hpage); |
| 2822 | n--; |
| 2823 | psInfo->nPages--; |
| 2824 | } |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2825 | } |
| Alexandre Julliard | 638f169 | 1999-01-17 16:32:32 +0000 | [diff] [blame] | 2826 | |
| Lei Zhang | 0cbee49 | 2007-06-25 23:56:24 -0700 | [diff] [blame] | 2827 | return PROPSHEET_PropertySheet(psInfo, FALSE); |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 2828 | } |
| 2829 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2830 | /****************************************************************************** |
| Patrik Stridvall | 4325554 | 2002-08-09 01:07:29 +0000 | [diff] [blame] | 2831 | * PropertySheetW (COMCTL32.@) |
| Robert Shearman | 57cc6f5 | 2004-02-27 04:40:08 +0000 | [diff] [blame] | 2832 | * |
| 2833 | * See PropertySheetA. |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 2834 | */ |
| Frank Richter | 9e57091 | 2005-08-30 10:07:17 +0000 | [diff] [blame] | 2835 | INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh) |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 2836 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 2837 | PropSheetInfo* psInfo = GlobalAlloc(GPTR, sizeof(PropSheetInfo)); |
| Rolf Kalbermatter | 6c79930 | 2002-12-16 22:43:58 +0000 | [diff] [blame] | 2838 | UINT i, n; |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 2839 | const BYTE* pByte; |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 2840 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2841 | TRACE("(%p)\n", lppsh); |
| 2842 | |
| 2843 | PROPSHEET_CollectSheetInfoW(lppsh, psInfo); |
| 2844 | |
| Michael Stefaniuc | b723e6f | 2008-10-23 23:52:10 +0200 | [diff] [blame] | 2845 | psInfo->proppage = Alloc(sizeof(PropPageInfo) * lppsh->nPages); |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 2846 | pByte = (const BYTE*) psInfo->ppshheader.u3.ppsp; |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2847 | |
| 2848 | for (n = i = 0; i < lppsh->nPages; i++, n++) |
| 2849 | { |
| Lei Zhang | e3b80a0 | 2007-06-26 00:22:19 -0700 | [diff] [blame] | 2850 | if (!psInfo->usePropPage) |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2851 | psInfo->proppage[n].hpage = psInfo->ppshheader.u3.phpage[i]; |
| 2852 | else |
| 2853 | { |
| 2854 | psInfo->proppage[n].hpage = CreatePropertySheetPageW((LPCPROPSHEETPAGEW)pByte); |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 2855 | pByte += ((LPCPROPSHEETPAGEW)pByte)->dwSize; |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2856 | } |
| 2857 | |
| Guy L. Albertelli | 7f9baba | 2002-05-14 03:48:48 +0000 | [diff] [blame] | 2858 | if (!PROPSHEET_CollectPageInfo((LPCPROPSHEETPAGEW)psInfo->proppage[n].hpage, |
| Aric Stewart | 7d947c1 | 2007-09-13 07:53:45 -0500 | [diff] [blame] | 2859 | psInfo, n, TRUE)) |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2860 | { |
| Lei Zhang | e3b80a0 | 2007-06-26 00:22:19 -0700 | [diff] [blame] | 2861 | if (psInfo->usePropPage) |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2862 | DestroyPropertySheetPage(psInfo->proppage[n].hpage); |
| 2863 | n--; |
| 2864 | psInfo->nPages--; |
| 2865 | } |
| 2866 | } |
| 2867 | |
| Lei Zhang | 0cbee49 | 2007-06-25 23:56:24 -0700 | [diff] [blame] | 2868 | return PROPSHEET_PropertySheet(psInfo, TRUE); |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 2869 | } |
| 2870 | |
| Dmitry Timoshkov | 217dae6 | 2006-06-08 23:56:52 +0900 | [diff] [blame] | 2871 | static LPWSTR load_string( HINSTANCE instance, LPCWSTR str ) |
| 2872 | { |
| 2873 | LPWSTR ret; |
| Dmitry Timoshkov | 217dae6 | 2006-06-08 23:56:52 +0900 | [diff] [blame] | 2874 | |
| 2875 | if (IS_INTRESOURCE(str)) |
| 2876 | { |
| 2877 | HRSRC hrsrc; |
| 2878 | HGLOBAL hmem; |
| 2879 | WCHAR *ptr; |
| 2880 | WORD i, id = LOWORD(str); |
| Rob Shearman | 45f13ce | 2008-02-22 19:17:19 +0000 | [diff] [blame] | 2881 | UINT len; |
| Dmitry Timoshkov | 217dae6 | 2006-06-08 23:56:52 +0900 | [diff] [blame] | 2882 | |
| 2883 | if (!(hrsrc = FindResourceW( instance, MAKEINTRESOURCEW((id >> 4) + 1), (LPWSTR)RT_STRING ))) |
| 2884 | return NULL; |
| 2885 | if (!(hmem = LoadResource( instance, hrsrc ))) return NULL; |
| 2886 | if (!(ptr = LockResource( hmem ))) return NULL; |
| 2887 | for (i = id & 0x0f; i > 0; i--) ptr += *ptr + 1; |
| 2888 | len = *ptr; |
| 2889 | if (!len) return NULL; |
| 2890 | ret = Alloc( (len + 1) * sizeof(WCHAR) ); |
| 2891 | if (ret) |
| 2892 | { |
| 2893 | memcpy( ret, ptr + 1, len * sizeof(WCHAR) ); |
| 2894 | ret[len] = 0; |
| 2895 | } |
| 2896 | } |
| 2897 | else |
| 2898 | { |
| 2899 | int len = (strlenW(str) + 1) * sizeof(WCHAR); |
| 2900 | ret = Alloc( len ); |
| 2901 | if (ret) memcpy( ret, str, len ); |
| 2902 | } |
| 2903 | return ret; |
| 2904 | } |
| 2905 | |
| 2906 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2907 | /****************************************************************************** |
| Patrik Stridvall | 4325554 | 2002-08-09 01:07:29 +0000 | [diff] [blame] | 2908 | * CreatePropertySheetPage (COMCTL32.@) |
| 2909 | * CreatePropertySheetPageA (COMCTL32.@) |
| Robert Shearman | 57cc6f5 | 2004-02-27 04:40:08 +0000 | [diff] [blame] | 2910 | * |
| 2911 | * Creates a new property sheet page. |
| 2912 | * |
| 2913 | * RETURNS |
| 2914 | * Success: Handle to new property sheet page. |
| 2915 | * Failure: NULL. |
| 2916 | * |
| 2917 | * NOTES |
| 2918 | * An application must use the PSM_ADDPAGE message to add the new page to |
| 2919 | * an existing property sheet. |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 2920 | */ |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2921 | HPROPSHEETPAGE WINAPI CreatePropertySheetPageA( |
| 2922 | LPCPROPSHEETPAGEA lpPropSheetPage) |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 2923 | { |
| Dimitrie O. Paun | 7de279a | 2003-09-22 21:32:33 +0000 | [diff] [blame] | 2924 | PROPSHEETPAGEW* ppsp = Alloc(sizeof(PROPSHEETPAGEW)); |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 2925 | |
| François Gouget | 16baace | 2001-01-10 22:42:58 +0000 | [diff] [blame] | 2926 | memcpy(ppsp,lpPropSheetPage,min(lpPropSheetPage->dwSize,sizeof(PROPSHEETPAGEA))); |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 2927 | |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 2928 | ppsp->dwFlags &= ~ PSP_INTERNAL_UNICODE; |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 2929 | |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 2930 | if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) ) |
| 2931 | { |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 2932 | if (!IS_INTRESOURCE( ppsp->u.pszTemplate )) |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 2933 | { |
| 2934 | int len = strlen(lpPropSheetPage->u.pszTemplate) + 1; |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 2935 | char *template = Alloc( len ); |
| 2936 | |
| 2937 | ppsp->u.pszTemplate = (LPWSTR)strcpy( template, lpPropSheetPage->u.pszTemplate ); |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 2938 | } |
| 2939 | } |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2940 | |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 2941 | if (ppsp->dwFlags & PSP_USEICONID) |
| 2942 | { |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 2943 | if (!IS_INTRESOURCE( ppsp->u2.pszIcon )) |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 2944 | PROPSHEET_AtoW(&ppsp->u2.pszIcon, lpPropSheetPage->u2.pszIcon); |
| 2945 | } |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 2946 | |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 2947 | if (ppsp->dwFlags & PSP_USETITLE) |
| 2948 | { |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 2949 | if (!IS_INTRESOURCE( ppsp->pszTitle )) |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 2950 | PROPSHEET_AtoW( &ppsp->pszTitle, lpPropSheetPage->pszTitle ); |
| 2951 | else |
| Dmitry Timoshkov | 217dae6 | 2006-06-08 23:56:52 +0900 | [diff] [blame] | 2952 | ppsp->pszTitle = load_string( ppsp->hInstance, ppsp->pszTitle ); |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 2953 | } |
| 2954 | else |
| 2955 | ppsp->pszTitle = NULL; |
| 2956 | |
| 2957 | if (ppsp->dwFlags & PSP_HIDEHEADER) |
| 2958 | ppsp->dwFlags &= ~(PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE); |
| 2959 | |
| 2960 | if (ppsp->dwFlags & PSP_USEHEADERTITLE) |
| 2961 | { |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 2962 | if (!IS_INTRESOURCE( ppsp->pszHeaderTitle )) |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 2963 | PROPSHEET_AtoW(&ppsp->pszHeaderTitle, lpPropSheetPage->pszHeaderTitle); |
| 2964 | else |
| Dmitry Timoshkov | 217dae6 | 2006-06-08 23:56:52 +0900 | [diff] [blame] | 2965 | ppsp->pszHeaderTitle = load_string( ppsp->hInstance, ppsp->pszHeaderTitle ); |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 2966 | } |
| 2967 | else |
| 2968 | ppsp->pszHeaderTitle = NULL; |
| 2969 | |
| 2970 | if (ppsp->dwFlags & PSP_USEHEADERSUBTITLE) |
| 2971 | { |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 2972 | if (!IS_INTRESOURCE( ppsp->pszHeaderSubTitle )) |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 2973 | PROPSHEET_AtoW(&ppsp->pszHeaderSubTitle, lpPropSheetPage->pszHeaderSubTitle); |
| 2974 | else |
| Dmitry Timoshkov | 217dae6 | 2006-06-08 23:56:52 +0900 | [diff] [blame] | 2975 | ppsp->pszHeaderSubTitle = load_string( ppsp->hInstance, ppsp->pszHeaderSubTitle ); |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 2976 | } |
| 2977 | else |
| 2978 | ppsp->pszHeaderSubTitle = NULL; |
| 2979 | |
| 2980 | return (HPROPSHEETPAGE)ppsp; |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 2981 | } |
| 2982 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 2983 | /****************************************************************************** |
| Patrik Stridvall | 4325554 | 2002-08-09 01:07:29 +0000 | [diff] [blame] | 2984 | * CreatePropertySheetPageW (COMCTL32.@) |
| Robert Shearman | 57cc6f5 | 2004-02-27 04:40:08 +0000 | [diff] [blame] | 2985 | * |
| 2986 | * See CreatePropertySheetA. |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 2987 | */ |
| Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2988 | HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage) |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 2989 | { |
| Dimitrie O. Paun | 7de279a | 2003-09-22 21:32:33 +0000 | [diff] [blame] | 2990 | PROPSHEETPAGEW* ppsp = Alloc(sizeof(PROPSHEETPAGEW)); |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 2991 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 2992 | memcpy(ppsp,lpPropSheetPage,min(lpPropSheetPage->dwSize,sizeof(PROPSHEETPAGEW))); |
| 2993 | |
| Mike McCormack | fc86392 | 2003-07-09 02:49:52 +0000 | [diff] [blame] | 2994 | ppsp->dwFlags |= PSP_INTERNAL_UNICODE; |
| 2995 | |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 2996 | if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) ) |
| 2997 | { |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 2998 | if (!IS_INTRESOURCE( ppsp->u.pszTemplate )) |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 2999 | { |
| 3000 | int len = strlenW(lpPropSheetPage->u.pszTemplate) + 1; |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 3001 | WCHAR *template = Alloc( len * sizeof (WCHAR) ); |
| 3002 | |
| 3003 | ppsp->u.pszTemplate = strcpyW( template, lpPropSheetPage->u.pszTemplate ); |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 3004 | } |
| 3005 | } |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3006 | |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 3007 | if ( ppsp->dwFlags & PSP_USEICONID ) |
| 3008 | { |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 3009 | if (!IS_INTRESOURCE( ppsp->u2.pszIcon )) |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 3010 | { |
| 3011 | int len = strlenW(lpPropSheetPage->u2.pszIcon) + 1; |
| Andrew Talbot | 63246a5 | 2006-11-28 22:23:42 +0000 | [diff] [blame] | 3012 | WCHAR *icon = Alloc( len * sizeof (WCHAR) ); |
| 3013 | |
| 3014 | ppsp->u2.pszIcon = strcpyW( icon, lpPropSheetPage->u2.pszIcon ); |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 3015 | } |
| 3016 | } |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3017 | |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 3018 | if (ppsp->dwFlags & PSP_USETITLE) |
| Dmitry Timoshkov | 217dae6 | 2006-06-08 23:56:52 +0900 | [diff] [blame] | 3019 | ppsp->pszTitle = load_string( ppsp->hInstance, ppsp->pszTitle ); |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 3020 | else |
| 3021 | ppsp->pszTitle = NULL; |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3022 | |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 3023 | if (ppsp->dwFlags & PSP_HIDEHEADER) |
| 3024 | ppsp->dwFlags &= ~(PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE); |
| 3025 | |
| 3026 | if (ppsp->dwFlags & PSP_USEHEADERTITLE) |
| Dmitry Timoshkov | 217dae6 | 2006-06-08 23:56:52 +0900 | [diff] [blame] | 3027 | ppsp->pszHeaderTitle = load_string( ppsp->hInstance, ppsp->pszHeaderTitle ); |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 3028 | else |
| 3029 | ppsp->pszHeaderTitle = NULL; |
| 3030 | |
| 3031 | if (ppsp->dwFlags & PSP_USEHEADERSUBTITLE) |
| Dmitry Timoshkov | 217dae6 | 2006-06-08 23:56:52 +0900 | [diff] [blame] | 3032 | ppsp->pszHeaderSubTitle = load_string( ppsp->hInstance, ppsp->pszHeaderSubTitle ); |
| Dmitry Timoshkov | 3088131 | 2006-05-05 22:58:55 +0900 | [diff] [blame] | 3033 | else |
| 3034 | ppsp->pszHeaderSubTitle = NULL; |
| 3035 | |
| 3036 | return (HPROPSHEETPAGE)ppsp; |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 3037 | } |
| 3038 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3039 | /****************************************************************************** |
| Patrik Stridvall | 4325554 | 2002-08-09 01:07:29 +0000 | [diff] [blame] | 3040 | * DestroyPropertySheetPage (COMCTL32.@) |
| Robert Shearman | 57cc6f5 | 2004-02-27 04:40:08 +0000 | [diff] [blame] | 3041 | * |
| 3042 | * Destroys a property sheet page previously created with |
| 3043 | * CreatePropertySheetA() or CreatePropertySheetW() and frees the associated |
| 3044 | * memory. |
| 3045 | * |
| 3046 | * RETURNS |
| 3047 | * Success: TRUE |
| 3048 | * Failure: FALSE |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 3049 | */ |
| Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 3050 | BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage) |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 3051 | { |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3052 | PROPSHEETPAGEW *psp = (PROPSHEETPAGEW *)hPropPage; |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 3053 | |
| 3054 | if (!psp) |
| 3055 | return FALSE; |
| 3056 | |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 3057 | if (!(psp->dwFlags & PSP_DLGINDIRECT) && !IS_INTRESOURCE( psp->u.pszTemplate )) |
| Dimitrie O. Paun | 8df71a6 | 2005-03-25 20:49:00 +0000 | [diff] [blame] | 3058 | Free ((LPVOID)psp->u.pszTemplate); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 3059 | |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 3060 | if ((psp->dwFlags & PSP_USEICONID) && !IS_INTRESOURCE( psp->u2.pszIcon )) |
| Dimitrie O. Paun | 8df71a6 | 2005-03-25 20:49:00 +0000 | [diff] [blame] | 3061 | Free ((LPVOID)psp->u2.pszIcon); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 3062 | |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 3063 | if ((psp->dwFlags & PSP_USETITLE) && !IS_INTRESOURCE( psp->pszTitle )) |
| Dimitrie O. Paun | 8df71a6 | 2005-03-25 20:49:00 +0000 | [diff] [blame] | 3064 | Free ((LPVOID)psp->pszTitle); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 3065 | |
| André Hentschel | 9e0517a | 2011-12-29 02:51:18 +0100 | [diff] [blame] | 3066 | if ((psp->dwFlags & PSP_USEHEADERTITLE) && !IS_INTRESOURCE( psp->pszHeaderTitle )) |
| 3067 | Free ((LPVOID)psp->pszHeaderTitle); |
| 3068 | |
| 3069 | if ((psp->dwFlags & PSP_USEHEADERSUBTITLE) && !IS_INTRESOURCE( psp->pszHeaderSubTitle )) |
| 3070 | Free ((LPVOID)psp->pszHeaderSubTitle); |
| 3071 | |
| Dimitrie O. Paun | 7de279a | 2003-09-22 21:32:33 +0000 | [diff] [blame] | 3072 | Free(hPropPage); |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 3073 | |
| 3074 | return TRUE; |
| Alexandre Julliard | 0c0e3be | 1998-12-10 15:49:22 +0000 | [diff] [blame] | 3075 | } |
| 3076 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3077 | /****************************************************************************** |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 3078 | * PROPSHEET_IsDialogMessage |
| 3079 | */ |
| 3080 | static BOOL PROPSHEET_IsDialogMessage(HWND hwnd, LPMSG lpMsg) |
| 3081 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 3082 | PropSheetInfo* psInfo = GetPropW(hwnd, PropSheetInfoStr); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 3083 | |
| Andreas Mohr | c457fbd | 2001-08-06 17:51:09 +0000 | [diff] [blame] | 3084 | TRACE("\n"); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 3085 | if (!psInfo || (hwnd != lpMsg->hwnd && !IsChild(hwnd, lpMsg->hwnd))) |
| 3086 | return FALSE; |
| 3087 | |
| 3088 | if (lpMsg->message == WM_KEYDOWN && (GetKeyState(VK_CONTROL) & 0x8000)) |
| 3089 | { |
| 3090 | int new_page = 0; |
| Dimitrie O. Paun | 2fbd839 | 2005-03-23 10:23:23 +0000 | [diff] [blame] | 3091 | INT dlgCode = SendMessageW(lpMsg->hwnd, WM_GETDLGCODE, 0, (LPARAM)lpMsg); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 3092 | |
| 3093 | if (!(dlgCode & DLGC_WANTMESSAGE)) |
| 3094 | { |
| 3095 | switch (lpMsg->wParam) |
| 3096 | { |
| 3097 | case VK_TAB: |
| 3098 | if (GetKeyState(VK_SHIFT) & 0x8000) |
| 3099 | new_page = -1; |
| 3100 | else |
| 3101 | new_page = 1; |
| 3102 | break; |
| 3103 | |
| 3104 | case VK_NEXT: new_page = 1; break; |
| 3105 | case VK_PRIOR: new_page = -1; break; |
| 3106 | } |
| 3107 | } |
| 3108 | |
| 3109 | if (new_page) |
| 3110 | { |
| 3111 | if (PROPSHEET_CanSetCurSel(hwnd) != FALSE) |
| 3112 | { |
| 3113 | new_page += psInfo->active_page; |
| 3114 | |
| 3115 | if (new_page < 0) |
| 3116 | new_page = psInfo->nPages - 1; |
| 3117 | else if (new_page >= psInfo->nPages) |
| 3118 | new_page = 0; |
| 3119 | |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 3120 | PROPSHEET_SetCurSel(hwnd, new_page, 1, 0); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 3121 | } |
| 3122 | |
| 3123 | return TRUE; |
| 3124 | } |
| 3125 | } |
| 3126 | |
| Dimitrie O. Paun | 2fbd839 | 2005-03-23 10:23:23 +0000 | [diff] [blame] | 3127 | return IsDialogMessageW(hwnd, lpMsg); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 3128 | } |
| 3129 | |
| 3130 | /****************************************************************************** |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3131 | * PROPSHEET_DoCommand |
| 3132 | */ |
| 3133 | static BOOL PROPSHEET_DoCommand(HWND hwnd, WORD wID) |
| 3134 | { |
| 3135 | |
| 3136 | switch (wID) { |
| 3137 | |
| 3138 | case IDOK: |
| 3139 | case IDC_APPLY_BUTTON: |
| 3140 | { |
| 3141 | HWND hwndApplyBtn = GetDlgItem(hwnd, IDC_APPLY_BUTTON); |
| 3142 | |
| 3143 | if (PROPSHEET_Apply(hwnd, wID == IDOK ? 1: 0) == FALSE) |
| 3144 | break; |
| 3145 | |
| 3146 | if (wID == IDOK) |
| 3147 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 3148 | PropSheetInfo* psInfo = GetPropW(hwnd, PropSheetInfoStr); |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3149 | |
| Huw Davies | 6d0b86a | 2006-11-02 12:21:53 +0000 | [diff] [blame] | 3150 | /* don't overwrite ID_PSRESTARTWINDOWS or ID_PSREBOOTSYSTEM */ |
| 3151 | if (psInfo->result == 0) |
| 3152 | psInfo->result = IDOK; |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3153 | |
| 3154 | if (psInfo->isModeless) |
| 3155 | psInfo->activeValid = FALSE; |
| 3156 | else |
| Huw Davies | 2e301ce | 2005-06-15 19:12:57 +0000 | [diff] [blame] | 3157 | psInfo->ended = TRUE; |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3158 | } |
| 3159 | else |
| 3160 | EnableWindow(hwndApplyBtn, FALSE); |
| 3161 | |
| 3162 | break; |
| 3163 | } |
| 3164 | |
| 3165 | case IDC_BACK_BUTTON: |
| 3166 | PROPSHEET_Back(hwnd); |
| 3167 | break; |
| 3168 | |
| 3169 | case IDC_NEXT_BUTTON: |
| 3170 | PROPSHEET_Next(hwnd); |
| 3171 | break; |
| 3172 | |
| 3173 | case IDC_FINISH_BUTTON: |
| 3174 | PROPSHEET_Finish(hwnd); |
| 3175 | break; |
| 3176 | |
| 3177 | case IDCANCEL: |
| 3178 | PROPSHEET_Cancel(hwnd, 0); |
| 3179 | break; |
| 3180 | |
| 3181 | case IDHELP: |
| 3182 | PROPSHEET_Help(hwnd); |
| 3183 | break; |
| Ulrich Czekalla | 710bd6f | 2004-01-27 20:11:05 +0000 | [diff] [blame] | 3184 | |
| 3185 | default: |
| 3186 | return FALSE; |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3187 | } |
| 3188 | |
| 3189 | return TRUE; |
| 3190 | } |
| 3191 | |
| 3192 | /****************************************************************************** |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3193 | * PROPSHEET_Paint |
| 3194 | */ |
| Dimitrie O. Paun | b1d65cb | 2005-03-25 10:26:10 +0000 | [diff] [blame] | 3195 | static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam) |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3196 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 3197 | PropSheetInfo* psInfo = GetPropW(hwnd, PropSheetInfoStr); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3198 | PAINTSTRUCT ps; |
| 3199 | HDC hdc, hdcSrc; |
| 3200 | BITMAP bm; |
| 3201 | HBITMAP hbmp; |
| 3202 | HPALETTE hOldPal = 0; |
| 3203 | int offsety = 0; |
| 3204 | HBRUSH hbr; |
| Filip Navara | 8a8a66c | 2004-09-13 19:17:00 +0000 | [diff] [blame] | 3205 | RECT r, rzone; |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3206 | LPCPROPSHEETPAGEW ppshpage; |
| Filip Navara | 335983e | 2004-08-30 18:39:32 +0000 | [diff] [blame] | 3207 | WCHAR szBuffer[256]; |
| 3208 | int nLength; |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3209 | |
| Dimitrie O. Paun | b1d65cb | 2005-03-25 10:26:10 +0000 | [diff] [blame] | 3210 | hdc = hdcParam ? hdcParam : BeginPaint(hwnd, &ps); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3211 | if (!hdc) return 1; |
| 3212 | |
| 3213 | hdcSrc = CreateCompatibleDC(0); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3214 | |
| 3215 | if (psInfo->ppshheader.dwFlags & PSH_USEHPLWATERMARK) |
| 3216 | hOldPal = SelectPalette(hdc, psInfo->ppshheader.hplWatermark, FALSE); |
| 3217 | |
| Francois Gouget | 6deccab | 2011-09-06 00:13:38 +0200 | [diff] [blame] | 3218 | if (psInfo->active_page < 0) |
| 3219 | ppshpage = NULL; |
| 3220 | else |
| 3221 | ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[psInfo->active_page].hpage; |
| 3222 | |
| 3223 | if ( (ppshpage && !(ppshpage->dwFlags & PSP_HIDEHEADER)) && |
| Filip Navara | c846f88 | 2004-07-21 21:17:59 +0000 | [diff] [blame] | 3224 | (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) && |
| 3225 | (psInfo->ppshheader.dwFlags & PSH_HEADER) ) |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3226 | { |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3227 | HWND hwndLineHeader = GetDlgItem(hwnd, IDC_SUNKEN_LINEHEADER); |
| 3228 | HFONT hOldFont; |
| 3229 | COLORREF clrOld = 0; |
| 3230 | int oldBkMode = 0; |
| 3231 | |
| 3232 | hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u5.hbmHeader); |
| Filip Navara | 002d911 | 2004-09-07 19:31:50 +0000 | [diff] [blame] | 3233 | hOldFont = SelectObject(hdc, psInfo->hFontBold); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3234 | |
| 3235 | GetClientRect(hwndLineHeader, &r); |
| 3236 | MapWindowPoints(hwndLineHeader, hwnd, (LPPOINT) &r, 2); |
| Filip Navara | 002d911 | 2004-09-07 19:31:50 +0000 | [diff] [blame] | 3237 | SetRect(&rzone, 0, 0, r.right + 1, r.top - 1); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3238 | |
| Michael Stefaniuc | da6d792 | 2009-02-13 10:21:25 +0100 | [diff] [blame] | 3239 | GetObjectW(psInfo->ppshheader.u5.hbmHeader, sizeof(BITMAP), &bm); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3240 | |
| Filip Navara | 9a0f5ed | 2004-08-09 22:54:14 +0000 | [diff] [blame] | 3241 | if (psInfo->ppshheader.dwFlags & PSH_WIZARD97_OLD) |
| 3242 | { |
| 3243 | /* Fill the unoccupied part of the header with color of the |
| 3244 | * left-top pixel, but do it only when needed. |
| 3245 | */ |
| 3246 | if (bm.bmWidth < r.right || bm.bmHeight < r.bottom) |
| 3247 | { |
| 3248 | hbr = CreateSolidBrush(GetPixel(hdcSrc, 0, 0)); |
| 3249 | CopyRect(&r, &rzone); |
| 3250 | if (bm.bmWidth < r.right) |
| 3251 | { |
| 3252 | r.left = bm.bmWidth; |
| 3253 | FillRect(hdc, &r, hbr); |
| 3254 | } |
| 3255 | if (bm.bmHeight < r.bottom) |
| 3256 | { |
| 3257 | r.left = 0; |
| 3258 | r.top = bm.bmHeight; |
| 3259 | FillRect(hdc, &r, hbr); |
| 3260 | } |
| 3261 | DeleteObject(hbr); |
| 3262 | } |
| Filip Navara | 002d911 | 2004-09-07 19:31:50 +0000 | [diff] [blame] | 3263 | |
| 3264 | /* Draw the header itself. */ |
| 3265 | BitBlt(hdc, 0, 0, |
| 3266 | bm.bmWidth, min(bm.bmHeight, rzone.bottom), |
| 3267 | hdcSrc, 0, 0, SRCCOPY); |
| Filip Navara | 9a0f5ed | 2004-08-09 22:54:14 +0000 | [diff] [blame] | 3268 | } |
| 3269 | else |
| 3270 | { |
| Huw Davies | 608ddd4 | 2006-07-31 15:38:14 +0100 | [diff] [blame] | 3271 | int margin; |
| Filip Navara | 8a8a66c | 2004-09-13 19:17:00 +0000 | [diff] [blame] | 3272 | hbr = GetSysColorBrush(COLOR_WINDOW); |
| Filip Navara | 9a0f5ed | 2004-08-09 22:54:14 +0000 | [diff] [blame] | 3273 | FillRect(hdc, &rzone, hbr); |
| Filip Navara | 002d911 | 2004-09-07 19:31:50 +0000 | [diff] [blame] | 3274 | |
| 3275 | /* Draw the header bitmap. It's always centered like a |
| 3276 | * common 49 x 49 bitmap. */ |
| Huw Davies | 608ddd4 | 2006-07-31 15:38:14 +0100 | [diff] [blame] | 3277 | margin = (rzone.bottom - 49) / 2; |
| 3278 | BitBlt(hdc, rzone.right - 49 - margin, margin, |
| 3279 | min(bm.bmWidth, 49), min(bm.bmHeight, 49), |
| 3280 | hdcSrc, 0, 0, SRCCOPY); |
| Filip Navara | 002d911 | 2004-09-07 19:31:50 +0000 | [diff] [blame] | 3281 | |
| 3282 | /* NOTE: Native COMCTL32 draws a white stripe over the bitmap |
| 3283 | * if its height is smaller than 49 pixels. Because the reason |
| 3284 | * for this bug is unknown the current code doesn't try to |
| 3285 | * replicate it. */ |
| Filip Navara | 9a0f5ed | 2004-08-09 22:54:14 +0000 | [diff] [blame] | 3286 | } |
| Filip Navara | 002d911 | 2004-09-07 19:31:50 +0000 | [diff] [blame] | 3287 | |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3288 | clrOld = SetTextColor (hdc, 0x00000000); |
| 3289 | oldBkMode = SetBkMode (hdc, TRANSPARENT); |
| 3290 | |
| Filip Navara | 335983e | 2004-08-30 18:39:32 +0000 | [diff] [blame] | 3291 | if (ppshpage->dwFlags & PSP_USEHEADERTITLE) { |
| Filip Navara | 002d911 | 2004-09-07 19:31:50 +0000 | [diff] [blame] | 3292 | SetRect(&r, 20, 10, 0, 0); |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 3293 | if (!IS_INTRESOURCE(ppshpage->pszHeaderTitle)) |
| Huw Davies | 64ddc97 | 2006-07-31 12:47:45 +0100 | [diff] [blame] | 3294 | DrawTextW(hdc, ppshpage->pszHeaderTitle, -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3295 | else |
| Filip Navara | 335983e | 2004-08-30 18:39:32 +0000 | [diff] [blame] | 3296 | { |
| Frank Richter | 9e57091 | 2005-08-30 10:07:17 +0000 | [diff] [blame] | 3297 | nLength = LoadStringW(ppshpage->hInstance, (UINT_PTR)ppshpage->pszHeaderTitle, |
| Filip Navara | 335983e | 2004-08-30 18:39:32 +0000 | [diff] [blame] | 3298 | szBuffer, 256); |
| 3299 | if (nLength != 0) |
| 3300 | { |
| Huw Davies | 12c0da6 | 2006-07-31 13:58:43 +0100 | [diff] [blame] | 3301 | DrawTextW(hdc, szBuffer, nLength, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); |
| Filip Navara | 335983e | 2004-08-30 18:39:32 +0000 | [diff] [blame] | 3302 | } |
| 3303 | } |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3304 | } |
| 3305 | |
| 3306 | if (ppshpage->dwFlags & PSP_USEHEADERSUBTITLE) { |
| 3307 | SelectObject(hdc, psInfo->hFont); |
| Filip Navara | 4387895 | 2004-09-13 18:02:32 +0000 | [diff] [blame] | 3308 | SetRect(&r, 40, 25, rzone.right - 69, rzone.bottom); |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 3309 | if (!IS_INTRESOURCE(ppshpage->pszHeaderTitle)) |
| Huw Davies | 12c0da6 | 2006-07-31 13:58:43 +0100 | [diff] [blame] | 3310 | DrawTextW(hdc, ppshpage->pszHeaderSubTitle, -1, &r, DT_LEFT | DT_WORDBREAK); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3311 | else |
| Filip Navara | 335983e | 2004-08-30 18:39:32 +0000 | [diff] [blame] | 3312 | { |
| Frank Richter | 9e57091 | 2005-08-30 10:07:17 +0000 | [diff] [blame] | 3313 | nLength = LoadStringW(ppshpage->hInstance, (UINT_PTR)ppshpage->pszHeaderSubTitle, |
| Filip Navara | 335983e | 2004-08-30 18:39:32 +0000 | [diff] [blame] | 3314 | szBuffer, 256); |
| 3315 | if (nLength != 0) |
| 3316 | { |
| Huw Davies | 12c0da6 | 2006-07-31 13:58:43 +0100 | [diff] [blame] | 3317 | DrawTextW(hdc, szBuffer, nLength, &r, DT_LEFT | DT_WORDBREAK); |
| Filip Navara | 335983e | 2004-08-30 18:39:32 +0000 | [diff] [blame] | 3318 | } |
| 3319 | } |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3320 | } |
| 3321 | |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3322 | offsety = rzone.bottom + 2; |
| 3323 | |
| 3324 | SetTextColor(hdc, clrOld); |
| 3325 | SetBkMode(hdc, oldBkMode); |
| 3326 | SelectObject(hdc, hOldFont); |
| 3327 | SelectObject(hdcSrc, hbmp); |
| 3328 | } |
| 3329 | |
| Francois Gouget | 6deccab | 2011-09-06 00:13:38 +0200 | [diff] [blame] | 3330 | if ( (ppshpage && (ppshpage->dwFlags & PSP_HIDEHEADER)) && |
| Filip Navara | c846f88 | 2004-07-21 21:17:59 +0000 | [diff] [blame] | 3331 | (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) && |
| 3332 | (psInfo->ppshheader.dwFlags & PSH_WATERMARK) ) |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3333 | { |
| Filip Navara | c846f88 | 2004-07-21 21:17:59 +0000 | [diff] [blame] | 3334 | HWND hwndLine = GetDlgItem(hwnd, IDC_SUNKEN_LINE); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3335 | |
| Filip Navara | c846f88 | 2004-07-21 21:17:59 +0000 | [diff] [blame] | 3336 | GetClientRect(hwndLine, &r); |
| 3337 | MapWindowPoints(hwndLine, hwnd, (LPPOINT) &r, 2); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3338 | |
| Filip Navara | 8a8a66c | 2004-09-13 19:17:00 +0000 | [diff] [blame] | 3339 | rzone.left = 0; |
| 3340 | rzone.top = 0; |
| 3341 | rzone.right = r.right; |
| 3342 | rzone.bottom = r.top - 1; |
| 3343 | |
| 3344 | hbr = GetSysColorBrush(COLOR_WINDOW); |
| 3345 | FillRect(hdc, &rzone, hbr); |
| 3346 | |
| Michael Stefaniuc | da6d792 | 2009-02-13 10:21:25 +0100 | [diff] [blame] | 3347 | GetObjectW(psInfo->ppshheader.u4.hbmWatermark, sizeof(BITMAP), &bm); |
| Filip Navara | c846f88 | 2004-07-21 21:17:59 +0000 | [diff] [blame] | 3348 | hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u4.hbmWatermark); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3349 | |
| Huw Davies | 650c9c4 | 2006-08-01 12:22:59 +0100 | [diff] [blame] | 3350 | /* The watermark is truncated to a width of 164 pixels */ |
| 3351 | r.right = min(r.right, 164); |
| Filip Navara | c846f88 | 2004-07-21 21:17:59 +0000 | [diff] [blame] | 3352 | BitBlt(hdc, 0, offsety, min(bm.bmWidth, r.right), |
| 3353 | min(bm.bmHeight, r.bottom), hdcSrc, 0, 0, SRCCOPY); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3354 | |
| Filip Navara | c846f88 | 2004-07-21 21:17:59 +0000 | [diff] [blame] | 3355 | /* If the bitmap is not big enough, fill the remaining area |
| 3356 | with the color of pixel (0,0) of bitmap - see MSDN */ |
| 3357 | if (r.top > bm.bmHeight) { |
| 3358 | r.bottom = r.top - 1; |
| 3359 | r.top = bm.bmHeight; |
| 3360 | r.left = 0; |
| 3361 | r.right = bm.bmWidth; |
| 3362 | hbr = CreateSolidBrush(GetPixel(hdcSrc, 0, 0)); |
| 3363 | FillRect(hdc, &r, hbr); |
| 3364 | DeleteObject(hbr); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3365 | } |
| Filip Navara | c846f88 | 2004-07-21 21:17:59 +0000 | [diff] [blame] | 3366 | |
| 3367 | SelectObject(hdcSrc, hbmp); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3368 | } |
| 3369 | |
| 3370 | if (psInfo->ppshheader.dwFlags & PSH_USEHPLWATERMARK) |
| 3371 | SelectPalette(hdc, hOldPal, FALSE); |
| 3372 | |
| 3373 | DeleteDC(hdcSrc); |
| 3374 | |
| Dimitrie O. Paun | b1d65cb | 2005-03-25 10:26:10 +0000 | [diff] [blame] | 3375 | if (!hdcParam) EndPaint(hwnd, &ps); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3376 | |
| 3377 | return 0; |
| 3378 | } |
| 3379 | |
| 3380 | /****************************************************************************** |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3381 | * PROPSHEET_DialogProc |
| 3382 | */ |
| Dmitry Timoshkov | 154e54e | 2006-05-05 22:59:20 +0900 | [diff] [blame] | 3383 | static INT_PTR CALLBACK |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3384 | PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
| Alexandre Julliard | 638f169 | 1999-01-17 16:32:32 +0000 | [diff] [blame] | 3385 | { |
| Dmitry Timoshkov | 3c9e7a7 | 2007-05-24 23:41:17 +0900 | [diff] [blame] | 3386 | TRACE("hwnd=%p msg=0x%04x wparam=%lx lparam=%lx\n", |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3387 | hwnd, uMsg, wParam, lParam); |
| 3388 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3389 | switch (uMsg) |
| 3390 | { |
| 3391 | case WM_INITDIALOG: |
| 3392 | { |
| 3393 | PropSheetInfo* psInfo = (PropSheetInfo*) lParam; |
| Michael Stefaniuc | b723e6f | 2008-10-23 23:52:10 +0200 | [diff] [blame] | 3394 | WCHAR* strCaption = Alloc(MAX_CAPTION_LENGTH*sizeof(WCHAR)); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3395 | HWND hwndTabCtrl = GetDlgItem(hwnd, IDC_TABCONTROL); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 3396 | int idx; |
| Dimitrie O. Paun | 2fbd839 | 2005-03-23 10:23:23 +0000 | [diff] [blame] | 3397 | LOGFONTW logFont; |
| Alexandre Julliard | 638f169 | 1999-01-17 16:32:32 +0000 | [diff] [blame] | 3398 | |
| Juan Lang | 9a3647a | 2004-03-13 19:24:04 +0000 | [diff] [blame] | 3399 | /* Using PropSheetInfoStr to store extra data doesn't match the native |
| 3400 | * common control: native uses TCM_[GS]ETITEM |
| 3401 | */ |
| Michael Stefaniuc | da6d792 | 2009-02-13 10:21:25 +0100 | [diff] [blame] | 3402 | SetPropW(hwnd, PropSheetInfoStr, psInfo); |
| Adrian Thurston | 7d487c9 | 1999-11-13 20:49:12 +0000 | [diff] [blame] | 3403 | |
| Thuy Nguyen | 43faed9 | 1999-08-18 18:25:46 +0000 | [diff] [blame] | 3404 | /* |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 3405 | * psInfo->hwnd is not being used by WINE code - it exists |
| 3406 | * for compatibility with "real" Windoze. The same about |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3407 | * SetWindowLongPtr - WINE is only using the PropSheetInfoStr |
| Slava Monich | 5b0ace1 | 2000-07-08 12:48:13 +0000 | [diff] [blame] | 3408 | * property. |
| 3409 | */ |
| 3410 | psInfo->hwnd = hwnd; |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3411 | SetWindowLongPtrW(hwnd, DWLP_USER, (DWORD_PTR)psInfo); |
| Slava Monich | 5b0ace1 | 2000-07-08 12:48:13 +0000 | [diff] [blame] | 3412 | |
| Dmitry Timoshkov | 1bf5e12 | 2010-07-22 17:50:41 +0900 | [diff] [blame] | 3413 | if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) |
| 3414 | { |
| 3415 | /* set up the Next and Back buttons by default */ |
| 3416 | PROPSHEET_SetWizButtons(hwnd, PSWIZB_BACK|PSWIZB_NEXT); |
| Dmitry Timoshkov | 1bf5e12 | 2010-07-22 17:50:41 +0900 | [diff] [blame] | 3417 | } |
| Mike McCormack | ec0d425 | 2003-07-21 20:01:59 +0000 | [diff] [blame] | 3418 | |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3419 | /* Set up fonts */ |
| Dimitrie O. Paun | 2fbd839 | 2005-03-23 10:23:23 +0000 | [diff] [blame] | 3420 | SystemParametersInfoW (SPI_GETICONTITLELOGFONT, 0, &logFont, 0); |
| 3421 | psInfo->hFont = CreateFontIndirectW (&logFont); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3422 | logFont.lfWeight = FW_BOLD; |
| Dimitrie O. Paun | 2fbd839 | 2005-03-23 10:23:23 +0000 | [diff] [blame] | 3423 | psInfo->hFontBold = CreateFontIndirectW (&logFont); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3424 | |
| Slava Monich | 5b0ace1 | 2000-07-08 12:48:13 +0000 | [diff] [blame] | 3425 | /* |
| Thuy Nguyen | 43faed9 | 1999-08-18 18:25:46 +0000 | [diff] [blame] | 3426 | * Small icon in the title bar. |
| 3427 | */ |
| Slava Monich | 5b0ace1 | 2000-07-08 12:48:13 +0000 | [diff] [blame] | 3428 | if ((psInfo->ppshheader.dwFlags & PSH_USEICONID) || |
| 3429 | (psInfo->ppshheader.dwFlags & PSH_USEHICON)) |
| Thuy Nguyen | 43faed9 | 1999-08-18 18:25:46 +0000 | [diff] [blame] | 3430 | { |
| 3431 | HICON hIcon; |
| 3432 | int icon_cx = GetSystemMetrics(SM_CXSMICON); |
| 3433 | int icon_cy = GetSystemMetrics(SM_CYSMICON); |
| 3434 | |
| Slava Monich | 5b0ace1 | 2000-07-08 12:48:13 +0000 | [diff] [blame] | 3435 | if (psInfo->ppshheader.dwFlags & PSH_USEICONID) |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3436 | hIcon = LoadImageW(psInfo->ppshheader.hInstance, |
| Peter Hunnisett | 565b008 | 2000-09-19 02:43:00 +0000 | [diff] [blame] | 3437 | psInfo->ppshheader.u.pszIcon, |
| Thuy Nguyen | 43faed9 | 1999-08-18 18:25:46 +0000 | [diff] [blame] | 3438 | IMAGE_ICON, |
| 3439 | icon_cx, icon_cy, |
| 3440 | LR_DEFAULTCOLOR); |
| 3441 | else |
| Peter Hunnisett | 565b008 | 2000-09-19 02:43:00 +0000 | [diff] [blame] | 3442 | hIcon = psInfo->ppshheader.u.hIcon; |
| Thuy Nguyen | 43faed9 | 1999-08-18 18:25:46 +0000 | [diff] [blame] | 3443 | |
| Michael Stefaniuc | bc54d78 | 2002-10-10 21:22:09 +0000 | [diff] [blame] | 3444 | SendMessageW(hwnd, WM_SETICON, 0, (LPARAM)hIcon); |
| Thuy Nguyen | 43faed9 | 1999-08-18 18:25:46 +0000 | [diff] [blame] | 3445 | } |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 3446 | |
| Slava Monich | 5b0ace1 | 2000-07-08 12:48:13 +0000 | [diff] [blame] | 3447 | if (psInfo->ppshheader.dwFlags & PSH_USEHICON) |
| Michael Stefaniuc | bc54d78 | 2002-10-10 21:22:09 +0000 | [diff] [blame] | 3448 | SendMessageW(hwnd, WM_SETICON, 0, (LPARAM)psInfo->ppshheader.u.hIcon); |
| Thuy Nguyen | 43faed9 | 1999-08-18 18:25:46 +0000 | [diff] [blame] | 3449 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3450 | psInfo->strPropertiesFor = strCaption; |
| Alexandre Julliard | 638f169 | 1999-01-17 16:32:32 +0000 | [diff] [blame] | 3451 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3452 | GetWindowTextW(hwnd, psInfo->strPropertiesFor, MAX_CAPTION_LENGTH); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3453 | |
| Thuy Nguyen | 709b083 | 1999-10-31 02:24:29 +0000 | [diff] [blame] | 3454 | PROPSHEET_CreateTabControl(hwnd, psInfo); |
| 3455 | |
| Eric Kohl | bea0555 | 2004-08-09 19:48:04 +0000 | [diff] [blame] | 3456 | PROPSHEET_LoadWizardBitmaps(psInfo); |
| 3457 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3458 | if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3459 | { |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3460 | ShowWindow(hwndTabCtrl, SW_HIDE); |
| Filip Navara | 043e275 | 2004-09-13 23:19:51 +0000 | [diff] [blame] | 3461 | PROPSHEET_AdjustSizeWizard(hwnd, psInfo); |
| 3462 | PROPSHEET_AdjustButtonsWizard(hwnd, psInfo); |
| Dmitry Timoshkov | 09539e4 | 2010-10-05 15:18:21 +0900 | [diff] [blame] | 3463 | SetFocus(GetDlgItem(hwnd, IDC_NEXT_BUTTON)); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 3464 | } |
| 3465 | else |
| 3466 | { |
| Serge Ivanov | c0b824d | 2000-02-25 20:49:49 +0000 | [diff] [blame] | 3467 | if (PROPSHEET_SizeMismatch(hwnd, psInfo)) |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 3468 | { |
| 3469 | PROPSHEET_AdjustSize(hwnd, psInfo); |
| 3470 | PROPSHEET_AdjustButtons(hwnd, psInfo); |
| 3471 | } |
| Dmitry Timoshkov | 09539e4 | 2010-10-05 15:18:21 +0900 | [diff] [blame] | 3472 | SetFocus(GetDlgItem(hwnd, IDOK)); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3473 | } |
| 3474 | |
| Michael Stefaniuc | 223603c | 2010-01-26 00:50:44 +0100 | [diff] [blame] | 3475 | if (IS_INTRESOURCE(psInfo->ppshheader.pszCaption) && |
| Slava Monich | 5b0ace1 | 2000-07-08 12:48:13 +0000 | [diff] [blame] | 3476 | psInfo->ppshheader.hInstance) |
| Ulrich Czekalla | d8eb8c5 | 1999-10-23 16:57:28 +0000 | [diff] [blame] | 3477 | { |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3478 | WCHAR szText[256]; |
| Ulrich Czekalla | d8eb8c5 | 1999-10-23 16:57:28 +0000 | [diff] [blame] | 3479 | |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 3480 | if (LoadStringW(psInfo->ppshheader.hInstance, |
| Frank Richter | 9e57091 | 2005-08-30 10:07:17 +0000 | [diff] [blame] | 3481 | (UINT_PTR)psInfo->ppshheader.pszCaption, szText, 255)) |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3482 | PROPSHEET_SetTitleW(hwnd, psInfo->ppshheader.dwFlags, szText); |
| Ulrich Czekalla | d8eb8c5 | 1999-10-23 16:57:28 +0000 | [diff] [blame] | 3483 | } |
| 3484 | else |
| 3485 | { |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3486 | PROPSHEET_SetTitleW(hwnd, psInfo->ppshheader.dwFlags, |
| Slava Monich | 5b0ace1 | 2000-07-08 12:48:13 +0000 | [diff] [blame] | 3487 | psInfo->ppshheader.pszCaption); |
| Ulrich Czekalla | d8eb8c5 | 1999-10-23 16:57:28 +0000 | [diff] [blame] | 3488 | } |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3489 | |
| Huw Davies | 517b85f | 2006-04-06 16:55:32 +0100 | [diff] [blame] | 3490 | |
| 3491 | if (psInfo->useCallback) |
| Michael Stefaniuc | 62e17fa | 2008-11-03 22:43:40 +0100 | [diff] [blame] | 3492 | (*(psInfo->ppshheader.pfnCallback))(hwnd, PSCB_INITIALIZED, 0); |
| Huw Davies | 517b85f | 2006-04-06 16:55:32 +0100 | [diff] [blame] | 3493 | |
| 3494 | idx = psInfo->active_page; |
| Huw Davies | 517b85f | 2006-04-06 16:55:32 +0100 | [diff] [blame] | 3495 | psInfo->active_page = -1; |
| 3496 | |
| 3497 | PROPSHEET_SetCurSel(hwnd, idx, 1, psInfo->proppage[idx].hpage); |
| 3498 | |
| 3499 | /* doing TCM_SETCURSEL seems to be needed even in case of PSH_WIZARD, |
| 3500 | * as some programs call TCM_GETCURSEL to get the current selection |
| 3501 | * from which to switch to the next page */ |
| 3502 | SendMessageW(hwndTabCtrl, TCM_SETCURSEL, psInfo->active_page, 0); |
| 3503 | |
| Andrew Eikum | 4a14ed4 | 2009-08-13 17:36:25 -0500 | [diff] [blame] | 3504 | PROPSHEET_UnChanged(hwnd, NULL); |
| Gregor Brunmar | 490e002 | 2007-12-02 12:25:00 +0100 | [diff] [blame] | 3505 | |
| Andrew Eikum | ac34e22 | 2009-08-13 17:36:35 -0500 | [diff] [blame] | 3506 | /* wizards set their focus during init */ |
| 3507 | if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD) |
| 3508 | return FALSE; |
| 3509 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3510 | return TRUE; |
| Eric Kohl | d68d501 | 1999-01-24 19:14:58 +0000 | [diff] [blame] | 3511 | } |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3512 | |
| Michael Kaufmann | e9310da | 2005-11-08 12:52:35 +0000 | [diff] [blame] | 3513 | case WM_PRINTCLIENT: |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3514 | case WM_PAINT: |
| Dimitrie O. Paun | b1d65cb | 2005-03-25 10:26:10 +0000 | [diff] [blame] | 3515 | PROPSHEET_Paint(hwnd, (HDC)wParam); |
| Maxime Bellengé | d19e264 | 2004-05-10 21:26:04 +0000 | [diff] [blame] | 3516 | return TRUE; |
| 3517 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3518 | case WM_DESTROY: |
| 3519 | PROPSHEET_CleanUp(hwnd); |
| 3520 | return TRUE; |
| 3521 | |
| 3522 | case WM_CLOSE: |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 3523 | PROPSHEET_Cancel(hwnd, 1); |
| Dmitry Timoshkov | 217dae6 | 2006-06-08 23:56:52 +0900 | [diff] [blame] | 3524 | return FALSE; /* let DefDlgProc post us WM_COMMAND/IDCANCEL */ |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3525 | |
| 3526 | case WM_COMMAND: |
| Ulrich Czekalla | 710bd6f | 2004-01-27 20:11:05 +0000 | [diff] [blame] | 3527 | if (!PROPSHEET_DoCommand(hwnd, LOWORD(wParam))) |
| 3528 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 3529 | PropSheetInfo* psInfo = GetPropW(hwnd, PropSheetInfoStr); |
| Ulrich Czekalla | 710bd6f | 2004-01-27 20:11:05 +0000 | [diff] [blame] | 3530 | |
| Aric Stewart | 764ff27 | 2004-10-04 20:39:55 +0000 | [diff] [blame] | 3531 | if (!psInfo) |
| 3532 | return FALSE; |
| 3533 | |
| Ulrich Czekalla | 710bd6f | 2004-01-27 20:11:05 +0000 | [diff] [blame] | 3534 | /* No default handler, forward notification to active page */ |
| 3535 | if (psInfo->activeValid && psInfo->active_page != -1) |
| 3536 | { |
| 3537 | HWND hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; |
| 3538 | SendMessageW(hwndPage, WM_COMMAND, wParam, lParam); |
| 3539 | } |
| 3540 | } |
| 3541 | return TRUE; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3542 | |
| 3543 | case WM_NOTIFY: |
| 3544 | { |
| 3545 | NMHDR* pnmh = (LPNMHDR) lParam; |
| 3546 | |
| 3547 | if (pnmh->code == TCN_SELCHANGE) |
| 3548 | { |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3549 | int index = SendMessageW(pnmh->hwndFrom, TCM_GETCURSEL, 0, 0); |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 3550 | PROPSHEET_SetCurSel(hwnd, index, 1, 0); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3551 | } |
| 3552 | |
| Pierre Mageau | 89ab9f0 | 1999-10-13 15:54:08 +0000 | [diff] [blame] | 3553 | if(pnmh->code == TCN_SELCHANGING) |
| 3554 | { |
| 3555 | BOOL bRet = PROPSHEET_CanSetCurSel(hwnd); |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3556 | SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, !bRet); |
| Pierre Mageau | 89ab9f0 | 1999-10-13 15:54:08 +0000 | [diff] [blame] | 3557 | return TRUE; |
| 3558 | } |
| 3559 | |
| Dmitry Timoshkov | 9965390 | 2000-11-09 20:25:27 +0000 | [diff] [blame] | 3560 | return FALSE; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3561 | } |
| Frank Richter | c81d46d | 2005-07-05 10:57:37 +0000 | [diff] [blame] | 3562 | |
| 3563 | case WM_SYSCOLORCHANGE: |
| 3564 | COMCTL32_RefreshSysColors(); |
| 3565 | return FALSE; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3566 | |
| 3567 | case PSM_GETCURRENTPAGEHWND: |
| 3568 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 3569 | PropSheetInfo* psInfo = GetPropW(hwnd, PropSheetInfoStr); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3570 | HWND hwndPage = 0; |
| 3571 | |
| Aric Stewart | 764ff27 | 2004-10-04 20:39:55 +0000 | [diff] [blame] | 3572 | if (!psInfo) |
| 3573 | return FALSE; |
| 3574 | |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 3575 | if (psInfo->activeValid && psInfo->active_page != -1) |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3576 | hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; |
| 3577 | |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3578 | SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, (DWORD_PTR)hwndPage); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3579 | |
| 3580 | return TRUE; |
| 3581 | } |
| 3582 | |
| 3583 | case PSM_CHANGED: |
| 3584 | PROPSHEET_Changed(hwnd, (HWND)wParam); |
| 3585 | return TRUE; |
| 3586 | |
| 3587 | case PSM_UNCHANGED: |
| 3588 | PROPSHEET_UnChanged(hwnd, (HWND)wParam); |
| 3589 | return TRUE; |
| 3590 | |
| 3591 | case PSM_GETTABCONTROL: |
| 3592 | { |
| 3593 | HWND hwndTabCtrl = GetDlgItem(hwnd, IDC_TABCONTROL); |
| 3594 | |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3595 | SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, (DWORD_PTR)hwndTabCtrl); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3596 | |
| 3597 | return TRUE; |
| 3598 | } |
| 3599 | |
| 3600 | case PSM_SETCURSEL: |
| 3601 | { |
| 3602 | BOOL msgResult; |
| 3603 | |
| Pierre Mageau | 89ab9f0 | 1999-10-13 15:54:08 +0000 | [diff] [blame] | 3604 | msgResult = PROPSHEET_CanSetCurSel(hwnd); |
| 3605 | if(msgResult != FALSE) |
| 3606 | { |
| 3607 | msgResult = PROPSHEET_SetCurSel(hwnd, |
| 3608 | (int)wParam, |
| Marcus Meissner | decd475 | 2001-06-06 21:03:21 +0000 | [diff] [blame] | 3609 | 1, |
| Pierre Mageau | 89ab9f0 | 1999-10-13 15:54:08 +0000 | [diff] [blame] | 3610 | (HPROPSHEETPAGE)lParam); |
| 3611 | } |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3612 | |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3613 | SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3614 | |
| 3615 | return TRUE; |
| 3616 | } |
| 3617 | |
| 3618 | case PSM_CANCELTOCLOSE: |
| 3619 | { |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3620 | WCHAR buf[MAX_BUTTONTEXT_LENGTH]; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3621 | HWND hwndOK = GetDlgItem(hwnd, IDOK); |
| 3622 | HWND hwndCancel = GetDlgItem(hwnd, IDCANCEL); |
| 3623 | |
| 3624 | EnableWindow(hwndCancel, FALSE); |
| Rob Shearman | fd291ed | 2008-02-15 10:05:36 +0000 | [diff] [blame] | 3625 | if (LoadStringW(COMCTL32_hModule, IDS_CLOSE, buf, sizeof(buf)/sizeof(buf[0]))) |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3626 | SetWindowTextW(hwndOK, buf); |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 3627 | |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 3628 | return FALSE; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3629 | } |
| 3630 | |
| 3631 | case PSM_RESTARTWINDOWS: |
| 3632 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 3633 | PropSheetInfo* psInfo = GetPropW(hwnd, PropSheetInfoStr); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3634 | |
| Aric Stewart | 764ff27 | 2004-10-04 20:39:55 +0000 | [diff] [blame] | 3635 | if (!psInfo) |
| 3636 | return FALSE; |
| 3637 | |
| Huw Davies | 6d0b86a | 2006-11-02 12:21:53 +0000 | [diff] [blame] | 3638 | /* reboot system takes precedence over restart windows */ |
| 3639 | if (psInfo->result != ID_PSREBOOTSYSTEM) |
| 3640 | psInfo->result = ID_PSRESTARTWINDOWS; |
| 3641 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3642 | return TRUE; |
| 3643 | } |
| 3644 | |
| 3645 | case PSM_REBOOTSYSTEM: |
| 3646 | { |
| Michael Stefaniuc | b12fbe1 | 2008-10-28 23:35:49 +0100 | [diff] [blame] | 3647 | PropSheetInfo* psInfo = GetPropW(hwnd, PropSheetInfoStr); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3648 | |
| Aric Stewart | 764ff27 | 2004-10-04 20:39:55 +0000 | [diff] [blame] | 3649 | if (!psInfo) |
| 3650 | return FALSE; |
| 3651 | |
| Huw Davies | 6d0b86a | 2006-11-02 12:21:53 +0000 | [diff] [blame] | 3652 | psInfo->result = ID_PSREBOOTSYSTEM; |
| 3653 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3654 | return TRUE; |
| 3655 | } |
| 3656 | |
| 3657 | case PSM_SETTITLEA: |
| 3658 | PROPSHEET_SetTitleA(hwnd, (DWORD) wParam, (LPCSTR) lParam); |
| 3659 | return TRUE; |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 3660 | |
| Alexandre Julliard | d328085 | 2002-01-29 17:14:53 +0000 | [diff] [blame] | 3661 | case PSM_SETTITLEW: |
| 3662 | PROPSHEET_SetTitleW(hwnd, (DWORD) wParam, (LPCWSTR) lParam); |
| 3663 | return TRUE; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3664 | |
| 3665 | case PSM_APPLY: |
| 3666 | { |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 3667 | BOOL msgResult = PROPSHEET_Apply(hwnd, 0); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3668 | |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3669 | SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3670 | |
| 3671 | return TRUE; |
| 3672 | } |
| 3673 | |
| 3674 | case PSM_QUERYSIBLINGS: |
| 3675 | { |
| 3676 | LRESULT msgResult = PROPSHEET_QuerySiblings(hwnd, wParam, lParam); |
| 3677 | |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3678 | SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3679 | |
| 3680 | return TRUE; |
| 3681 | } |
| 3682 | |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 3683 | case PSM_ADDPAGE: |
| Thuy Nguyen | ac514e1 | 1999-10-31 18:29:47 +0000 | [diff] [blame] | 3684 | { |
| 3685 | /* |
| 3686 | * Note: MSVC++ 6.0 documentation says that PSM_ADDPAGE does not have |
| 3687 | * a return value. This is not true. PSM_ADDPAGE returns TRUE |
| 3688 | * on success or FALSE otherwise, as specified on MSDN Online. |
| 3689 | * Also see the MFC code for |
| 3690 | * CPropertySheet::AddPage(CPropertyPage* pPage). |
| 3691 | */ |
| 3692 | |
| 3693 | BOOL msgResult = PROPSHEET_AddPage(hwnd, (HPROPSHEETPAGE)lParam); |
| 3694 | |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3695 | SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); |
| Thuy Nguyen | ac514e1 | 1999-10-31 18:29:47 +0000 | [diff] [blame] | 3696 | |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 3697 | return TRUE; |
| Thuy Nguyen | ac514e1 | 1999-10-31 18:29:47 +0000 | [diff] [blame] | 3698 | } |
| Thuy Nguyen | 93c68a7 | 1999-05-01 10:27:05 +0000 | [diff] [blame] | 3699 | |
| 3700 | case PSM_REMOVEPAGE: |
| 3701 | PROPSHEET_RemovePage(hwnd, (int)wParam, (HPROPSHEETPAGE)lParam); |
| 3702 | return TRUE; |
| 3703 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3704 | case PSM_ISDIALOGMESSAGE: |
| 3705 | { |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 3706 | BOOL msgResult = PROPSHEET_IsDialogMessage(hwnd, (LPMSG)lParam); |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3707 | SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); |
| Alexandre Julliard | 08afc1a | 1999-11-28 21:01:47 +0000 | [diff] [blame] | 3708 | return TRUE; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3709 | } |
| 3710 | |
| 3711 | case PSM_PRESSBUTTON: |
| 3712 | PROPSHEET_PressButton(hwnd, (int)wParam); |
| 3713 | return TRUE; |
| 3714 | |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 3715 | case PSM_SETFINISHTEXTA: |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 3716 | PROPSHEET_SetFinishTextA(hwnd, (LPCSTR) lParam); |
| Thuy Nguyen | bf35d80 | 1999-09-19 12:14:38 +0000 | [diff] [blame] | 3717 | return TRUE; |
| 3718 | |
| 3719 | case PSM_SETWIZBUTTONS: |
| 3720 | PROPSHEET_SetWizButtons(hwnd, (DWORD)lParam); |
| 3721 | return TRUE; |
| 3722 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3723 | case PSM_SETCURSELID: |
| Andriy Palamarchuk | a6affaa | 2002-08-26 21:47:06 +0000 | [diff] [blame] | 3724 | PROPSHEET_SetCurSelId(hwnd, (int)lParam); |
| 3725 | return TRUE; |
| Dmitry Timoshkov | 9965390 | 2000-11-09 20:25:27 +0000 | [diff] [blame] | 3726 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3727 | case PSM_SETFINISHTEXTW: |
| Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 3728 | PROPSHEET_SetFinishTextW(hwnd, (LPCWSTR) lParam); |
| Dmitry Timoshkov | 9965390 | 2000-11-09 20:25:27 +0000 | [diff] [blame] | 3729 | return FALSE; |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3730 | |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 3731 | case PSM_INSERTPAGE: |
| 3732 | { |
| 3733 | BOOL msgResult = PROPSHEET_InsertPage(hwnd, (HPROPSHEETPAGE)wParam, (HPROPSHEETPAGE)lParam); |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3734 | SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 3735 | return TRUE; |
| 3736 | } |
| 3737 | |
| 3738 | case PSM_SETHEADERTITLEW: |
| 3739 | PROPSHEET_SetHeaderTitleW(hwnd, (int)wParam, (LPCWSTR)lParam); |
| 3740 | return TRUE; |
| 3741 | |
| 3742 | case PSM_SETHEADERTITLEA: |
| 3743 | PROPSHEET_SetHeaderTitleA(hwnd, (int)wParam, (LPCSTR)lParam); |
| 3744 | return TRUE; |
| 3745 | |
| 3746 | case PSM_SETHEADERSUBTITLEW: |
| 3747 | PROPSHEET_SetHeaderSubTitleW(hwnd, (int)wParam, (LPCWSTR)lParam); |
| 3748 | return TRUE; |
| 3749 | |
| 3750 | case PSM_SETHEADERSUBTITLEA: |
| 3751 | PROPSHEET_SetHeaderSubTitleA(hwnd, (int)wParam, (LPCSTR)lParam); |
| 3752 | return TRUE; |
| 3753 | |
| 3754 | case PSM_HWNDTOINDEX: |
| 3755 | { |
| 3756 | LRESULT msgResult = PROPSHEET_HwndToIndex(hwnd, (HWND)wParam); |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3757 | SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 3758 | return TRUE; |
| 3759 | } |
| 3760 | |
| 3761 | case PSM_INDEXTOHWND: |
| 3762 | { |
| 3763 | LRESULT msgResult = PROPSHEET_IndexToHwnd(hwnd, (int)wParam); |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3764 | SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 3765 | return TRUE; |
| 3766 | } |
| 3767 | |
| 3768 | case PSM_PAGETOINDEX: |
| 3769 | { |
| 3770 | LRESULT msgResult = PROPSHEET_PageToIndex(hwnd, (HPROPSHEETPAGE)wParam); |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3771 | SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 3772 | return TRUE; |
| 3773 | } |
| 3774 | |
| 3775 | case PSM_INDEXTOPAGE: |
| 3776 | { |
| 3777 | LRESULT msgResult = PROPSHEET_IndexToPage(hwnd, (int)wParam); |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3778 | SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 3779 | return TRUE; |
| 3780 | } |
| 3781 | |
| 3782 | case PSM_IDTOINDEX: |
| 3783 | { |
| 3784 | LRESULT msgResult = PROPSHEET_IdToIndex(hwnd, (int)lParam); |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3785 | SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 3786 | return TRUE; |
| 3787 | } |
| 3788 | |
| 3789 | case PSM_INDEXTOID: |
| 3790 | { |
| 3791 | LRESULT msgResult = PROPSHEET_IndexToId(hwnd, (int)wParam); |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3792 | SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 3793 | return TRUE; |
| 3794 | } |
| 3795 | |
| 3796 | case PSM_GETRESULT: |
| 3797 | { |
| 3798 | LRESULT msgResult = PROPSHEET_GetResult(hwnd); |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3799 | SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 3800 | return TRUE; |
| 3801 | } |
| 3802 | |
| 3803 | case PSM_RECALCPAGESIZES: |
| 3804 | { |
| 3805 | LRESULT msgResult = PROPSHEET_RecalcPageSizes(hwnd); |
| Robert Shearman | cdb263e | 2004-08-25 17:33:01 +0000 | [diff] [blame] | 3806 | SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, msgResult); |
| Robert Shearman | cd2065f | 2004-07-12 23:30:54 +0000 | [diff] [blame] | 3807 | return TRUE; |
| 3808 | } |
| 3809 | |
| Thuy Nguyen | 44bd9f0 | 1999-04-22 09:24:47 +0000 | [diff] [blame] | 3810 | default: |
| 3811 | return FALSE; |
| 3812 | } |
| Alexandre Julliard | 638f169 | 1999-01-17 16:32:32 +0000 | [diff] [blame] | 3813 | } |