Inheritance diagram for os::MenuItem:
Public Member Functions | |
MenuItem (const String &cLabel, Message *pcMsg, const String &cShortcut="", Image *pcImage=NULL) | |
Constructor. | |
MenuItem (Menu *pcMenu, Message *pcMsg, const String &cShortcut="", Image *pcImage=NULL) | |
Constructor. | |
~MenuItem () | |
internal | |
Menu * | GetSubMenu () const |
Gets the Sub Menu(Menu that is inside the MenuItem). | |
Menu * | GetSuperMenu () const |
Gets the Super Menu(Menu that holds the MenuItem). | |
Rect | GetFrame () const |
Gets the frame of the MenuItem. | |
virtual Point | GetContentSize () |
Gets the size of the MenuItem. | |
virtual float | GetColumnWidth (int nColumn) const |
Gets the size of a column. | |
virtual int | GetNumColumns () const |
Get number of columns. | |
const String & | GetLabel () const |
Gets the label of the MenuItem. | |
void | SetLabel (const os::String &cTitle) |
Sets the label of the MenuItem. | |
virtual void | Draw () |
Draws the os::MenuItem. | |
Point | GetContentLocation () const |
Returns the current location of this item. | |
virtual bool | Invoked (Message *pcMessage) |
Intercept outgoing messages. | |
void | SetEnable (bool bEnabled) |
Tells the system to disable or enable this element. | |
bool | IsEnabled () const |
Tells the programmer whether this element is enabled or disabled. | |
virtual void | SetHighlighted (bool bHighlighted) |
Tells the system to highlight or unhighlight this element. | |
bool | IsHighlighted () const |
Tells the programmer whether this element is highlighted or not highlighted. | |
Image * | GetImage () const |
Gets the image that is attached to the MenuItem. | |
void | SetImage (Image *pcImage, bool bRefresh=false) |
Sets the image that you want to attach to the MenuItem. | |
void | SetShortcut (const String &cShortcut) |
Sets the shortcut for the MenuItem. | |
const String & | GetShortcut () const |
Gets the shortcut for the menu item. | |
virtual bool | IsSelectable () const |
Tells the system whether or not this item can be selected. | |
Friends | |
class | Menu |
Classes | |
class | Private |
MenuItem::MenuItem | ( | const String & | cLabel, | |
Message * | pcMsg, | |||
const String & | cShortcut = "" , |
|||
Image * | pcImage = NULL | |||
) |
cLabel | - The label that will be displayed. | |
pcMsg | - The message that will be passed when invoked. | |
cShortcut | - Keyboard shortcut. | |
pcImage | - The image that will be attached to the MenuItem. |
Menu* pcMenu = new Menu(Rect(),"main_menu",os::ITEMS_IN_ROW, CF_FOLLOW_LEFT | CF_FOLLOW_RIGHT | CF_FOLLOW_TOP ); //creates the main menu Menu* pcSubMenu = new Menu(Rect(),"File", ITEMS_IN_COLUMN, CF_FOLLOW_LEFT | CF_FOLLOW_RIGHT | CF_FOLLOW_TOP ); //creates the file menu File cFile = File("./options.png"); //not the best way to do this, because then options.png will need to be in the same directory as the application at all times. Image* pcImage = new BitmapImage(&cFile); MenuItem* pcItem("Options",NULL,pcImage) // creates the menu item with the sub menu and image. pcSubMenu->AddItem(pcItem); //attaches the item to the file menu pcMenu->AddItem(pcSubMenu) //attaches the file menu to the main menu
MenuItem::MenuItem | ( | Menu * | pcMenu, | |
Message * | pcMsg, | |||
const String & | cShortcut = "" , |
|||
Image * | pcImage = NULL | |||
) |
pcMenu | - The menu that will be a sub menu. | |
pcMsg | - The message that will be passed when invoked. | |
cShortcut | - Keyboard shortcut. | |
pcImage | - The image that will be attached to this menu item. |
Menu* pcMenu = new Menu(Rect(),"main_menu",os::ITEMS_IN_ROW, CF_FOLLOW_LEFT | CF_FOLLOW_RIGHT | CF_FOLLOW_TOP ); //creates the main menu Menu* pcSubMenu = new Menu(Rect(),"File", ITEMS_IN_COLUMN, CF_FOLLOW_LEFT | CF_FOLLOW_RIGHT | CF_FOLLOW_TOP ); //creates the file menu Menu* pcOptionsMenu = new Menu(Rect(),"Options", ITEMS_IN_COLUMN, CF_FOLLOW_LEFT | CF_FOLLOW_RIGHT | CF_FOLLOW_TOP ); //creates the option menu File cFile = File("./options.png"); //not the best way to do this, because then options.png will need to be in the same directory as the application at all times. Image* pcImage = new BitmapImage(&cFile); MenuItem* pcItem(pcMenu,NULL,pcImage) // creates the menu item with the sub menu and image. pcSubMenu->AddItem(pcItem); //attaches the item to the file menu pcMenu->AddItem(pcSubMenu) //attaches the file menu to the main menu
MenuItem::~MenuItem | ( | ) |
Menu * MenuItem::GetSubMenu | ( | ) | const |
Menu * MenuItem::GetSuperMenu | ( | ) | const |
Rect MenuItem::GetFrame | ( | ) | const |
Point MenuItem::GetContentSize | ( | ) | [virtual] |
float MenuItem::GetColumnWidth | ( | int | nColumn | ) | const [virtual] |
int MenuItem::GetNumColumns | ( | ) | const [virtual] |
const String & MenuItem::GetLabel | ( | ) | const |
void MenuItem::SetLabel | ( | const os::String & | cLabel | ) |
void MenuItem::Draw | ( | ) | [virtual] |
Reimplemented in os::CheckMenu, and os::MenuSeparator.
Point MenuItem::GetContentLocation | ( | ) | const |
bool MenuItem::Invoked | ( | Message * | pcMessage | ) | [virtual] |
pcMessage | Pointer to the message that is about to be sendt. You can do any modification you like to this message (but never delete it). |
Reimplemented from os::Invoker.
Reimplemented in os::CheckMenu.
void MenuItem::SetEnable | ( | bool | bEnabled | ) |
..
bEnabled | - To enable this element set this to true(default) and to disable set this to false. |
bool MenuItem::IsEnabled | ( | void | ) | const |
..
void MenuItem::SetHighlighted | ( | bool | bHighlighted | ) | [virtual] |
..
bHighlighted | - To highlight this element set this to true(default) and to unhighlight set this to false. |
Reimplemented in os::CheckMenu, and os::MenuSeparator.
bool MenuItem::IsHighlighted | ( | ) | const |
..
Image * MenuItem::GetImage | ( | ) | const |
..
void MenuItem::SetImage | ( | Image * | pcImage, | |
bool | bRefresh = false | |||
) |
..
pcImage | - the image to be placed on the MenuItem. | |
bRefresh | - tell the system whether to or not to redraw the MenuItem |
void MenuItem::SetShortcut | ( | const String & | cShortcut | ) |
cShortcut | - The shortcut key that will invoke with this menuitem. |
const String & MenuItem::GetShortcut | ( | ) | const |
..
bool MenuItem::IsSelectable | ( | ) | const [virtual] |
Reimplemented in os::CheckMenu, and os::MenuSeparator.
friend class Menu [friend] |