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 BOOL bLock
, bHide
, bGroup
, bShowQL
, bShowClock
, bShowSeconds
, bHideInactive
;
40 LPTSTR lpTaskBarImageName
= NULL
, lpTrayImageName
= NULL
;
43 hwndLock
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_LOCK
);
44 hwndHide
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_HIDE
);
45 hwndGroup
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_GROUP
);
46 hwndShowQL
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_SHOWQL
);
48 hwndClock
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_CLOCK
);
49 hwndSeconds
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_SECONDS
);
50 hwndHideInactive
= GetDlgItem(pPropInfo
->hTaskbarWnd
, IDC_TASKBARPROP_HIDEICONS
);
52 if (hwndLock
&& hwndHide
&& hwndGroup
&& hwndShowQL
&& hwndClock
&& hwndSeconds
&& hwndHideInactive
)
54 bLock
= (SendMessage(hwndLock
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
55 bHide
= (SendMessage(hwndHide
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
56 bGroup
= (SendMessage(hwndGroup
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
57 bShowQL
= (SendMessage(hwndShowQL
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
59 bShowClock
= (SendMessage(hwndClock
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
60 bShowSeconds
= (SendMessage(hwndSeconds
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
61 bHideInactive
= (SendMessage(hwndHideInactive
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
64 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_AUTOHIDE
);
65 else if (bLock
&& bGroup
&& bShowQL
)
66 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_GROUP_QL
);
67 else if (bLock
&& !bGroup
&& !bShowQL
)
68 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_NOGROUP_NOQL
);
69 else if (bLock
&& bGroup
&& !bShowQL
)
70 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_GROUP_NOQL
);
71 else if (bLock
&& !bGroup
&& bShowQL
)
72 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_NOGROUP_QL
);
73 else if (!bLock
&& !bGroup
&& !bShowQL
)
74 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL
);
75 else if (!bLock
&& bGroup
&& !bShowQL
)
76 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_GROUP_NOQL
);
77 else if (!bLock
&& !bGroup
&& bShowQL
)
78 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_NOGROUP_QL
);
79 else if (!bLock
&& bGroup
&& bShowQL
)
80 lpTaskBarImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_GROUP_QL
);
83 if (lpTaskBarImageName
)
85 if (pPropInfo
->hTaskbarBitmap
)
87 DeleteObject(pPropInfo
->hTaskbarBitmap
);
90 pPropInfo
->hTaskbarBitmap
= (HBITMAP
)LoadImage(hExplorerInstance
,
96 if (pPropInfo
->hTaskbarBitmap
)
98 hwndTaskbarBitmap
= GetDlgItem(pPropInfo
->hTaskbarWnd
,
99 IDC_TASKBARPROP_TASKBARBITMAP
);
100 if (hwndTaskbarBitmap
)
102 SendMessage(hwndTaskbarBitmap
,
105 (LPARAM
)pPropInfo
->hTaskbarBitmap
);
112 /* FIXME: when the customize button is disabled, enable it. */
115 /* FIXME: when the seconds checkbox is disabled, enable it. */
117 lpTrayImageName
= MAKEINTRESOURCE(IDB_SYSTRAYPROP_HIDE_SECONDS
);
119 lpTrayImageName
= MAKEINTRESOURCE(IDB_SYSTRAYPROP_HIDE_CLOCK
);
123 /* FIXME: when the seconds checkbox is enabled, disable it it. */
124 lpTrayImageName
= MAKEINTRESOURCE(IDB_SYSTRAYPROP_HIDE_NOCLOCK
);
129 /* FIXME: when the customize button is enabled, disable it. */
132 /* FIXME: when the seconds checkbox is disabled, enable it. */
134 lpTrayImageName
= MAKEINTRESOURCE(IDB_SYSTRAYPROP_SHOW_SECONDS
);
136 lpTrayImageName
= MAKEINTRESOURCE(IDB_SYSTRAYPROP_SHOW_CLOCK
);
140 /* FIXME: when the seconds checkbox is enabled, disable it it. */
141 lpTrayImageName
= MAKEINTRESOURCE(IDB_SYSTRAYPROP_SHOW_NOCLOCK
);
147 if (pPropInfo
->hTrayBitmap
)
149 DeleteObject(pPropInfo
->hTrayBitmap
);
152 pPropInfo
->hTrayBitmap
= (HBITMAP
)LoadImage(hExplorerInstance
,
158 if (pPropInfo
->hTrayBitmap
)
160 hwndTrayBitmap
= GetDlgItem(pPropInfo
->hTaskbarWnd
,
161 IDC_TASKBARPROP_NOTIFICATIONBITMAP
);
164 SendMessage(hwndTrayBitmap
,
167 (LPARAM
)pPropInfo
->hTrayBitmap
);
177 OnCreateTaskbarPage(HWND hwnd
,
178 PPROPSHEET_INFO pPropInfo
)
180 SetWindowLongPtr(hwnd
,
182 (LONG_PTR
)pPropInfo
);
184 pPropInfo
->hTaskbarWnd
= hwnd
;
186 // FIXME: check buttons
188 UpdateTaskbarBitmap(pPropInfo
);
192 TaskbarPageProc(HWND hwndDlg
,
197 PPROPSHEET_INFO pPropInfo
;
199 /* Get the window context */
200 pPropInfo
= (PPROPSHEET_INFO
)GetWindowLongPtrW(hwndDlg
,
202 if (pPropInfo
== NULL
&& uMsg
!= WM_INITDIALOG
)
204 goto HandleDefaultMessage
;
210 OnCreateTaskbarPage(hwndDlg
, (PPROPSHEET_INFO
)((LPPROPSHEETPAGE
)lParam
)->lParam
);
214 switch (LOWORD(wParam
))
216 case IDC_TASKBARPROP_LOCK
:
217 case IDC_TASKBARPROP_HIDE
:
218 case IDC_TASKBARPROP_GROUP
:
219 case IDC_TASKBARPROP_SHOWQL
:
220 case IDC_TASKBARPROP_HIDEICONS
:
221 case IDC_TASKBARPROP_CLOCK
:
222 case IDC_TASKBARPROP_SECONDS
:
223 if (HIWORD(wParam
) == BN_CLICKED
)
225 UpdateTaskbarBitmap(pPropInfo
);
227 /* Enable the 'Apply' button */
228 PropSheet_Changed(GetParent(hwndDlg
), hwndDlg
);
236 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
251 if (pPropInfo
->hTaskbarBitmap
)
253 DeleteObject(pPropInfo
->hTaskbarBitmap
);
255 if (pPropInfo
->hTrayBitmap
)
257 DeleteObject(pPropInfo
->hTrayBitmap
);
261 HandleDefaultMessage
:
269 static INT_PTR CALLBACK
270 StartMenuPageProc(HWND hwndDlg
,
282 switch (LOWORD(wParam
))
284 case IDC_TASKBARPROP_STARTMENUCLASSICCUST
:
285 ShowCustomizeClassic(hExplorerInstance
, hwndDlg
);
296 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
315 InitPropSheetPage(PROPSHEETPAGE
*psp
,
320 ZeroMemory(psp
, sizeof(PROPSHEETPAGE
));
321 psp
->dwSize
= sizeof(PROPSHEETPAGE
);
322 psp
->dwFlags
= PSP_DEFAULT
;
323 psp
->hInstance
= hExplorerInstance
;
324 psp
->pszTemplate
= MAKEINTRESOURCE(idDlg
);
325 psp
->lParam
= lParam
;
326 psp
->pfnDlgProc
= DlgProc
;
331 DisplayTrayProperties(IN HWND hwndOwner
)
333 PROPSHEET_INFO propInfo
;
335 PROPSHEETPAGE psp
[2];
336 WCHAR szCaption
[256];
338 if (!LoadString(hExplorerInstance
,
339 IDS_TASKBAR_STARTMENU_PROP_CAPTION
,
341 sizeof(szCaption
) / sizeof(szCaption
[0])))
346 ZeroMemory(&psh
, sizeof(PROPSHEETHEADER
));
347 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
348 psh
.dwFlags
= PSH_PROPSHEETPAGE
| PSH_PROPTITLE
;
349 psh
.hwndParent
= hwndOwner
;
350 psh
.hInstance
= hExplorerInstance
;
352 psh
.pszCaption
= szCaption
;
353 psh
.nPages
= sizeof(psp
) / sizeof(PROPSHEETPAGE
);
357 InitPropSheetPage(&psp
[0], IDD_TASKBARPROP_TASKBAR
, TaskbarPageProc
, (LPARAM
)&propInfo
);
358 InitPropSheetPage(&psp
[1], IDD_TASKBARPROP_STARTMENU
, StartMenuPageProc
, (LPARAM
)&propInfo
);