#include <GMenu.h>
Inheritance diagram for GMenu:

Public Member Functions | |
| GMenu () | |
| Constructor. | |
| virtual | ~GMenu () |
| Destructor. | |
| GViewI * | WindowHandle () |
| Returns the top level window that this menu is attached to. | |
| bool | Attach (GViewI *p) |
| Attach the menu to a window. | |
| bool | Detach () |
| Detact the menu from the window. | |
| bool | Load (GView *p, char *Res, char *Tags=0) |
| Load the menu from a resource file. | |
| bool | OnKey (GView *v, GKey &k) |
| See if any of the accelerators match the key event. | |
Static Public Member Functions | |
| static GFont * | GetFont () |
| Returns the font used by the menu items. | |
Protected Attributes | |
| List< GAccelerator > | Accel |
| List of keyboard shortcuts in the menu items attached. | |
Friends | |
| class | GSubMenu |
| class | GMenuItem |
| class | GWindow |
This class contains GMenuItem's and GSubMenu's.
A basic menu can be constructed inside a GWindow like this:
Menu = NEW(GMenu); if (Menu) { Menu->Attach(this); GSubMenu *File = Menu->AppendSub("&File"); if (File) { File->AppendItem("&Open\tCtrl+O", IDM_OPEN, true); File->AppendItem("&Save All\tCtrl+S", IDM_SAVE_ALL, true); File->AppendItem("Save &As", IDM_SAVEAS, true); File->AppendSeparator(); File->AppendItem("&Options", IDM_OPTIONS, true); File->AppendSeparator(); File->AppendItem("E&xit", IDM_EXIT, true); } GSubMenu *Help = Menu->AppendSub("&Help"); if (Help) { Help->AppendItem("&Help", IDM_HELP, true); Help->AppendItem("&About", IDM_ABOUT, true); } }
Or you can load a menu from a resource like this:
|
||||||||||||||||
|
Load the menu from a resource file.
|
|
||||||||||||
|
See if any of the accelerators match the key event.
|
1.4.1