context menu for desktop bar

svn path=/trunk/; revision=7720
This commit is contained in:
Martin Fuchs 2004-01-17 16:41:20 +00:00
parent 00a738fdfd
commit 5a76bbd8ac
6 changed files with 79 additions and 3 deletions

View file

@ -3,7 +3,7 @@
<tr> <tr>
<td><address style="align: right;"><small> <td><address style="align: right;"><small>
ROS Explorer Source Code Documentation ROS Explorer Source Code Documentation
<br>generated on 06.01.2004 by <a href="http://www.doxygen.org/index.html"> <br>generated on 17.01.2004 by <a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0> <img src="doxygen.png" alt="doxygen" align="middle" border=0>
</small></address> </small></address>
</td> </td>

View file

@ -403,6 +403,13 @@ void explorer_show_frame(HWND hwndDesktop, int cmdshow, LPTSTR lpCmdLine)
} }
PopupMenu::PopupMenu(UINT nid)
{
HMENU hMenu = LoadMenu(g_Globals._hInstance, MAKEINTRESOURCE(nid));
_hmenu = GetSubMenu(hMenu, 0);
}
/// "About Explorer" Dialog /// "About Explorer" Dialog
struct ExplorerAboutDlg : public struct ExplorerAboutDlg : public
CtlColorParent< CtlColorParent<

View file

@ -66,6 +66,7 @@
#define IDI_PRINTER 147 #define IDI_PRINTER 147
#define IDI_NETWORK 148 #define IDI_NETWORK 148
#define IDI_COMPUTER 149 #define IDI_COMPUTER 149
#define IDM_DESKTOPBAR 150
#define ID_VIEW_NAME 401 #define ID_VIEW_NAME 401
#define ID_VIEW_ALL_ATTRIBUTES 402 #define ID_VIEW_ALL_ATTRIBUTES 402
#define ID_VIEW_SELECTED_ATTRIBUTES 403 #define ID_VIEW_SELECTED_ATTRIBUTES 403
@ -89,6 +90,7 @@
#define ID_DRIVE_FIRST 0x9003 #define ID_DRIVE_FIRST 0x9003
#define ID_ABOUT_WINDOWS 40002 #define ID_ABOUT_WINDOWS 40002
#define ID_ABOUT_EXPLORER 40003 #define ID_ABOUT_EXPLORER 40003
#define ID_DESKTOPBAR_SETTINGS 40005
#define ID_WINDOW_NEW 0xE130 #define ID_WINDOW_NEW 0xE130
#define ID_WINDOW_ARRANGE 0xE131 #define ID_WINDOW_ARRANGE 0xE131
#define ID_WINDOW_CASCADE 0xE132 #define ID_WINDOW_CASCADE 0xE132
@ -105,8 +107,8 @@
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 150 #define _APS_NEXT_RESOURCE_VALUE 151
#define _APS_NEXT_COMMAND_VALUE 40004 #define _APS_NEXT_COMMAND_VALUE 40006
#define _APS_NEXT_CONTROL_VALUE 1001 #define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif

View file

@ -621,6 +621,15 @@ BEGIN
END END
END END
IDM_DESKTOPBAR MENU DISCARDABLE
BEGIN
POPUP ""
BEGIN
MENUITEM "&About Explorer...", ID_ABOUT_EXPLORER
MENUITEM "&Settings...", ID_DESKTOPBAR_SETTINGS
END
END
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //

View file

@ -180,6 +180,10 @@ LRESULT DesktopBar::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
case WM_COPYDATA: case WM_COPYDATA:
return ProcessCopyData((COPYDATASTRUCT*)lparam); return ProcessCopyData((COPYDATASTRUCT*)lparam);
case WM_CONTEXTMENU:
PopupMenu(IDM_DESKTOPBAR).TrackPopupMenu(_hwnd, MAKEPOINTS(lparam));
break;
default: def: default: def:
return super::WndProc(nmsg, wparam, lparam); return super::WndProc(nmsg, wparam, lparam);
} }
@ -221,6 +225,14 @@ int DesktopBar::Command(int id, int code)
ShowStartMenu(); ShowStartMenu();
break; break;
case ID_ABOUT_EXPLORER:
explorer_about(_hwnd);
break;
case ID_DESKTOPBAR_SETTINGS:
MessageBox(_hwnd, TEXT("Not yet implemented"), ResString(IDS_TITLE), MB_OK);
break;
default: default:
if ((id&~0xFF) == IDC_FIRST_QUICK_ID) if ((id&~0xFF) == IDC_FIRST_QUICK_ID)
SendMessage(_hwndQuickLaunch, WM_COMMAND, MAKEWPARAM(id,code), 0); SendMessage(_hwndQuickLaunch, WM_COMMAND, MAKEWPARAM(id,code), 0);

View file

@ -585,6 +585,52 @@ protected:
}; };
/// Popup Menus
struct PopupMenu
{
PopupMenu()
: _hmenu(CreatePopupMenu())
{
}
PopupMenu(UINT nid);
operator HMENU() {return _hmenu;}
void Append(UINT id, LPCTSTR str, UINT flags=MF_STRING)
{
AppendMenu(_hmenu, flags, id, str);
}
int TrackPopupMenu(HWND hwnd, const POINT& pt, UINT flags=TPM_LEFTBUTTON|TPM_RIGHTBUTTON, LPTPMPARAMS tpm=NULL) {
return TrackPopupMenuEx(_hmenu, flags, pt.x, pt.y, hwnd, tpm);
}
int PopupContextMenu(HWND hwnd, POINTS pos, UINT flags=TPM_LEFTBUTTON|TPM_RIGHTBUTTON) {
POINT pt; POINTSTOPOINT(pt, pos);
return TrackPopupMenuEx(_hmenu, flags, pt.x, pt.y, hwnd, NULL);
}
int TrackPopupMenu(HWND hwnd, POINTS pos, UINT flags=TPM_LEFTBUTTON|TPM_RIGHTBUTTON) {
POINT pt; POINTSTOPOINT(pt, pos);
ClientToScreen(hwnd, &pt);
return TrackPopupMenuEx(_hmenu, flags, pt.x, pt.y, hwnd, NULL);
}
int TrackPopupMenuAtCursor(HWND hwnd, UINT flags=TPM_LEFTBUTTON) {
POINT pt; GetCursorPos(&pt);
return TrackPopupMenuEx(_hmenu, flags, pt.x, pt.y, hwnd, NULL);
}
int TrackPopupMenuAtPos(HWND hwnd, DWORD pos, UINT flags=TPM_LEFTBUTTON) {
return TrackPopupMenuEx(_hmenu, flags, GET_X_LPARAM(pos), GET_Y_LPARAM(pos), hwnd, NULL);
}
protected:
HMENU _hmenu;
};
/// string class for convenience /// string class for convenience
struct String struct String
#ifdef UNICODE #ifdef UNICODE