#include <GMenu.h>
Public Member Functions | |
GSubMenu (const char *name="", bool Popup=true) | |
Constructor. | |
OsSubMenu | Handle () |
Returns the OS handle. | |
GMenuItem * | AppendItem (const char *Str, int Id, bool Enabled=true, int Where=-1, char *Shortcut=0) |
Add a new item. | |
GSubMenu * | AppendSub (const char *Str, int Where=-1) |
Add a submenu. | |
GMenuItem * | AppendSeparator (int Where=-1) |
Add a separator. | |
void | Empty () |
Delete all items. | |
bool | RemoveItem (int i) |
Detachs an item from the sub menu but doesn't delete it. | |
bool | RemoveItem (GMenuItem *Item) |
Detachs an item from the sub menu but doesn't delete it. | |
int | Length () |
Returns numbers of items in menu. | |
GMenuItem * | ItemAt (int i) |
Return a pointer to an item. | |
GMenuItem * | FindItem (int Id) |
Returns a pointer to an item. | |
GSubMenu * | FindSubMenu (int Id) |
Returns a pointer to an sub menu. | |
int | Float (GView *Parent, int x, int y, bool Left=false) |
Floats the submenu anywhere on the screen. | |
GMenuItem * | GetParent () |
Returns the parent menu item. | |
GMenu * | GetMenu () |
Returns the menu that this belongs to. | |
Protected Attributes | |
GMenuItem * | Parent |
The parent menu item or NULL if the root menu. | |
GMenu * | Menu |
The top level window this sub menu belongs to or NULL. | |
GViewI * | Window |
The window that the menu belongs to or NULL. | |
Friends | |
class | GMenuItem |
class | GMenu |
GSubMenu::GSubMenu | ( | const char * | name = "" , |
|
bool | Popup = true | |||
) |
GMenuItem * GSubMenu::AppendItem | ( | const char * | Str, | |
int | Id, | |||
bool | Enabled = true , |
|||
int | Where = -1 , |
|||
char * | Shortcut = 0 | |||
) |
Add a new item.
Str |
The text of the item. If you put a tab control in the text, anything after the tab is considered to be the keyboard shortcut for the menu item. The shortcut can be a combination of keys added together with '+'. e.g.
|
Id | Command ID to post to the OnCommand() handler |
Enabled | True if the item should be enabled |
Where | The index into the list to insert at, or -1 to insert at the end |
References GMenuItem::Enabled(), GMenuItem::Id(), Menu, GMenuItem::Menu, GMenuItem::Name(), GMenuItem::Parent, and GMenuItem::ScanForAccel().
Referenced by GDocApp< OptionsFmt >::_LoadMenu(), GTextView3::OnMouseClick(), Html2::GHtml2::OnMouseClick(), and GHtml::OnMouseClick().
GSubMenu * GSubMenu::AppendSub | ( | const char * | Str, | |
int | Where = -1 | |||
) |
Add a submenu.
Str | The text of the item |
Where | The index to insert the item, or -1 to insert on the end |
References GMenuItem::Child, GSubMenu(), GMenuItem::Id(), Menu, GMenuItem::Menu, GMenuItem::Name(), Parent, GMenuItem::Parent, and Window.
Referenced by GDocApp< OptionsFmt >::_LoadMenu(), Html2::GHtml2::OnMouseClick(), and GHtml::OnMouseClick().
bool GSubMenu::RemoveItem | ( | int | i | ) |
Detachs an item from the sub menu but doesn't delete it.
i | The index of the item to remove |
bool GSubMenu::RemoveItem | ( | GMenuItem * | Item | ) |
Detachs an item from the sub menu but doesn't delete it.
Item | Pointer of the item to remove |
References GMenuItem::Remove().
GMenuItem * GSubMenu::ItemAt | ( | int | i | ) |
Return a pointer to an item.
i | The index of the item to return |
GMenuItem * GSubMenu::FindItem | ( | int | Id | ) |
Returns a pointer to an item.
Id | The ID of the item to return |
References FindItem(), and GMenuItem::Sub().
Referenced by FindItem().
GSubMenu * GSubMenu::FindSubMenu | ( | int | Id | ) |
Returns a pointer to an sub menu.
Id | The ID of the sub menu to return |
References FindSubMenu().
Referenced by FindSubMenu().
int GSubMenu::Float | ( | GView * | Parent, | |
int | x, | |||
int | y, | |||
bool | Left = false | |||
) |
Floats the submenu anywhere on the screen.
Parent | The parent view |
x | The x coord of the top-left corner |
y | The y coord of the top-left corner |
Left | True if the menu is tracking the left button, else it tracks the right button |
References GView::Capture(), GView::GetParent(), GView::Handle(), GMenuItem::Id(), LgiSleep, LgiYield, GRect::Offset(), GRect::x1, and GRect::y1.
Referenced by GTextView3::OnMouseClick(), Html2::GHtml2::OnMouseClick(), and GHtml::OnMouseClick().