1c2c66affSColin Finck /*
2c2c66affSColin Finck * ReactOS Explorer
3c2c66affSColin Finck *
4c2c66affSColin Finck * Copyright 2006 - 2007 Thomas Weidenmueller <w3seek@reactos.org>
5c2c66affSColin Finck * 2015 Robert Naumann <gonzomdx@gmail.com>
6c2c66affSColin Finck *
7c2c66affSColin Finck * This library is free software; you can redistribute it and/or
8c2c66affSColin Finck * modify it under the terms of the GNU Lesser General Public
9c2c66affSColin Finck * License as published by the Free Software Foundation; either
10c2c66affSColin Finck * version 2.1 of the License, or (at your option) any later version.
11c2c66affSColin Finck *
12c2c66affSColin Finck * This library is distributed in the hope that it will be useful,
13c2c66affSColin Finck * but WITHOUT ANY WARRANTY; without even the implied warranty of
14c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15c2c66affSColin Finck * Lesser General Public License for more details.
16c2c66affSColin Finck *
17c2c66affSColin Finck * You should have received a copy of the GNU Lesser General Public
18c2c66affSColin Finck * License along with this library; if not, write to the Free Software
19c2c66affSColin Finck * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20c2c66affSColin Finck */
21c2c66affSColin Finck
22c2c66affSColin Finck #include "precomp.h"
23c2c66affSColin Finck
SetBitmap(HWND hwnd,HBITMAP * hbmp,UINT uImageId)242ed535daSGiannis Adamopoulos static void SetBitmap(HWND hwnd, HBITMAP* hbmp, UINT uImageId)
25c2c66affSColin Finck {
262ed535daSGiannis Adamopoulos if (*hbmp)
272ed535daSGiannis Adamopoulos DeleteObject(*hbmp);
28c2c66affSColin Finck
292ed535daSGiannis Adamopoulos *hbmp = (HBITMAP)LoadImageW(hExplorerInstance,
302ed535daSGiannis Adamopoulos MAKEINTRESOURCEW(uImageId),
312ed535daSGiannis Adamopoulos IMAGE_BITMAP,
322ed535daSGiannis Adamopoulos 0,
332ed535daSGiannis Adamopoulos 0,
342ed535daSGiannis Adamopoulos LR_DEFAULTCOLOR);
35c2c66affSColin Finck
362ed535daSGiannis Adamopoulos if (*hbmp && hwnd)
37c2c66affSColin Finck {
382ed535daSGiannis Adamopoulos BITMAP bm;
392ed535daSGiannis Adamopoulos GetObject(*hbmp, sizeof(bm), &bm);
402ed535daSGiannis Adamopoulos ::SetWindowPos(hwnd, NULL, 0, 0, bm.bmWidth + 2, bm.bmHeight + 2,
412ed535daSGiannis Adamopoulos SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
422ed535daSGiannis Adamopoulos SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)*hbmp);
432ed535daSGiannis Adamopoulos }
44c2c66affSColin Finck
452ed535daSGiannis Adamopoulos }
46c2c66affSColin Finck
472ed535daSGiannis Adamopoulos class CTaskBarSettingsPage : public CPropertyPageImpl<CTaskBarSettingsPage>
48c2c66affSColin Finck {
492ed535daSGiannis Adamopoulos private:
502ed535daSGiannis Adamopoulos HBITMAP m_hbmpTaskbar;
512ed535daSGiannis Adamopoulos HWND m_hwndTaskbar;
52c2c66affSColin Finck
_UpdateDialog()5328ae9fb7SCarl J. Bialorucki void _UpdateDialog()
542ed535daSGiannis Adamopoulos {
552ed535daSGiannis Adamopoulos BOOL bLock = IsDlgButtonChecked(IDC_TASKBARPROP_LOCK);
562ed535daSGiannis Adamopoulos BOOL bHide = IsDlgButtonChecked(IDC_TASKBARPROP_HIDE);
572ed535daSGiannis Adamopoulos BOOL bGroup = IsDlgButtonChecked(IDC_TASKBARPROP_GROUP);
582ed535daSGiannis Adamopoulos BOOL bShowQL = IsDlgButtonChecked(IDC_TASKBARPROP_SHOWQL);
592ed535daSGiannis Adamopoulos UINT uImageId;
602ed535daSGiannis Adamopoulos
612ed535daSGiannis Adamopoulos HWND hwndTaskbarBitmap = GetDlgItem(IDC_TASKBARPROP_TASKBARBITMAP);
62c2c66affSColin Finck
63c2c66affSColin Finck if (bHide)
642ed535daSGiannis Adamopoulos uImageId = IDB_TASKBARPROP_AUTOHIDE;
65c2c66affSColin Finck else if (bLock && bGroup && bShowQL)
662ed535daSGiannis Adamopoulos uImageId = IDB_TASKBARPROP_LOCK_GROUP_QL;
67c2c66affSColin Finck else if (bLock && !bGroup && !bShowQL)
682ed535daSGiannis Adamopoulos uImageId = IDB_TASKBARPROP_LOCK_NOGROUP_NOQL;
69c2c66affSColin Finck else if (bLock && bGroup && !bShowQL)
702ed535daSGiannis Adamopoulos uImageId = IDB_TASKBARPROP_LOCK_GROUP_NOQL;
71c2c66affSColin Finck else if (bLock && !bGroup && bShowQL)
722ed535daSGiannis Adamopoulos uImageId = IDB_TASKBARPROP_LOCK_NOGROUP_QL;
73c2c66affSColin Finck else if (!bLock && !bGroup && !bShowQL)
742ed535daSGiannis Adamopoulos uImageId = IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL;
75c2c66affSColin Finck else if (!bLock && bGroup && !bShowQL)
762ed535daSGiannis Adamopoulos uImageId = IDB_TASKBARPROP_NOLOCK_GROUP_NOQL;
77c2c66affSColin Finck else if (!bLock && !bGroup && bShowQL)
782ed535daSGiannis Adamopoulos uImageId = IDB_TASKBARPROP_NOLOCK_NOGROUP_QL;
79c2c66affSColin Finck else if (!bLock && bGroup && bShowQL)
802ed535daSGiannis Adamopoulos uImageId = IDB_TASKBARPROP_NOLOCK_GROUP_QL;
812ed535daSGiannis Adamopoulos
822ed535daSGiannis Adamopoulos SetBitmap(hwndTaskbarBitmap, &m_hbmpTaskbar, uImageId);
832ed535daSGiannis Adamopoulos }
842ed535daSGiannis Adamopoulos
852ed535daSGiannis Adamopoulos public:
862ed535daSGiannis Adamopoulos enum { IDD = IDD_TASKBARPROP_TASKBAR };
872ed535daSGiannis Adamopoulos
882ed535daSGiannis Adamopoulos BEGIN_MSG_MAP(CTaskBarSettingsPage)
MESSAGE_HANDLER(WM_INITDIALOG,OnInitDialog)892ed535daSGiannis Adamopoulos MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
902ed535daSGiannis Adamopoulos COMMAND_RANGE_HANDLER(IDC_TASKBARPROP_FIRST_CMD, IDC_TASKBARPROP_LAST_CMD, OnCtrlCommand)
912ed535daSGiannis Adamopoulos CHAIN_MSG_MAP(CPropertyPageImpl<CTaskBarSettingsPage>)
922ed535daSGiannis Adamopoulos END_MSG_MAP()
932ed535daSGiannis Adamopoulos
942ed535daSGiannis Adamopoulos CTaskBarSettingsPage(HWND hwnd):
952ed535daSGiannis Adamopoulos m_hbmpTaskbar(NULL),
962ed535daSGiannis Adamopoulos m_hwndTaskbar(hwnd)
97c2c66affSColin Finck {
98c2c66affSColin Finck }
992ed535daSGiannis Adamopoulos
~CTaskBarSettingsPage()1002ed535daSGiannis Adamopoulos ~CTaskBarSettingsPage()
101c2c66affSColin Finck {
1022ed535daSGiannis Adamopoulos if (m_hbmpTaskbar)
1032ed535daSGiannis Adamopoulos DeleteObject(m_hbmpTaskbar);
1042ed535daSGiannis Adamopoulos }
1052ed535daSGiannis Adamopoulos
OnInitDialog(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)1062ed535daSGiannis Adamopoulos LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
107c2c66affSColin Finck {
1082ed535daSGiannis Adamopoulos CheckDlgButton(IDC_TASKBARPROP_LOCK, g_TaskbarSettings.bLock ? BST_CHECKED : BST_UNCHECKED);
1092ed535daSGiannis Adamopoulos CheckDlgButton(IDC_TASKBARPROP_HIDE, g_TaskbarSettings.sr.AutoHide ? BST_CHECKED : BST_UNCHECKED);
1102ed535daSGiannis Adamopoulos CheckDlgButton(IDC_TASKBARPROP_ONTOP, g_TaskbarSettings.sr.AlwaysOnTop ? BST_CHECKED : BST_UNCHECKED);
1112ed535daSGiannis Adamopoulos CheckDlgButton(IDC_TASKBARPROP_GROUP, g_TaskbarSettings.bGroupButtons ? BST_CHECKED : BST_UNCHECKED);
1122ed535daSGiannis Adamopoulos //CheckDlgButton(IDC_TASKBARPROP_SHOWQL, g_TaskbarSettings.bShowQuickLaunch ? BST_CHECKED : BST_UNCHECKED);
11328ae9fb7SCarl J. Bialorucki CheckDlgButton(IDC_TASKBARPROP_SMALLICONS, g_TaskbarSettings.bSmallIcons ? BST_CHECKED : BST_UNCHECKED);
1142ed535daSGiannis Adamopoulos
11528ae9fb7SCarl J. Bialorucki _UpdateDialog();
1162ed535daSGiannis Adamopoulos return TRUE;
117c2c66affSColin Finck }
1182ed535daSGiannis Adamopoulos
OnCtrlCommand(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)1192ed535daSGiannis Adamopoulos LRESULT OnCtrlCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
120c2c66affSColin Finck {
12128ae9fb7SCarl J. Bialorucki _UpdateDialog();
1222ed535daSGiannis Adamopoulos SetModified(TRUE);
1232ed535daSGiannis Adamopoulos return 0;
1242ed535daSGiannis Adamopoulos }
1252ed535daSGiannis Adamopoulos
OnApply()1262ed535daSGiannis Adamopoulos int OnApply()
127c2c66affSColin Finck {
12828ae9fb7SCarl J. Bialorucki TaskbarSettings newSettings = g_TaskbarSettings;
129c2c66affSColin Finck
1302ed535daSGiannis Adamopoulos newSettings.bLock = IsDlgButtonChecked(IDC_TASKBARPROP_LOCK);
1312ed535daSGiannis Adamopoulos newSettings.sr.AutoHide = IsDlgButtonChecked(IDC_TASKBARPROP_HIDE);
1322ed535daSGiannis Adamopoulos newSettings.sr.AlwaysOnTop = IsDlgButtonChecked(IDC_TASKBARPROP_ONTOP);
1332ed535daSGiannis Adamopoulos newSettings.bGroupButtons = IsDlgButtonChecked(IDC_TASKBARPROP_GROUP);
1342ed535daSGiannis Adamopoulos //newSettings.bShowQuickLaunch = IsDlgButtonChecked(IDC_TASKBARPROP_SHOWQL);
13528ae9fb7SCarl J. Bialorucki newSettings.bSmallIcons = IsDlgButtonChecked(IDC_TASKBARPROP_SMALLICONS);
1362ed535daSGiannis Adamopoulos
1372ed535daSGiannis Adamopoulos SendMessage(m_hwndTaskbar, TWM_SETTINGSCHANGED, 0, (LPARAM)&newSettings);
1382ed535daSGiannis Adamopoulos
1392ed535daSGiannis Adamopoulos return PSNRET_NOERROR;
1402ed535daSGiannis Adamopoulos }
1412ed535daSGiannis Adamopoulos };
1422ed535daSGiannis Adamopoulos
1432ed535daSGiannis Adamopoulos class CStartMenuSettingsPage : public CPropertyPageImpl<CStartMenuSettingsPage>
144c2c66affSColin Finck {
1452ed535daSGiannis Adamopoulos private:
1462ed535daSGiannis Adamopoulos HBITMAP m_hbmpStartBitmap;
1472ed535daSGiannis Adamopoulos
_UpdateDialog()14828ae9fb7SCarl J. Bialorucki void _UpdateDialog()
149c2c66affSColin Finck {
1502ed535daSGiannis Adamopoulos HWND hwndCustomizeClassic = GetDlgItem(IDC_TASKBARPROP_STARTMENUCLASSICCUST);
1512ed535daSGiannis Adamopoulos HWND hwndCustomizeModern = GetDlgItem(IDC_TASKBARPROP_STARTMENUCUST);
1522ed535daSGiannis Adamopoulos HWND hwndStartBitmap = GetDlgItem(IDC_TASKBARPROP_STARTMENU_BITMAP);
153a30e644dSYaroslav Kibysh HWND hwndModernRadioBtn = GetDlgItem(IDC_TASKBARPROP_STARTMENU);
154a30e644dSYaroslav Kibysh HWND hwndModernText = GetDlgItem(IDC_TASKBARPROP_STARTMENUMODERNTEXT);
155a30e644dSYaroslav Kibysh BOOL policyNoSimpleStartMenu = SHRestricted(REST_NOSTARTPANEL) != 0;
156a30e644dSYaroslav Kibysh BOOL bModern = FALSE;
1572ed535daSGiannis Adamopoulos
158a30e644dSYaroslav Kibysh /* If NoSimpleStartMenu, disable ability to use Modern Start Menu */
159a30e644dSYaroslav Kibysh if (policyNoSimpleStartMenu)
160a30e644dSYaroslav Kibysh {
161a30e644dSYaroslav Kibysh /* Switch to classic */
162a30e644dSYaroslav Kibysh CheckDlgButton(IDC_TASKBARPROP_STARTMENUCLASSIC, BST_CHECKED);
163a30e644dSYaroslav Kibysh
164a30e644dSYaroslav Kibysh /* Disable radio button */
165a30e644dSYaroslav Kibysh ::EnableWindow(hwndModernRadioBtn, FALSE);
166a30e644dSYaroslav Kibysh
167a30e644dSYaroslav Kibysh /* Hide controls related to modern menu */
168a30e644dSYaroslav Kibysh ::ShowWindow(hwndModernRadioBtn, SW_HIDE);
169a30e644dSYaroslav Kibysh ::ShowWindow(hwndModernText, SW_HIDE);
170a30e644dSYaroslav Kibysh ::ShowWindow(hwndCustomizeModern, SW_HIDE);
171a30e644dSYaroslav Kibysh }
172a30e644dSYaroslav Kibysh /* If no restrictions, then get bModern from dialog */
173a30e644dSYaroslav Kibysh else
174a30e644dSYaroslav Kibysh {
175a30e644dSYaroslav Kibysh bModern = IsDlgButtonChecked(IDC_TASKBARPROP_STARTMENU);
176a30e644dSYaroslav Kibysh }
177a30e644dSYaroslav Kibysh
1782ed535daSGiannis Adamopoulos ::EnableWindow(hwndCustomizeModern, bModern);
1792ed535daSGiannis Adamopoulos ::EnableWindow(hwndCustomizeClassic, !bModern);
1802ed535daSGiannis Adamopoulos
1812ed535daSGiannis Adamopoulos UINT uImageId = bModern ? IDB_STARTPREVIEW : IDB_STARTPREVIEW_CLASSIC;
1822ed535daSGiannis Adamopoulos SetBitmap(hwndStartBitmap, &m_hbmpStartBitmap, uImageId);
183c2c66affSColin Finck }
184c2c66affSColin Finck
1852ed535daSGiannis Adamopoulos public:
1862ed535daSGiannis Adamopoulos enum { IDD = IDD_TASKBARPROP_STARTMENU };
1872ed535daSGiannis Adamopoulos
1882ed535daSGiannis Adamopoulos BEGIN_MSG_MAP(CTaskBarSettingsPage)
MESSAGE_HANDLER(WM_INITDIALOG,OnInitDialog)1892ed535daSGiannis Adamopoulos MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
1902ed535daSGiannis Adamopoulos COMMAND_ID_HANDLER(IDC_TASKBARPROP_STARTMENUCLASSICCUST, OnStartMenuCustomize)
1912ed535daSGiannis Adamopoulos CHAIN_MSG_MAP(CPropertyPageImpl<CStartMenuSettingsPage>)
1922ed535daSGiannis Adamopoulos END_MSG_MAP()
1932ed535daSGiannis Adamopoulos
1942ed535daSGiannis Adamopoulos CStartMenuSettingsPage():
1952ed535daSGiannis Adamopoulos m_hbmpStartBitmap(NULL)
196c2c66affSColin Finck {
1972ed535daSGiannis Adamopoulos }
1982ed535daSGiannis Adamopoulos
~CStartMenuSettingsPage()1992ed535daSGiannis Adamopoulos ~CStartMenuSettingsPage()
200c2c66affSColin Finck {
2012ed535daSGiannis Adamopoulos if (m_hbmpStartBitmap)
2022ed535daSGiannis Adamopoulos DeleteObject(m_hbmpStartBitmap);
203c2c66affSColin Finck }
2042ed535daSGiannis Adamopoulos
OnInitDialog(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)2052ed535daSGiannis Adamopoulos LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
206c2c66affSColin Finck {
207*71a3be24SWhindmar Saksit BOOL modern = SHELL_GetSetting(SSF_STARTPANELON, fStartPanelOn);
208*71a3be24SWhindmar Saksit CheckDlgButton(modern ? IDC_TASKBARPROP_STARTMENU : IDC_TASKBARPROP_STARTMENUCLASSIC, BST_CHECKED);
20928ae9fb7SCarl J. Bialorucki _UpdateDialog();
2102ed535daSGiannis Adamopoulos return TRUE;
211c2c66affSColin Finck }
212c2c66affSColin Finck
OnStartMenuCustomize(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)2132ed535daSGiannis Adamopoulos LRESULT OnStartMenuCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
214c2c66affSColin Finck {
2152ed535daSGiannis Adamopoulos ShowCustomizeClassic(hExplorerInstance, m_hWnd);
2162ed535daSGiannis Adamopoulos return 0;
2172ed535daSGiannis Adamopoulos }
2182ed535daSGiannis Adamopoulos
OnApply()2192ed535daSGiannis Adamopoulos int OnApply()
220c2c66affSColin Finck {
221*71a3be24SWhindmar Saksit SHELLSTATE ss;
222*71a3be24SWhindmar Saksit ss.fStartPanelOn = !IsDlgButtonChecked(IDC_TASKBARPROP_STARTMENUCLASSIC);
223*71a3be24SWhindmar Saksit SHGetSetSettings(&ss, SSF_STARTPANELON, TRUE);
2242ed535daSGiannis Adamopoulos return PSNRET_NOERROR;
225c2c66affSColin Finck }
2262ed535daSGiannis Adamopoulos };
227c2c66affSColin Finck
22828ae9fb7SCarl J. Bialorucki class CNotifySettingsPage : public CPropertyPageImpl<CNotifySettingsPage>
22928ae9fb7SCarl J. Bialorucki {
23028ae9fb7SCarl J. Bialorucki private:
23128ae9fb7SCarl J. Bialorucki HBITMAP m_hbmpTray;
23228ae9fb7SCarl J. Bialorucki HWND m_hwndTaskbar;
23328ae9fb7SCarl J. Bialorucki
_UpdateDialog()23428ae9fb7SCarl J. Bialorucki void _UpdateDialog()
23528ae9fb7SCarl J. Bialorucki {
23628ae9fb7SCarl J. Bialorucki BOOL bShowClock = IsDlgButtonChecked(IDC_TASKBARPROP_CLOCK);
23728ae9fb7SCarl J. Bialorucki BOOL bShowSeconds = IsDlgButtonChecked(IDC_TASKBARPROP_SECONDS);
23828ae9fb7SCarl J. Bialorucki BOOL bHideInactive = IsDlgButtonChecked(IDC_TASKBARPROP_HIDEICONS);
23928ae9fb7SCarl J. Bialorucki UINT uImageId;
24028ae9fb7SCarl J. Bialorucki
24128ae9fb7SCarl J. Bialorucki HWND hwndCustomizeNotifyButton = GetDlgItem(IDC_TASKBARPROP_ICONCUST);
24228ae9fb7SCarl J. Bialorucki HWND hwndSeconds = GetDlgItem(IDC_TASKBARPROP_SECONDS);
24328ae9fb7SCarl J. Bialorucki HWND hwndTrayBitmap = GetDlgItem(IDC_TASKBARPROP_NOTIFICATIONBITMAP);
24428ae9fb7SCarl J. Bialorucki
24528ae9fb7SCarl J. Bialorucki ::EnableWindow(hwndCustomizeNotifyButton, bHideInactive);
24628ae9fb7SCarl J. Bialorucki ::EnableWindow(hwndSeconds, bShowClock);
24728ae9fb7SCarl J. Bialorucki if (!bShowSeconds)
24828ae9fb7SCarl J. Bialorucki CheckDlgButton(IDC_TASKBARPROP_SECONDS, BST_UNCHECKED);
24928ae9fb7SCarl J. Bialorucki
25028ae9fb7SCarl J. Bialorucki if (bHideInactive && bShowClock && bShowSeconds)
25128ae9fb7SCarl J. Bialorucki uImageId = IDB_SYSTRAYPROP_HIDE_SECONDS;
25228ae9fb7SCarl J. Bialorucki else if (bHideInactive && bShowClock && !bShowSeconds)
25328ae9fb7SCarl J. Bialorucki uImageId = IDB_SYSTRAYPROP_HIDE_CLOCK;
25428ae9fb7SCarl J. Bialorucki else if (bHideInactive && !bShowClock)
25528ae9fb7SCarl J. Bialorucki uImageId = IDB_SYSTRAYPROP_HIDE_NOCLOCK;
25628ae9fb7SCarl J. Bialorucki else if (!bHideInactive && bShowClock && bShowSeconds)
25728ae9fb7SCarl J. Bialorucki uImageId = IDB_SYSTRAYPROP_SHOW_SECONDS;
25828ae9fb7SCarl J. Bialorucki else if (!bHideInactive && bShowClock && !bShowSeconds)
25928ae9fb7SCarl J. Bialorucki uImageId = IDB_SYSTRAYPROP_SHOW_CLOCK;
26028ae9fb7SCarl J. Bialorucki else if (!bHideInactive && !bShowClock)
26128ae9fb7SCarl J. Bialorucki uImageId = IDB_SYSTRAYPROP_SHOW_NOCLOCK;
26228ae9fb7SCarl J. Bialorucki
26328ae9fb7SCarl J. Bialorucki SetBitmap(hwndTrayBitmap, &m_hbmpTray, uImageId);
26428ae9fb7SCarl J. Bialorucki }
26528ae9fb7SCarl J. Bialorucki
26628ae9fb7SCarl J. Bialorucki public:
26728ae9fb7SCarl J. Bialorucki enum { IDD = IDD_TASKBARPROP_NOTIFY };
26828ae9fb7SCarl J. Bialorucki
26928ae9fb7SCarl J. Bialorucki BEGIN_MSG_MAP(CNotifySettingsPage)
MESSAGE_HANDLER(WM_INITDIALOG,OnInitDialog)27028ae9fb7SCarl J. Bialorucki MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
27128ae9fb7SCarl J. Bialorucki COMMAND_ID_HANDLER(IDC_TASKBARPROP_ICONCUST, OnCustomizeTrayIcons)
27228ae9fb7SCarl J. Bialorucki COMMAND_RANGE_HANDLER(IDC_TASKBARPROP_NOTIFY_FIRST_CMD, IDC_TASKBARPROP_NOTIFY_LAST_CMD, OnCtrlCommand)
27328ae9fb7SCarl J. Bialorucki CHAIN_MSG_MAP(CPropertyPageImpl<CNotifySettingsPage>)
27428ae9fb7SCarl J. Bialorucki END_MSG_MAP()
27528ae9fb7SCarl J. Bialorucki
27628ae9fb7SCarl J. Bialorucki CNotifySettingsPage(HWND hwnd):
27728ae9fb7SCarl J. Bialorucki m_hbmpTray(NULL),
27828ae9fb7SCarl J. Bialorucki m_hwndTaskbar(hwnd)
27928ae9fb7SCarl J. Bialorucki {
28028ae9fb7SCarl J. Bialorucki }
28128ae9fb7SCarl J. Bialorucki
~CNotifySettingsPage()28228ae9fb7SCarl J. Bialorucki ~CNotifySettingsPage()
28328ae9fb7SCarl J. Bialorucki {
28428ae9fb7SCarl J. Bialorucki if (m_hbmpTray)
28528ae9fb7SCarl J. Bialorucki DeleteObject(m_hbmpTray);
28628ae9fb7SCarl J. Bialorucki }
28728ae9fb7SCarl J. Bialorucki
OnInitDialog(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL & bHandled)28828ae9fb7SCarl J. Bialorucki LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
28928ae9fb7SCarl J. Bialorucki {
29028ae9fb7SCarl J. Bialorucki CheckDlgButton(IDC_TASKBARPROP_CLOCK, (!g_TaskbarSettings.sr.HideClock) ? BST_CHECKED : BST_UNCHECKED);
29128ae9fb7SCarl J. Bialorucki CheckDlgButton(IDC_TASKBARPROP_SECONDS, g_TaskbarSettings.bShowSeconds ? BST_CHECKED : BST_UNCHECKED);
29228ae9fb7SCarl J. Bialorucki CheckDlgButton(IDC_TASKBARPROP_HIDEICONS, g_TaskbarSettings.bHideInactiveIcons ? BST_CHECKED : BST_UNCHECKED);
29328ae9fb7SCarl J. Bialorucki CheckDlgButton(IDC_TASKBARPROP_DESKTOP, g_TaskbarSettings.bShowDesktopButton ? BST_CHECKED : BST_UNCHECKED);
29428ae9fb7SCarl J. Bialorucki
29528ae9fb7SCarl J. Bialorucki _UpdateDialog();
29628ae9fb7SCarl J. Bialorucki return TRUE;
29728ae9fb7SCarl J. Bialorucki }
29828ae9fb7SCarl J. Bialorucki
OnCustomizeTrayIcons(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)29928ae9fb7SCarl J. Bialorucki LRESULT OnCustomizeTrayIcons(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
30028ae9fb7SCarl J. Bialorucki {
30128ae9fb7SCarl J. Bialorucki ShowCustomizeNotifyIcons(hExplorerInstance, m_hWnd);
30228ae9fb7SCarl J. Bialorucki return 0;
30328ae9fb7SCarl J. Bialorucki }
30428ae9fb7SCarl J. Bialorucki
OnCtrlCommand(WORD wNotifyCode,WORD wID,HWND hWndCtl,BOOL & bHandled)30528ae9fb7SCarl J. Bialorucki LRESULT OnCtrlCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
30628ae9fb7SCarl J. Bialorucki {
30728ae9fb7SCarl J. Bialorucki _UpdateDialog();
30828ae9fb7SCarl J. Bialorucki SetModified(TRUE);
30928ae9fb7SCarl J. Bialorucki return 0;
31028ae9fb7SCarl J. Bialorucki }
31128ae9fb7SCarl J. Bialorucki
OnApply()31228ae9fb7SCarl J. Bialorucki int OnApply()
31328ae9fb7SCarl J. Bialorucki {
31428ae9fb7SCarl J. Bialorucki TaskbarSettings newSettings = g_TaskbarSettings;
31528ae9fb7SCarl J. Bialorucki
31628ae9fb7SCarl J. Bialorucki newSettings.sr.HideClock = !IsDlgButtonChecked(IDC_TASKBARPROP_CLOCK);
31728ae9fb7SCarl J. Bialorucki newSettings.bShowSeconds = IsDlgButtonChecked(IDC_TASKBARPROP_SECONDS);
31828ae9fb7SCarl J. Bialorucki newSettings.bHideInactiveIcons = IsDlgButtonChecked(IDC_TASKBARPROP_HIDEICONS);
31928ae9fb7SCarl J. Bialorucki newSettings.bShowDesktopButton = IsDlgButtonChecked(IDC_TASKBARPROP_DESKTOP);
32028ae9fb7SCarl J. Bialorucki
32128ae9fb7SCarl J. Bialorucki SendMessage(m_hwndTaskbar, TWM_SETTINGSCHANGED, 0, (LPARAM)&newSettings);
32228ae9fb7SCarl J. Bialorucki
32328ae9fb7SCarl J. Bialorucki return PSNRET_NOERROR;
32428ae9fb7SCarl J. Bialorucki }
32528ae9fb7SCarl J. Bialorucki };
32628ae9fb7SCarl J. Bialorucki
327d310503dSKatayama Hirofumi MZ static int CALLBACK
PropSheetProc(HWND hwndDlg,UINT uMsg,LPARAM lParam)328d310503dSKatayama Hirofumi MZ PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
329d310503dSKatayama Hirofumi MZ {
330d310503dSKatayama Hirofumi MZ // NOTE: This callback is needed to set large icon correctly.
331d310503dSKatayama Hirofumi MZ HICON hIcon;
332d310503dSKatayama Hirofumi MZ switch (uMsg)
333d310503dSKatayama Hirofumi MZ {
334d310503dSKatayama Hirofumi MZ case PSCB_INITIALIZED:
335d310503dSKatayama Hirofumi MZ {
336d310503dSKatayama Hirofumi MZ hIcon = LoadIconW(hExplorerInstance, MAKEINTRESOURCEW(IDI_STARTMENU));
337d310503dSKatayama Hirofumi MZ SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
338d310503dSKatayama Hirofumi MZ break;
339d310503dSKatayama Hirofumi MZ }
340d310503dSKatayama Hirofumi MZ }
341d310503dSKatayama Hirofumi MZ return 0;
342d310503dSKatayama Hirofumi MZ }
343d310503dSKatayama Hirofumi MZ
344c2c66affSColin Finck VOID
DisplayTrayProperties(IN HWND hwndOwner,IN HWND hwndTaskbar)3452ed535daSGiannis Adamopoulos DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar)
346c2c66affSColin Finck {
347c2c66affSColin Finck PROPSHEETHEADER psh;
34828ae9fb7SCarl J. Bialorucki CSimpleArray<HPROPSHEETPAGE> hpsp;
3492ed535daSGiannis Adamopoulos CTaskBarSettingsPage tbSettingsPage(hwndTaskbar);
3502ed535daSGiannis Adamopoulos CStartMenuSettingsPage smSettingsPage;
35128ae9fb7SCarl J. Bialorucki CNotifySettingsPage naSettingsPage(hwndTaskbar);
3522ed535daSGiannis Adamopoulos CStringW caption;
353c2c66affSColin Finck
3542ed535daSGiannis Adamopoulos caption.LoadStringW(IDS_TASKBAR_STARTMENU_PROP_CAPTION);
3552ed535daSGiannis Adamopoulos
35628ae9fb7SCarl J. Bialorucki hpsp.Add(tbSettingsPage.Create());
35728ae9fb7SCarl J. Bialorucki hpsp.Add(smSettingsPage.Create());
35828ae9fb7SCarl J. Bialorucki hpsp.Add(naSettingsPage.Create());
359c2c66affSColin Finck
360c2c66affSColin Finck ZeroMemory(&psh, sizeof(psh));
361c2c66affSColin Finck psh.dwSize = sizeof(psh);
362d310503dSKatayama Hirofumi MZ psh.dwFlags = PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK;
363c2c66affSColin Finck psh.hwndParent = hwndOwner;
364c2c66affSColin Finck psh.hInstance = hExplorerInstance;
365d310503dSKatayama Hirofumi MZ psh.pszIcon = MAKEINTRESOURCEW(IDI_STARTMENU);
3662ed535daSGiannis Adamopoulos psh.pszCaption = caption.GetString();
36728ae9fb7SCarl J. Bialorucki psh.nPages = hpsp.GetSize();
368c2c66affSColin Finck psh.nStartPage = 0;
36928ae9fb7SCarl J. Bialorucki psh.phpage = hpsp.GetData();
370d310503dSKatayama Hirofumi MZ psh.pfnCallback = PropSheetProc;
371c2c66affSColin Finck
372c2c66affSColin Finck PropertySheet(&psh);
373c2c66affSColin Finck }
374