ReactOS 0.4.15-dev-5666-gc548b97
trayprop.cpp
Go to the documentation of this file.
1/*
2 * ReactOS Explorer
3 *
4 * Copyright 2006 - 2007 Thomas Weidenmueller <w3seek@reactos.org>
5 * 2015 Robert Naumann <gonzomdx@gmail.com>
6 *
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.
11 *
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.
16 *
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
20 */
21
22#include "precomp.h"
23
24static void SetBitmap(HWND hwnd, HBITMAP* hbmp, UINT uImageId)
25{
26 if (*hbmp)
28
30 MAKEINTRESOURCEW(uImageId),
32 0,
33 0,
35
36 if (*hbmp && hwnd)
37 {
38 BITMAP bm;
39 GetObject(*hbmp, sizeof(bm), &bm);
40 ::SetWindowPos(hwnd, NULL, 0, 0, bm.bmWidth + 2, bm.bmHeight + 2,
43 }
44
45}
46
47class CTaskBarSettingsPage : public CPropertyPageImpl<CTaskBarSettingsPage>
48{
49private:
53
55 {
63 UINT uImageId;
64
65 HWND hwndCustomizeNotifyButton = GetDlgItem(IDC_TASKBARPROP_ICONCUST);
69
70 if (bHide)
71 uImageId = IDB_TASKBARPROP_AUTOHIDE;
72 else if (bLock && bGroup && bShowQL)
74 else if (bLock && !bGroup && !bShowQL)
76 else if (bLock && bGroup && !bShowQL)
78 else if (bLock && !bGroup && bShowQL)
80 else if (!bLock && !bGroup && !bShowQL)
82 else if (!bLock && bGroup && !bShowQL)
84 else if (!bLock && !bGroup && bShowQL)
86 else if (!bLock && bGroup && bShowQL)
88 else
90
91 SetBitmap(hwndTaskbarBitmap, &m_hbmpTaskbar, uImageId);
92
93 ::EnableWindow(hwndCustomizeNotifyButton, bHideInactive);
94 ::EnableWindow(hwndSeconds, bShowClock);
95 if (!bShowSeconds)
97
98 if (bHideInactive && bShowClock && bShowSeconds)
100 else if (bHideInactive && bShowClock && !bShowSeconds)
102 else if (bHideInactive && !bShowClock)
104 else if (!bHideInactive && bShowClock && bShowSeconds)
106 else if (!bHideInactive && bShowClock && !bShowSeconds)
108 else if (!bHideInactive && !bShowClock)
110 else
111 ASSERT(FALSE);
112
113 SetBitmap(hwndTrayBitmap, &m_hbmpTray, uImageId);
114 }
115
116public:
118
125
130 {
131 }
132
134 {
135 if (m_hbmpTaskbar)
137 if (m_hbmpTray)
139 }
140
142 {
147 //CheckDlgButton(IDC_TASKBARPROP_SHOWQL, g_TaskbarSettings.bShowQuickLaunch ? BST_CHECKED : BST_UNCHECKED);
151
152 UpdateDialog();
153 return TRUE;
154 }
155
156 LRESULT OnCustomizeTrayIcons(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
157 {
159 return 0;
160 }
161
162 LRESULT OnCtrlCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
163 {
164 UpdateDialog();
166 return 0;
167 }
168
170 {
171 TaskbarSettings newSettings;
172 memcpy(&newSettings, &g_TaskbarSettings, sizeof(TaskbarSettings));
173
178 //newSettings.bShowQuickLaunch = IsDlgButtonChecked(IDC_TASKBARPROP_SHOWQL);
182
184
185 return PSNRET_NOERROR;
186 }
187};
188
189class CStartMenuSettingsPage : public CPropertyPageImpl<CStartMenuSettingsPage>
190{
191private:
193
195 {
197 HWND hwndCustomizeModern = GetDlgItem(IDC_TASKBARPROP_STARTMENUCUST);
199 HWND hwndModernRadioBtn = GetDlgItem(IDC_TASKBARPROP_STARTMENU);
201 BOOL policyNoSimpleStartMenu = SHRestricted(REST_NOSTARTPANEL) != 0;
202 BOOL bModern = FALSE;
203
204 /* If NoSimpleStartMenu, disable ability to use Modern Start Menu */
205 if (policyNoSimpleStartMenu)
206 {
207 /* Switch to classic */
209
210 /* Disable radio button */
211 ::EnableWindow(hwndModernRadioBtn, FALSE);
212
213 /* Hide controls related to modern menu */
214 ::ShowWindow(hwndModernRadioBtn, SW_HIDE);
215 ::ShowWindow(hwndModernText, SW_HIDE);
216 ::ShowWindow(hwndCustomizeModern, SW_HIDE);
217 }
218 /* If no restrictions, then get bModern from dialog */
219 else
220 {
222 }
223
224 ::EnableWindow(hwndCustomizeModern, bModern);
225 ::EnableWindow(hwndCustomizeClassic, !bModern);
226
227 UINT uImageId = bModern ? IDB_STARTPREVIEW : IDB_STARTPREVIEW_CLASSIC;
228 SetBitmap(hwndStartBitmap, &m_hbmpStartBitmap, uImageId);
229 }
230
231public:
233
239
242 {
243 }
244
246 {
249 }
250
252 {
253 // fix me: start menu style (classic/modern) should be read somewhere from the registry.
254 CheckDlgButton(IDC_TASKBARPROP_STARTMENUCLASSIC, BST_CHECKED); // HACK: This has to be read from registry!!!!!!!
255 UpdateDialog();
256
257 return TRUE;
258 }
259
260 LRESULT OnStartMenuCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
261 {
263 return 0;
264 }
265
267 {
268 //TODO
269 return PSNRET_NOERROR;
270 }
271};
272
273static int CALLBACK
275{
276 // NOTE: This callback is needed to set large icon correctly.
277 HICON hIcon;
278 switch (uMsg)
279 {
280 case PSCB_INITIALIZED:
281 {
283 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
284 break;
285 }
286 }
287 return 0;
288}
289
290VOID
291DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar)
292{
293 PROPSHEETHEADER psh;
294 HPROPSHEETPAGE hpsp[2];
295 CTaskBarSettingsPage tbSettingsPage(hwndTaskbar);
296 CStartMenuSettingsPage smSettingsPage;
297 CStringW caption;
298
299 caption.LoadStringW(IDS_TASKBAR_STARTMENU_PROP_CAPTION);
300
301 hpsp[0] = tbSettingsPage.Create();
302 hpsp[1] = smSettingsPage.Create();
303
304 ZeroMemory(&psh, sizeof(psh));
305 psh.dwSize = sizeof(psh);
307 psh.hwndParent = hwndOwner;
308 psh.hInstance = hExplorerInstance;
309 psh.pszIcon = MAKEINTRESOURCEW(IDI_STARTMENU);
310 psh.pszCaption = caption.GetString();
311 psh.nPages = _countof(hpsp);
312 psh.nStartPage = 0;
313 psh.phpage = hpsp;
314 psh.pfnCallback = PropSheetProc;
315
316 PropertySheet(&psh);
317}
HINSTANCE hExplorerInstance
Definition: explorer.cpp:24
TaskbarSettings g_TaskbarSettings
Definition: settings.cpp:23
VOID ShowCustomizeClassic(HINSTANCE, HWND)
#define TWM_SETTINGSCHANGED
Definition: precomp.h:132
#define IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL
Definition: resource.h:41
#define IDB_TASKBARPROP_NOLOCK_GROUP_NOQL
Definition: resource.h:39
#define IDB_TASKBARPROP_NOLOCK_NOGROUP_QL
Definition: resource.h:37
#define IDC_TASKBARPROP_LAST_CMD
Definition: resource.h:123
#define IDC_TASKBARPROP_STARTMENUCLASSIC
Definition: resource.h:132
#define IDC_TASKBARPROP_TASKBARBITMAP
Definition: resource.h:124
#define IDB_SYSTRAYPROP_HIDE_NOCLOCK
Definition: resource.h:48
#define IDC_TASKBARPROP_ICONCUST
Definition: resource.h:115
#define IDC_TASKBARPROP_CLOCK
Definition: resource.h:118
#define IDB_TASKBARPROP_NOLOCK_GROUP_QL
Definition: resource.h:35
#define IDC_TASKBARPROP_HIDE
Definition: resource.h:117
#define IDC_TASKBARPROP_NOTIFICATIONBITMAP
Definition: resource.h:125
#define IDC_TASKBARPROP_STARTMENU_BITMAP
Definition: resource.h:134
#define IDB_TASKBARPROP_LOCK_GROUP_NOQL
Definition: resource.h:38
#define IDC_TASKBARPROP_STARTMENUCLASSICCUST
Definition: resource.h:128
#define IDB_TASKBARPROP_LOCK_NOGROUP_QL
Definition: resource.h:36
#define IDD_TASKBARPROP_STARTMENU
Definition: resource.h:89
#define IDB_SYSTRAYPROP_SHOW_CLOCK
Definition: resource.h:49
#define IDI_STARTMENU
Definition: resource.h:14
#define IDB_TASKBARPROP_LOCK_NOGROUP_NOQL
Definition: resource.h:40
#define IDC_TASKBARPROP_SHOWQL
Definition: resource.h:122
#define IDB_SYSTRAYPROP_SHOW_NOCLOCK
Definition: resource.h:50
#define IDC_TASKBARPROP_HIDEICONS
Definition: resource.h:114
#define IDS_TASKBAR_STARTMENU_PROP_CAPTION
Definition: resource.h:103
#define IDB_TASKBARPROP_LOCK_GROUP_QL
Definition: resource.h:34
#define IDC_TASKBARPROP_STARTMENU
Definition: resource.h:131
#define IDB_SYSTRAYPROP_HIDE_SECONDS
Definition: resource.h:43
#define IDD_TASKBARPROP_TASKBAR
Definition: resource.h:85
#define IDB_STARTPREVIEW
Definition: resource.h:45
#define IDB_SYSTRAYPROP_HIDE_CLOCK
Definition: resource.h:47
#define IDC_TASKBARPROP_LOCK
Definition: resource.h:120
#define IDC_TASKBARPROP_SECONDS
Definition: resource.h:121
#define IDB_STARTPREVIEW_CLASSIC
Definition: resource.h:46
#define IDC_TASKBARPROP_STARTMENUMODERNTEXT
Definition: resource.h:129
#define IDB_TASKBARPROP_AUTOHIDE
Definition: resource.h:33
#define IDC_TASKBARPROP_GROUP
Definition: resource.h:119
#define IDC_TASKBARPROP_ONTOP
Definition: resource.h:116
#define IDB_SYSTRAYPROP_SHOW_SECONDS
Definition: resource.h:42
#define IDC_TASKBARPROP_STARTMENUCUST
Definition: resource.h:130
#define IDC_TASKBARPROP_FIRST_CMD
Definition: resource.h:113
HBITMAP hbmp
void SetModified(BOOL bChanged=TRUE)
Definition: rosdlgs.h:67
HPROPSHEETPAGE Create()
Definition: rosdlgs.h:57
PCXSTR GetString() const
Definition: atlsimpstr.h:361
HWND m_hWnd
Definition: atlwin.h:267
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayprop.cpp:251
LRESULT OnStartMenuCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: trayprop.cpp:260
LRESULT OnCustomizeTrayIcons(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: trayprop.cpp:156
LRESULT OnCtrlCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: trayprop.cpp:162
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayprop.cpp:141
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CALLBACK
Definition: compat.h:35
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned short WORD
Definition: ntddk_ex.h:93
pKey DeleteObject()
#define MESSAGE_HANDLER(msg, func)
Definition: atlwin.h:1920
#define CHAIN_MSG_MAP(theChainClass)
Definition: atlwin.h:1992
#define BEGIN_MSG_MAP(theClass)
Definition: atlwin.h:1892
#define COMMAND_ID_HANDLER(id, func)
Definition: atlwin.h:1947
#define END_MSG_MAP()
Definition: atlwin.h:1911
#define COMMAND_RANGE_HANDLER(idFirst, idLast, func)
Definition: atlwin.h:1965
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ASSERT(a)
Definition: mode.c:44
static HBITMAP
Definition: button.c:44
static HICON
Definition: imagelist.c:84
HICON hIcon
Definition: msconfig.c:44
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
unsigned int UINT
Definition: ndis.h:50
VOID ShowCustomizeNotifyIcons(HINSTANCE hInst, HWND hExplorer)
#define PROPSHEETHEADER
Definition: prsht.h:392
#define PSH_PROPTITLE
Definition: prsht.h:40
#define PSH_USECALLBACK
Definition: prsht.h:48
#define PSNRET_NOERROR
Definition: prsht.h:129
#define PropertySheet
Definition: prsht.h:400
#define PSH_USEICONID
Definition: prsht.h:42
#define PSCB_INITIALIZED
Definition: prsht.h:75
@ REST_NOSTARTPANEL
Definition: shlobj.h:1680
DWORD WINAPI SHRestricted(RESTRICTIONS policy)
Definition: shpolicy.c:827
#define _countof(array)
Definition: sndvol32.h:68
BOOL bGroupButtons
Definition: precomp.h:206
BOOL bHideInactiveIcons
Definition: precomp.h:208
TW_STRUCKRECTS2 sr
Definition: precomp.h:209
BOOL bShowSeconds
Definition: precomp.h:207
Definition: bl.h:1331
DWORD AutoHide
Definition: precomp.h:192
DWORD HideClock
Definition: precomp.h:195
DWORD AlwaysOnTop
Definition: precomp.h:193
#define ICON_BIG
Definition: tnclass.cpp:51
VOID DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar)
Definition: trayprop.cpp:291
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: trayprop.cpp:274
static void SetBitmap(HWND hwnd, HBITMAP *hbmp, UINT uImageId)
Definition: trayprop.cpp:24
#define IN
Definition: typedefs.h:39
#define ZeroMemory
Definition: winbase.h:1670
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define GetObject
Definition: wingdi.h:4468
#define SW_HIDE
Definition: winuser.h:762
#define SWP_NOACTIVATE
Definition: winuser.h:1232
#define IMAGE_BITMAP
Definition: winuser.h:211
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define BST_UNCHECKED
Definition: winuser.h:199
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOMOVE
Definition: winuser.h:1234
#define WM_INITDIALOG
Definition: winuser.h:1729
#define STM_SETIMAGE
Definition: winuser.h:2083
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define SendMessage
Definition: winuser.h:5833
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define LR_DEFAULTCOLOR
Definition: winuser.h:1081
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define SWP_NOZORDER
Definition: winuser.h:1237
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197