4 * Copyright 2006 - 2007 Thomas Weidenmueller <w3seek@reactos.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 typedef struct _PROPSHEET_INFO
30 HBITMAP hTaskbarBitmap
;
31 } PROPSHEET_INFO
, *PPROPSHEET_INFO
;
35 UpdateTaskbarBitmap(PPROPSHEET_INFO pPropInfo
)
37 HWND hwndLock
, hwndHide
, hwndGroup
, hwndShowQL
;
39 BOOL bLock
, bHide
, bGroup
, bShowQL
;
40 LPTSTR lpImageName
= 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 if (hwndLock
&& hwndHide
&& hwndGroup
&& hwndShowQL
)
50 bLock
= (SendMessage(hwndLock
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
51 bHide
= (SendMessage(hwndHide
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
52 bGroup
= (SendMessage(hwndGroup
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
53 bShowQL
= (SendMessage(hwndShowQL
, BM_GETCHECK
, 0, 0) == BST_CHECKED
);
56 lpImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_AUTOHIDE
);
57 else if (bLock
&& bGroup
&& bShowQL
)
58 lpImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_GROUP_QL
);
59 else if (bLock
&& !bGroup
&& !bShowQL
)
60 lpImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_NOGROUP_NOQL
);
61 else if (bLock
&& bGroup
&& !bShowQL
)
62 lpImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_GROUP_NOQL
);
63 else if (bLock
&& !bGroup
&& bShowQL
)
64 lpImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_NOGROUP_QL
);
65 else if (!bLock
&& !bGroup
&& !bShowQL
)
66 lpImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL
);
67 else if (!bLock
&& bGroup
&& !bShowQL
)
68 lpImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_GROUP_NOQL
);
69 else if (!bLock
&& !bGroup
&& bShowQL
)
70 lpImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_NOGROUP_QL
);
71 else if (!bLock
&& bGroup
&& bShowQL
)
72 lpImageName
= MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_GROUP_QL
);
76 if (pPropInfo
->hTaskbarBitmap
)
78 DeleteObject(pPropInfo
->hTaskbarBitmap
);
81 pPropInfo
->hTaskbarBitmap
= (HBITMAP
)LoadImage(hExplorerInstance
,
87 if (pPropInfo
->hTaskbarBitmap
)
89 hwndBitmap
= GetDlgItem(pPropInfo
->hTaskbarWnd
,
90 IDC_TASKBARPROP_TASKBARBITMAP
);
93 SendMessage(hwndBitmap
,
96 (LPARAM
)pPropInfo
->hTaskbarBitmap
);
106 OnCreateTaskbarPage(HWND hwnd
,
107 PPROPSHEET_INFO pPropInfo
)
109 SetWindowLongPtr(hwnd
,
111 (LONG_PTR
)pPropInfo
);
113 pPropInfo
->hTaskbarWnd
= hwnd
;
115 // FIXME: check buttons
117 UpdateTaskbarBitmap(pPropInfo
);
121 TaskbarPageProc(HWND hwndDlg
,
126 PPROPSHEET_INFO pPropInfo
;
128 /* Get the window context */
129 pPropInfo
= (PPROPSHEET_INFO
)GetWindowLongPtrW(hwndDlg
,
131 if (pPropInfo
== NULL
&& uMsg
!= WM_INITDIALOG
)
133 goto HandleDefaultMessage
;
139 OnCreateTaskbarPage(hwndDlg
, (PPROPSHEET_INFO
)lParam
);
143 switch (LOWORD(wParam
))
145 case IDC_TASKBARPROP_LOCK
:
146 case IDC_TASKBARPROP_HIDE
:
147 case IDC_TASKBARPROP_GROUP
:
148 case IDC_TASKBARPROP_SHOWQL
:
149 if (HIWORD(wParam
) == BN_CLICKED
)
151 UpdateTaskbarBitmap(pPropInfo
);
153 /* Enable the 'Apply' button */
154 PropSheet_Changed(GetParent(hwndDlg
), hwndDlg
);
162 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
177 if (pPropInfo
->hTaskbarBitmap
)
179 DeleteObject(pPropInfo
->hTaskbarBitmap
);
183 HandleDefaultMessage
:
191 static INT_PTR CALLBACK
192 StartMenuPageProc(HWND hwndDlg
,
204 switch (LOWORD(wParam
))
206 case IDC_TASKBARPROP_STARTMENUCLASSICCUST
:
207 ShowCustomizeClassic(hExplorerInstance
, hwndDlg
);
218 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
237 InitPropSheetPage(PROPSHEETPAGE
*psp
,
242 ZeroMemory(psp
, sizeof(PROPSHEETPAGE
));
243 psp
->dwSize
= sizeof(PROPSHEETPAGE
);
244 psp
->dwFlags
= PSP_DEFAULT
;
245 psp
->hInstance
= hExplorerInstance
;
246 psp
->pszTemplate
= MAKEINTRESOURCE(idDlg
);
247 psp
->lParam
= lParam
;
248 psp
->pfnDlgProc
= DlgProc
;
253 DisplayTrayProperties(IN HWND hwndOwner
)
255 PROPSHEET_INFO propInfo
;
257 PROPSHEETPAGE psp
[2];
258 WCHAR szCaption
[256];
260 if (!LoadString(hExplorerInstance
,
261 IDS_TASKBAR_STARTMENU_PROP_CAPTION
,
263 sizeof(szCaption
) / sizeof(szCaption
[0])))
268 ZeroMemory(&psh
, sizeof(PROPSHEETHEADER
));
269 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
270 psh
.dwFlags
= PSH_PROPSHEETPAGE
| PSH_PROPTITLE
;
271 psh
.hwndParent
= hwndOwner
;
272 psh
.hInstance
= hExplorerInstance
;
274 psh
.pszCaption
= szCaption
;
275 psh
.nPages
= sizeof(psp
) / sizeof(PROPSHEETPAGE
);
279 InitPropSheetPage(&psp
[0], IDD_TASKBARPROP_TASKBAR
, TaskbarPageProc
, (LPARAM
)&propInfo
);
280 InitPropSheetPage(&psp
[1], IDD_TASKBARPROP_STARTMENU
, StartMenuPageProc
, (LPARAM
)&propInfo
);