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
:
193 StartMenuPageProc(HWND hwndDlg
,
208 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
228 NotificationPageProc(HWND hwndDlg
,
243 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
263 ToolbarsPageProc(HWND hwndDlg
,
278 LPNMHDR pnmh
= (LPNMHDR
)lParam
;
298 InitPropSheetPage(PROPSHEETPAGE
*psp
,
303 ZeroMemory(psp
, sizeof(PROPSHEETPAGE
));
304 psp
->dwSize
= sizeof(PROPSHEETPAGE
);
305 psp
->dwFlags
= PSP_DEFAULT
;
306 psp
->hInstance
= hExplorerInstance
;
307 psp
->pszTemplate
= MAKEINTRESOURCE(idDlg
);
308 psp
->lParam
= lParam
;
309 psp
->pfnDlgProc
= DlgProc
;
314 DisplayTrayProperties(ITrayWindow
*Tray
)
316 PPROPSHEET_INFO pPropInfo
;
318 PROPSHEETPAGE psp
[4];
319 TCHAR szCaption
[256];
321 pPropInfo
= (PPROPSHEET_INFO
)HeapAlloc(hProcessHeap
,
323 sizeof(PROPSHEET_INFO
));
329 if (!LoadString(hExplorerInstance
,
330 IDS_TASKBAR_STARTMENU_PROP_CAPTION
,
332 sizeof(szCaption
) / sizeof(szCaption
[0])))
337 ZeroMemory(&psh
, sizeof(PROPSHEETHEADER
));
338 psh
.dwSize
= sizeof(PROPSHEETHEADER
);
339 psh
.dwFlags
= PSH_PROPSHEETPAGE
| PSH_PROPTITLE
;
340 psh
.hwndParent
= NULL
;
341 psh
.hInstance
= hExplorerInstance
;
343 psh
.pszCaption
= szCaption
;
344 psh
.nPages
= sizeof(psp
) / sizeof(PROPSHEETPAGE
);
348 InitPropSheetPage(&psp
[0], IDD_TASKBARPROP_TASKBAR
, (DLGPROC
)TaskbarPageProc
, (LPARAM
)pPropInfo
);
349 InitPropSheetPage(&psp
[1], IDD_TASKBARPROP_STARTMENU
, (DLGPROC
)StartMenuPageProc
, (LPARAM
)pPropInfo
);
350 InitPropSheetPage(&psp
[2], IDD_TASKBARPROP_NOTIFICATION
, (DLGPROC
)NotificationPageProc
, (LPARAM
)pPropInfo
);
351 InitPropSheetPage(&psp
[3], IDD_TASKBARPROP_TOOLBARS
, (DLGPROC
)ToolbarsPageProc
, (LPARAM
)pPropInfo
);
355 HeapFree(hProcessHeap
,
359 // FIXME: return the HWND