aboutsummaryrefslogtreecommitdiff
path: root/CPP/Windows/Control/PropertyPage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/Windows/Control/PropertyPage.cpp')
-rw-r--r--CPP/Windows/Control/PropertyPage.cpp90
1 files changed, 56 insertions, 34 deletions
diff --git a/CPP/Windows/Control/PropertyPage.cpp b/CPP/Windows/Control/PropertyPage.cpp
index ce8696d..f8effe6 100644
--- a/CPP/Windows/Control/PropertyPage.cpp
+++ b/CPP/Windows/Control/PropertyPage.cpp
@@ -16,7 +16,13 @@ extern bool g_IsNT;
16namespace NWindows { 16namespace NWindows {
17namespace NControl { 17namespace NControl {
18 18
19static INT_PTR APIENTRY MyProperyPageProcedure(HWND dialogHWND, UINT message, WPARAM wParam, LPARAM lParam) 19static
20#ifdef Z7_OLD_WIN_SDK
21 BOOL
22#else
23 INT_PTR
24#endif
25APIENTRY MyProperyPageProcedure(HWND dialogHWND, UINT message, WPARAM wParam, LPARAM lParam)
20{ 26{
21 CWindow tempDialog(dialogHWND); 27 CWindow tempDialog(dialogHWND);
22 if (message == WM_INITDIALOG) 28 if (message == WM_INITDIALOG)
@@ -34,75 +40,91 @@ bool CPropertyPage::OnNotify(UINT /* controlID */, LPNMHDR lParam)
34{ 40{
35 switch (lParam->code) 41 switch (lParam->code)
36 { 42 {
37 case PSN_APPLY: SetMsgResult(OnApply(LPPSHNOTIFY(lParam))); break; 43 case PSN_APPLY: SetMsgResult(OnApply2(LPPSHNOTIFY(lParam))); break;
38 case PSN_KILLACTIVE: SetMsgResult(BoolToBOOL(OnKillActive(LPPSHNOTIFY(lParam)))); break; 44 case PSN_KILLACTIVE: SetMsgResult(BoolToBOOL(OnKillActive2(LPPSHNOTIFY(lParam)))); break;
39 case PSN_SETACTIVE: SetMsgResult(OnSetActive(LPPSHNOTIFY(lParam))); break; 45 case PSN_SETACTIVE: SetMsgResult(OnSetActive2(LPPSHNOTIFY(lParam))); break;
40 case PSN_RESET: OnReset(LPPSHNOTIFY(lParam)); break; 46 case PSN_RESET: OnReset2(LPPSHNOTIFY(lParam)); break;
41 case PSN_HELP: OnNotifyHelp(LPPSHNOTIFY(lParam)); break; 47 case PSN_HELP: OnNotifyHelp2(LPPSHNOTIFY(lParam)); break;
42 default: return false; 48 default: return false;
43 } 49 }
44 return true; 50 return true;
45} 51}
46 52
53/*
54PROPSHEETPAGE fields depend from
55#if (_WIN32_WINNT >= 0x0600)
56#elif (_WIN32_WINNT >= 0x0501)
57#elif (_WIN32_IE >= 0x0400)
58PROPSHEETHEADER fields depend from
59#if (_WIN32_IE >= 0x0400)
60*/
61#if defined(PROPSHEETPAGEA_V1_SIZE) && !defined(Z7_OLD_WIN_SDK)
62#ifndef _UNICODE
63#define my_compatib_PROPSHEETPAGEA PROPSHEETPAGEA_V1
64#endif
65#define my_compatib_PROPSHEETPAGEW PROPSHEETPAGEW_V1
66#else
67// for old mingw:
68#ifndef _UNICODE
69#define my_compatib_PROPSHEETPAGEA PROPSHEETPAGEA
70#endif
71#define my_compatib_PROPSHEETPAGEW PROPSHEETPAGEW
72#endif
73
47INT_PTR MyPropertySheet(const CObjectVector<CPageInfo> &pagesInfo, HWND hwndParent, const UString &title) 74INT_PTR MyPropertySheet(const CObjectVector<CPageInfo> &pagesInfo, HWND hwndParent, const UString &title)
48{ 75{
49 #ifndef _UNICODE
50 AStringVector titles;
51 #endif
52 #ifndef _UNICODE
53 CRecordVector<PROPSHEETPAGEA> pagesA;
54 #endif
55 CRecordVector<PROPSHEETPAGEW> pagesW;
56
57 unsigned i; 76 unsigned i;
58 #ifndef _UNICODE 77 #ifndef _UNICODE
78 AStringVector titles;
59 for (i = 0; i < pagesInfo.Size(); i++) 79 for (i = 0; i < pagesInfo.Size(); i++)
60 titles.Add(GetSystemString(pagesInfo[i].Title)); 80 titles.Add(GetSystemString(pagesInfo[i].Title));
81 CRecordVector<my_compatib_PROPSHEETPAGEA> pagesA;
61 #endif 82 #endif
83 CRecordVector<my_compatib_PROPSHEETPAGEW> pagesW;
62 84
63 for (i = 0; i < pagesInfo.Size(); i++) 85 for (i = 0; i < pagesInfo.Size(); i++)
64 { 86 {
65 const CPageInfo &pageInfo = pagesInfo[i]; 87 const CPageInfo &pageInfo = pagesInfo[i];
66 #ifndef _UNICODE 88 #ifndef _UNICODE
67 { 89 {
68 PROPSHEETPAGE page; 90 my_compatib_PROPSHEETPAGEA page;
91 memset(&page, 0, sizeof(page));
69 page.dwSize = sizeof(page); 92 page.dwSize = sizeof(page);
70 page.dwFlags = PSP_HASHELP; 93 page.dwFlags = PSP_HASHELP;
71 page.hInstance = g_hInstance; 94 page.hInstance = g_hInstance;
72 page.pszTemplate = MAKEINTRESOURCE(pageInfo.ID); 95 page.pszTemplate = MAKEINTRESOURCEA(pageInfo.ID);
73 page.pszIcon = NULL; 96 // page.pszIcon = NULL;
74 page.pfnDlgProc = NWindows::NControl::MyProperyPageProcedure; 97 page.pfnDlgProc = NWindows::NControl::MyProperyPageProcedure;
75 98
76 if (titles[i].IsEmpty()) 99 if (!titles[i].IsEmpty())
77 page.pszTitle = NULL;
78 else
79 { 100 {
80 page.dwFlags |= PSP_USETITLE;
81 page.pszTitle = titles[i]; 101 page.pszTitle = titles[i];
102 page.dwFlags |= PSP_USETITLE;
82 } 103 }
104 // else page.pszTitle = NULL;
83 page.lParam = (LPARAM)pageInfo.Page; 105 page.lParam = (LPARAM)pageInfo.Page;
84 page.pfnCallback = NULL; 106 // page.pfnCallback = NULL;
85 pagesA.Add(page); 107 pagesA.Add(page);
86 } 108 }
87 #endif 109 #endif
88 { 110 {
89 PROPSHEETPAGEW page; 111 my_compatib_PROPSHEETPAGEW page;
112 memset(&page, 0, sizeof(page));
90 page.dwSize = sizeof(page); 113 page.dwSize = sizeof(page);
91 page.dwFlags = PSP_HASHELP; 114 page.dwFlags = PSP_HASHELP;
92 page.hInstance = g_hInstance; 115 page.hInstance = g_hInstance;
93 page.pszTemplate = MAKEINTRESOURCEW(pageInfo.ID); 116 page.pszTemplate = MAKEINTRESOURCEW(pageInfo.ID);
94 page.pszIcon = NULL; 117 // page.pszIcon = NULL;
95 page.pfnDlgProc = NWindows::NControl::MyProperyPageProcedure; 118 page.pfnDlgProc = NWindows::NControl::MyProperyPageProcedure;
96 119
97 if (pageInfo.Title.IsEmpty()) 120 if (!pageInfo.Title.IsEmpty())
98 page.pszTitle = NULL;
99 else
100 { 121 {
101 page.dwFlags |= PSP_USETITLE;
102 page.pszTitle = pageInfo.Title; 122 page.pszTitle = pageInfo.Title;
123 page.dwFlags |= PSP_USETITLE;
103 } 124 }
125 // else page.pszTitle = NULL;
104 page.lParam = (LPARAM)pageInfo.Page; 126 page.lParam = (LPARAM)pageInfo.Page;
105 page.pfnCallback = NULL; 127 // page.pfnCallback = NULL;
106 pagesW.Add(page); 128 pagesW.Add(page);
107 } 129 }
108 } 130 }
@@ -110,16 +132,16 @@ INT_PTR MyPropertySheet(const CObjectVector<CPageInfo> &pagesInfo, HWND hwndPare
110 #ifndef _UNICODE 132 #ifndef _UNICODE
111 if (!g_IsNT) 133 if (!g_IsNT)
112 { 134 {
113 PROPSHEETHEADER sheet; 135 PROPSHEETHEADERA sheet;
114 sheet.dwSize = sizeof(sheet); 136 sheet.dwSize = sizeof(sheet);
115 sheet.dwFlags = PSH_PROPSHEETPAGE; 137 sheet.dwFlags = PSH_PROPSHEETPAGE;
116 sheet.hwndParent = hwndParent; 138 sheet.hwndParent = hwndParent;
117 sheet.hInstance = g_hInstance; 139 sheet.hInstance = g_hInstance;
118 AString titleA (GetSystemString(title)); 140 AString titleA (GetSystemString(title));
119 sheet.pszCaption = titleA; 141 sheet.pszCaption = titleA;
120 sheet.nPages = pagesInfo.Size(); 142 sheet.nPages = pagesA.Size();
121 sheet.nStartPage = 0; 143 sheet.nStartPage = 0;
122 sheet.ppsp = &pagesA.Front(); 144 sheet.ppsp = (LPCPROPSHEETPAGEA)(const void *)&pagesA.Front();
123 sheet.pfnCallback = NULL; 145 sheet.pfnCallback = NULL;
124 return ::PropertySheetA(&sheet); 146 return ::PropertySheetA(&sheet);
125 } 147 }
@@ -132,9 +154,9 @@ INT_PTR MyPropertySheet(const CObjectVector<CPageInfo> &pagesInfo, HWND hwndPare
132 sheet.hwndParent = hwndParent; 154 sheet.hwndParent = hwndParent;
133 sheet.hInstance = g_hInstance; 155 sheet.hInstance = g_hInstance;
134 sheet.pszCaption = title; 156 sheet.pszCaption = title;
135 sheet.nPages = pagesInfo.Size(); 157 sheet.nPages = pagesW.Size();
136 sheet.nStartPage = 0; 158 sheet.nStartPage = 0;
137 sheet.ppsp = &pagesW.Front(); 159 sheet.ppsp = (LPCPROPSHEETPAGEW)(const void *)&pagesW.Front();
138 sheet.pfnCallback = NULL; 160 sheet.pfnCallback = NULL;
139 return ::PropertySheetW(&sheet); 161 return ::PropertySheetW(&sheet);
140 } 162 }