ReactOS 0.4.15-dev-8434-g155a7c7
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:
52
54 {
59 UINT uImageId;
60
62
63 if (bHide)
64 uImageId = IDB_TASKBARPROP_AUTOHIDE;
65 else if (bLock && bGroup && bShowQL)
67 else if (bLock && !bGroup && !bShowQL)
69 else if (bLock && bGroup && !bShowQL)
71 else if (bLock && !bGroup && bShowQL)
73 else if (!bLock && !bGroup && !bShowQL)
75 else if (!bLock && bGroup && !bShowQL)
77 else if (!bLock && !bGroup && bShowQL)
79 else if (!bLock && bGroup && bShowQL)
81
82 SetBitmap(hwndTaskbarBitmap, &m_hbmpTaskbar, uImageId);
83 }
84
85public:
87
93
97 {
98 }
99
101 {
102 if (m_hbmpTaskbar)
104 }
105
107 {
112 //CheckDlgButton(IDC_TASKBARPROP_SHOWQL, g_TaskbarSettings.bShowQuickLaunch ? BST_CHECKED : BST_UNCHECKED);
114
116 return TRUE;
117 }
118
119 LRESULT OnCtrlCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
120 {
123 return 0;
124 }
125
127 {
129
134 //newSettings.bShowQuickLaunch = IsDlgButtonChecked(IDC_TASKBARPROP_SHOWQL);
136
138
139 return PSNRET_NOERROR;
140 }
141};
142
143class CStartMenuSettingsPage : public CPropertyPageImpl<CStartMenuSettingsPage>
144{
145private:
147
149 {
151 HWND hwndCustomizeModern = GetDlgItem(IDC_TASKBARPROP_STARTMENUCUST);
153 HWND hwndModernRadioBtn = GetDlgItem(IDC_TASKBARPROP_STARTMENU);
155 BOOL policyNoSimpleStartMenu = SHRestricted(REST_NOSTARTPANEL) != 0;
156 BOOL bModern = FALSE;
157
158 /* If NoSimpleStartMenu, disable ability to use Modern Start Menu */
159 if (policyNoSimpleStartMenu)
160 {
161 /* Switch to classic */
163
164 /* Disable radio button */
165 ::EnableWindow(hwndModernRadioBtn, FALSE);
166
167 /* Hide controls related to modern menu */
168 ::ShowWindow(hwndModernRadioBtn, SW_HIDE);
169 ::ShowWindow(hwndModernText, SW_HIDE);
170 ::ShowWindow(hwndCustomizeModern, SW_HIDE);
171 }
172 /* If no restrictions, then get bModern from dialog */
173 else
174 {
176 }
177
178 ::EnableWindow(hwndCustomizeModern, bModern);
179 ::EnableWindow(hwndCustomizeClassic, !bModern);
180
181 UINT uImageId = bModern ? IDB_STARTPREVIEW : IDB_STARTPREVIEW_CLASSIC;
182 SetBitmap(hwndStartBitmap, &m_hbmpStartBitmap, uImageId);
183 }
184
185public:
187
193
196 {
197 }
198
200 {
203 }
204
206 {
207 BOOL modern = SHELL_GetSetting(SSF_STARTPANELON, fStartPanelOn);
210 return TRUE;
211 }
212
213 LRESULT OnStartMenuCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
214 {
216 return 0;
217 }
218
220 {
224 return PSNRET_NOERROR;
225 }
226};
227
228class CNotifySettingsPage : public CPropertyPageImpl<CNotifySettingsPage>
229{
230private:
233
235 {
239 UINT uImageId;
240
241 HWND hwndCustomizeNotifyButton = GetDlgItem(IDC_TASKBARPROP_ICONCUST);
244
245 ::EnableWindow(hwndCustomizeNotifyButton, bHideInactive);
246 ::EnableWindow(hwndSeconds, bShowClock);
247 if (!bShowSeconds)
249
250 if (bHideInactive && bShowClock && bShowSeconds)
252 else if (bHideInactive && bShowClock && !bShowSeconds)
254 else if (bHideInactive && !bShowClock)
256 else if (!bHideInactive && bShowClock && bShowSeconds)
258 else if (!bHideInactive && bShowClock && !bShowSeconds)
260 else if (!bHideInactive && !bShowClock)
262
263 SetBitmap(hwndTrayBitmap, &m_hbmpTray, uImageId);
264 }
265
266public:
268
275
279 {
280 }
281
283 {
284 if (m_hbmpTray)
286 }
287
289 {
294
296 return TRUE;
297 }
298
299 LRESULT OnCustomizeTrayIcons(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
300 {
302 return 0;
303 }
304
305 LRESULT OnCtrlCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
306 {
309 return 0;
310 }
311
313 {
315
320
322
323 return PSNRET_NOERROR;
324 }
325};
326
327static int CALLBACK
329{
330 // NOTE: This callback is needed to set large icon correctly.
331 HICON hIcon;
332 switch (uMsg)
333 {
334 case PSCB_INITIALIZED:
335 {
337 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
338 break;
339 }
340 }
341 return 0;
342}
343
344VOID
345DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar)
346{
347 PROPSHEETHEADER psh;
349 CTaskBarSettingsPage tbSettingsPage(hwndTaskbar);
350 CStartMenuSettingsPage smSettingsPage;
351 CNotifySettingsPage naSettingsPage(hwndTaskbar);
352 CStringW caption;
353
354 caption.LoadStringW(IDS_TASKBAR_STARTMENU_PROP_CAPTION);
355
356 hpsp.Add(tbSettingsPage.Create());
357 hpsp.Add(smSettingsPage.Create());
358 hpsp.Add(naSettingsPage.Create());
359
360 ZeroMemory(&psh, sizeof(psh));
361 psh.dwSize = sizeof(psh);
363 psh.hwndParent = hwndOwner;
364 psh.hInstance = hExplorerInstance;
365 psh.pszIcon = MAKEINTRESOURCEW(IDI_STARTMENU);
366 psh.pszCaption = caption.GetString();
367 psh.nPages = hpsp.GetSize();
368 psh.nStartPage = 0;
369 psh.phpage = hpsp.GetData();
370 psh.pfnCallback = PropSheetProc;
371
372 PropertySheet(&psh);
373}
HINSTANCE hExplorerInstance
Definition: explorer.cpp:24
TaskbarSettings g_TaskbarSettings
Definition: settings.cpp:23
VOID ShowCustomizeClassic(HINSTANCE, HWND)
#define TWM_SETTINGSCHANGED
Definition: precomp.h:133
#define IDC_TASKBARPROP_NOTIFY_FIRST_CMD
Definition: resource.h:147
#define IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL
Definition: resource.h:41
#define IDC_TASKBARPROP_SMALLICONS
Definition: resource.h:132
#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:133
#define IDC_TASKBARPROP_STARTMENUCLASSIC
Definition: resource.h:141
#define IDC_TASKBARPROP_TASKBARBITMAP
Definition: resource.h:134
#define IDB_SYSTRAYPROP_HIDE_NOCLOCK
Definition: resource.h:48
#define IDC_TASKBARPROP_ICONCUST
Definition: resource.h:149
#define IDC_TASKBARPROP_CLOCK
Definition: resource.h:150
#define IDB_TASKBARPROP_NOLOCK_GROUP_QL
Definition: resource.h:35
#define IDC_TASKBARPROP_HIDE
Definition: resource.h:128
#define IDC_TASKBARPROP_NOTIFICATIONBITMAP
Definition: resource.h:152
#define IDC_TASKBARPROP_STARTMENU_BITMAP
Definition: resource.h:143
#define IDB_TASKBARPROP_LOCK_GROUP_NOQL
Definition: resource.h:38
#define IDC_TASKBARPROP_STARTMENUCLASSICCUST
Definition: resource.h:137
#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:131
#define IDB_SYSTRAYPROP_SHOW_NOCLOCK
Definition: resource.h:50
#define IDC_TASKBARPROP_HIDEICONS
Definition: resource.h:148
#define IDS_TASKBAR_STARTMENU_PROP_CAPTION
Definition: resource.h:104
#define IDD_TASKBARPROP_NOTIFY
Definition: resource.h:90
#define IDB_TASKBARPROP_LOCK_GROUP_QL
Definition: resource.h:34
#define IDC_TASKBARPROP_STARTMENU
Definition: resource.h:140
#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:130
#define IDC_TASKBARPROP_SECONDS
Definition: resource.h:151
#define IDB_STARTPREVIEW_CLASSIC
Definition: resource.h:46
#define IDC_TASKBARPROP_NOTIFY_LAST_CMD
Definition: resource.h:154
#define IDC_TASKBARPROP_DESKTOP
Definition: resource.h:153
#define IDC_TASKBARPROP_STARTMENUMODERNTEXT
Definition: resource.h:138
#define IDB_TASKBARPROP_AUTOHIDE
Definition: resource.h:33
#define IDC_TASKBARPROP_GROUP
Definition: resource.h:129
#define IDC_TASKBARPROP_ONTOP
Definition: resource.h:127
#define IDB_SYSTRAYPROP_SHOW_SECONDS
Definition: resource.h:42
#define IDC_TASKBARPROP_STARTMENUCUST
Definition: resource.h:139
#define IDC_TASKBARPROP_FIRST_CMD
Definition: resource.h:126
HBITMAP hbmp
void SetModified(BOOL bChanged=TRUE)
Definition: rosdlgs.h:67
HPROPSHEETPAGE Create()
Definition: rosdlgs.h:57
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
HWND m_hWnd
Definition: atlwin.h:273
LRESULT OnCtrlCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: trayprop.cpp:305
LRESULT OnCustomizeTrayIcons(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: trayprop.cpp:299
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayprop.cpp:288
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayprop.cpp:205
LRESULT OnStartMenuCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: trayprop.cpp:213
LRESULT OnCtrlCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: trayprop.cpp:119
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayprop.cpp:106
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 ss
Definition: i386-dis.c:441
#define MESSAGE_HANDLER(msg, func)
Definition: atlwin.h:1926
#define CHAIN_MSG_MAP(theChainClass)
Definition: atlwin.h:1998
#define BEGIN_MSG_MAP(theClass)
Definition: atlwin.h:1898
#define COMMAND_ID_HANDLER(id, func)
Definition: atlwin.h:1953
#define END_MSG_MAP()
Definition: atlwin.h:1917
#define COMMAND_RANGE_HANDLER(idFirst, idLast, func)
Definition: atlwin.h:1971
static HBITMAP
Definition: button.c:44
static HICON
Definition: imagelist.c:84
HICON hIcon
Definition: msconfig.c:44
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
VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet)
Definition: shellord.c:225
#define SHELL_GetSetting(pss, ssf, field)
Definition: shellutils.h:798
#define SSF_STARTPANELON
Definition: shlobj.h:1624
@ REST_NOSTARTPANEL
Definition: shlobj.h:1771
DWORD WINAPI SHRestricted(RESTRICTIONS rest)
Definition: shpolicy.c:150
BOOL bGroupButtons
Definition: precomp.h:218
BOOL bShowDesktopButton
Definition: precomp.h:224
BOOL bHideInactiveIcons
Definition: precomp.h:221
TW_STRUCKRECTS2 sr
Definition: precomp.h:225
BOOL bShowSeconds
Definition: precomp.h:219
BOOL bSmallIcons
Definition: precomp.h:222
Definition: bl.h:1331
DWORD AutoHide
Definition: precomp.h:204
DWORD HideClock
Definition: precomp.h:207
DWORD AlwaysOnTop
Definition: precomp.h:205
#define ICON_BIG
Definition: tnclass.cpp:51
VOID DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar)
Definition: trayprop.cpp:345
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: trayprop.cpp:328
static void SetBitmap(HWND hwnd, HBITMAP *hbmp, UINT uImageId)
Definition: trayprop.cpp:24
#define IN
Definition: typedefs.h:39
#define ZeroMemory
Definition: winbase.h:1712
_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:768
#define SWP_NOACTIVATE
Definition: winuser.h:1242
#define IMAGE_BITMAP
Definition: winuser.h:211
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:1244
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2247
#define WM_INITDIALOG
Definition: winuser.h:1739
#define STM_SETIMAGE
Definition: winuser.h:2093
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define SendMessage
Definition: winuser.h:5852
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define LR_DEFAULTCOLOR
Definition: winuser.h:1087
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define SWP_NOZORDER
Definition: winuser.h:1247
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2119
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197