Handling of standard start menu commands. More...
#include <startmenu.h>


Public Types | |
| typedef StartMenu | super |
Public Member Functions | |
| StartMenuHandler (HWND hwnd, int icon_size=ICON_SIZE_SMALL) | |
| StartMenuHandler (HWND hwnd, const StartMenuCreateInfo &create_info, int icon_size=ICON_SIZE_SMALL) | |
Protected Member Functions | |
| int | Command (int id, int code) |
Static Protected Member Functions | |
| static void | ShowLaunchDialog (HWND hwndOwner) |
| static void | ShowLogoffDialog (HWND hwndOwner) |
| static void | ShowRestartDialog (HWND hwndOwner, UINT flags) |
| static void | ShowSearchDialog () |
| static void | ShowSearchComputer () |
Handling of standard start menu commands.
Definition at line 332 of file startmenu.h.
| typedef StartMenu StartMenuHandler::super |
Reimplemented from StartMenu.
Reimplemented in StartMenuRoot, SettingsMenu, BrowseMenu, and SearchMenu.
Definition at line 334 of file startmenu.h.
| StartMenuHandler::StartMenuHandler | ( | HWND | hwnd, |
| int | icon_size = ICON_SIZE_SMALL |
||
| ) | [inline] |
Definition at line 336 of file startmenu.h.
: super(hwnd, icon_size) { }
| StartMenuHandler::StartMenuHandler | ( | HWND | hwnd, |
| const StartMenuCreateInfo & | create_info, | ||
| int | icon_size = ICON_SIZE_SMALL |
||
| ) | [inline] |
Definition at line 341 of file startmenu.h.
: super(hwnd, create_info, icon_size) { }
| int StartMenuHandler::Command | ( | int | id, |
| int | code | ||
| ) | [protected, virtual] |
Reimplemented from StartMenu.
Definition at line 1888 of file startmenu.cpp.
References ExplorerGlobals::_favorites, WindowHandle::_hwnd, ExplorerGlobals::_hwndDesktop, ExplorerGlobals::_hwndDesktopBar, StartMenu::CloseStartMenu(), StartMenu::Command(), StartMenu::Create(), StartMenu::CreateSubmenu(), Dialog::DoModal(), explorer_show_frame(), ExplorerPropertySheet(), g_Globals, ExplorerGlobals::get_cfg(), ID_DESKTOPBAR_SETTINGS, IDC_ADMIN, IDC_BROWSE, IDC_CONNECTIONS, IDC_CONTROL_PANEL, IDC_DOCUMENTS, IDC_DRIVES, IDC_EXPLORE, IDC_FAVORITES, IDC_LAUNCH, IDC_LOGOFF, IDC_NETWORK, IDC_PRINTERS, IDC_PRINTERS_MENU, IDC_PROGRAMS, IDC_RECENT, IDC_RESTART, IDC_SEARCH, IDC_SEARCH_COMPUTER, IDC_SEARCH_FILES, IDC_SEARCH_PROGRAM, IDC_SETTINGS, IDC_SETTINGS_MENU, IDC_SHUTDOWN, IDC_START_HELP, IDC_TERMINATE, IDD_SEARCH_PROGRAM, IDS_ADMIN, IDS_BROWSE, IDS_CONNECTIONS, IDS_DOCUMENTS, IDS_DRIVES, IDS_FAVORITES, IDS_NETWORK, IDS_PRINTERS, IDS_PROGRAMS, IDS_RECENT, IDS_SEARCH, IDS_SETTINGS, IDS_SETTINGS_MENU, IDS_TITLE, launch_file(), SHELLPATH_CONTROL_PANEL, SHELLPATH_NET_CONNECTIONS, SHELLPATH_PRINTERS, ShowExitWindowsDialog(), ShowLaunchDialog(), ShowLogoffDialog(), ShowRestartDialog(), ShowSearchComputer(), ShowSearchDialog(), STARTMENU_CREATOR, TEXT, and WINDOW_CREATOR.
{
switch(id) {
// start menu root
case IDC_PROGRAMS:
CreateSubmenu(id, CSIDL_COMMON_PROGRAMS, CSIDL_PROGRAMS, ResString(IDS_PROGRAMS));
break;
case IDC_EXPLORE:
CloseStartMenu(id);
explorer_show_frame(SW_SHOWNORMAL);
break;
case IDC_LAUNCH:
CloseStartMenu(id);
ShowLaunchDialog(g_Globals._hwndDesktopBar);
break;
case IDC_DOCUMENTS:
CreateSubmenu(id, CSIDL_PERSONAL, ResString(IDS_DOCUMENTS));
break;
case IDC_RECENT:
CreateSubmenu(id, CSIDL_RECENT, ResString(IDS_RECENT), STARTMENU_CREATOR(RecentStartMenu));
break;
case IDC_FAVORITES:
#ifndef _SHELL32_FAVORITES
CreateSubmenu(id, ResString(IDS_FAVORITES), STARTMENU_CREATOR(FavoritesMenu), &static_cast<BookmarkList&>(g_Globals._favorites));
#else
CreateSubmenu(id, CSIDL_COMMON_FAVORITES, CSIDL_FAVORITES, ResString(IDS_FAVORITES));
#endif
break;
case IDC_BROWSE:
CreateSubmenu(id, ResString(IDS_BROWSE), STARTMENU_CREATOR(BrowseMenu));
break;
case IDC_SETTINGS:
CreateSubmenu(id, ResString(IDS_SETTINGS), STARTMENU_CREATOR(SettingsMenu));
break;
case IDC_SEARCH:
CreateSubmenu(id, ResString(IDS_SEARCH), STARTMENU_CREATOR(SearchMenu));
break;
case IDC_START_HELP:
CloseStartMenu(id);
MessageBox(g_Globals._hwndDesktopBar, TEXT("Help not yet implemented"), ResString(IDS_TITLE), MB_OK);
break;
case IDC_LOGOFF:
CloseStartMenu(id);
ShowLogoffDialog(g_Globals._hwndDesktopBar);
break;
#ifndef __REACTOS__
case IDC_TERMINATE:
DestroyWindow(GetParent(_hwnd));
break;
#endif
case IDC_SHUTDOWN:
CloseStartMenu(id);
ShowExitWindowsDialog(g_Globals._hwndDesktop);
break;
case IDC_RESTART:
CloseStartMenu(id);
ShowRestartDialog(g_Globals._hwndDesktop, EWX_REBOOT);
/* An alternative way to do restart without shell32 help */
//launch_file(_hwnd, TEXT("shutdown.exe"), SW_HIDE, TEXT("-r"));
break;
// settings menu
case ID_DESKTOPBAR_SETTINGS:
CloseStartMenu(id);
ExplorerPropertySheet(g_Globals._hwndDesktopBar);
break;
case IDC_CONTROL_PANEL: {
CloseStartMenu(id);
#ifndef ROSSHELL
#ifndef _NO_MDI
XMLPos explorer_options = g_Globals.get_cfg("general/explorer");
bool mdi = XMLBool(explorer_options, "mdi", true);
if (mdi)
MDIMainFrame::Create(TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}"), 0);
else
#endif
SDIMainFrame::Create(TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}"), 0);
#else
launch_file(_hwnd, SHELLPATH_CONTROL_PANEL);
#endif
break;}
case IDC_SETTINGS_MENU:
CreateSubmenu(id, CSIDL_CONTROLS, ResString(IDS_SETTINGS_MENU));
break;
case IDC_PRINTERS: {
CloseStartMenu(id);
#ifndef ROSSHELL
#ifndef _NO_MDI
XMLPos explorer_options = g_Globals.get_cfg("general/explorer");
bool mdi = XMLBool(explorer_options, "mdi", true);
if (mdi)
MDIMainFrame::Create(TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{2227A280-3AEA-1069-A2DE-08002B30309D}"), 0);
else
#endif
SDIMainFrame::Create(TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{2227A280-3AEA-1069-A2DE-08002B30309D}"), 0);
#else
launch_file(_hwnd, SHELLPATH_PRINTERS);
#endif
break;}
#if 0 ///@todo use printer start menu folder per default and allow opening "printers" cabinet window using the context menu
case IDC_PRINTERS_MENU:
CreateSubmenu(id, CSIDL_PRINTERS, CSIDL_PRINTHOOD, ResString(IDS_PRINTERS));
/* StartMenuFolders new_folders;
try {
new_folders.push_back(ShellPath(TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{2227A280-3AEA-1069-A2DE-08002B30309D}")));
} catch(COMException&) {
}
CreateSubmenu(id, new_folders, ResString(IDS_PRINTERS));*/
break;
#endif
case IDC_ADMIN:
#ifndef ROSSHELL
CreateSubmenu(id, CSIDL_COMMON_ADMINTOOLS, CSIDL_ADMINTOOLS, ResString(IDS_ADMIN));
//CloseStartMenu(id);
//MainFrame::Create(SpecialFolderPath(CSIDL_COMMON_ADMINTOOLS, _hwnd), OWM_PIDL);
#else
launch_file(_hwnd, SpecialFolderFSPath(CSIDL_COMMON_ADMINTOOLS, _hwnd));
#endif
break;
case IDC_CONNECTIONS:
#ifndef ROSSHELL
#ifdef __REACTOS__ // to be removed when RAS will be implemented
MessageBox(0, TEXT("RAS folder not yet implemented in SHELL32"), ResString(IDS_TITLE), MB_OK);
#else
CreateSubmenu(id, CSIDL_CONNECTIONS, ResString(IDS_CONNECTIONS));
//CloseStartMenu(id);
//MainFrame::Create(SpecialFolderPath(CSIDL_CONNECTIONS, _hwnd), OWM_PIDL);
#endif
#else
launch_file(_hwnd, SHELLPATH_NET_CONNECTIONS);
#endif
break;
// browse menu
case IDC_NETWORK:
#ifdef __REACTOS__ ///@todo to be removed when network browsing will be implemented in shell namespace
MessageBox(0, TEXT("network not yet implemented"), ResString(IDS_TITLE), MB_OK);
#else
CreateSubmenu(id, CSIDL_NETWORK, ResString(IDS_NETWORK));
#endif
break;
case IDC_DRIVES:
///@todo exclude removable drives
CreateSubmenu(id, CSIDL_DRIVES, ResString(IDS_DRIVES));
break;
// search menu
case IDC_SEARCH_PROGRAM:
CloseStartMenu(id);
Dialog::DoModal(IDD_SEARCH_PROGRAM, WINDOW_CREATOR(FindProgramDlg));
break;
case IDC_SEARCH_FILES:
CloseStartMenu(id);
ShowSearchDialog();
break;
case IDC_SEARCH_COMPUTER:
CloseStartMenu(id);
ShowSearchComputer();
break;
default:
return super::Command(id, code);
}
return 0;
}

| void StartMenuHandler::ShowLaunchDialog | ( | HWND | hwndOwner ) | [static, protected] |
Definition at line 2115 of file startmenu.cpp.
References RFF_CALCDIRECTORY, and TEXT.
Referenced by Command().
{
static DynamicFct<RUNFILEDLG> RunFileDlg(TEXT("SHELL32"), 61);
// Show "Run..." dialog
if (RunFileDlg) {
(*RunFileDlg)(hwndOwner, 0, NULL, NULL, NULL, RFF_CALCDIRECTORY);
}
}

| void StartMenuHandler::ShowLogoffDialog | ( | HWND | hwndOwner ) | [static, protected] |
Definition at line 2125 of file startmenu.cpp.
References IDS_TITLE, and TEXT.
Referenced by Command().
{
static DynamicFct<LOGOFFWINDOWSDIALOG> LogoffWindowsDialog(TEXT("SHELL32"), 54);
// static DynamicFct<RESTARTWINDOWSDLG> RestartDialog(TEXT("SHELL32"), 59);
if (LogoffWindowsDialog)
(*LogoffWindowsDialog)(0);
/* The RestartDialog function prompts about some system setting change. This is not what we want to display here.
else if (RestartDialog)
return (*RestartDialog)(hwndOwner, (LPWSTR)L"You selected <Log Off>.\n\n", EWX_LOGOFF) == 1; ///@todo ANSI string conversion if needed
*/
else
MessageBox(hwndOwner, TEXT("LogoffWindowsDialog() not yet implemented in SHELL32"), ResString(IDS_TITLE), MB_OK);
}

| void StartMenuHandler::ShowRestartDialog | ( | HWND | hwndOwner, |
| UINT | flags | ||
| ) | [static, protected] |
Definition at line 2150 of file startmenu.cpp.
References IDS_TITLE, and TEXT.
Referenced by Command().
{
static DynamicFct<RESTARTWINDOWSDLG> RestartDlg(TEXT("SHELL32"), 59);
if (RestartDlg)
(*RestartDlg)(hwndOwner, (LPWSTR)L"You selected restart.\n\n", flags);
else
MessageBox(hwndOwner, TEXT("RestartDlg() not yet implemented in SHELL32"), ResString(IDS_TITLE), MB_OK);
}

| void StartMenuHandler::ShowSearchComputer | ( | ) | [static, protected] |
Definition at line 2103 of file startmenu.cpp.
References IDS_TITLE, and TEXT.
Referenced by Command().
{
#ifndef __REACTOS__ ///@todo to be removed when SHFindComputer() will be implemented in shell32.dll
static DynamicFct<SHFINDCOMPUTER> SHFindComputer(TEXT("SHELL32"), 91);
if (SHFindComputer)
(*SHFindComputer)(NULL, NULL);
else
#endif
MessageBox(0, TEXT("SHFindComputer() not yet implemented in SHELL32"), ResString(IDS_TITLE), MB_OK);
}

| void StartMenuHandler::ShowSearchDialog | ( | ) | [static, protected] |
Definition at line 2091 of file startmenu.cpp.
References IDS_TITLE, and TEXT.
Referenced by Command().
{
#ifndef __REACTOS__ ///@todo to be removed when SHFindFiles() will be implemented in shell32.dll
static DynamicFct<SHFINDFILES> SHFindFiles(TEXT("SHELL32"), 90);
if (SHFindFiles)
(*SHFindFiles)(NULL, NULL);
else
#endif
MessageBox(0, TEXT("SHFindFiles() not yet implemented in SHELL32"), ResString(IDS_TITLE), MB_OK);
}

|
ROS Explorer Source Code Documentation
generated on 02.01.2013 by
|