Control for an icon or text button that shows a menu. More...
#include <mgui/menubtn.h>

Public Types | |
| enum | ITEMSTYLE { ITEMSTYLE_Normal = 0, ITEMSTYLE_Toggle = 0x00000001 } |
| enum | STYLE { STYLE_Normal = 0, STYLE_NoBorder = 0x00000001, STYLE_HighlightOnEnter = 0x00000002, STYLE_LargeButton = 0x00000004 } |
Public Member Functions | |
| CTRL_MENUBUTTON () | |
| virtual | ~CTRL_MENUBUTTON () |
| ID | AddItem (ID id, const MISTRING &label, ITEMSTYLE style=ITEMSTYLE_Normal) |
| void | Create (MGUI::LAYOUT_PANE_BASE &ParentPane, ICONID iconid, const MISTRING &tooltip, STYLE style=STYLE_Normal, int iconsize=0) |
| void | Create (MGUI::LAYOUT_PANE_BASE &ParentPane, const MISTRING &label, STYLE style=STYLE_Normal, MGUI::LAYOUT_SIZEALIGN sizealign=MGUI::LAYOUT_SIZEALIGN_FixedSize) |
| bool | GetItemState (ID id) const |
| int | GetNumItems () const |
| void | RemoveAllItems () |
| void | RemoveItemByID (ID id) |
| void | RemoveItemByIndex (int indx) |
| void | SetDelegateOnSelection (DELEGATE_VOID_ID delegate) |
| void | SetItemEnabled (ID id, bool enabled=true) |
| void | SetItemState (ID id, bool state) |
Protected Member Functions | |
| virtual void | OnMenuPopup () |
| virtual void | OnSelection (ID id) |
Control for an icon or text button that shows a menu.
| MGUI::CTRL_MENUBUTTON::CTRL_MENUBUTTON | ( | ) | [inline] |
Constructor.
| virtual MGUI::CTRL_MENUBUTTON::~CTRL_MENUBUTTON | ( | ) | [virtual] |
Destructor.
| ID MGUI::CTRL_MENUBUTTON::AddItem | ( | ID | id, | |
| const MISTRING & | label, | |||
| ITEMSTYLE | style = ITEMSTYLE_Normal | |||
| ) |
Add menu item with Unicode label.
The id will be passed to OnSelected() and must be unique within the dialog (for X it only has to be unique within the menu). If you pass -1, an ID will be assigned.
| void MGUI::CTRL_MENUBUTTON::Create | ( | MGUI::LAYOUT_PANE_BASE & | ParentPane, | |
| ICONID | iconid, | |||
| const MISTRING & | tooltip, | |||
| STYLE | style = STYLE_Normal, |
|||
| int | iconsize = 0 | |||
| ) |
Create control with icon and ToolTip.
| ParentPane | Parent pane | |
| iconid | Icon ID | |
| tooltip | ToolTip string | |
| style | Button style | |
| iconsize | Icon size, 0 for default |
| void MGUI::CTRL_MENUBUTTON::Create | ( | MGUI::LAYOUT_PANE_BASE & | ParentPane, | |
| const MISTRING & | label, | |||
| STYLE | style = STYLE_Normal, |
|||
| MGUI::LAYOUT_SIZEALIGN | sizealign = MGUI::LAYOUT_SIZEALIGN_FixedSize | |||
| ) |
Create control with text label.
| ParentPane | Parent pane | |
| label | Label string | |
| style | Button style |
| bool MGUI::CTRL_MENUBUTTON::GetItemState | ( | ID | id | ) | const |
Get the toggle state of a menu item.
| int MGUI::CTRL_MENUBUTTON::GetNumItems | ( | ) | const |
Get the number of items on the menu.
| virtual void MGUI::CTRL_MENUBUTTON::OnMenuPopup | ( | ) | [protected, virtual] |
Called just before the menu is popped up.
Default implementation does nothing.
| virtual void MGUI::CTRL_MENUBUTTON::OnSelection | ( | ID | id | ) | [protected, virtual] |
Called when a menu item is selected.
Default implementation calls delegate.
| id | ID of the item selected |
| void MGUI::CTRL_MENUBUTTON::RemoveAllItems | ( | ) |
Remove all items from menu.
| void MGUI::CTRL_MENUBUTTON::RemoveItemByID | ( | ID | id | ) |
Remove item by ID.
| void MGUI::CTRL_MENUBUTTON::RemoveItemByIndex | ( | int | indx | ) |
Remove item by index.
| void MGUI::CTRL_MENUBUTTON::SetDelegateOnSelection | ( | DELEGATE_VOID_ID | delegate | ) | [inline] |
Set delegate to call when selection made from menu.
| void MGUI::CTRL_MENUBUTTON::SetItemEnabled | ( | ID | id, | |
| bool | enabled = true | |||
| ) |
Enable or disable an item.
| void MGUI::CTRL_MENUBUTTON::SetItemState | ( | ID | id, | |
| bool | state | |||
| ) |
Set the toggle state of a menu item.
1.6.1