NCBI C++ ToolKit
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Private Attributes | List of all members

Search Toolkit Book for CMenuItem

CMenuItem - represents a menu items in IMenu-style menus. More...

#include <gui/utils/menu_item.hpp>

+ Collaboration diagram for CMenuItem:

Public Types

enum  EType { eItem , eSubmenu , eSeparator }
 Type of menu item. More...
 
enum  EState {
  eDefault = 0 , eDisabled = 0x1 , eCheckItem = 0x2 , eRadioItem = 0x4 ,
  eSet = 0x8
}
 State and subtype of menu item. More...
 
typedef TItemNode::TNodeList_I TChildItem_I
 
typedef TItemNode::TNodeList_CI TChildItem_CI
 

Public Member Functions

 CMenuItem ()
 creates a separator item More...
 
 CMenuItem (const string &label, const string &image_alias="")
 creates a submenu item More...
 
 CMenuItem (const string &label, TCmdID cmd, const string &image_alias="", const string &tooltip="", int state=eDefault)
 creates a command item More...
 
 CMenuItem (EType type, const string &label="", TCmdID cmd=eCmdNone, const string &image_alias="", const string &tooltip="", int state=eDefault)
 generic constructor, can be used to create any type of menuitem More...
 
 CMenuItem (const CMenuItem &item)
 copy contsructor - copies attributes but not subitems More...
 
virtual ~CMenuItem ()
 
void Init (EType type, const string &label="", TCmdID cmd=eCmdNone, const string &image_alias="", const string &tooltip="", int state=eDefault)
 
void InitPopup (const string &label, const string &image_alias="", const string &tooltip="")
 
void InitItem (const string &label, TCmdID cmd, const string &image_alias="", const string &tooltip="", int state=eDefault)
 
void InitSeparator ()
 
bool Equal (const CMenuItem &item) const
 
CMenuItemClone () const
 clones item and its subitems More...
 
EType GetType () const
 
void SetType (EType type)
 
bool IsItem () const
 
bool IsSubmenu () const
 
bool IsSeparator () const
 
const stringGetLabel () const
 
void SetLabel (const string &label)
 
const TCmdIDGetCommand () const
 
void SetCommand (TCmdID cmd)
 
bool HasImage () const
 
const stringGetImageAlias () const
 
void SetImageAlias (const string &image_alias)
 
const stringGetTooltip () const
 
void SetTooltip (const string &tooltip)
 
int GetState () const
 
void SetState (int state)
 
bool IsEnabled () const
 
void Enable (bool b_en)
 
bool IsCheckType () const
 
bool IsChecked () const
 
void SetCheck (bool b_set)
 
bool IsRadioType () const
 
bool IsRadioSelected () const
 
void SelectRadio (bool b_set)
 
bool IsValid () const
 
bool IsEnabledItem () const
 
bool IsEnabledSubmenu () const
 
void Merge (const CMenuItem &item)
 merges menu tree represented by "item" into menu tree represented by "this" More...
 
Operations with submenus
CMenuItemGetParent ()
 
const CMenuItemGetParent () const
 
CMenuItemAddSubItem (CMenuItem *item)
 
CMenuItemAddSeparator ()
 Adds Separator. More...
 
CMenuItemAddSeparator (const string &label)
 
CMenuItemAddSubMenu (const string &Label, const string &image_alias="")
 it is recommended that labels start with '-' More...
 
CMenuItemAddSubItem (const string &label, TCmdID cmd, const string &image_alias="", const string &tooltip="", int state=eDefault)
 Adds command subitem. More...
 
CMenuItemInsertSubItem (TChildItem_I it, CMenuItem *item)
 
void RemoveItem (TChildItem_I it)
 
void DestroyAllSubNodes ()
 
bool IsSubmenuEmpty ()
 
TChildItem_I SubItemsBegin ()
 
TChildItem_I SubItemsEnd ()
 
TChildItem_CI SubItemsBegin () const
 
TChildItem_CI SubItemsEnd () const
 
CMenuItemFindEqualSubItem (const CMenuItem &item)
 
const CMenuItemFindEqualSubItem (const CMenuItem &item) const
 
TChildItem_I FindSubItem (const CMenuItem &item)
 
TChildItem_CI FindSubItem (const CMenuItem &item) const
 
TChildItem_I FindSubItem (const string &label)
 
TChildItem_CI FindSubItem (const string &label) const
 
TChildItem_I FindSubItem (EType type, const string &label)
 
TChildItem_CI FindSubItem (EType type, const string &label) const
 

Protected Types

typedef CTreeNode< CMenuItem * > TItemNode
 

Protected Member Functions

void x_MergeItems (CMenuItem &target, const CMenuItem &new_item)
 
TChildItem_I x_FindSubItem (TChildItem_I it_begin, TChildItem_I it_end, const string &label, bool skip_named_groups)
 
void x_InsertInUnnamedGroup (CMenuItem &item)
 
void x_SetState (int mask, bool b_en)
 
void x_SetState (int mask, int values)
 

Private Attributes

EType m_Type
 
string m_Label
 
TCmdID m_CommandID
 
string m_ImageAlias
 
string m_Tooltip
 
int m_State
 
TItemNode m_ItemNode
 

Detailed Description

CMenuItem - represents a menu items in IMenu-style menus.

Definition at line 52 of file menu_item.hpp.


The documentation for this class was generated from the following files:
Modified on Thu May 23 12:30:49 2024 by modify_doxy.py rev. 669887