ReactOS 0.4.15-dev-7681-g776c3a3
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 // fix me: start menu style (classic/modern) should be read somewhere from the registry.
208 CheckDlgButton(IDC_TASKBARPROP_STARTMENUCLASSIC, BST_CHECKED); // HACK: This has to be read from registry!!!!!!!
210
211 return TRUE;
212 }
213
214 LRESULT OnStartMenuCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
215 {
217 return 0;
218 }
219
221 {
222 //TODO
223 return PSNRET_NOERROR;
224 }
225};
226
227class CNotifySettingsPage : public CPropertyPageImpl<CNotifySettingsPage>
228{
229private:
232
234 {
238 UINT uImageId;
239
240 HWND hwndCustomizeNotifyButton = GetDlgItem(IDC_TASKBARPROP_ICONCUST);
243
244 ::EnableWindow(hwndCustomizeNotifyButton, bHideInactive);
245 ::EnableWindow(hwndSeconds, bShowClock);
246 if (!bShowSeconds)
248
249 if (bHideInactive && bShowClock && bShowSeconds)
251 else if (bHideInactive && bShowClock && !bShowSeconds)
253 else if (bHideInactive && !bShowClock)
255 else if (!bHideInactive && bShowClock && bShowSeconds)
257 else if (!bHideInactive && bShowClock && !bShowSeconds)
259 else if (!bHideInactive && !bShowClock)
261
262 SetBitmap(hwndTrayBitmap, &m_hbmpTray, uImageId);
263 }
264
265public:
267
274
278 {
279 }
280
282 {
283 if (m_hbmpTray)
285 }
286
288 {
293
295 return TRUE;
296 }
297
298 LRESULT OnCustomizeTrayIcons(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
299 {
301 return 0;
302 }
303
304 LRESULT OnCtrlCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
305 {
308 return 0;
309 }
310
312 {
314
319
321
322 return PSNRET_NOERROR;
323 }
324};
325
326static int CALLBACK
328{
329 // NOTE: This callback is needed to set large icon correctly.
330 HICON hIcon;
331 switch (uMsg)
332 {
333 case PSCB_INITIALIZED:
334 {
336 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
337 break;
338 }
339 }
340 return 0;
341}
342
343VOID
344DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar)
345{
346 PROPSHEETHEADER psh;
348 CTaskBarSettingsPage tbSettingsPage(hwndTaskbar);
349 CStartMenuSettingsPage smSettingsPage;
350 CNotifySettingsPage naSettingsPage(hwndTaskbar);
351 CStringW caption;
352
353 caption.LoadStringW(IDS_TASKBAR_STARTMENU_PROP_CAPTION);
354
355 hpsp.Add(tbSettingsPage.Create());
356 hpsp.Add(smSettingsPage.Create());
357 hpsp.Add(naSettingsPage.Create());
358
359 ZeroMemory(&psh, sizeof(psh));
360 psh.dwSize = sizeof(psh);
362 psh.hwndParent = hwndOwner;
363 psh.hInstance = hExplorerInstance;
364 psh.pszIcon = MAKEINTRESOURCEW(IDI_STARTMENU);
365 psh.pszCaption = caption.GetString();
366 psh.nPages = hpsp.GetSize();
367 psh.nStartPage = 0;
368 psh.phpage = hpsp.GetData();
369 psh.pfnCallback = PropSheetProc;
370
371 PropertySheet(&psh);
372}
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:141
#define IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL
Definition: resource.h:41
#define IDC_TASKBARPROP_SMALLICONS
Definition: resource.h:126
#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:127
#define IDC_TASKBARPROP_STARTMENUCLASSIC
Definition: resource.h:135
#define IDC_TASKBARPROP_TASKBARBITMAP
Definition: resource.h:128
#define IDB_SYSTRAYPROP_HIDE_NOCLOCK
Definition: resource.h:48
#define IDC_TASKBARPROP_ICONCUST
Definition: resource.h:143
#define IDC_TASKBARPROP_CLOCK
Definition: resource.h:144
#define IDB_TASKBARPROP_NOLOCK_GROUP_QL
Definition: resource.h:35
#define IDC_TASKBARPROP_HIDE
Definition: resource.h:122
#define IDC_TASKBARPROP_NOTIFICATIONBITMAP
Definition: resource.h:146
#define IDC_TASKBARPROP_STARTMENU_BITMAP
Definition: resource.h:137
#define IDB_TASKBARPROP_LOCK_GROUP_NOQL
Definition: resource.h:38
#define IDC_TASKBARPROP_STARTMENUCLASSICCUST
Definition: resource.h:131
#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:125
#define IDB_SYSTRAYPROP_SHOW_NOCLOCK
Definition: resource.h:50
#define IDC_TASKBARPROP_HIDEICONS
Definition: resource.h:142
#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:134
#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:124
#define IDC_TASKBARPROP_SECONDS
Definition: resource.h:145
#define IDB_STARTPREVIEW_CLASSIC
Definition: resource.h:46
#define IDC_TASKBARPROP_NOTIFY_LAST_CMD
Definition: resource.h:148
#define IDC_TASKBARPROP_DESKTOP
Definition: resource.h:147
#define IDC_TASKBARPROP_STARTMENUMODERNTEXT
Definition: resource.h:132
#define IDB_TASKBARPROP_AUTOHIDE
Definition: resource.h:33
#define IDC_TASKBARPROP_GROUP
Definition: resource.h:123
#define IDC_TASKBARPROP_ONTOP
Definition: resource.h:121
#define IDB_SYSTRAYPROP_SHOW_SECONDS
Definition: resource.h:42
#define IDC_TASKBARPROP_STARTMENUCUST
Definition: resource.h:133
#define IDC_TASKBARPROP_FIRST_CMD
Definition: resource.h:120
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:304
LRESULT OnCustomizeTrayIcons(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: trayprop.cpp:298
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: trayprop.cpp:287
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:214
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 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
@ REST_NOSTARTPANEL
Definition: shlobj.h:1746
DWORD WINAPI SHRestricted(RESTRICTIONS policy)
Definition: shpolicy.c:827
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:344
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: trayprop.cpp:327
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:767
#define SWP_NOACTIVATE
Definition: winuser.h:1241
#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:1243
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:2186
#define WM_INITDIALOG
Definition: winuser.h:1738
#define STM_SETIMAGE
Definition: winuser.h:2092
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define SendMessage
Definition: winuser.h:5842
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define LR_DEFAULTCOLOR
Definition: winuser.h:1086
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define SWP_NOZORDER
Definition: winuser.h:1246
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2058
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197