ASPiK SDK
VSTGUI::CCommandMenuItem Class Reference

a command menu item More...

#include <coptionmenu.h>

Inheritance diagram for VSTGUI::CCommandMenuItem:
VSTGUI::CMenuItem VSTGUI::CBaseObject VSTGUI::ReferenceCounted< T > VSTGUI::IReference

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 ()
 
- Public Member Functions inherited from VSTGUI::CMenuItem
 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 UTF8StringgetTitle () const
 returns the title of the item
 
int32_t getKeyModifiers () const
 returns the key modifiers of the item
 
const UTF8StringgetKeycode () const
 returns the keycode of the item
 
int32_t getVirtualKeyCode () const
 returns the virtual keycode of the item
 
COptionMenugetSubmenu () const
 returns the submenu of the item
 
CBitmapgetIcon () const
 returns the icon of the item
 
int32_t getTag () const
 returns the tag of the item
 
- Public Member Functions inherited from VSTGUI::CBaseObject
 CBaseObject (const CBaseObject &o)
 
CBaseObjectoperator= (const CBaseObject &obj)
 
virtual CMessageResult notify (CBaseObject *sender, IdStringPtr message)
 
- Public Member Functions inherited from VSTGUI::ReferenceCounted< T >
 ReferenceCounted (const ReferenceCounted &)
 
ReferenceCountedoperator= (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< CBaseObjecttarget
 
UTF8String commandCategory
 
UTF8String commandName
 
- Protected Attributes inherited from VSTGUI::CMenuItem
UTF8String title
 
UTF8String keyCode
 
SharedPointer< COptionMenusubmenu
 
SharedPointer< CBitmapicon
 
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 UTF8StringgetCommandCategory () const
 
bool isCommandCategory (const UTF8String &category) const
 
void setCommandName (const UTF8String &name)
 
const UTF8StringgetCommandName () const
 
bool isCommandName (const UTF8String &name) const
 
void setTarget (CBaseObject *target)
 
CBaseObjectgetTarget () const
 
void setActions (SelectedCallbackFunction &&selected, ValidateCallbackFunction &&validate=[](CCommandMenuItem *){})
 

Additional Inherited Members

- Public Types inherited from VSTGUI::CMenuItem
enum  Flags {
  kNoFlags = 0, kDisabled = 1 << 0, kTitle = 1 << 1, kChecked = 1 << 2,
  kSeparator = 1 << 3
}
 

Detailed Description

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.

See also
CCommandMenuItem::kMsgMenuItemValidate and
CCommandMenuItem::kMsgMenuItemSelected

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