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
= 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 AdvancedSettingsPageProc(HWND hwndDlg
,
200 CheckDlgButton(hwndDlg
, IDC_TASKBARPROP_SECONDS
, AdvancedSettings
.bShowSeconds
? BST_CHECKED
: BST_UNCHECKED
);
204 switch (LOWORD(wParam
))
206 case IDC_TASKBARPROP_SECONDS
:
207 if (HIWORD(wParam
) == BN_CLICKED
)
209 PropSheet_Changed(GetParent(hwndDlg
), hwndDlg
);
217 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
225 AdvancedSettings
.bShowSeconds
= IsDlgButtonChecked(hwndDlg
, IDC_TASKBARPROP_SECONDS
);
226 SaveSettingDword(szAdvancedSettingsKey
, TEXT("ShowSeconds"), AdvancedSettings
.bShowSeconds
);
243 static INT_PTR CALLBACK
244 StartMenuPageProc(HWND hwndDlg
,
259 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
278 static INT_PTR CALLBACK
279 NotificationPageProc(HWND hwndDlg
,
294 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
313 static INT_PTR CALLBACK
314 ToolbarsPageProc(HWND hwndDlg
,
329 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
349 InitPropSheetPage(PROPSHEETPAGE
*psp
,
354 ZeroMemory(psp
, sizeof(PROPSHEETPAGE
));
355 psp
->dwSize
= sizeof(PROPSHEETPAGE
);
356 psp
->dwFlags
= PSP_DEFAULT
;
357 psp
->hInstance
= hExplorerInstance
;
358 psp
->pszTemplate
= MAKEINTRESOURCE(idDlg
);
359 psp
->lParam
= lParam
;
360 psp
->pfnDlgProc
= DlgProc
;
365 DisplayTrayProperties(ITrayWindow
*Tray
)
367 PPROPSHEET_INFO pPropInfo
;
369 PROPSHEETPAGE psp
[5];
370 TCHAR szCaption
[256];
372 pPropInfo
= HeapAlloc(hProcessHeap
,
374 sizeof(PROPSHEET_INFO
));
380 if (!LoadString(hExplorerInstance
,
381 IDS_TASKBAR_STARTMENU_PROP_CAPTION
,
383 sizeof(szCaption
) / sizeof(szCaption
[0])))
385 HeapFree(hProcessHeap
,
392 ZeroMemory(&psh
, sizeof(PROPSHEETHEADER
));
393 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
394 psh
.dwFlags
= PSH_PROPSHEETPAGE
| PSH_PROPTITLE
;
395 psh
.hwndParent
= NULL
;
396 psh
.hInstance
= hExplorerInstance
;
398 psh
.pszCaption
= szCaption
;
399 psh
.nPages
= sizeof(psp
) / sizeof(PROPSHEETPAGE
);
403 InitPropSheetPage(&psp
[0], IDD_TASKBARPROP_TASKBAR
, TaskbarPageProc
, (LPARAM
)pPropInfo
);
404 InitPropSheetPage(&psp
[1], IDD_TASKBARPROP_STARTMENU
, StartMenuPageProc
, (LPARAM
)pPropInfo
);
405 InitPropSheetPage(&psp
[2], IDD_TASKBARPROP_NOTIFICATION
, NotificationPageProc
, (LPARAM
)pPropInfo
);
406 InitPropSheetPage(&psp
[3], IDD_TASKBARPROP_TOOLBARS
, ToolbarsPageProc
, (LPARAM
)pPropInfo
);
407 InitPropSheetPage(&psp
[4], IDD_TASKBARPROP_ADVANCED
, AdvancedSettingsPageProc
, (LPARAM
)pPropInfo
);
411 HeapFree(hProcessHeap
,
415 // FIXME: return the HWND