ASPiK SDK
|
a command menu item More...
#include <coptionmenu.h>
Public Member Functions | |
CCommandMenuItem (const UTF8String &title, const UTF8String &keycode=nullptr, int32_t keyModifiers=0, CBitmap *icon=nullptr, int32_t flags=kNoFlags, CBaseObject *target=nullptr, const UTF8String &commandCategory=nullptr, const UTF8String &commandName=nullptr) | |
CCommandMenuItem (const UTF8String &title, COptionMenu *submenu, CBitmap *icon=nullptr, CBaseObject *target=nullptr, const UTF8String &commandCategory=nullptr, const UTF8String &commandName=nullptr) | |
CCommandMenuItem (const UTF8String &title, int32_t tag, CBaseObject *target=nullptr, const UTF8String &commandCategory=nullptr, const UTF8String &commandName=nullptr) | |
CCommandMenuItem (const UTF8String &title, CBaseObject *target, const UTF8String &commandCategory=nullptr, const UTF8String &commandName=nullptr) | |
CCommandMenuItem (const CCommandMenuItem &item) | |
void | execute () |
void | validate () |
![]() | |
CMenuItem (const UTF8String &title, const UTF8String &keycode="", int32_t keyModifiers=0, CBitmap *icon=nullptr, int32_t flags=kNoFlags) | |
CMenuItem (const UTF8String &title, COptionMenu *submenu, CBitmap *icon=nullptr) | |
CMenuItem (const UTF8String &title, int32_t tag) | |
CMenuItem (const CMenuItem &item) | |
virtual void | setTitle (const UTF8String &title) |
set title of menu item | |
virtual void | setSubmenu (COptionMenu *submenu) |
set submenu of menu item | |
virtual void | setKey (const UTF8String &keyCode, int32_t keyModifiers=0) |
set keycode and key modifiers of menu item | |
virtual void | setVirtualKey (int32_t virtualKeyCode, int32_t keyModifiers=0) |
set virtual keycode and key modifiers of menu item | |
virtual void | setEnabled (bool state=true) |
set menu item enabled state | |
virtual void | setChecked (bool state=true) |
set menu item checked state | |
virtual void | setIsTitle (bool state=true) |
set menu item title state | |
virtual void | setIsSeparator (bool state=true) |
set menu item separator state | |
virtual void | setIcon (CBitmap *icon) |
set menu item icon | |
virtual void | setTag (int32_t tag) |
set menu item tag | |
bool | isEnabled () const |
returns whether the item is enabled or not | |
bool | isChecked () const |
returns whether the item is checked or not | |
bool | isTitle () const |
returns whether the item is a title item or not | |
bool | isSeparator () const |
returns whether the item is a separator or not | |
const UTF8String & | getTitle () const |
returns the title of the item | |
int32_t | getKeyModifiers () const |
returns the key modifiers of the item | |
const UTF8String & | getKeycode () const |
returns the keycode of the item | |
int32_t | getVirtualKeyCode () const |
returns the virtual keycode of the item | |
COptionMenu * | getSubmenu () const |
returns the submenu of the item | |
CBitmap * | getIcon () const |
returns the icon of the item | |
int32_t | getTag () const |
returns the tag of the item | |
![]() | |
CBaseObject (const CBaseObject &o) | |
CBaseObject & | operator= (const CBaseObject &obj) |
virtual CMessageResult | notify (CBaseObject *sender, IdStringPtr message) |
![]() | |
ReferenceCounted (const ReferenceCounted &) | |
ReferenceCounted & | operator= (const ReferenceCounted &) |
void | forget () override |
decrease refcount and delete object if refcount == 0 | |
void | remember () override |
increase refcount | |
virtual int32_t | getNbReference () const |
get refcount | |
virtual void | beforeDelete () |
Static Public Attributes | |
static IdStringPtr | kMsgMenuItemValidate = "kMsgMenuItemValidate" |
message send to the target before the item is shown | |
static IdStringPtr | kMsgMenuItemSelected = "kMsgMenuItemSelected" |
message send to the target when this item was selected | |
Protected Attributes | |
ValidateCallbackFunction | validateFunc |
SelectedCallbackFunction | selectedFunc |
SharedPointer< CBaseObject > | target |
UTF8String | commandCategory |
UTF8String | commandName |
![]() | |
UTF8String | title |
UTF8String | keyCode |
SharedPointer< COptionMenu > | submenu |
SharedPointer< CBitmap > | icon |
int32_t | flags {0} |
int32_t | keyModifiers {0} |
int32_t | virtualKeyCode {0} |
int32_t | tag {-1} |
CCommandMenuItem Methods | |
using | ValidateCallbackFunction = std::function< void(CCommandMenuItem *item)> |
using | SelectedCallbackFunction = std::function< void(CCommandMenuItem *item)> |
void | setCommandCategory (const UTF8String &category) |
const UTF8String & | getCommandCategory () const |
bool | isCommandCategory (const UTF8String &category) const |
void | setCommandName (const UTF8String &name) |
const UTF8String & | getCommandName () const |
bool | isCommandName (const UTF8String &name) const |
void | setTarget (CBaseObject *target) |
CBaseObject * | getTarget () const |
void | setActions (SelectedCallbackFunction &&selected, ValidateCallbackFunction &&validate=[](CCommandMenuItem *){}) |
Additional Inherited Members | |
![]() | |
enum | Flags { kNoFlags = 0, kDisabled = 1 << 0, kTitle = 1 << 1, kChecked = 1 << 2, kSeparator = 1 << 3 } |
a command menu item
The CCommandMenuItem supports setting a category, name and a target. The target will get a notify() call before the item is displayed and after it was selected.