4 * Copyright 2006 - 2007 Thomas Weidenmueller <w3seek@reactos.org>
5 * 2015 Robert Naumann <gonzomdx@gmail.com>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 typedef struct _PROPSHEET_INFO
29 HBITMAP hTaskbarBitmap
;
32 } PROPSHEET_INFO
, *PPROPSHEET_INFO
;
36 UpdateBitmaps(PPROPSHEET_INFO pPropInfo
)
38 HWND hwndLock
, hwndHide
, hwndGroup
, hwndShowQL
, hwndClock
, hwndSeconds
, hwndHideInactive
, hwndModernStart
, hwndClassicStart
;
39 HWND hwndTaskbarBitmap
, hwndTrayBitmap
, hwndStartBitmap
;
40 HWND hwndCustomizeNotifyButton
, hwndCustomizeClassicStartButton
, hwndCustomizeModernStartButton
;
41 BOOL bLock
, bHide
, bGroup
, bShowQL
, bShowClock
, bShowSeconds
, bHideInactive
;
42 LPTSTR lpTaskBarImageName
= NULL
, lpTrayImageName
= NULL
, lpStartImageName
= NULL
;
45 hwndLock
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_LOCK
);
46 hwndHide
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_HIDE
);
47 hwndGroup
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_GROUP
);
48 hwndShowQL
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_SHOWQL
);
50 hwndClock
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_CLOCK
);
51 hwndSeconds
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_SECONDS
);
52 hwndHideInactive
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_HIDEICONS
);
54 hwndCustomizeNotifyButton
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_ICONCUST
);
56 hwndModernStart
= GetDlgItem(pPropInfo
->hStartWnd
, IDC_TASKBARPROP_STARTMENU
);
57 hwndClassicStart
= GetDlgItem(pPropInfo
->hStartWnd
, IDC_TASKBARPROP_STARTMENUCLASSIC
);
59 hwndCustomizeClassicStartButton
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_STARTMENUCLASSICCUST
);
60 hwndCustomizeModernStartButton
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_STARTMENUCUST
);
64 if (hwndLock
&& hwndHide
&& hwndGroup
&& hwndShowQL
&& hwndClock
&& hwndSeconds
&& hwndHideInactive
)
66 bLock
= (SendMessage(hwndLock
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
67 bHide
= (SendMessage(hwndHide
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
68 bGroup
= (SendMessage(hwndGroup
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
69 bShowQL
= (SendMessage(hwndShowQL
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
71 bShowClock
= (SendMessage(hwndClock
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
72 bShowSeconds
= (SendMessage(hwndSeconds
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
73 bHideInactive
= (SendMessage(hwndHideInactive
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
76 lpTaskBarImageName
= MAKEINTRESOURCEW(IDB_TASKBARPROP_AUTOHIDE
);
77 else if (bLock
&& bGroup
&& bShowQL
)
78 lpTaskBarImageName
= MAKEINTRESOURCEW(IDB_TASKBARPROP_LOCK_GROUP_QL
);
79 else if (bLock
&& !bGroup
&& !bShowQL
)
80 lpTaskBarImageName
= MAKEINTRESOURCEW(IDB_TASKBARPROP_LOCK_NOGROUP_NOQL
);
81 else if (bLock
&& bGroup
&& !bShowQL
)
82 lpTaskBarImageName
= MAKEINTRESOURCEW(IDB_TASKBARPROP_LOCK_GROUP_NOQL
);
83 else if (bLock
&& !bGroup
&& bShowQL
)
84 lpTaskBarImageName
= MAKEINTRESOURCEW(IDB_TASKBARPROP_LOCK_NOGROUP_QL
);
85 else if (!bLock
&& !bGroup
&& !bShowQL
)
86 lpTaskBarImageName
= MAKEINTRESOURCEW(IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL
);
87 else if (!bLock
&& bGroup
&& !bShowQL
)
88 lpTaskBarImageName
= MAKEINTRESOURCEW(IDB_TASKBARPROP_NOLOCK_GROUP_NOQL
);
89 else if (!bLock
&& !bGroup
&& bShowQL
)
90 lpTaskBarImageName
= MAKEINTRESOURCEW(IDB_TASKBARPROP_NOLOCK_NOGROUP_QL
);
91 else if (!bLock
&& bGroup
&& bShowQL
)
92 lpTaskBarImageName
= MAKEINTRESOURCEW(IDB_TASKBARPROP_NOLOCK_GROUP_QL
);
95 if (lpTaskBarImageName
)
97 if (pPropInfo
->hTaskbarBitmap
)
99 DeleteObject(pPropInfo
->hTaskbarBitmap
);
102 pPropInfo
->hTaskbarBitmap
= (HBITMAP
)LoadImageW(hExplorerInstance
,
108 if (pPropInfo
->hTaskbarBitmap
)
110 hwndTaskbarBitmap
= GetDlgItem(pPropInfo
->hTaskbarWnd
,
111 IDC_TASKBARPROP_TASKBARBITMAP
);
112 if (hwndTaskbarBitmap
)
114 SendMessage(hwndTaskbarBitmap
,
117 (LPARAM
)pPropInfo
->hTaskbarBitmap
);
124 EnableWindow(hwndCustomizeNotifyButton
, TRUE
);
127 EnableWindow(hwndSeconds
, TRUE
);
129 lpTrayImageName
= MAKEINTRESOURCEW(IDB_SYSTRAYPROP_HIDE_SECONDS
);
131 lpTrayImageName
= MAKEINTRESOURCEW(IDB_SYSTRAYPROP_HIDE_CLOCK
);
135 SendMessage(hwndSeconds
, BM_SETCHECK
, BST_UNCHECKED
, 0);
136 EnableWindow(hwndSeconds
, FALSE
);
137 lpTrayImageName
= MAKEINTRESOURCEW(IDB_SYSTRAYPROP_HIDE_NOCLOCK
);
142 EnableWindow(hwndCustomizeNotifyButton
, FALSE
);
145 EnableWindow(hwndSeconds
, TRUE
);
147 lpTrayImageName
= MAKEINTRESOURCEW(IDB_SYSTRAYPROP_SHOW_SECONDS
);
149 lpTrayImageName
= MAKEINTRESOURCEW(IDB_SYSTRAYPROP_SHOW_CLOCK
);
153 SendMessage(hwndSeconds
, BM_SETCHECK
, BST_UNCHECKED
, 0);
154 EnableWindow(hwndSeconds
, FALSE
);
155 lpTrayImageName
= MAKEINTRESOURCEW(IDB_SYSTRAYPROP_SHOW_NOCLOCK
);
161 if (pPropInfo
->hTrayBitmap
)
163 DeleteObject(pPropInfo
->hTrayBitmap
);
166 pPropInfo
->hTrayBitmap
= (HBITMAP
)LoadImageW(hExplorerInstance
,
172 if (pPropInfo
->hTrayBitmap
)
174 hwndTrayBitmap
= GetDlgItem(pPropInfo
->hTaskbarWnd
,
175 IDC_TASKBARPROP_NOTIFICATIONBITMAP
);
178 SendMessage(hwndTrayBitmap
,
181 (LPARAM
)pPropInfo
->hTrayBitmap
);
187 if(hwndClassicStart
&& hwndModernStart
)
189 if(SendMessage(hwndModernStart
, BM_GETCHECK
, 0, 0) == BST_CHECKED
)
191 EnableWindow(hwndCustomizeModernStartButton
, TRUE
);
192 EnableWindow(hwndCustomizeClassicStartButton
, FALSE
);
193 lpStartImageName
= MAKEINTRESOURCEW(IDB_STARTPREVIEW
);
197 EnableWindow(hwndCustomizeModernStartButton
, FALSE
);
198 EnableWindow(hwndCustomizeClassicStartButton
, TRUE
);
199 lpStartImageName
= MAKEINTRESOURCEW(IDB_STARTPREVIEW_CLASSIC
);
202 if (lpStartImageName
)
204 if (pPropInfo
->hStartBitmap
)
206 DeleteObject(pPropInfo
->hStartBitmap
);
209 pPropInfo
->hStartBitmap
= (HBITMAP
)LoadImageW(hExplorerInstance
,
215 if (pPropInfo
->hStartBitmap
)
217 hwndStartBitmap
= GetDlgItem(pPropInfo
->hStartWnd
,
218 IDC_TASKBARPROP_STARTMENU_BITMAP
);
221 SendMessage(hwndStartBitmap
,
224 (LPARAM
)pPropInfo
->hStartBitmap
);
234 OnCreateTaskbarPage(HWND hwnd
,
235 PPROPSHEET_INFO pPropInfo
)
237 SetWindowLongPtr(hwnd
,
239 (LONG_PTR
)pPropInfo
);
241 pPropInfo
->hTaskbarWnd
= hwnd
;
243 CheckDlgButton(hwnd
, IDC_TASKBARPROP_SECONDS
, TaskBarSettings
.bLock
? BST_CHECKED
: BST_UNCHECKED
);
244 CheckDlgButton(hwnd
, IDC_TASKBARPROP_SECONDS
, TaskBarSettings
.bAutoHide
? BST_CHECKED
: BST_UNCHECKED
);
245 CheckDlgButton(hwnd
, IDC_TASKBARPROP_SECONDS
, TaskBarSettings
.bAlwaysOnTop
? BST_CHECKED
: BST_UNCHECKED
);
246 CheckDlgButton(hwnd
, IDC_TASKBARPROP_SECONDS
, TaskBarSettings
.bGroupButtons
? BST_CHECKED
: BST_UNCHECKED
);
247 CheckDlgButton(hwnd
, IDC_TASKBARPROP_SECONDS
, TaskBarSettings
.bShowQuickLaunch
? BST_CHECKED
: BST_UNCHECKED
);
248 CheckDlgButton(hwnd
, IDC_TASKBARPROP_SECONDS
, TaskBarSettings
.bShowClock
? BST_CHECKED
: BST_UNCHECKED
);
249 CheckDlgButton(hwnd
, IDC_TASKBARPROP_SECONDS
, TaskBarSettings
.bShowSeconds
? BST_CHECKED
: BST_UNCHECKED
);
250 CheckDlgButton(hwnd
, IDC_TASKBARPROP_SECONDS
, TaskBarSettings
.bHideInactiveIcons
? BST_CHECKED
: BST_UNCHECKED
);
252 UpdateBitmaps(pPropInfo
);
256 OnCreateStartPage(HWND hwnd
,
257 PPROPSHEET_INFO pPropInfo
)
259 pPropInfo
->hStartWnd
= hwnd
;
261 CheckDlgButton(hwnd
, IDC_TASKBARPROP_STARTMENUCLASSIC
, 1); // HACK: This has to be read from registry!
263 UpdateBitmaps(pPropInfo
);
267 TaskbarPageProc(HWND hwndDlg
,
272 PPROPSHEET_INFO pPropInfo
;
274 /* Get the window context */
275 pPropInfo
= (PPROPSHEET_INFO
)GetWindowLongPtrW(hwndDlg
,
277 if (pPropInfo
== NULL
&& uMsg
!= WM_INITDIALOG
)
279 goto HandleDefaultMessage
;
285 OnCreateTaskbarPage(hwndDlg
, (PPROPSHEET_INFO
)((LPPROPSHEETPAGE
)lParam
)->lParam
);
289 switch (LOWORD(wParam
))
291 case IDC_TASKBARPROP_LOCK
:
292 case IDC_TASKBARPROP_HIDE
:
293 case IDC_TASKBARPROP_GROUP
:
294 case IDC_TASKBARPROP_SHOWQL
:
295 case IDC_TASKBARPROP_HIDEICONS
:
296 case IDC_TASKBARPROP_CLOCK
:
297 case IDC_TASKBARPROP_SECONDS
:
298 if (HIWORD(wParam
) == BN_CLICKED
)
300 UpdateBitmaps(pPropInfo
);
302 /* Enable the 'Apply' button */
303 PropSheet_Changed(GetParent(hwndDlg
), hwndDlg
);
306 case IDC_TASKBARPROP_ICONCUST
:
307 ShowCustomizeNotifyIcons(hExplorerInstance
, hwndDlg
);
314 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
322 TaskBarSettings
.bShowSeconds
= IsDlgButtonChecked(hwndDlg
, IDC_TASKBARPROP_SECONDS
);
323 SaveTaskBarSettings();
331 if (pPropInfo
->hTaskbarBitmap
)
333 DeleteObject(pPropInfo
->hTaskbarBitmap
);
335 if (pPropInfo
->hTrayBitmap
)
337 DeleteObject(pPropInfo
->hTrayBitmap
);
341 HandleDefaultMessage
:
349 static INT_PTR CALLBACK
350 StartMenuPageProc(HWND hwndDlg
,
358 OnCreateStartPage(hwndDlg
, (PPROPSHEET_INFO
)((LPPROPSHEETPAGE
)lParam
)->lParam
);
363 switch (LOWORD(wParam
))
365 case IDC_TASKBARPROP_STARTMENUCLASSICCUST
:
366 ShowCustomizeClassic(hExplorerInstance
, hwndDlg
);
377 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
396 InitPropSheetPage(PROPSHEETPAGE
*psp
,
401 ZeroMemory(psp
, sizeof(*psp
));
402 psp
->dwSize
= sizeof(*psp
);
403 psp
->dwFlags
= PSP_DEFAULT
;
404 psp
->hInstance
= hExplorerInstance
;
405 psp
->pszTemplate
= MAKEINTRESOURCEW(idDlg
);
406 psp
->lParam
= lParam
;
407 psp
->pfnDlgProc
= DlgProc
;
412 DisplayTrayProperties(IN HWND hwndOwner
)
414 PROPSHEET_INFO propInfo
= {0};
416 PROPSHEETPAGE psp
[2];
417 WCHAR szCaption
[256];
419 if (!LoadStringW(hExplorerInstance
,
420 IDS_TASKBAR_STARTMENU_PROP_CAPTION
,
422 _countof(szCaption
)))
427 ZeroMemory(&psh
, sizeof(psh
));
428 psh
.dwSize
= sizeof(psh
);
429 psh
.dwFlags
= PSH_PROPSHEETPAGE
| PSH_PROPTITLE
;
430 psh
.hwndParent
= hwndOwner
;
431 psh
.hInstance
= hExplorerInstance
;
433 psh
.pszCaption
= szCaption
;
434 psh
.nPages
= _countof(psp
);
438 InitPropSheetPage(&psp
[0], IDD_TASKBARPROP_TASKBAR
, TaskbarPageProc
, (LPARAM
)&propInfo
);
439 InitPropSheetPage(&psp
[1], IDD_TASKBARPROP_STARTMENU
, StartMenuPageProc
, (LPARAM
)&propInfo
);