class StartMenuHandler

svn path=/trunk/; revision=7402
This commit is contained in:
Martin Fuchs
2004-01-02 15:18:17 +00:00
parent 8f70adb80c
commit 975329fe8b
3 changed files with 87 additions and 91 deletions
+10 -10
View File
@@ -58,7 +58,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 user32.lib gdi32.lib advapi32.lib ole32.lib shell32.lib comctl32.lib /nologo /subsystem:windows /machine:I386
# SUBTRACT LINK32 /pdb:none
# SUBTRACT LINK32 /pdb:none /force
!ELSEIF "$(CFG)" == "explorer - Win32 Debug"
@@ -82,8 +82,8 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib ole32.lib shell32.lib comctl32.lib /nologo /subsystem:windows /debug /machine:I386 /force /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib ole32.lib shell32.lib comctl32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# SUBTRACT LINK32 /pdb:none /force
!ELSEIF "$(CFG)" == "explorer - Win32 Debug Release"
@@ -109,7 +109,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 user32.lib gdi32.lib advapi32.lib ole32.lib shell32.lib comctl32.lib /nologo /subsystem:windows /debug /machine:I386
# SUBTRACT LINK32 /pdb:none
# SUBTRACT LINK32 /pdb:none /force
!ELSEIF "$(CFG)" == "explorer - Win32 Unicode Release"
@@ -135,7 +135,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 user32.lib gdi32.lib advapi32.lib ole32.lib shell32.lib comctl32.lib /nologo /subsystem:windows /machine:I386
# SUBTRACT LINK32 /pdb:none
# SUBTRACT LINK32 /pdb:none /force
!ELSEIF "$(CFG)" == "explorer - Win32 Unicode Debug"
@@ -161,7 +161,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 user32.lib gdi32.lib advapi32.lib ole32.lib shell32.lib comctl32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
# SUBTRACT LINK32 /pdb:none /force
!ELSEIF "$(CFG)" == "explorer - Win32 _NO_COMUTIL"
@@ -188,7 +188,7 @@ LINK32=link.exe
# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib ole32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 user32.lib gdi32.lib advapi32.lib ole32.lib shell32.lib comctl32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
# SUBTRACT LINK32 /pdb:none /force
!ELSEIF "$(CFG)" == "explorer - Win32"
@@ -215,7 +215,7 @@ LINK32=link.exe
# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib ole32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 gdi32.lib user32.lib advapi32.lib ole32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"Win32/wexplorer.exe" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
# SUBTRACT LINK32 /pdb:none /force
!ELSEIF "$(CFG)" == "explorer - Win32 WineRelease"
@@ -242,7 +242,7 @@ LINK32=link.exe
# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib ole32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 gdi32.lib user32.lib advapi32.lib ole32.lib /nologo /subsystem:windows /incremental:no /machine:I386 /out:"WineRelease/wexplorer.exe" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none /debug
# SUBTRACT LINK32 /pdb:none /debug /force
!ELSEIF "$(CFG)" == "explorer - Win32 WineDll"
@@ -269,7 +269,7 @@ LINK32=link.exe
# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib ole32.lib /nologo /subsystem:windows /machine:I386 /pdbtype:sept
# SUBTRACT BASE LINK32 /pdb:none /debug
# ADD LINK32 gdi32.lib user32.lib advapi32.lib ole32.lib /nologo /subsystem:windows /machine:I386 /out:"WineDll/wexplorer.exe" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none /debug
# SUBTRACT LINK32 /pdb:none /debug /force
!ENDIF
@@ -1012,26 +1012,7 @@ void StartMenuRoot::ShowRestartDialog(HWND hwndOwner, UINT flags)
}
void SettingsMenu::AddEntries()
{
super::AddEntries();
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_NOCONTROLPANEL))
#endif
AddButton(ResString(IDS_CONTROL_PANEL), SmallIcon(IDI_CONFIG), false, IDC_CONTROL_PANEL);
AddButton(ResString(IDS_PRINTERS), SmallIcon(IDI_PRINTER), true, IDC_PRINTERS);
AddButton(ResString(IDS_CONNECTIONS), SmallIcon(IDI_NETWORK), true, IDC_CONNECTIONS);
AddButton(ResString(IDS_ADMIN), SmallIcon(IDI_CONFIG), true, IDC_ADMIN);
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_NOCONTROLPANEL))
#endif
AddButton(ResString(IDS_SETTINGS_MENU), SmallIcon(IDI_CONFIG), true, IDC_SETTINGS_MENU);
}
int SettingsMenu::Command(int id, int code)
int StartMenuHandler::Command(int id, int code)
{
switch(id) {
case IDC_SETTINGS_MENU:
@@ -1055,29 +1036,9 @@ int SettingsMenu::Command(int id, int code)
CreateSubmenu(id, CSIDL_CONNECTIONS, ResString(IDS_CONNECTIONS));
break;
default:
return super::Command(id, code);
}
return 0;
}
// browse menu
void BrowseMenu::AddEntries()
{
super::AddEntries();
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_NONETHOOD)) // or REST_NOENTIRENETWORK ?
#endif
AddButton(ResString(IDS_NETWORK), SmallIcon(IDI_NETWORK), true, IDC_NETWORK);
AddButton(ResString(IDS_DRIVES), SmallIcon(IDI_FOLDER), true, IDC_DRIVES);
}
int BrowseMenu::Command(int id, int code)
{
switch(id) {
case IDC_NETWORK:
CreateSubmenu(id, CSIDL_NETWORK, ResString(IDS_NETWORK));
break;
@@ -1087,31 +1048,9 @@ int BrowseMenu::Command(int id, int code)
CreateSubmenu(id, CSIDL_DRIVES, ResString(IDS_DRIVES));
break;
default:
return super::Command(id, code);
}
return 0;
}
// search menu
void SearchMenu::AddEntries()
{
super::AddEntries();
AddButton(ResString(IDS_SEARCH_PRG), SmallIcon(IDI_APPS), false, IDC_SEARCH_PROGRAM);
AddButton(ResString(IDS_SEARCH_FILES), SmallIcon(IDI_SEARCH_DOC), false, IDC_SEARCH_FILES);
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_HASFINDCOMPUTERS))
#endif
AddButton(ResString(IDS_SEARCH_COMPUTER), SmallIcon(IDI_COMPUTER), false, IDC_SEARCH_COMPUTER);
}
int SearchMenu::Command(int id, int code)
{
switch(id) {
case IDC_SEARCH_PROGRAM:
CloseStartMenu(id);
Dialog::DoModal(IDD_SEARCH_PROGRAM, WINDOW_CREATOR(FindProgramDlg));
@@ -1127,6 +1066,7 @@ int SearchMenu::Command(int id, int code)
ShowSearchComputer();
break;
default:
return super::Command(id, code);
}
@@ -1134,7 +1074,7 @@ int SearchMenu::Command(int id, int code)
return 0;
}
void SearchMenu::ShowSearchDialog()
void StartMenuHandler::ShowSearchDialog()
{
static DynamicFct<SHFINDFILES> SHFindFiles(TEXT("SHELL32"), 90);
@@ -1142,7 +1082,7 @@ void SearchMenu::ShowSearchDialog()
(*SHFindFiles)(NULL, NULL);
}
void SearchMenu::ShowSearchComputer()
void StartMenuHandler::ShowSearchComputer()
{
static DynamicFct<SHFINDCOMPUTER> SHFindComputer(TEXT("SHELL32"), 91);
@@ -1151,11 +1091,52 @@ void SearchMenu::ShowSearchComputer()
}
RecentStartMenu::RecentStartMenu(HWND hwnd, const StartMenuCreateInfo& create_info)
: super(hwnd, create_info)
void SettingsMenu::AddEntries()
{
super::AddEntries();
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_NOCONTROLPANEL))
#endif
AddButton(ResString(IDS_CONTROL_PANEL), SmallIcon(IDI_CONFIG), false, IDC_CONTROL_PANEL);
AddButton(ResString(IDS_PRINTERS), SmallIcon(IDI_PRINTER), true, IDC_PRINTERS);
AddButton(ResString(IDS_CONNECTIONS), SmallIcon(IDI_NETWORK), true, IDC_CONNECTIONS);
AddButton(ResString(IDS_ADMIN), SmallIcon(IDI_CONFIG), true, IDC_ADMIN);
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_NOCONTROLPANEL))
#endif
AddButton(ResString(IDS_SETTINGS_MENU), SmallIcon(IDI_CONFIG), true, IDC_SETTINGS_MENU);
}
void BrowseMenu::AddEntries()
{
super::AddEntries();
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_NONETHOOD)) // or REST_NOENTIRENETWORK ?
#endif
AddButton(ResString(IDS_NETWORK), SmallIcon(IDI_NETWORK), true, IDC_NETWORK);
AddButton(ResString(IDS_DRIVES), SmallIcon(IDI_FOLDER), true, IDC_DRIVES);
}
void SearchMenu::AddEntries()
{
super::AddEntries();
AddButton(ResString(IDS_SEARCH_PRG), SmallIcon(IDI_APPS), false, IDC_SEARCH_PROGRAM);
AddButton(ResString(IDS_SEARCH_FILES), SmallIcon(IDI_SEARCH_DOC), false, IDC_SEARCH_FILES);
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_HASFINDCOMPUTERS))
#endif
AddButton(ResString(IDS_SEARCH_COMPUTER), SmallIcon(IDI_COMPUTER), false, IDC_SEARCH_COMPUTER);
}
void RecentStartMenu::AddEntries()
{
for(StartMenuShellDirs::iterator it=_dirs.begin(); it!=_dirs.end(); ++it) {
@@ -250,11 +250,29 @@ protected:
};
/// Settings sub-startmenu
struct SettingsMenu : public StartMenu
/// Handling of standard start menu commands
struct StartMenuHandler : public StartMenu
{
typedef StartMenu super;
StartMenuHandler(HWND hwnd, const StartMenuCreateInfo& create_info)
: super(hwnd, create_info)
{
}
protected:
int Command(int id, int code);
static void ShowSearchDialog();
static void ShowSearchComputer();
};
/// Settings sub-startmenu
struct SettingsMenu : public StartMenuHandler
{
typedef StartMenuHandler super;
SettingsMenu(HWND hwnd, const StartMenuCreateInfo& create_info)
: super(hwnd, create_info)
{
@@ -264,14 +282,13 @@ struct SettingsMenu : public StartMenu
protected:
void AddEntries();
int Command(int id, int code);
};
/// "Browse Files..." sub-start menu
struct BrowseMenu : public StartMenu
struct BrowseMenu : public StartMenuHandler
{
typedef StartMenu super;
typedef StartMenuHandler super;
BrowseMenu(HWND hwnd, const StartMenuCreateInfo& create_info)
: super(hwnd, create_info)
@@ -282,14 +299,13 @@ struct BrowseMenu : public StartMenu
protected:
void AddEntries();
int Command(int id, int code);
};
/// Search sub-startmenu
struct SearchMenu : public StartMenu
struct SearchMenu : public StartMenuHandler
{
typedef StartMenu super;
typedef StartMenuHandler super;
SearchMenu(HWND hwnd, const StartMenuCreateInfo& create_info)
: super(hwnd, create_info)
@@ -300,10 +316,6 @@ struct SearchMenu : public StartMenu
protected:
void AddEntries();
int Command(int id, int code);
static void ShowSearchDialog();
static void ShowSearchComputer();
};
@@ -312,7 +324,10 @@ struct RecentStartMenu : public StartMenu
{
typedef StartMenu super;
RecentStartMenu(HWND hwnd, const StartMenuCreateInfo& create_info);
RecentStartMenu(HWND hwnd, const StartMenuCreateInfo& create_info)
: super(hwnd, create_info)
{
}
protected:
virtual void AddEntries();