1 | /*
|
---|
2 | * Property Sheets
|
---|
3 | *
|
---|
4 | * Copyright 1998 Francis Beaudet
|
---|
5 | * Copyright 1999 Thuy Nguyen
|
---|
6 | *
|
---|
7 | * TODO:
|
---|
8 | * - Modeless mode
|
---|
9 | * - Wizard mode
|
---|
10 | * - Unicode property sheets
|
---|
11 | */
|
---|
12 |
|
---|
13 | #include <string.h>
|
---|
14 | #include "winbase.h"
|
---|
15 | #include "commctrl.h"
|
---|
16 | #include "prsht.h"
|
---|
17 | #include "winnls.h"
|
---|
18 | #include "comctl32.h"
|
---|
19 |
|
---|
20 |
|
---|
21 | /******************************************************************************
|
---|
22 | * Data structures
|
---|
23 | */
|
---|
24 | typedef struct
|
---|
25 | {
|
---|
26 | WORD dlgVer;
|
---|
27 | WORD signature;
|
---|
28 | DWORD helpID;
|
---|
29 | DWORD exStyle;
|
---|
30 | DWORD style;
|
---|
31 | } MyDLGTEMPLATEEX;
|
---|
32 |
|
---|
33 | typedef struct tagPropPageInfo
|
---|
34 | {
|
---|
35 | int index; /* corresponds to the index in ppshheader->ppsp */
|
---|
36 | HPROPSHEETPAGE hpage; /* to keep track of pages not passed to PropertySheet */
|
---|
37 | HWND hwndPage;
|
---|
38 | BOOL isDirty;
|
---|
39 | LPCWSTR pszText;
|
---|
40 | BOOL hasHelp;
|
---|
41 | BOOL useCallback;
|
---|
42 | } PropPageInfo;
|
---|
43 |
|
---|
44 | typedef struct tagPropSheetInfo
|
---|
45 | {
|
---|
46 | LPSTR strPropertiesFor;
|
---|
47 | int nPages;
|
---|
48 | int active_page;
|
---|
49 | LPCPROPSHEETHEADERA ppshheader;
|
---|
50 | BOOL isModeless;
|
---|
51 | BOOL hasHelp;
|
---|
52 | BOOL hasApply;
|
---|
53 | BOOL useCallback;
|
---|
54 | BOOL restartWindows;
|
---|
55 | BOOL rebootSystem;
|
---|
56 | PropPageInfo* proppage;
|
---|
57 | int x;
|
---|
58 | int y;
|
---|
59 | int width;
|
---|
60 | int height;
|
---|
61 | } PropSheetInfo;
|
---|
62 |
|
---|
63 | typedef struct
|
---|
64 | {
|
---|
65 | int x;
|
---|
66 | int y;
|
---|
67 | } PADDING_INFO;
|
---|
68 |
|
---|
69 | /******************************************************************************
|
---|
70 | * Defines and global variables
|
---|
71 | */
|
---|
72 |
|
---|
73 | const char * PropSheetInfoStr = "PropertySheetInfo";
|
---|
74 |
|
---|
75 | #define MAX_CAPTION_LENGTH 255
|
---|
76 | #define MAX_TABTEXT_LENGTH 255
|
---|
77 |
|
---|
78 |
|
---|
79 | /******************************************************************************
|
---|
80 | * Prototypes
|
---|
81 | */
|
---|
82 | static BOOL PROPSHEET_CreateDialog(PropSheetInfo* psInfo);
|
---|
83 | static BOOL PROPSHEET_IsTooSmall(HWND hwndDlg, PropSheetInfo* psInfo);
|
---|
84 | static BOOL PROPSHEET_AdjustSize(HWND hwndDlg, PropSheetInfo* psInfo);
|
---|
85 | static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, PropSheetInfo* psInfo);
|
---|
86 | static BOOL PROPSHEET_CollectSheetInfo(LPCPROPSHEETHEADERA lppsh,
|
---|
87 | PropSheetInfo * psInfo);
|
---|
88 | static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEA lppsp,
|
---|
89 | PropSheetInfo * psInfo,
|
---|
90 | int index);
|
---|
91 | static BOOL PROPSHEET_CreateTabControl(HWND hwndParent,
|
---|
92 | PropSheetInfo * psInfo);
|
---|
93 | static int PROPSHEET_CreatePage(HWND hwndParent, int index,
|
---|
94 | const PropSheetInfo * psInfo,
|
---|
95 | LPCPROPSHEETPAGEA ppshpage,
|
---|
96 | BOOL showPage);
|
---|
97 | static BOOL PROPSHEET_ShowPage(HWND hwndDlg, int index, PropSheetInfo * psInfo);
|
---|
98 | static PADDING_INFO PROPSHEET_GetPaddingInfo(HWND hwndDlg);
|
---|
99 | static BOOL PROPSHEET_Apply(HWND hwndDlg);
|
---|
100 | static void PROPSHEET_Cancel(HWND hwndDlg);
|
---|
101 | static void PROPSHEET_Help(HWND hwndDlg);
|
---|
102 | static void PROPSHEET_Changed(HWND hwndDlg, HWND hwndDirtyPage);
|
---|
103 | static void PROPSHEET_UnChanged(HWND hwndDlg, HWND hwndCleanPage);
|
---|
104 | static void PROPSHEET_PressButton(HWND hwndDlg, int buttonID);
|
---|
105 | static void PROPSHEET_SetTitleA(HWND hwndDlg, DWORD dwStyle, LPCSTR lpszText);
|
---|
106 | static BOOL PROPSHEET_SetCurSel(HWND hwndDlg,
|
---|
107 | int index,
|
---|
108 | HPROPSHEETPAGE hpage);
|
---|
109 | static LRESULT PROPSHEET_QuerySiblings(HWND hwndDlg,
|
---|
110 | WPARAM wParam, LPARAM lParam);
|
---|
111 | static LPCPROPSHEETPAGEA PROPSHEET_GetPSPPage(const PropSheetInfo * psInfo,
|
---|
112 | int index);
|
---|
113 | static BOOL PROPSHEET_AddPage(HWND hwndDlg,
|
---|
114 | HPROPSHEETPAGE hpage);
|
---|
115 |
|
---|
116 | static BOOL PROPSHEET_RemovePage(HWND hwndDlg,
|
---|
117 | int index,
|
---|
118 | HPROPSHEETPAGE hpage);
|
---|
119 | static void PROPSHEET_CleanUp();
|
---|
120 | static int PROPSHEET_GetPageIndex(HPROPSHEETPAGE hpage, PropSheetInfo* psInfo);
|
---|
121 |
|
---|
122 | BOOL WINAPI
|
---|
123 | PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
---|
124 |
|
---|
125 |
|
---|
126 | /******************************************************************************
|
---|
127 | * PROPSHEET_CollectSheetInfo
|
---|
128 | *
|
---|
129 | * Collect relevant data.
|
---|
130 | */
|
---|
131 | static BOOL PROPSHEET_CollectSheetInfo(LPCPROPSHEETHEADERA lppsh,
|
---|
132 | PropSheetInfo * psInfo)
|
---|
133 | {
|
---|
134 | DWORD dwFlags = lppsh->dwFlags;
|
---|
135 |
|
---|
136 | psInfo->hasHelp = dwFlags & PSH_HASHELP;
|
---|
137 | psInfo->hasApply = !(dwFlags & PSH_NOAPPLYNOW);
|
---|
138 | psInfo->useCallback = dwFlags & PSH_USECALLBACK;
|
---|
139 | psInfo->isModeless = dwFlags & PSH_MODELESS;
|
---|
140 | psInfo->ppshheader = lppsh;
|
---|
141 | psInfo->nPages = lppsh->nPages;
|
---|
142 |
|
---|
143 | if (dwFlags & PSH_USEPSTARTPAGE)
|
---|
144 | {
|
---|
145 | // TRACE(propsheet, "PSH_USEPSTARTPAGE is on");
|
---|
146 | psInfo->active_page = 0;
|
---|
147 | }
|
---|
148 | else
|
---|
149 | psInfo->active_page = lppsh->u2.nStartPage;
|
---|
150 |
|
---|
151 | psInfo->restartWindows = FALSE;
|
---|
152 | psInfo->rebootSystem = FALSE;
|
---|
153 |
|
---|
154 | return TRUE;
|
---|
155 | }
|
---|
156 |
|
---|
157 | /******************************************************************************
|
---|
158 | * PROPSHEET_CollectPageInfo
|
---|
159 | *
|
---|
160 | * Collect property sheet data.
|
---|
161 | * With code taken from DIALOG_ParseTemplate32.
|
---|
162 | */
|
---|
163 | BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEA lppsp,
|
---|
164 | PropSheetInfo * psInfo,
|
---|
165 | int index)
|
---|
166 | {
|
---|
167 | DLGTEMPLATE* pTemplate;
|
---|
168 | const WORD* p;
|
---|
169 | DWORD dwFlags;
|
---|
170 | int width, height;
|
---|
171 |
|
---|
172 | if (psInfo->ppshheader->dwFlags & PSH_PROPSHEETPAGE)
|
---|
173 | psInfo->proppage[index].hpage = 0;
|
---|
174 | psInfo->proppage[index].hwndPage = 0;
|
---|
175 | psInfo->proppage[index].isDirty = FALSE;
|
---|
176 |
|
---|
177 | /*
|
---|
178 | * Process property page flags.
|
---|
179 | */
|
---|
180 | dwFlags = lppsp->dwFlags;
|
---|
181 | psInfo->proppage[index].useCallback = dwFlags & PSP_USECALLBACK;
|
---|
182 | psInfo->proppage[index].hasHelp = dwFlags & PSP_HASHELP;
|
---|
183 |
|
---|
184 | /* as soon as we have a page with the help flag, set the sheet flag on */
|
---|
185 | if (psInfo->proppage[index].hasHelp)
|
---|
186 | psInfo->hasHelp = TRUE;
|
---|
187 |
|
---|
188 | /*
|
---|
189 | * Process page template.
|
---|
190 | */
|
---|
191 | if (dwFlags & PSP_DLGINDIRECT)
|
---|
192 | pTemplate = (DLGTEMPLATE*)lppsp->u1.pResource;
|
---|
193 | else
|
---|
194 | {
|
---|
195 | HRSRC hResource = FindResourceA(lppsp->hInstance,
|
---|
196 | lppsp->u1.pszTemplate,
|
---|
197 | RT_DIALOGA);
|
---|
198 | HGLOBAL hTemplate = LoadResource(lppsp->hInstance,
|
---|
199 | hResource);
|
---|
200 | pTemplate = (LPDLGTEMPLATEA)LockResource(hTemplate);
|
---|
201 | }
|
---|
202 |
|
---|
203 | /*
|
---|
204 | * Extract the size of the page and the caption.
|
---|
205 | */
|
---|
206 | p = (const WORD *)pTemplate;
|
---|
207 |
|
---|
208 | if (((MyDLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF)
|
---|
209 | {
|
---|
210 | /* DIALOGEX template */
|
---|
211 |
|
---|
212 | p++; /* dlgVer */
|
---|
213 | p++; /* signature */
|
---|
214 | p += 2; /* help ID */
|
---|
215 | p += 2; /* ext style */
|
---|
216 | p += 2; /* style */
|
---|
217 | }
|
---|
218 | else
|
---|
219 | {
|
---|
220 | /* DIALOG template */
|
---|
221 |
|
---|
222 | p += 2; /* style */
|
---|
223 | p += 2; /* ext style */
|
---|
224 | }
|
---|
225 |
|
---|
226 | p++; /* nb items */
|
---|
227 | p++; /* x */
|
---|
228 | p++; /* y */
|
---|
229 | width = (WORD)*p; p++;
|
---|
230 | height = (WORD)*p; p++;
|
---|
231 |
|
---|
232 | /* remember the largest width and height */
|
---|
233 | if (width > psInfo->width)
|
---|
234 | psInfo->width = width;
|
---|
235 |
|
---|
236 | if (height > psInfo->height)
|
---|
237 | psInfo->height = height;
|
---|
238 |
|
---|
239 | /* menu */
|
---|
240 | switch ((WORD)*p)
|
---|
241 | {
|
---|
242 | case 0x0000:
|
---|
243 | p++;
|
---|
244 | break;
|
---|
245 | case 0xffff:
|
---|
246 | p += 2;
|
---|
247 | break;
|
---|
248 | default:
|
---|
249 | p += lstrlenW( (LPCWSTR)p ) + 1;
|
---|
250 | break;
|
---|
251 | }
|
---|
252 |
|
---|
253 | /* class */
|
---|
254 | switch ((WORD)*p)
|
---|
255 | {
|
---|
256 | case 0x0000:
|
---|
257 | p++;
|
---|
258 | break;
|
---|
259 | case 0xffff:
|
---|
260 | p += 2;
|
---|
261 | break;
|
---|
262 | default:
|
---|
263 | p += lstrlenW( (LPCWSTR)p ) + 1;
|
---|
264 | break;
|
---|
265 | }
|
---|
266 |
|
---|
267 | /* Extract the caption */
|
---|
268 | psInfo->proppage[index].pszText = (LPCWSTR)p;
|
---|
269 | // TRACE(propsheet, "Tab %d %s\n",index,debugstr_w((LPCWSTR)p));
|
---|
270 | p += lstrlenW((LPCWSTR)p) + 1;
|
---|
271 |
|
---|
272 | return TRUE;
|
---|
273 | }
|
---|
274 |
|
---|
275 | /******************************************************************************
|
---|
276 | * PROPSHEET_CreateDialog
|
---|
277 | *
|
---|
278 | * Creates the actual property sheet.
|
---|
279 | */
|
---|
280 | BOOL PROPSHEET_CreateDialog(PropSheetInfo* psInfo)
|
---|
281 | {
|
---|
282 | LRESULT ret;
|
---|
283 | LPCVOID template;
|
---|
284 | HRSRC hRes;
|
---|
285 |
|
---|
286 | if(!(hRes = FindResourceA(COMCTL32_hModule,
|
---|
287 | MAKEINTRESOURCEA(IDD_PROPSHEET),
|
---|
288 | RT_DIALOGA)))
|
---|
289 | return FALSE;
|
---|
290 |
|
---|
291 | if(!(template = (LPVOID)LoadResource(COMCTL32_hModule, hRes)))
|
---|
292 | return FALSE;
|
---|
293 |
|
---|
294 | if (psInfo->useCallback)
|
---|
295 | (*(psInfo->ppshheader->pfnCallback))(0, PSCB_PRECREATE, (LPARAM)template);
|
---|
296 |
|
---|
297 | if (psInfo->ppshheader->dwFlags & PSH_MODELESS)
|
---|
298 | ret = CreateDialogIndirectParamA(psInfo->ppshheader->hInstance,
|
---|
299 | (LPDLGTEMPLATEA) template,
|
---|
300 | psInfo->ppshheader->hwndParent,
|
---|
301 | (DLGPROC) PROPSHEET_DialogProc,
|
---|
302 | (LPARAM)psInfo);
|
---|
303 | else
|
---|
304 | ret = DialogBoxIndirectParamA(psInfo->ppshheader->hInstance,
|
---|
305 | (LPDLGTEMPLATEA) template,
|
---|
306 | psInfo->ppshheader->hwndParent,
|
---|
307 | (DLGPROC) PROPSHEET_DialogProc,
|
---|
308 | (LPARAM)psInfo);
|
---|
309 |
|
---|
310 | return ret;
|
---|
311 | }
|
---|
312 |
|
---|
313 | /******************************************************************************
|
---|
314 | * PROPSHEET_IsTooSmall
|
---|
315 | *
|
---|
316 | * Verify that the resource property sheet is big enough.
|
---|
317 | */
|
---|
318 | static BOOL PROPSHEET_IsTooSmall(HWND hwndDlg, PropSheetInfo* psInfo)
|
---|
319 | {
|
---|
320 | HWND hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
|
---|
321 | RECT rcOrigTab, rcPage;
|
---|
322 |
|
---|
323 | /*
|
---|
324 | * Original tab size.
|
---|
325 | */
|
---|
326 | GetClientRect(hwndTabCtrl, &rcOrigTab);
|
---|
327 | // TRACE(propsheet, "orig tab %d %d %d %d\n", rcOrigTab.left, rcOrigTab.top,
|
---|
328 | // rcOrigTab.right, rcOrigTab.bottom);
|
---|
329 |
|
---|
330 | /*
|
---|
331 | * Biggest page size.
|
---|
332 | */
|
---|
333 | rcPage.left = psInfo->x;
|
---|
334 | rcPage.top = psInfo->y;
|
---|
335 | rcPage.right = psInfo->width;
|
---|
336 | rcPage.bottom = psInfo->height;
|
---|
337 |
|
---|
338 | MapDialogRect(hwndDlg, &rcPage);
|
---|
339 | // TRACE(propsheet, "biggest page %d %d %d %d\n", rcPage.left, rcPage.top,
|
---|
340 | // rcPage.right, rcPage.bottom);
|
---|
341 |
|
---|
342 | if (rcPage.right > rcOrigTab.right)
|
---|
343 | return TRUE;
|
---|
344 |
|
---|
345 | if (rcPage.bottom > rcOrigTab.bottom)
|
---|
346 | return TRUE;
|
---|
347 |
|
---|
348 | return FALSE;
|
---|
349 | }
|
---|
350 |
|
---|
351 | /******************************************************************************
|
---|
352 | * PROPSHEET_AdjustSize
|
---|
353 | *
|
---|
354 | * Resizes the property sheet and the tab control to fit the largest page.
|
---|
355 | */
|
---|
356 | static BOOL PROPSHEET_AdjustSize(HWND hwndDlg, PropSheetInfo* psInfo)
|
---|
357 | {
|
---|
358 | HWND hwndTabCtrl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
|
---|
359 | HWND hwndButton = GetDlgItem(hwndDlg, IDOK);
|
---|
360 | RECT rc;
|
---|
361 | int tabOffsetX, tabOffsetY, buttonHeight;
|
---|
362 | PADDING_INFO padding = PROPSHEET_GetPaddingInfo(hwndDlg);
|
---|
363 |
|
---|
364 | /* Get the height of buttons */
|
---|
365 | GetClientRect(hwndButton, &rc);
|
---|
366 | buttonHeight = rc.bottom;
|
---|
367 |
|
---|
368 | /*
|
---|
369 | * Biggest page size.
|
---|
370 | */
|
---|
371 | rc.left = psInfo->x;
|
---|
372 | rc.top = psInfo->y;
|
---|
373 | rc.right = psInfo->width;
|
---|
374 | rc.bottom = psInfo->height;
|
---|
375 |
|
---|
376 | MapDialogRect(hwndDlg, &rc);
|
---|
377 |
|
---|
378 | /*
|
---|
379 | * Resize the tab control.
|
---|
380 | */
|
---|
381 | SendMessageA(hwndTabCtrl, TCM_ADJUSTRECT, TRUE, (LPARAM)&rc);
|
---|
382 |
|
---|
383 | tabOffsetX = -(rc.left);
|
---|
384 | tabOffsetY = -(rc.top);
|
---|
385 |
|
---|
386 | rc.right -= rc.left;
|
---|
387 | rc.bottom -= rc.top;
|
---|
388 | SetWindowPos(hwndTabCtrl, 0, 0, 0, rc.right, rc.bottom,
|
---|
389 | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
---|
390 |
|
---|
391 | GetClientRect(hwndTabCtrl, &rc);
|
---|
392 |
|
---|
393 | // TRACE(propsheet, "tab client rc %d %d %d %d\n",
|
---|
394 | // rc.left, rc.top, rc.right, rc.bottom);
|
---|
395 |
|
---|
396 | rc.right += ((padding.x * 2) + tabOffsetX);
|
---|
397 | rc.bottom += (buttonHeight + (3 * padding.y) + tabOffsetY);
|
---|
398 |
|
---|
399 | /*
|
---|
400 | * Resize the property sheet.
|
---|
401 | */
|
---|
402 | SetWindowPos(hwndDlg, 0, 0, 0, rc.right, rc.bottom,
|
---|
403 | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
---|
404 |
|
---|
405 | return TRUE;
|
---|
406 | }
|
---|
407 |
|
---|
408 | /******************************************************************************
|
---|
409 | * PROPSHEET_AdjustButtons
|
---|
410 | *
|
---|
411 | * Adjusts the buttons' positions.
|
---|
412 | */
|
---|
413 | static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, PropSheetInfo* psInfo)
|
---|
414 | {
|
---|
415 | HWND hwndButton = GetDlgItem(hwndParent, IDOK);
|
---|
416 | RECT rcSheet;
|
---|
417 | int x, y;
|
---|
418 | int num_buttons = 2;
|
---|
419 | int buttonWidth, buttonHeight;
|
---|
420 | PADDING_INFO padding = PROPSHEET_GetPaddingInfo(hwndParent);
|
---|
421 |
|
---|
422 | if (psInfo->hasApply)
|
---|
423 | num_buttons++;
|
---|
424 |
|
---|
425 | if (psInfo->hasHelp)
|
---|
426 | num_buttons++;
|
---|
427 |
|
---|
428 | /*
|
---|
429 | * Obtain the size of the buttons.
|
---|
430 | */
|
---|
431 | GetClientRect(hwndButton, &rcSheet);
|
---|
432 | buttonWidth = rcSheet.right;
|
---|
433 | buttonHeight = rcSheet.bottom;
|
---|
434 |
|
---|
435 | /*
|
---|
436 | * Get the size of the property sheet.
|
---|
437 | */
|
---|
438 | GetClientRect(hwndParent, &rcSheet);
|
---|
439 |
|
---|
440 | /*
|
---|
441 | * All buttons will be at this y coordinate.
|
---|
442 | */
|
---|
443 | y = rcSheet.bottom - (padding.y + buttonHeight);
|
---|
444 |
|
---|
445 | /*
|
---|
446 | * Position OK button.
|
---|
447 | */
|
---|
448 | hwndButton = GetDlgItem(hwndParent, IDOK);
|
---|
449 |
|
---|
450 | x = rcSheet.right - ((padding.x + buttonWidth) * num_buttons);
|
---|
451 |
|
---|
452 | SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
---|
453 | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
---|
454 |
|
---|
455 | /*
|
---|
456 | * Position Cancel button.
|
---|
457 | */
|
---|
458 | hwndButton = GetDlgItem(hwndParent, IDCANCEL);
|
---|
459 |
|
---|
460 | x = rcSheet.right - ((padding.x + buttonWidth) * (num_buttons - 1));
|
---|
461 |
|
---|
462 | SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
---|
463 | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
---|
464 |
|
---|
465 | /*
|
---|
466 | * Position Apply button.
|
---|
467 | */
|
---|
468 | hwndButton = GetDlgItem(hwndParent, IDC_APPLY_BUTTON);
|
---|
469 |
|
---|
470 | if (psInfo->hasApply)
|
---|
471 | {
|
---|
472 | if (psInfo->hasHelp)
|
---|
473 | x = rcSheet.right - ((padding.x + buttonWidth) * 2);
|
---|
474 | else
|
---|
475 | x = rcSheet.right - (padding.x + buttonWidth);
|
---|
476 |
|
---|
477 | SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
---|
478 | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
---|
479 |
|
---|
480 | EnableWindow(hwndButton, FALSE);
|
---|
481 | }
|
---|
482 | else
|
---|
483 | ShowWindow(hwndButton, SW_HIDE);
|
---|
484 |
|
---|
485 | /*
|
---|
486 | * Position Help button.
|
---|
487 | */
|
---|
488 | hwndButton = GetDlgItem(hwndParent, IDHELP);
|
---|
489 |
|
---|
490 | if (psInfo->hasHelp)
|
---|
491 | {
|
---|
492 | x = rcSheet.right - (padding.x + buttonWidth);
|
---|
493 |
|
---|
494 | SetWindowPos(hwndButton, 0, x, y, 0, 0,
|
---|
495 | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
---|
496 | }
|
---|
497 | else
|
---|
498 | ShowWindow(hwndButton, SW_HIDE);
|
---|
499 |
|
---|
500 | return TRUE;
|
---|
501 | }
|
---|
502 |
|
---|
503 | /******************************************************************************
|
---|
504 | * PROPSHEET_GetPaddingInfo
|
---|
505 | *
|
---|
506 | * Returns the layout information.
|
---|
507 | */
|
---|
508 | static PADDING_INFO PROPSHEET_GetPaddingInfo(HWND hwndDlg)
|
---|
509 | {
|
---|
510 | HWND hwndTab = GetDlgItem(hwndDlg, IDC_TABCONTROL);
|
---|
511 | RECT rcTab;
|
---|
512 | POINT tl;
|
---|
513 | PADDING_INFO padding;
|
---|
514 |
|
---|
515 | GetWindowRect(hwndTab, &rcTab);
|
---|
516 |
|
---|
517 | tl.x = rcTab.left;
|
---|
518 | tl.y = rcTab.top;
|
---|
519 |
|
---|
520 | ScreenToClient(hwndDlg, &tl);
|
---|
521 |
|
---|
522 | padding.x = tl.x;
|
---|
523 | padding.y = tl.y;
|
---|
524 |
|
---|
525 | return padding;
|
---|
526 | }
|
---|
527 |
|
---|
528 | /******************************************************************************
|
---|
529 | * PROPSHEET_CreateTabControl
|
---|
530 | *
|
---|
531 | * Insert the tabs in the tab control.
|
---|
532 | */
|
---|
533 | static BOOL PROPSHEET_CreateTabControl(HWND hwndParent,
|
---|
534 | PropSheetInfo * psInfo)
|
---|
535 | {
|
---|
536 | HWND hwndTabCtrl = GetDlgItem(hwndParent, IDC_TABCONTROL);
|
---|
537 | TCITEMA item;
|
---|
538 | int i, nTabs;
|
---|
539 | char tabtext[MAX_TABTEXT_LENGTH] = "Tab text";
|
---|
540 |
|
---|
541 | item.mask = TCIF_TEXT;
|
---|
542 | item.pszText = tabtext;
|
---|
543 | item.cchTextMax = MAX_TABTEXT_LENGTH;
|
---|
544 |
|
---|
545 | nTabs = psInfo->ppshheader->nPages;
|
---|
546 |
|
---|
547 | for (i = 0; i < nTabs; i++)
|
---|
548 | {
|
---|
549 | WideCharToMultiByte(CP_ACP, 0,
|
---|
550 | (LPCWSTR)psInfo->proppage[i].pszText,
|
---|
551 | -1, tabtext, MAX_TABTEXT_LENGTH, NULL, NULL);
|
---|
552 |
|
---|
553 | SendMessageA(hwndTabCtrl, TCM_INSERTITEMA, (WPARAM)i, (LPARAM)&item);
|
---|
554 | }
|
---|
555 |
|
---|
556 | return TRUE;
|
---|
557 | }
|
---|
558 |
|
---|
559 | /******************************************************************************
|
---|
560 | * PROPSHEET_CreatePage
|
---|
561 | *
|
---|
562 | * Creates a page.
|
---|
563 | */
|
---|
564 | static int PROPSHEET_CreatePage(HWND hwndParent,
|
---|
565 | int index,
|
---|
566 | const PropSheetInfo * psInfo,
|
---|
567 | LPCPROPSHEETPAGEA ppshpage,
|
---|
568 | BOOL showPage)
|
---|
569 | {
|
---|
570 | DLGTEMPLATE* pTemplate;
|
---|
571 | HWND hwndPage;
|
---|
572 | RECT rc;
|
---|
573 | PropPageInfo* ppInfo = psInfo->proppage;
|
---|
574 | PADDING_INFO padding = PROPSHEET_GetPaddingInfo(hwndParent);
|
---|
575 | HWND hwndTabCtrl = GetDlgItem(hwndParent, IDC_TABCONTROL);
|
---|
576 |
|
---|
577 | // TRACE(propsheet, "index %d\n", index);
|
---|
578 |
|
---|
579 | if (ppshpage->dwFlags & PSP_DLGINDIRECT)
|
---|
580 | pTemplate = (DLGTEMPLATE*)ppshpage->u1.pResource;
|
---|
581 | else
|
---|
582 | {
|
---|
583 | HRSRC hResource = FindResourceA(ppshpage->hInstance,
|
---|
584 | ppshpage->u1.pszTemplate,
|
---|
585 | RT_DIALOGA);
|
---|
586 | HGLOBAL hTemplate = LoadResource(ppshpage->hInstance, hResource);
|
---|
587 | pTemplate = (LPDLGTEMPLATEA)LockResource(hTemplate);
|
---|
588 | }
|
---|
589 |
|
---|
590 | if (((MyDLGTEMPLATEEX*)pTemplate)->signature == 0xFFFF)
|
---|
591 | {
|
---|
592 | ((MyDLGTEMPLATEEX*)pTemplate)->style |= WS_CHILD;
|
---|
593 | ((MyDLGTEMPLATEEX*)pTemplate)->style &= ~DS_MODALFRAME;
|
---|
594 | ((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_CAPTION;
|
---|
595 | ((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_SYSMENU;
|
---|
596 | ((MyDLGTEMPLATEEX*)pTemplate)->style &= ~WS_POPUP;
|
---|
597 | }
|
---|
598 | else
|
---|
599 | {
|
---|
600 | pTemplate->style |= WS_CHILD;
|
---|
601 | pTemplate->style &= ~DS_MODALFRAME;
|
---|
602 | pTemplate->style &= ~WS_CAPTION;
|
---|
603 | pTemplate->style &= ~WS_SYSMENU;
|
---|
604 | pTemplate->style &= ~WS_POPUP;
|
---|
605 | }
|
---|
606 |
|
---|
607 | if (psInfo->proppage[index].useCallback)
|
---|
608 | (*(ppshpage->pfnCallback))(hwndParent,
|
---|
609 | PSPCB_CREATE,
|
---|
610 | (LPPROPSHEETPAGEA)ppshpage);
|
---|
611 |
|
---|
612 | hwndPage = CreateDialogIndirectParamA(ppshpage->hInstance,
|
---|
613 | pTemplate,
|
---|
614 | hwndParent,
|
---|
615 | ppshpage->pfnDlgProc,
|
---|
616 | (LPARAM)ppshpage);
|
---|
617 |
|
---|
618 | ppInfo[index].hwndPage = hwndPage;
|
---|
619 |
|
---|
620 | rc.left = psInfo->x;
|
---|
621 | rc.top = psInfo->y;
|
---|
622 | rc.right = psInfo->width;
|
---|
623 | rc.bottom = psInfo->height;
|
---|
624 |
|
---|
625 | MapDialogRect(hwndParent, &rc);
|
---|
626 |
|
---|
627 | /*
|
---|
628 | * Ask the Tab control to fit this page in.
|
---|
629 | */
|
---|
630 | SendMessageA(hwndTabCtrl, TCM_ADJUSTRECT, FALSE, (LPARAM)&rc);
|
---|
631 |
|
---|
632 | SetWindowPos(hwndPage, HWND_TOP,
|
---|
633 | rc.left + padding.x,
|
---|
634 | rc.top + padding.y,
|
---|
635 | 0, 0, SWP_NOSIZE);
|
---|
636 |
|
---|
637 | if (showPage)
|
---|
638 | ShowWindow(hwndPage, SW_SHOW);
|
---|
639 | else
|
---|
640 | ShowWindow(hwndPage, SW_HIDE);
|
---|
641 |
|
---|
642 | return TRUE;
|
---|
643 | }
|
---|
644 |
|
---|
645 | /******************************************************************************
|
---|
646 | * PROPSHEET_ShowPage
|
---|
647 | *
|
---|
648 | * Displays or creates the specified page.
|
---|
649 | */
|
---|
650 | static BOOL PROPSHEET_ShowPage(HWND hwndDlg, int index, PropSheetInfo * psInfo)
|
---|
651 | {
|
---|
652 | if (index == psInfo->active_page)
|
---|
653 | return TRUE;
|
---|
654 |
|
---|
655 | ShowWindow(psInfo->proppage[psInfo->active_page].hwndPage, SW_HIDE);
|
---|
656 |
|
---|
657 | if (psInfo->proppage[index].hwndPage != 0)
|
---|
658 | ShowWindow(psInfo->proppage[index].hwndPage, SW_SHOW);
|
---|
659 | else
|
---|
660 | {
|
---|
661 | LPCPROPSHEETPAGEA ppshpage = PROPSHEET_GetPSPPage(psInfo, index);
|
---|
662 | PROPSHEET_CreatePage(hwndDlg, index, psInfo, ppshpage, TRUE);
|
---|
663 | }
|
---|
664 |
|
---|
665 | psInfo->active_page = index;
|
---|
666 |
|
---|
667 | return TRUE;
|
---|
668 | }
|
---|
669 |
|
---|
670 | /******************************************************************************
|
---|
671 | * PROPSHEET_Apply
|
---|
672 | */
|
---|
673 | static BOOL PROPSHEET_Apply(HWND hwndDlg)
|
---|
674 | {
|
---|
675 | int i;
|
---|
676 | NMHDR hdr;
|
---|
677 | HWND hwndPage;
|
---|
678 | LRESULT msgResult;
|
---|
679 | PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
---|
680 | PropSheetInfoStr);
|
---|
681 |
|
---|
682 | hdr.hwndFrom = hwndDlg;
|
---|
683 |
|
---|
684 | /*
|
---|
685 | * Send PSN_KILLACTIVE to the current page.
|
---|
686 | */
|
---|
687 | hdr.code = PSN_KILLACTIVE;
|
---|
688 |
|
---|
689 | hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
---|
690 |
|
---|
691 | if (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &hdr) != FALSE)
|
---|
692 | return FALSE;
|
---|
693 |
|
---|
694 | /*
|
---|
695 | * Send PSN_APPLY to all pages.
|
---|
696 | */
|
---|
697 | hdr.code = PSN_APPLY;
|
---|
698 |
|
---|
699 | for (i = 0; i < psInfo->nPages; i++)
|
---|
700 | {
|
---|
701 | hwndPage = psInfo->proppage[i].hwndPage;
|
---|
702 | msgResult = SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &hdr);
|
---|
703 |
|
---|
704 | if (msgResult == PSNRET_INVALID_NOCHANGEPAGE)
|
---|
705 | return FALSE;
|
---|
706 | }
|
---|
707 |
|
---|
708 | return TRUE;
|
---|
709 | }
|
---|
710 |
|
---|
711 | /******************************************************************************
|
---|
712 | * PROPSHEET_Cancel
|
---|
713 | */
|
---|
714 | static void PROPSHEET_Cancel(HWND hwndDlg)
|
---|
715 | {
|
---|
716 | PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
---|
717 | PropSheetInfoStr);
|
---|
718 | HWND hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
---|
719 | NMHDR hdr;
|
---|
720 |
|
---|
721 | hdr.hwndFrom = hwndDlg;
|
---|
722 | hdr.code = PSN_QUERYCANCEL;
|
---|
723 |
|
---|
724 | if (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &hdr))
|
---|
725 | return;
|
---|
726 |
|
---|
727 | hdr.code = PSN_RESET;
|
---|
728 |
|
---|
729 | SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &hdr);
|
---|
730 |
|
---|
731 | if (psInfo->isModeless)
|
---|
732 | psInfo->active_page = -1; /* makes PSM_GETCURRENTPAGEHWND return NULL */
|
---|
733 | else
|
---|
734 | EndDialog(hwndDlg, FALSE);
|
---|
735 | }
|
---|
736 |
|
---|
737 | /******************************************************************************
|
---|
738 | * PROPSHEET_Help
|
---|
739 | */
|
---|
740 | static void PROPSHEET_Help(HWND hwndDlg)
|
---|
741 | {
|
---|
742 | PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
---|
743 | PropSheetInfoStr);
|
---|
744 | HWND hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
---|
745 | NMHDR hdr;
|
---|
746 |
|
---|
747 | hdr.hwndFrom = hwndDlg;
|
---|
748 | hdr.code = PSN_HELP;
|
---|
749 |
|
---|
750 | SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &hdr);
|
---|
751 | }
|
---|
752 |
|
---|
753 | /******************************************************************************
|
---|
754 | * PROPSHEET_Changed
|
---|
755 | */
|
---|
756 | static void PROPSHEET_Changed(HWND hwndDlg, HWND hwndDirtyPage)
|
---|
757 | {
|
---|
758 | int i;
|
---|
759 | PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
---|
760 | PropSheetInfoStr);
|
---|
761 |
|
---|
762 | /*
|
---|
763 | * Set the dirty flag of this page.
|
---|
764 | */
|
---|
765 | for (i = 0; i < psInfo->nPages; i++)
|
---|
766 | {
|
---|
767 | if (psInfo->proppage[i].hwndPage == hwndDirtyPage)
|
---|
768 | psInfo->proppage[i].isDirty = TRUE;
|
---|
769 | }
|
---|
770 |
|
---|
771 | /*
|
---|
772 | * Enable the Apply button.
|
---|
773 | */
|
---|
774 | if (psInfo->hasApply)
|
---|
775 | {
|
---|
776 | HWND hwndApplyBtn = GetDlgItem(hwndDlg, IDC_APPLY_BUTTON);
|
---|
777 |
|
---|
778 | EnableWindow(hwndApplyBtn, TRUE);
|
---|
779 | }
|
---|
780 | }
|
---|
781 |
|
---|
782 | /******************************************************************************
|
---|
783 | * PROPSHEET_UnChanged
|
---|
784 | */
|
---|
785 | static void PROPSHEET_UnChanged(HWND hwndDlg, HWND hwndCleanPage)
|
---|
786 | {
|
---|
787 | int i;
|
---|
788 | BOOL noPageDirty = TRUE;
|
---|
789 | HWND hwndApplyBtn = GetDlgItem(hwndDlg, IDC_APPLY_BUTTON);
|
---|
790 | PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
---|
791 | PropSheetInfoStr);
|
---|
792 |
|
---|
793 | for (i = 0; i < psInfo->nPages; i++)
|
---|
794 | {
|
---|
795 | /* set the specified page as clean */
|
---|
796 | if (psInfo->proppage[i].hwndPage == hwndCleanPage)
|
---|
797 | psInfo->proppage[i].isDirty = FALSE;
|
---|
798 |
|
---|
799 | /* look to see if there's any dirty pages */
|
---|
800 | if (psInfo->proppage[i].isDirty)
|
---|
801 | noPageDirty = FALSE;
|
---|
802 | }
|
---|
803 |
|
---|
804 | /*
|
---|
805 | * Disable Apply button.
|
---|
806 | */
|
---|
807 | if (noPageDirty)
|
---|
808 | EnableWindow(hwndApplyBtn, FALSE);
|
---|
809 | }
|
---|
810 |
|
---|
811 | /******************************************************************************
|
---|
812 | * PROPSHEET_PressButton
|
---|
813 | */
|
---|
814 | static void PROPSHEET_PressButton(HWND hwndDlg, int buttonID)
|
---|
815 | {
|
---|
816 | switch (buttonID)
|
---|
817 | {
|
---|
818 | case PSBTN_APPLYNOW:
|
---|
819 | SendMessageA(hwndDlg, WM_COMMAND, IDC_APPLY_BUTTON, 0);
|
---|
820 | break;
|
---|
821 | case PSBTN_BACK:
|
---|
822 | // FIXME(propsheet, "Wizard mode not implemented.\n");
|
---|
823 | break;
|
---|
824 | case PSBTN_CANCEL:
|
---|
825 | SendMessageA(hwndDlg, WM_COMMAND, IDCANCEL, 0);
|
---|
826 | break;
|
---|
827 | case PSBTN_FINISH:
|
---|
828 | // FIXME(propsheet, "Wizard mode not implemented.\n");
|
---|
829 | break;
|
---|
830 | case PSBTN_HELP:
|
---|
831 | SendMessageA(hwndDlg, WM_COMMAND, IDHELP, 0);
|
---|
832 | break;
|
---|
833 | case PSBTN_NEXT:
|
---|
834 | // FIXME(propsheet, "Wizard mode not implemented.\n");
|
---|
835 | break;
|
---|
836 | case PSBTN_OK:
|
---|
837 | SendMessageA(hwndDlg, WM_COMMAND, IDOK, 0);
|
---|
838 | break;
|
---|
839 | default:
|
---|
840 | // FIXME(propsheet, "Invalid button index %d\n", buttonID);
|
---|
841 | break;
|
---|
842 | }
|
---|
843 | }
|
---|
844 |
|
---|
845 | /******************************************************************************
|
---|
846 | * PROPSHEET_SetCurSel
|
---|
847 | */
|
---|
848 | static BOOL PROPSHEET_SetCurSel(HWND hwndDlg,
|
---|
849 | int index,
|
---|
850 | HPROPSHEETPAGE hpage)
|
---|
851 | {
|
---|
852 | PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
---|
853 | PropSheetInfoStr);
|
---|
854 | HWND hwndPage;
|
---|
855 | HWND hwndHelp = GetDlgItem(hwndDlg, IDHELP);
|
---|
856 | NMHDR hdr;
|
---|
857 |
|
---|
858 | /*
|
---|
859 | * Notify the current page.
|
---|
860 | */
|
---|
861 | hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
---|
862 |
|
---|
863 | hdr.hwndFrom = hwndDlg;
|
---|
864 | hdr.code = PSN_KILLACTIVE;
|
---|
865 |
|
---|
866 | if (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &hdr))
|
---|
867 | return FALSE;
|
---|
868 |
|
---|
869 | // if (hpage != NULL)
|
---|
870 | // FIXME(propsheet, "Implement HPROPSHEETPAGE!\n");
|
---|
871 | // else
|
---|
872 | hwndPage = psInfo->proppage[index].hwndPage;
|
---|
873 |
|
---|
874 | /*
|
---|
875 | * Notify the new page.
|
---|
876 | */
|
---|
877 | hdr.code = PSN_SETACTIVE;
|
---|
878 |
|
---|
879 | SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &hdr);
|
---|
880 |
|
---|
881 | /*
|
---|
882 | * Display the new page.
|
---|
883 | */
|
---|
884 | PROPSHEET_ShowPage(hwndDlg, index, psInfo);
|
---|
885 |
|
---|
886 | if (psInfo->proppage[index].hasHelp)
|
---|
887 | EnableWindow(hwndHelp, TRUE);
|
---|
888 | else
|
---|
889 | EnableWindow(hwndHelp, FALSE);
|
---|
890 |
|
---|
891 | return TRUE;
|
---|
892 | }
|
---|
893 |
|
---|
894 | /******************************************************************************
|
---|
895 | * PROPSHEET_SetTitleA
|
---|
896 | */
|
---|
897 | static void PROPSHEET_SetTitleA(HWND hwndDlg, DWORD dwStyle, LPCSTR lpszText)
|
---|
898 | {
|
---|
899 | if (dwStyle & PSH_PROPTITLE)
|
---|
900 | {
|
---|
901 | PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
---|
902 | PropSheetInfoStr);
|
---|
903 | char* dest;
|
---|
904 | int lentitle = strlen(lpszText);
|
---|
905 | int lenprop = strlen(psInfo->strPropertiesFor);
|
---|
906 |
|
---|
907 | dest = COMCTL32_Alloc(lentitle + lenprop + 1);
|
---|
908 | strcpy(dest, psInfo->strPropertiesFor);
|
---|
909 | strcat(dest, lpszText);
|
---|
910 |
|
---|
911 | SetWindowTextA(hwndDlg, dest);
|
---|
912 | COMCTL32_Free(dest);
|
---|
913 | }
|
---|
914 | else
|
---|
915 | SetWindowTextA(hwndDlg, lpszText);
|
---|
916 | }
|
---|
917 |
|
---|
918 | /******************************************************************************
|
---|
919 | * PROPSHEET_QuerySiblings
|
---|
920 | */
|
---|
921 | static LRESULT PROPSHEET_QuerySiblings(HWND hwndDlg,
|
---|
922 | WPARAM wParam, LPARAM lParam)
|
---|
923 | {
|
---|
924 | int i = 0;
|
---|
925 | HWND hwndPage;
|
---|
926 | LRESULT msgResult = 0;
|
---|
927 | PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
---|
928 | PropSheetInfoStr);
|
---|
929 |
|
---|
930 | while ((i < psInfo->nPages) && (msgResult == 0))
|
---|
931 | {
|
---|
932 | hwndPage = psInfo->proppage[i].hwndPage;
|
---|
933 | msgResult = SendMessageA(hwndPage, PSM_QUERYSIBLINGS, wParam, lParam);
|
---|
934 | i++;
|
---|
935 | }
|
---|
936 |
|
---|
937 | return msgResult;
|
---|
938 | }
|
---|
939 |
|
---|
940 | /******************************************************************************
|
---|
941 | * PROPSHEET_GetPSPPage
|
---|
942 | */
|
---|
943 | static LPCPROPSHEETPAGEA PROPSHEET_GetPSPPage(const PropSheetInfo * psInfo,
|
---|
944 | int index)
|
---|
945 | {
|
---|
946 | BOOL usePSP = psInfo->ppshheader->dwFlags & PSH_PROPSHEETPAGE;
|
---|
947 | LPCPROPSHEETPAGEA lppsp;
|
---|
948 | int realIndex = psInfo->proppage[index].index;
|
---|
949 |
|
---|
950 | if (usePSP)
|
---|
951 | {
|
---|
952 | BYTE* pByte;
|
---|
953 |
|
---|
954 | lppsp = psInfo->ppshheader->u3.ppsp;
|
---|
955 |
|
---|
956 | pByte = (BYTE*) lppsp;
|
---|
957 |
|
---|
958 | pByte += (lppsp->dwSize * realIndex);
|
---|
959 | lppsp = (LPCPROPSHEETPAGEA)pByte;
|
---|
960 | }
|
---|
961 | else
|
---|
962 | lppsp = (LPCPROPSHEETPAGEA) psInfo->ppshheader->u3.phpage[realIndex];
|
---|
963 |
|
---|
964 | return lppsp;
|
---|
965 | }
|
---|
966 |
|
---|
967 | /******************************************************************************
|
---|
968 | * PROPSHEET_AddPage
|
---|
969 | */
|
---|
970 | static BOOL PROPSHEET_AddPage(HWND hwndDlg,
|
---|
971 | HPROPSHEETPAGE hpage)
|
---|
972 | {
|
---|
973 | PropSheetInfo * psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
---|
974 | PropSheetInfoStr);
|
---|
975 | HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
|
---|
976 | TCITEMA item;
|
---|
977 | char tabtext[MAX_TABTEXT_LENGTH] = "Tab text";
|
---|
978 | LPCPROPSHEETPAGEA ppsp = (LPCPROPSHEETPAGEA)hpage;
|
---|
979 |
|
---|
980 | /*
|
---|
981 | * Allocate and fill in a new PropPageInfo entry.
|
---|
982 | */
|
---|
983 | psInfo->proppage = (PropPageInfo*) COMCTL32_ReAlloc(psInfo->proppage,
|
---|
984 | sizeof(PropPageInfo) *
|
---|
985 | (psInfo->nPages + 1));
|
---|
986 |
|
---|
987 | PROPSHEET_CollectPageInfo(ppsp, psInfo, psInfo->nPages);
|
---|
988 | psInfo->proppage[psInfo->nPages].index = -1;
|
---|
989 | psInfo->proppage[psInfo->nPages].hpage = hpage;
|
---|
990 |
|
---|
991 | /*
|
---|
992 | * Create the page but don't show it.
|
---|
993 | */
|
---|
994 | PROPSHEET_CreatePage(hwndDlg, psInfo->nPages, psInfo, ppsp, FALSE);
|
---|
995 |
|
---|
996 | /*
|
---|
997 | * Add a new tab to the tab control.
|
---|
998 | */
|
---|
999 | item.mask = TCIF_TEXT;
|
---|
1000 | item.pszText = tabtext;
|
---|
1001 | item.cchTextMax = MAX_TABTEXT_LENGTH;
|
---|
1002 |
|
---|
1003 | WideCharToMultiByte(CP_ACP, 0,
|
---|
1004 | (LPCWSTR)psInfo->proppage[psInfo->nPages].pszText,
|
---|
1005 | -1, tabtext, MAX_TABTEXT_LENGTH, NULL, NULL);
|
---|
1006 |
|
---|
1007 | SendMessageA(hwndTabControl, TCM_INSERTITEMA, psInfo->nPages + 1,
|
---|
1008 | (LPARAM)&item);
|
---|
1009 |
|
---|
1010 | psInfo->nPages++;
|
---|
1011 |
|
---|
1012 | return FALSE;
|
---|
1013 | }
|
---|
1014 |
|
---|
1015 | /******************************************************************************
|
---|
1016 | * PROPSHEET_RemovePage
|
---|
1017 | */
|
---|
1018 | static BOOL PROPSHEET_RemovePage(HWND hwndDlg,
|
---|
1019 | int index,
|
---|
1020 | HPROPSHEETPAGE hpage)
|
---|
1021 | {
|
---|
1022 | PropSheetInfo * psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
|
---|
1023 | PropSheetInfoStr);
|
---|
1024 | HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
|
---|
1025 | PropPageInfo* oldPages = psInfo->proppage;
|
---|
1026 |
|
---|
1027 | /*
|
---|
1028 | * hpage takes precedence over index.
|
---|
1029 | */
|
---|
1030 | if (hpage != 0)
|
---|
1031 | {
|
---|
1032 | index = PROPSHEET_GetPageIndex(hpage, psInfo);
|
---|
1033 |
|
---|
1034 | if (index == -1)
|
---|
1035 | {
|
---|
1036 | // TRACE(propsheet, "Could not find page to remove!\n");
|
---|
1037 | return FALSE;
|
---|
1038 | }
|
---|
1039 | }
|
---|
1040 |
|
---|
1041 | // TRACE(propsheet, "total pages %d removing page %d active page %d\n",
|
---|
1042 | // psInfo->nPages, index, psInfo->active_page);
|
---|
1043 | /*
|
---|
1044 | * Check if we're removing the active page.
|
---|
1045 | */
|
---|
1046 | if (index == psInfo->active_page)
|
---|
1047 | {
|
---|
1048 | if (psInfo->nPages > 1)
|
---|
1049 | {
|
---|
1050 | if (index > 0)
|
---|
1051 | {
|
---|
1052 | /* activate previous page */
|
---|
1053 | PROPSHEET_ShowPage(hwndDlg, index - 1, psInfo);
|
---|
1054 | }
|
---|
1055 | else
|
---|
1056 | {
|
---|
1057 | /* activate the next page */
|
---|
1058 | PROPSHEET_ShowPage(hwndDlg, index + 1, psInfo);
|
---|
1059 | }
|
---|
1060 | }
|
---|
1061 | else
|
---|
1062 | {
|
---|
1063 | // TRACE(propsheet, "Removing the only page, close the dialog!\n");
|
---|
1064 |
|
---|
1065 | if (psInfo->isModeless)
|
---|
1066 | psInfo->active_page = -1;
|
---|
1067 | else
|
---|
1068 | EndDialog(hwndDlg, FALSE);
|
---|
1069 |
|
---|
1070 | return TRUE;
|
---|
1071 | }
|
---|
1072 | }
|
---|
1073 |
|
---|
1074 | if (index < psInfo->active_page)
|
---|
1075 | psInfo->active_page--;
|
---|
1076 |
|
---|
1077 | /* Remove the tab */
|
---|
1078 | SendMessageA(hwndTabControl, TCM_DELETEITEM, index, 0);
|
---|
1079 |
|
---|
1080 | psInfo->nPages--;
|
---|
1081 | psInfo->proppage = COMCTL32_Alloc(sizeof(PropPageInfo) * psInfo->nPages);
|
---|
1082 |
|
---|
1083 | if (index > 0)
|
---|
1084 | memcpy(&psInfo->proppage[0], &oldPages[0], index * sizeof(PropPageInfo));
|
---|
1085 |
|
---|
1086 | if (index < psInfo->nPages)
|
---|
1087 | memcpy(&psInfo->proppage[index], &oldPages[index + 1],
|
---|
1088 | (psInfo->nPages - index) * sizeof(PropPageInfo));
|
---|
1089 |
|
---|
1090 | COMCTL32_Free(oldPages);
|
---|
1091 |
|
---|
1092 | return FALSE;
|
---|
1093 | }
|
---|
1094 |
|
---|
1095 | /******************************************************************************
|
---|
1096 | * PROPSHEET_GetPageIndex
|
---|
1097 | *
|
---|
1098 | * Given a HPROPSHEETPAGE, returns the index of the corresponding page from
|
---|
1099 | * the array of PropPageInfo.
|
---|
1100 | */
|
---|
1101 | static int PROPSHEET_GetPageIndex(HPROPSHEETPAGE hpage, PropSheetInfo* psInfo)
|
---|
1102 | {
|
---|
1103 | BOOL found = FALSE;
|
---|
1104 | int index = 0;
|
---|
1105 |
|
---|
1106 | while ((index < psInfo->nPages) && (found == FALSE))
|
---|
1107 | {
|
---|
1108 | if (psInfo->proppage[index].hpage == hpage)
|
---|
1109 | found = TRUE;
|
---|
1110 | else
|
---|
1111 | index++;
|
---|
1112 | }
|
---|
1113 |
|
---|
1114 | if (found == FALSE)
|
---|
1115 | index = -1;
|
---|
1116 |
|
---|
1117 | return index;
|
---|
1118 | }
|
---|
1119 |
|
---|
1120 | /******************************************************************************
|
---|
1121 | * PROPSHEET_CleanUp
|
---|
1122 | */
|
---|
1123 | static void PROPSHEET_CleanUp(HWND hwndDlg)
|
---|
1124 | {
|
---|
1125 | PropSheetInfo* psInfo = (PropSheetInfo*) RemovePropA(hwndDlg,
|
---|
1126 | PropSheetInfoStr);
|
---|
1127 | COMCTL32_Free(psInfo->proppage);
|
---|
1128 | COMCTL32_Free(psInfo->strPropertiesFor);
|
---|
1129 |
|
---|
1130 | GlobalFree((HGLOBAL)psInfo);
|
---|
1131 | }
|
---|
1132 |
|
---|
1133 | /******************************************************************************
|
---|
1134 | * PropertySheetA (COMCTL32.84)(COMCTL32.83)
|
---|
1135 | */
|
---|
1136 | INT WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh)
|
---|
1137 | {
|
---|
1138 | int bRet = 0;
|
---|
1139 | PropSheetInfo* psInfo = (PropSheetInfo*) GlobalAlloc(GPTR,
|
---|
1140 | sizeof(PropSheetInfo));
|
---|
1141 | LPCPROPSHEETPAGEA lppsp;
|
---|
1142 | int i;
|
---|
1143 |
|
---|
1144 | PROPSHEET_CollectSheetInfo(lppsh, psInfo);
|
---|
1145 |
|
---|
1146 | psInfo->proppage = (PropPageInfo*) COMCTL32_Alloc(sizeof(PropPageInfo) *
|
---|
1147 | lppsh->nPages);
|
---|
1148 |
|
---|
1149 | for (i = 0; i < lppsh->nPages; i++)
|
---|
1150 | {
|
---|
1151 | psInfo->proppage[i].index = i;
|
---|
1152 | if (!(lppsh->dwFlags & PSH_PROPSHEETPAGE))
|
---|
1153 | psInfo->proppage[i].hpage = psInfo->ppshheader->u3.phpage[i];
|
---|
1154 | lppsp = PROPSHEET_GetPSPPage(psInfo, i);
|
---|
1155 | PROPSHEET_CollectPageInfo(lppsp, psInfo, i);
|
---|
1156 | }
|
---|
1157 |
|
---|
1158 | bRet = PROPSHEET_CreateDialog(psInfo);
|
---|
1159 |
|
---|
1160 | return bRet;
|
---|
1161 | }
|
---|
1162 |
|
---|
1163 | /******************************************************************************
|
---|
1164 | * PropertySheet32W (COMCTL32.85)
|
---|
1165 | */
|
---|
1166 | INT WINAPI PropertySheetW(LPCPROPSHEETHEADERW propertySheetHeader)
|
---|
1167 | {
|
---|
1168 | // FIXME(propsheet, "(%p): stub\n", propertySheetHeader);
|
---|
1169 |
|
---|
1170 | return -1;
|
---|
1171 | }
|
---|
1172 |
|
---|
1173 | /******************************************************************************
|
---|
1174 | * CreatePropertySheetPageA (COMCTL32.19)(COMCTL32.18)
|
---|
1175 | */
|
---|
1176 | HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(
|
---|
1177 | LPCPROPSHEETPAGEA lpPropSheetPage)
|
---|
1178 | {
|
---|
1179 | PROPSHEETPAGEA* ppsp = COMCTL32_Alloc(sizeof(PROPSHEETPAGEA));
|
---|
1180 |
|
---|
1181 | *ppsp = *lpPropSheetPage;
|
---|
1182 |
|
---|
1183 | return (HPROPSHEETPAGE)ppsp;
|
---|
1184 | }
|
---|
1185 |
|
---|
1186 | /******************************************************************************
|
---|
1187 | * CreatePropertySheetPageW (COMCTL32.20)
|
---|
1188 | */
|
---|
1189 | HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage)
|
---|
1190 | {
|
---|
1191 | // FIXME(propsheet, "(%p): stub\n", lpPropSheetPage);
|
---|
1192 |
|
---|
1193 | return 0;
|
---|
1194 | }
|
---|
1195 |
|
---|
1196 | /******************************************************************************
|
---|
1197 | * DestroyPropertySheetPage (COMCTL32.24)
|
---|
1198 | */
|
---|
1199 | BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
|
---|
1200 | {
|
---|
1201 | COMCTL32_Free(hPropPage);
|
---|
1202 |
|
---|
1203 | return TRUE;
|
---|
1204 | }
|
---|
1205 |
|
---|
1206 | /******************************************************************************
|
---|
1207 | * PROPSHEET_DialogProc
|
---|
1208 | */
|
---|
1209 | BOOL WINAPI
|
---|
1210 | PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
---|
1211 | {
|
---|
1212 | switch (uMsg)
|
---|
1213 | {
|
---|
1214 | case WM_INITDIALOG:
|
---|
1215 | {
|
---|
1216 | PropSheetInfo* psInfo = (PropSheetInfo*) lParam;
|
---|
1217 | char* strCaption = (char*)COMCTL32_Alloc(MAX_CAPTION_LENGTH);
|
---|
1218 | HWND hwndTabCtrl = GetDlgItem(hwnd, IDC_TABCONTROL);
|
---|
1219 | LPCPROPSHEETPAGEA ppshpage;
|
---|
1220 |
|
---|
1221 | psInfo->strPropertiesFor = strCaption;
|
---|
1222 |
|
---|
1223 | GetWindowTextA(hwnd, psInfo->strPropertiesFor, MAX_CAPTION_LENGTH);
|
---|
1224 |
|
---|
1225 | PROPSHEET_CreateTabControl(hwnd, psInfo);
|
---|
1226 |
|
---|
1227 | if (PROPSHEET_IsTooSmall(hwnd, psInfo))
|
---|
1228 | {
|
---|
1229 | PROPSHEET_AdjustSize(hwnd, psInfo);
|
---|
1230 | PROPSHEET_AdjustButtons(hwnd, psInfo);
|
---|
1231 | }
|
---|
1232 |
|
---|
1233 | ppshpage = PROPSHEET_GetPSPPage(psInfo, psInfo->active_page);
|
---|
1234 | PROPSHEET_CreatePage(hwnd, psInfo->active_page, psInfo, ppshpage, TRUE);
|
---|
1235 | SendMessageA(hwndTabCtrl, TCM_SETCURSEL, psInfo->active_page, 0);
|
---|
1236 |
|
---|
1237 | SetPropA(hwnd, PropSheetInfoStr, (HANDLE)psInfo);
|
---|
1238 |
|
---|
1239 | PROPSHEET_SetTitleA(hwnd,
|
---|
1240 | psInfo->ppshheader->dwFlags,
|
---|
1241 | psInfo->ppshheader->pszCaption);
|
---|
1242 |
|
---|
1243 | return TRUE;
|
---|
1244 | }
|
---|
1245 |
|
---|
1246 | case WM_DESTROY:
|
---|
1247 | PROPSHEET_CleanUp(hwnd);
|
---|
1248 | return TRUE;
|
---|
1249 |
|
---|
1250 | case WM_CLOSE:
|
---|
1251 | PROPSHEET_Cancel(hwnd);
|
---|
1252 | return TRUE;
|
---|
1253 |
|
---|
1254 | case WM_COMMAND:
|
---|
1255 | {
|
---|
1256 | WORD wID = LOWORD(wParam);
|
---|
1257 |
|
---|
1258 | switch (wID)
|
---|
1259 | {
|
---|
1260 | case IDOK:
|
---|
1261 | case IDC_APPLY_BUTTON:
|
---|
1262 | {
|
---|
1263 | HWND hwndApplyBtn = GetDlgItem(hwnd, IDC_APPLY_BUTTON);
|
---|
1264 |
|
---|
1265 | if (PROPSHEET_Apply(hwnd) == FALSE)
|
---|
1266 | break;
|
---|
1267 |
|
---|
1268 | EnableWindow(hwndApplyBtn, FALSE);
|
---|
1269 |
|
---|
1270 | if (wID == IDOK)
|
---|
1271 | {
|
---|
1272 | PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwnd,
|
---|
1273 | PropSheetInfoStr);
|
---|
1274 | int result = TRUE;
|
---|
1275 |
|
---|
1276 | if (psInfo->restartWindows)
|
---|
1277 | result = ID_PSRESTARTWINDOWS;
|
---|
1278 |
|
---|
1279 | /* reboot system takes precedence over restart windows */
|
---|
1280 | if (psInfo->rebootSystem)
|
---|
1281 | result = ID_PSREBOOTSYSTEM;
|
---|
1282 |
|
---|
1283 | if (psInfo->isModeless)
|
---|
1284 | psInfo->active_page = -1;
|
---|
1285 | else
|
---|
1286 | EndDialog(hwnd, result);
|
---|
1287 | }
|
---|
1288 |
|
---|
1289 | break;
|
---|
1290 | }
|
---|
1291 |
|
---|
1292 | case IDCANCEL:
|
---|
1293 | PROPSHEET_Cancel(hwnd);
|
---|
1294 | break;
|
---|
1295 |
|
---|
1296 | case IDHELP:
|
---|
1297 | PROPSHEET_Help(hwnd);
|
---|
1298 | break;
|
---|
1299 | }
|
---|
1300 |
|
---|
1301 | return TRUE;
|
---|
1302 | }
|
---|
1303 |
|
---|
1304 | case WM_NOTIFY:
|
---|
1305 | {
|
---|
1306 | NMHDR* pnmh = (LPNMHDR) lParam;
|
---|
1307 |
|
---|
1308 | if (pnmh->code == TCN_SELCHANGE)
|
---|
1309 | {
|
---|
1310 | PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwnd,
|
---|
1311 | PropSheetInfoStr);
|
---|
1312 | int index = SendMessageA(pnmh->hwndFrom, TCM_GETCURSEL, 0, 0);
|
---|
1313 | HWND hwndHelp = GetDlgItem(hwnd, IDHELP);
|
---|
1314 |
|
---|
1315 | PROPSHEET_ShowPage(hwnd, index, psInfo);
|
---|
1316 |
|
---|
1317 | if (psInfo->proppage[index].hasHelp)
|
---|
1318 | EnableWindow(hwndHelp, TRUE);
|
---|
1319 | else
|
---|
1320 | EnableWindow(hwndHelp, FALSE);
|
---|
1321 | }
|
---|
1322 |
|
---|
1323 | return 0;
|
---|
1324 | }
|
---|
1325 |
|
---|
1326 | case PSM_GETCURRENTPAGEHWND:
|
---|
1327 | {
|
---|
1328 | PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwnd,
|
---|
1329 | PropSheetInfoStr);
|
---|
1330 | HWND hwndPage = 0;
|
---|
1331 |
|
---|
1332 | if (psInfo->active_page != -1)
|
---|
1333 | hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
|
---|
1334 |
|
---|
1335 | SetWindowLongA(hwnd, DWL_MSGRESULT, hwndPage);
|
---|
1336 |
|
---|
1337 | return TRUE;
|
---|
1338 | }
|
---|
1339 |
|
---|
1340 | case PSM_CHANGED:
|
---|
1341 | PROPSHEET_Changed(hwnd, (HWND)wParam);
|
---|
1342 | return TRUE;
|
---|
1343 |
|
---|
1344 | case PSM_UNCHANGED:
|
---|
1345 | PROPSHEET_UnChanged(hwnd, (HWND)wParam);
|
---|
1346 | return TRUE;
|
---|
1347 |
|
---|
1348 | case PSM_GETTABCONTROL:
|
---|
1349 | {
|
---|
1350 | HWND hwndTabCtrl = GetDlgItem(hwnd, IDC_TABCONTROL);
|
---|
1351 |
|
---|
1352 | SetWindowLongA(hwnd, DWL_MSGRESULT, hwndTabCtrl);
|
---|
1353 |
|
---|
1354 | return TRUE;
|
---|
1355 | }
|
---|
1356 |
|
---|
1357 | case PSM_SETCURSEL:
|
---|
1358 | {
|
---|
1359 | BOOL msgResult;
|
---|
1360 |
|
---|
1361 | msgResult = PROPSHEET_SetCurSel(hwnd,
|
---|
1362 | (int)wParam,
|
---|
1363 | (HPROPSHEETPAGE)lParam);
|
---|
1364 |
|
---|
1365 | SetWindowLongA(hwnd, DWL_MSGRESULT, msgResult);
|
---|
1366 |
|
---|
1367 | return TRUE;
|
---|
1368 | }
|
---|
1369 |
|
---|
1370 | case PSM_CANCELTOCLOSE:
|
---|
1371 | {
|
---|
1372 | HWND hwndOK = GetDlgItem(hwnd, IDOK);
|
---|
1373 | HWND hwndCancel = GetDlgItem(hwnd, IDCANCEL);
|
---|
1374 |
|
---|
1375 | EnableWindow(hwndCancel, FALSE);
|
---|
1376 | SetWindowTextA(hwndOK, "Close"); /* FIXME: hardcoded string */
|
---|
1377 |
|
---|
1378 | return TRUE;
|
---|
1379 | }
|
---|
1380 |
|
---|
1381 | case PSM_RESTARTWINDOWS:
|
---|
1382 | {
|
---|
1383 | PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwnd,
|
---|
1384 | PropSheetInfoStr);
|
---|
1385 |
|
---|
1386 | psInfo->restartWindows = TRUE;
|
---|
1387 | return TRUE;
|
---|
1388 | }
|
---|
1389 |
|
---|
1390 | case PSM_REBOOTSYSTEM:
|
---|
1391 | {
|
---|
1392 | PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwnd,
|
---|
1393 | PropSheetInfoStr);
|
---|
1394 |
|
---|
1395 | psInfo->rebootSystem = TRUE;
|
---|
1396 | return TRUE;
|
---|
1397 | }
|
---|
1398 |
|
---|
1399 | case PSM_SETTITLEA:
|
---|
1400 | PROPSHEET_SetTitleA(hwnd, (DWORD) wParam, (LPCSTR) lParam);
|
---|
1401 | return TRUE;
|
---|
1402 |
|
---|
1403 | case PSM_APPLY:
|
---|
1404 | {
|
---|
1405 | BOOL msgResult = PROPSHEET_Apply(hwnd);
|
---|
1406 |
|
---|
1407 | SetWindowLongA(hwnd, DWL_MSGRESULT, msgResult);
|
---|
1408 |
|
---|
1409 | return TRUE;
|
---|
1410 | }
|
---|
1411 |
|
---|
1412 | case PSM_QUERYSIBLINGS:
|
---|
1413 | {
|
---|
1414 | LRESULT msgResult = PROPSHEET_QuerySiblings(hwnd, wParam, lParam);
|
---|
1415 |
|
---|
1416 | SetWindowLongA(hwnd, DWL_MSGRESULT, msgResult);
|
---|
1417 |
|
---|
1418 | return TRUE;
|
---|
1419 | }
|
---|
1420 |
|
---|
1421 | case PSM_ADDPAGE:
|
---|
1422 | PROPSHEET_AddPage(hwnd, (HPROPSHEETPAGE)lParam);
|
---|
1423 | return TRUE;
|
---|
1424 |
|
---|
1425 | case PSM_REMOVEPAGE:
|
---|
1426 | PROPSHEET_RemovePage(hwnd, (int)wParam, (HPROPSHEETPAGE)lParam);
|
---|
1427 | return TRUE;
|
---|
1428 |
|
---|
1429 | case PSM_ISDIALOGMESSAGE:
|
---|
1430 | {
|
---|
1431 | // FIXME (propsheet, "Unimplemented msg PSM_ISDIALOGMESSAGE\n");
|
---|
1432 | return 0;
|
---|
1433 | }
|
---|
1434 |
|
---|
1435 | case PSM_PRESSBUTTON:
|
---|
1436 | PROPSHEET_PressButton(hwnd, (int)wParam);
|
---|
1437 | return TRUE;
|
---|
1438 |
|
---|
1439 | case PSM_SETTITLEW:
|
---|
1440 | // FIXME (propsheet, "Unimplemented msg PSM_SETTITLE32W\n");
|
---|
1441 | return 0;
|
---|
1442 | case PSM_SETWIZBUTTONS:
|
---|
1443 | // FIXME (propsheet, "Unimplemented msg PSM_SETWIZBUTTONS\n");
|
---|
1444 | return 0;
|
---|
1445 | case PSM_SETCURSELID:
|
---|
1446 | // FIXME (propsheet, "Unimplemented msg PSM_SETCURSELID\n");
|
---|
1447 | return 0;
|
---|
1448 | case PSM_SETFINISHTEXTA:
|
---|
1449 | // FIXME (propsheet, "Unimplemented msg PSM_SETFINISHTEXT32A\n");
|
---|
1450 | return 0;
|
---|
1451 | case PSM_SETFINISHTEXTW:
|
---|
1452 | // FIXME (propsheet, "Unimplemented msg PSM_SETFINISHTEXT32W\n");
|
---|
1453 | return 0;
|
---|
1454 |
|
---|
1455 | default:
|
---|
1456 | return FALSE;
|
---|
1457 | }
|
---|
1458 | }
|
---|
1459 |
|
---|