ReactOS 0.4.16-dev-835-gd769f56
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 static const WORD wImageIdLookupTable[2][2][2][2];
234
236 {
240 BOOL bShowDesktopButton = IsDlgButtonChecked(IDC_TASKBARPROP_DESKTOP);
241
242 HWND hwndCustomizeNotifyButton = GetDlgItem(IDC_TASKBARPROP_ICONCUST);
245
246 ::EnableWindow(hwndCustomizeNotifyButton, bHideInactive);
247 ::EnableWindow(hwndSeconds, bShowClock);
248 if (!bShowSeconds)
250 UINT uImageId = wImageIdLookupTable[bShowClock][bShowSeconds][bHideInactive][bShowDesktopButton];
251
252 SetBitmap(hwndTrayBitmap, &m_hbmpTray, uImageId);
253 }
254
255public:
257
264
268 {
269 }
270
272 {
273 if (m_hbmpTray)
275 }
276
278 {
283
285 return TRUE;
286 }
287
288 LRESULT OnCustomizeTrayIcons(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
289 {
291 return 0;
292 }
293
294 LRESULT OnCtrlCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
295 {
298 return 0;
299 }
300
302 {
304
309
311
312 return PSNRET_NOERROR;
313 }
314};
315
317{
318 {
319 {
322 },
323 {
326 }
327 },
328 {
329 {
332 },
333 {
336 }
337 }
338};
339
340static int CALLBACK
342{
343 // NOTE: This callback is needed to set large icon correctly.
344 HICON hIcon;
345 switch (uMsg)
346 {
347 case PSCB_INITIALIZED:
348 {
350 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
351 break;
352 }
353 }
354 return 0;
355}
356
357VOID
358DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar)
359{
360 PROPSHEETHEADER psh;
362 CTaskBarSettingsPage tbSettingsPage(hwndTaskbar);
363 CStartMenuSettingsPage smSettingsPage;
364 CNotifySettingsPage naSettingsPage(hwndTaskbar);
365 CStringW caption;
366
367 caption.LoadStringW(IDS_TASKBAR_STARTMENU_PROP_CAPTION);
368
369 hpsp.Add(tbSettingsPage.Create());
370 hpsp.Add(smSettingsPage.Create());
371 hpsp.Add(naSettingsPage.Create());
372
373 ZeroMemory(&psh, sizeof(psh));
374 psh.dwSize = sizeof(psh);
376 psh.hwndParent = hwndOwner;
377 psh.hInstance = hExplorerInstance;
378 psh.pszIcon = MAKEINTRESOURCEW(IDI_STARTMENU);
379 psh.pszCaption = caption.GetString();
380 psh.nPages = hpsp.GetSize();
381 psh.nStartPage = 0;
382 psh.phpage = hpsp.GetData();
383 psh.pfnCallback = PropSheetProc;
384
385 PropertySheet(&psh);
386}
HINSTANCE hExplorerInstance
Definition: explorer.cpp:24
TaskbarSettings g_TaskbarSettings
Definition: settings.cpp:23
VOID ShowCustomizeClassic(HINSTANCE, HWND)
#define TWM_SETTINGSCHANGED
Definition: precomp.h:134
#define IDC_TASKBARPROP_NOTIFY_FIRST_CMD
Definition: resource.h:154
#define IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL
Definition: resource.h:41
#define IDC_TASKBARPROP_SMALLICONS
Definition: resource.h:139
#define IDB_SYSTRAYPROP_HIDE_NOCLOCK_NODESK
Definition: resource.h:48
#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:140
#define IDC_TASKBARPROP_STARTMENUCLASSIC
Definition: resource.h:148
#define IDC_TASKBARPROP_TASKBARBITMAP
Definition: resource.h:141
#define IDB_SYSTRAYPROP_HIDE_NOCLOCK_DESK
Definition: resource.h:54
#define IDC_TASKBARPROP_ICONCUST
Definition: resource.h:156
#define IDC_TASKBARPROP_CLOCK
Definition: resource.h:157
#define IDB_TASKBARPROP_NOLOCK_GROUP_QL
Definition: resource.h:35
#define IDC_TASKBARPROP_HIDE
Definition: resource.h:135
#define IDB_SYSTRAYPROP_HIDE_CLOCK_NODESK
Definition: resource.h:47
#define IDC_TASKBARPROP_NOTIFICATIONBITMAP
Definition: resource.h:159
#define IDC_TASKBARPROP_STARTMENU_BITMAP
Definition: resource.h:150
#define IDB_TASKBARPROP_LOCK_GROUP_NOQL
Definition: resource.h:38
#define IDC_TASKBARPROP_STARTMENUCLASSICCUST
Definition: resource.h:144
#define IDB_SYSTRAYPROP_SHOW_SECONDS_DESK
Definition: resource.h:51
#define IDB_TASKBARPROP_LOCK_NOGROUP_QL
Definition: resource.h:36
#define IDB_SYSTRAYPROP_SHOW_NOCLOCK_NODESK
Definition: resource.h:50
#define IDB_SYSTRAYPROP_SHOW_CLOCK_NODESK
Definition: resource.h:49
#define IDD_TASKBARPROP_STARTMENU
Definition: resource.h:95
#define IDI_STARTMENU
Definition: resource.h:14
#define IDB_TASKBARPROP_LOCK_NOGROUP_NOQL
Definition: resource.h:40
#define IDB_SYSTRAYPROP_SHOW_SECONDS_NODESK
Definition: resource.h:42
#define IDC_TASKBARPROP_SHOWQL
Definition: resource.h:138
#define IDC_TASKBARPROP_HIDEICONS
Definition: resource.h:155
#define IDB_SYSTRAYPROP_HIDE_CLOCK_DESK
Definition: resource.h:53
#define IDS_TASKBAR_STARTMENU_PROP_CAPTION
Definition: resource.h:110
#define IDD_TASKBARPROP_NOTIFY
Definition: resource.h:96
#define IDB_SYSTRAYPROP_SHOW_NOCLOCK_DESK
Definition: resource.h:56
#define IDB_TASKBARPROP_LOCK_GROUP_QL
Definition: resource.h:34
#define IDC_TASKBARPROP_STARTMENU
Definition: resource.h:147
#define IDD_TASKBARPROP_TASKBAR
Definition: resource.h:91
#define IDB_STARTPREVIEW
Definition: resource.h:45
#define IDC_TASKBARPROP_LOCK
Definition: resource.h:137
#define IDC_TASKBARPROP_SECONDS
Definition: resource.h:158
#define IDB_SYSTRAYPROP_HIDE_SECONDS_DESK
Definition: resource.h:52
#define IDB_STARTPREVIEW_CLASSIC
Definition: resource.h:46
#define IDC_TASKBARPROP_NOTIFY_LAST_CMD
Definition: resource.h:161
#define IDB_SYSTRAYPROP_HIDE_SECONDS_NODESK
Definition: resource.h:43
#define IDC_TASKBARPROP_DESKTOP
Definition: resource.h:160
#define IDC_TASKBARPROP_STARTMENUMODERNTEXT
Definition: resource.h:145
#define IDB_TASKBARPROP_AUTOHIDE
Definition: resource.h:33
#define IDC_TASKBARPROP_GROUP
Definition: resource.h:136
#define IDC_TASKBARPROP_ONTOP
Definition: resource.h:134
#define IDB_SYSTRAYPROP_SHOW_CLOCK_DESK
Definition: resource.h:55
#define IDC_TASKBARPROP_STARTMENUCUST
Definition: resource.h:146
#define IDC_TASKBARPROP_FIRST_CMD
Definition: resource.h:133
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:294
LRESULT OnCustomizeTrayIcons(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: trayprop.cpp:288
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayprop.cpp:277
static const WORD wImageIdLookupTable[2][2][2][2]
Definition: trayprop.cpp:233
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:80
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:830
#define SSF_STARTPANELON
Definition: shlobj.h:1625
@ REST_NOSTARTPANEL
Definition: shlobj.h:1772
DWORD WINAPI SHRestricted(RESTRICTIONS rest)
Definition: shpolicy.c:150
BOOL bGroupButtons
Definition: precomp.h:219
BOOL bShowDesktopButton
Definition: precomp.h:225
BOOL bHideInactiveIcons
Definition: precomp.h:222
TW_STRUCKRECTS2 sr
Definition: precomp.h:226
BOOL bShowSeconds
Definition: precomp.h:220
BOOL bSmallIcons
Definition: precomp.h:223
Definition: bl.h:1331
DWORD AutoHide
Definition: precomp.h:205
DWORD HideClock
Definition: precomp.h:208
DWORD AlwaysOnTop
Definition: precomp.h:206
#define ICON_BIG
Definition: tnclass.cpp:51
VOID DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar)
Definition: trayprop.cpp:358
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: trayprop.cpp:341
static void SetBitmap(HWND hwnd, HBITMAP *hbmp, UINT uImageId)
Definition: trayprop.cpp:24
#define IN
Definition: typedefs.h:39
#define ZeroMemory
Definition: winbase.h:1737
_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:771
#define SWP_NOACTIVATE
Definition: winuser.h:1245
#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:1247
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:2289
#define WM_INITDIALOG
Definition: winuser.h:1742
#define STM_SETIMAGE
Definition: winuser.h:2096
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define SendMessage
Definition: winuser.h:5855
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define LR_DEFAULTCOLOR
Definition: winuser.h:1090
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define SWP_NOZORDER
Definition: winuser.h:1250
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2161
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197