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
;
31 } PROPSHEET_INFO
, *PPROPSHEET_INFO
;
35 UpdateTaskbarBitmap(PPROPSHEET_INFO pPropInfo
)
37 HWND hwndLock
, hwndHide
, hwndGroup
, hwndShowQL
, hwndClock
, hwndSeconds
, hwndHideInactive
;
38 HWND hwndTaskbarBitmap
, hwndTrayBitmap
;
39 HWND hwndAdvancedButton
;
40 BOOL bLock
, bHide
, bGroup
, bShowQL
, bShowClock
, bShowSeconds
, bHideInactive
;
41 LPTSTR lpTaskBarImageName
= NULL
, lpTrayImageName
= NULL
;
44 hwndLock
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_LOCK
);
45 hwndHide
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_HIDE
);
46 hwndGroup
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_GROUP
);
47 hwndShowQL
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_SHOWQL
);
49 hwndClock
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_CLOCK
);
50 hwndSeconds
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_SECONDS
);
51 hwndHideInactive
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_HIDEICONS
);
53 hwndAdvancedButton
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_ICONCUST
);
55 if (hwndLock
&& hwndHide
&& hwndGroup
&& hwndShowQL
&& hwndClock
&& hwndSeconds
&& hwndHideInactive
)
57 bLock
= (SendMessage(hwndLock
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
58 bHide
= (SendMessage(hwndHide
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
59 bGroup
= (SendMessage(hwndGroup
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
60 bShowQL
= (SendMessage(hwndShowQL
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
62 bShowClock
= (SendMessage(hwndClock
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
63 bShowSeconds
= (SendMessage(hwndSeconds
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
64 bHideInactive
= (SendMessage(hwndHideInactive
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
67 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_AUTOHIDE
);
68 else if (bLock
&& bGroup
&& bShowQL
)
69 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_GROUP_QL
);
70 else if (bLock
&& !bGroup
&& !bShowQL
)
71 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_NOGROUP_NOQL
);
72 else if (bLock
&& bGroup
&& !bShowQL
)
73 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_GROUP_NOQL
);
74 else if (bLock
&& !bGroup
&& bShowQL
)
75 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_NOGROUP_QL
);
76 else if (!bLock
&& !bGroup
&& !bShowQL
)
77 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL
);
78 else if (!bLock
&& bGroup
&& !bShowQL
)
79 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_GROUP_NOQL
);
80 else if (!bLock
&& !bGroup
&& bShowQL
)
81 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_NOGROUP_QL
);
82 else if (!bLock
&& bGroup
&& bShowQL
)
83 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_GROUP_QL
);
86 if (lpTaskBarImageName
)
88 if (pPropInfo
->hTaskbarBitmap
)
90 DeleteObject(pPropInfo
->hTaskbarBitmap
);
93 pPropInfo
->hTaskbarBitmap
= (HBITMAP
)LoadImage(hExplorerInstance
,
99 if (pPropInfo
->hTaskbarBitmap
)
101 hwndTaskbarBitmap
= GetDlgItem(pPropInfo
->hTaskbarWnd
,
102 IDC_TASKBARPROP_TASKBARBITMAP
);
103 if (hwndTaskbarBitmap
)
105 SendMessage(hwndTaskbarBitmap
,
108 (LPARAM
)pPropInfo
->hTaskbarBitmap
);
115 EnableWindow(hwndAdvancedButton
, TRUE
);
118 EnableWindow(hwndSeconds
, TRUE
);
120 lpTrayImageName
= MAKEINTRESOURCE(IDB_SYSTRAYPROP_HIDE_SECONDS
);
122 lpTrayImageName
= MAKEINTRESOURCE(IDB_SYSTRAYPROP_HIDE_CLOCK
);
126 SendMessage(hwndSeconds
, BM_SETCHECK
, BST_UNCHECKED
, 0);
127 EnableWindow(hwndSeconds
, FALSE
);
128 lpTrayImageName
= MAKEINTRESOURCE(IDB_SYSTRAYPROP_HIDE_NOCLOCK
);
133 EnableWindow(hwndAdvancedButton
, FALSE
);
136 EnableWindow(hwndSeconds
, TRUE
);
138 lpTrayImageName
= MAKEINTRESOURCE(IDB_SYSTRAYPROP_SHOW_SECONDS
);
140 lpTrayImageName
= MAKEINTRESOURCE(IDB_SYSTRAYPROP_SHOW_CLOCK
);
144 SendMessage(hwndSeconds
, BM_SETCHECK
, BST_UNCHECKED
, 0);
145 EnableWindow(hwndSeconds
, FALSE
);
146 lpTrayImageName
= MAKEINTRESOURCE(IDB_SYSTRAYPROP_SHOW_NOCLOCK
);
152 if (pPropInfo
->hTrayBitmap
)
154 DeleteObject(pPropInfo
->hTrayBitmap
);
157 pPropInfo
->hTrayBitmap
= (HBITMAP
)LoadImage(hExplorerInstance
,
163 if (pPropInfo
->hTrayBitmap
)
165 hwndTrayBitmap
= GetDlgItem(pPropInfo
->hTaskbarWnd
,
166 IDC_TASKBARPROP_NOTIFICATIONBITMAP
);
169 SendMessage(hwndTrayBitmap
,
172 (LPARAM
)pPropInfo
->hTrayBitmap
);
182 OnCreateTaskbarPage(HWND hwnd
,
183 PPROPSHEET_INFO pPropInfo
)
185 SetWindowLongPtr(hwnd
,
187 (LONG_PTR
)pPropInfo
);
189 pPropInfo
->hTaskbarWnd
= hwnd
;
191 // FIXME: check buttons
192 CheckDlgButton(hwnd
, IDC_TASKBARPROP_SECONDS
, AdvancedSettings
.bShowSeconds
? BST_CHECKED
: BST_UNCHECKED
);
194 UpdateTaskbarBitmap(pPropInfo
);
198 TaskbarPageProc(HWND hwndDlg
,
203 PPROPSHEET_INFO pPropInfo
;
205 /* Get the window context */
206 pPropInfo
= (PPROPSHEET_INFO
)GetWindowLongPtrW(hwndDlg
,
208 if (pPropInfo
== NULL
&& uMsg
!= WM_INITDIALOG
)
210 goto HandleDefaultMessage
;
216 OnCreateTaskbarPage(hwndDlg
, (PPROPSHEET_INFO
)((LPPROPSHEETPAGE
)lParam
)->lParam
);
220 switch (LOWORD(wParam
))
222 case IDC_TASKBARPROP_LOCK
:
223 case IDC_TASKBARPROP_HIDE
:
224 case IDC_TASKBARPROP_GROUP
:
225 case IDC_TASKBARPROP_SHOWQL
:
226 case IDC_TASKBARPROP_HIDEICONS
:
227 case IDC_TASKBARPROP_CLOCK
:
228 case IDC_TASKBARPROP_SECONDS
:
229 if (HIWORD(wParam
) == BN_CLICKED
)
231 UpdateTaskbarBitmap(pPropInfo
);
233 /* Enable the 'Apply' button */
234 PropSheet_Changed(GetParent(hwndDlg
), hwndDlg
);
242 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
250 AdvancedSettings
.bShowSeconds
= IsDlgButtonChecked(hwndDlg
, IDC_TASKBARPROP_SECONDS
);
251 SaveSettingDword(szAdvancedSettingsKey
, TEXT("ShowSeconds"), AdvancedSettings
.bShowSeconds
);
259 if (pPropInfo
->hTaskbarBitmap
)
261 DeleteObject(pPropInfo
->hTaskbarBitmap
);
263 if (pPropInfo
->hTrayBitmap
)
265 DeleteObject(pPropInfo
->hTrayBitmap
);
269 HandleDefaultMessage
:
277 static INT_PTR CALLBACK
278 StartMenuPageProc(HWND hwndDlg
,
290 switch (LOWORD(wParam
))
292 case IDC_TASKBARPROP_STARTMENUCLASSICCUST
:
293 ShowCustomizeClassic(hExplorerInstance
, hwndDlg
);
304 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
323 InitPropSheetPage(PROPSHEETPAGE
*psp
,
328 ZeroMemory(psp
, sizeof(PROPSHEETPAGE
));
329 psp
->dwSize
= sizeof(PROPSHEETPAGE
);
330 psp
->dwFlags
= PSP_DEFAULT
;
331 psp
->hInstance
= hExplorerInstance
;
332 psp
->pszTemplate
= MAKEINTRESOURCE(idDlg
);
333 psp
->lParam
= lParam
;
334 psp
->pfnDlgProc
= DlgProc
;
339 DisplayTrayProperties(IN HWND hwndOwner
)
341 PROPSHEET_INFO propInfo
= {0};
343 PROPSHEETPAGE psp
[2];
344 WCHAR szCaption
[256];
346 if (!LoadString(hExplorerInstance
,
347 IDS_TASKBAR_STARTMENU_PROP_CAPTION
,
349 sizeof(szCaption
) / sizeof(szCaption
[0])))
354 ZeroMemory(&psh
, sizeof(PROPSHEETHEADER
));
355 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
356 psh
.dwFlags
= PSH_PROPSHEETPAGE
| PSH_PROPTITLE
;
357 psh
.hwndParent
= hwndOwner
;
358 psh
.hInstance
= hExplorerInstance
;
360 psh
.pszCaption
= szCaption
;
361 psh
.nPages
= sizeof(psp
) / sizeof(PROPSHEETPAGE
);
365 InitPropSheetPage(&psp
[0], IDD_TASKBARPROP_TASKBAR
, TaskbarPageProc
, (LPARAM
)&propInfo
);
366 InitPropSheetPage(&psp
[1], IDD_TASKBARPROP_STARTMENU
, StartMenuPageProc
, (LPARAM
)&propInfo
);