GSubMenu Class Reference

Sub menu. More...

#include <GMenu.h>

Inheritance diagram for GSubMenu:

GTarget GMenu

List of all members.

Public Member Functions

 GSubMenu (char *name=(char *)"", bool Popup=true)
 Constructor.
OsSubMenu Handle ()
 Returns the OS handle.
GMenuItemAppendItem (char *Str, int Id, bool Enabled=true, int Where=-1, char *Shortcut=0)
 Add a new item.
GSubMenuAppendSub (char *Str, int Where=-1)
 Add a submenu.
GMenuItemAppendSeparator (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.
GMenuItemItemAt (int i)
 Return a pointer to an item.
GMenuItemFindItem (int Id)
 Returns a pointer to an item.
GSubMenuFindSubMenu (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.
GMenuItemGetParent ()
 Returns the parent menu item.
GMenuGetMenu ()
 Returns the menu that this belongs to.

Protected Attributes

GMenuItemParent
 The parent menu item or NULL if the root menu.
GMenuMenu
 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


Detailed Description

Sub menu.

Constructor & Destructor Documentation

GSubMenu::GSubMenu ( char *  name = (char*)"",
bool  Popup = true 
)

Constructor.

Parameters:
name  Name of the menu
Popup  True if it's popup

References Menu, and Parent.

Referenced by AppendSub().


Member Function Documentation

GMenuItem * GSubMenu::AppendItem ( char *  Str,
int  Id,
bool  Enabled = true,
int  Where = -1,
char *  Shortcut = 0 
)

Add a new item.

Parameters:
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.

  • Ctrl+S
  • Alt+Del
  • F2
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 ( char *  Str,
int  Where = -1 
)

Add a submenu.

Parameters:
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().

GMenuItem * GSubMenu::FindItem ( int  Id  ) 

Returns a pointer to an item.

Parameters:
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.

Parameters:
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.

Parameters:
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().

GMenuItem * GSubMenu::ItemAt ( int  i  ) 

Return a pointer to an item.

Parameters:
i  The index of the item to return

bool GSubMenu::RemoveItem ( GMenuItem Item  ) 

Detachs an item from the sub menu but doesn't delete it.

Parameters:
Item  Pointer of the item to remove

References GMenuItem::Remove().

bool GSubMenu::RemoveItem ( int  i  ) 

Detachs an item from the sub menu but doesn't delete it.

Parameters:
i  The index of the item to remove


The documentation for this class was generated from the following files:

Generated on Wed Dec 1 15:41:04 2010 for Lgi by  doxygen 1.5.7.1