CMenuItem Class Reference
[GUI Utility Classes and Modules]

Search Toolkit Book for CMenuItem

#include <menu_item.hpp>

Collaboration diagram for CMenuItem:

Collaboration graph
[legend]
List of all members.

Detailed Description

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

Definition at line 52 of file menu_item.hpp.

Public Types

typedef TItemNode::TNodeList_I TChildItem_I
typedef TItemNode::TNodeList_CI TChildItem_CI
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...

Public Member Functions

 CMenuItem ()
 creates a separator item
 CMenuItem (const string &label, const string &image_alias="")
 creates a submenu item
 CMenuItem (const string &label, TCmdID cmd, const string &image_alias="", const string &tooltip="", int state=eDefault)
 creates a command item
 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
 CMenuItem (const CMenuItem &item)
 copy contsructor - copies attributes but not subitems
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
EType GetType () const
void SetType (EType type)
bool IsItem () const
bool IsSubmenu () const
bool IsSeparator () const
const string & GetLabel () const
void SetLabel (const string &label)
const TCmdIDGetCommand () const
void SetCommand (TCmdID cmd)
bool HasImage () const
const string & GetImageAlias () const
void SetImageAlias (const string &image_alias)
const string & GetTooltip () 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"
Operations with submenus
CMenuItemGetParent ()
const CMenuItemGetParent () const
CMenuItemAddSubItem (CMenuItem *item)
CMenuItemAddSeparator ()
 Adds Separator.
CMenuItemAddSeparator (const string &label)
CMenuItemAddSubMenu (const string &Label, const string &image_alias="")
 Adds Submenu.
CMenuItemAddSubItem (const string &label, TCmdID cmd, const string &image_alias="", const string &tooltip="", int state=eDefault)
 Adds command subitem.
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


Member Typedef Documentation

typedef TItemNode::TNodeList_CI CMenuItem::TChildItem_CI
 

Definition at line 150 of file menu_item.hpp.

typedef TItemNode::TNodeList_I CMenuItem::TChildItem_I
 

Definition at line 149 of file menu_item.hpp.

typedef CTreeNode<CMenuItem*> CMenuItem::TItemNode [protected]
 

Definition at line 70 of file menu_item.hpp.


Member Enumeration Documentation

enum CMenuItem::EState
 

State and subtype of menu item.

Enumerator:
eDefault 
eDisabled 
eCheckItem  item is disabled (visible but inactive)
eRadioItem  "check-box" item
eSet  "radio" item

Definition at line 62 of file menu_item.hpp.

enum CMenuItem::EType
 

Type of menu item.

Enumerator:
eItem 
eSubmenu 
eSeparator 

Definition at line 56 of file menu_item.hpp.


Constructor & Destructor Documentation

CMenuItem::CMenuItem  ) 
 

creates a separator item

Definition at line 42 of file menu_item.cpp.

References eSeparator, and Init().

Referenced by AddSeparator(), AddSubItem(), AddSubMenu(), and Clone().

CMenuItem::CMenuItem const string &  label,
const string &  image_alias = ""
 

creates a submenu item

Definition at line 51 of file menu_item.cpp.

References eCmdNone, eSubmenu, and Init().

CMenuItem::CMenuItem const string &  label,
TCmdID  cmd,
const string &  image_alias = "",
const string &  tooltip = "",
int  state = eDefault
 

creates a command item

Definition at line 60 of file menu_item.cpp.

References eItem, and Init().

CMenuItem::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

Definition at line 70 of file menu_item.cpp.

References Init().

CMenuItem::CMenuItem const CMenuItem item  ) 
 

copy contsructor - copies attributes but not subitems

Definition at line 81 of file menu_item.cpp.

References Init(), m_CommandID, m_ImageAlias, m_Label, m_State, m_Tooltip, and m_Type.

CMenuItem::~CMenuItem  )  [virtual]
 

Definition at line 91 of file menu_item.cpp.

References DestroyAllSubNodes().


Member Function Documentation

CMenuItem * CMenuItem::AddSeparator const string &  label  ) 
 

Definition at line 469 of file menu_item.cpp.

References AddSubItem(), CMenuItem(), and eSeparator.

CMenuItem * CMenuItem::AddSeparator  ) 
 

Adds Separator.

Definition at line 462 of file menu_item.cpp.

References AddSubItem(), and CMenuItem().

CMenuItem * CMenuItem::AddSubItem const string &  label,
TCmdID  cmd,
const string &  image_alias = "",
const string &  tooltip = "",
int  state = eDefault
 

Adds command subitem.

Definition at line 482 of file menu_item.cpp.

References AddSubItem(), and CMenuItem().

CMenuItem * CMenuItem::AddSubItem CMenuItem item  ) 
 

Definition at line 440 of file menu_item.cpp.

References _ASSERT, CTreeNode< TValue, TKeyGetter >::AddNode(), IsSubmenu(), and m_ItemNode.

Referenced by AddSeparator(), AddSubItem(), AddSubMenu(), Clone(), and CreateMenuItems().

CMenuItem * CMenuItem::AddSubMenu const string &  Label,
const string &  image_alias = ""
 

Adds Submenu.

Definition at line 476 of file menu_item.cpp.

References AddSubItem(), and CMenuItem().

CMenuItem * CMenuItem::Clone  )  const
 

clones item and its subitems

Definition at line 130 of file menu_item.cpp.

References AddSubItem(), CMenuItem(), SubItemsBegin(), and SubItemsEnd().

void CMenuItem::DestroyAllSubNodes  ) 
 

Definition at line 451 of file menu_item.cpp.

References CTreeNode< TValue, TKeyGetter >::DetachNode(), CTreeNode< TValue, TKeyGetter >::GetValue(), m_ItemNode, CTreeNode< TValue, TKeyGetter >::SubNodeBegin(), and CTreeNode< TValue, TKeyGetter >::SubNodeEnd().

Referenced by ~CMenuItem().

void CMenuItem::Enable bool  b_en  ) 
 

Definition at line 227 of file menu_item.cpp.

References eDisabled, and x_SetState().

bool CMenuItem::Equal const CMenuItem item  )  const
 

Definition at line 124 of file menu_item.cpp.

References m_CommandID, m_ImageAlias, m_Label, and m_Type.

const CMenuItem * CMenuItem::FindEqualSubItem const CMenuItem item  )  const
 

Definition at line 545 of file menu_item.cpp.

References SubItemsBegin(), and SubItemsEnd().

CMenuItem * CMenuItem::FindEqualSubItem const CMenuItem item  ) 
 

Definition at line 535 of file menu_item.cpp.

References SubItemsBegin(), and SubItemsEnd().

CMenuItem::TChildItem_CI CMenuItem::FindSubItem EType  type,
const string &  label
const
 

Definition at line 603 of file menu_item.cpp.

References SubItemsBegin(), and SubItemsEnd().

CMenuItem::TChildItem_I CMenuItem::FindSubItem EType  type,
const string &  label
 

Definition at line 592 of file menu_item.cpp.

References SubItemsBegin(), and SubItemsEnd().

CMenuItem::TChildItem_CI CMenuItem::FindSubItem const string &  label  )  const
 

Definition at line 582 of file menu_item.cpp.

References SubItemsBegin(), and SubItemsEnd().

CMenuItem::TChildItem_I CMenuItem::FindSubItem const string &  label  ) 
 

Definition at line 573 of file menu_item.cpp.

References SubItemsBegin(), and SubItemsEnd().

CMenuItem::TChildItem_CI CMenuItem::FindSubItem const CMenuItem item  )  const
 

Definition at line 564 of file menu_item.cpp.

References SubItemsBegin(), and SubItemsEnd().

CMenuItem::TChildItem_I CMenuItem::FindSubItem const CMenuItem item  ) 
 

Definition at line 555 of file menu_item.cpp.

References SubItemsBegin(), and SubItemsEnd().

Referenced by Merge().

const TCmdID & CMenuItem::GetCommand  )  const
 

Definition at line 177 of file menu_item.cpp.

References m_CommandID.

const string & CMenuItem::GetImageAlias  )  const
 

Definition at line 192 of file menu_item.cpp.

References m_ImageAlias.

const string & CMenuItem::GetLabel  )  const
 

Definition at line 167 of file menu_item.cpp.

References m_Label.

Referenced by Merge(), and CAlnMultiWidget::x_CreateScoringMethodsMenu().

const CMenuItem * CMenuItem::GetParent  )  const
 

Definition at line 434 of file menu_item.cpp.

References CTreeNode< TValue, TKeyGetter >::GetParent(), CTreeNode< TValue, TKeyGetter >::GetValue(), and m_ItemNode.

CMenuItem * CMenuItem::GetParent  ) 
 

Definition at line 428 of file menu_item.cpp.

References CTreeNode< TValue, TKeyGetter >::GetParent(), CTreeNode< TValue, TKeyGetter >::GetValue(), and m_ItemNode.

int CMenuItem::GetState  )  const
 

Definition at line 212 of file menu_item.cpp.

References m_State.

const string & CMenuItem::GetTooltip  )  const
 

Definition at line 202 of file menu_item.cpp.

References m_Tooltip.

CMenuItem::EType CMenuItem::GetType  )  const
 

Definition at line 142 of file menu_item.cpp.

References m_Type.

bool CMenuItem::HasImage  )  const
 

Definition at line 187 of file menu_item.cpp.

References m_ImageAlias.

void CMenuItem::Init EType  type,
const string &  label = "",
TCmdID  cmd = eCmdNone,
const string &  image_alias = "",
const string &  tooltip = "",
int  state = eDefault
 

Definition at line 96 of file menu_item.cpp.

References m_CommandID, m_ImageAlias, m_Label, m_State, m_Tooltip, and m_Type.

Referenced by CMenuItem(), InitItem(), InitPopup(), and InitSeparator().

void CMenuItem::InitItem const string &  label,
TCmdID  cmd,
const string &  image_alias = "",
const string &  tooltip = "",
int  state = eDefault
 

Definition at line 113 of file menu_item.cpp.

References eItem, and Init().

void CMenuItem::InitPopup const string &  label,
const string &  image_alias = "",
const string &  tooltip = ""
 

Definition at line 107 of file menu_item.cpp.

References eCmdNone, eSubmenu, and Init().

void CMenuItem::InitSeparator  ) 
 

Definition at line 119 of file menu_item.cpp.

References eSeparator, and Init().

CMenuItem * CMenuItem::InsertSubItem TChildItem_I  it,
CMenuItem item
 

Definition at line 491 of file menu_item.cpp.

References _ASSERT, CTreeNode< TValue, TKeyGetter >::InsertNode(), IsSubmenu(), and m_ItemNode.

bool CMenuItem::IsChecked  )  const
 

Definition at line 237 of file menu_item.cpp.

References eCheckItem, eSet, and m_State.

bool CMenuItem::IsCheckType  )  const
 

Definition at line 232 of file menu_item.cpp.

References eCheckItem, and m_State.

Referenced by IsValid().

bool CMenuItem::IsEnabled  )  const
 

Definition at line 222 of file menu_item.cpp.

References eDisabled, and m_State.

Referenced by IsEnabledItem(), and IsEnabledSubmenu().

bool CMenuItem::IsEnabledItem  )  const [inline]
 

Definition at line 142 of file menu_item.hpp.

References IsEnabled(), and IsItem().

bool CMenuItem::IsEnabledSubmenu  )  const [inline]
 

Definition at line 143 of file menu_item.hpp.

References IsEnabled(), and IsSubmenu().

bool CMenuItem::IsItem  )  const
 

Definition at line 152 of file menu_item.cpp.

References eItem, and m_Type.

Referenced by IsEnabledItem(), and IsValid().

bool CMenuItem::IsRadioSelected  )  const
 

Definition at line 253 of file menu_item.cpp.

References eRadioItem, eSet, and m_State.

bool CMenuItem::IsRadioType  )  const
 

Definition at line 248 of file menu_item.cpp.

References eRadioItem, and m_State.

Referenced by IsValid().

bool CMenuItem::IsSeparator  )  const
 

Definition at line 162 of file menu_item.cpp.

References eSeparator, and m_Type.

Referenced by IsValid().

bool CMenuItem::IsSubmenu  )  const
 

Definition at line 157 of file menu_item.cpp.

References eSubmenu, and m_Type.

Referenced by AddSubItem(), CreateMenu(), InsertSubItem(), IsEnabledSubmenu(), Merge(), and x_MergeItems().

bool CMenuItem::IsSubmenuEmpty  ) 
 

Definition at line 510 of file menu_item.cpp.

References m_ItemNode, CTreeNode< TValue, TKeyGetter >::SubNodeBegin(), and CTreeNode< TValue, TKeyGetter >::SubNodeEnd().

bool CMenuItem::IsValid  )  const
 

Definition at line 264 of file menu_item.cpp.

References IsCheckType(), IsItem(), IsRadioType(), IsSeparator(), and m_Label.

void CMenuItem::Merge const CMenuItem item  ) 
 

merges menu tree represented by "item" into menu tree represented by "this"

Labels specify unique path to an item (similarly to paths in file systems).

Definition at line 285 of file menu_item.cpp.

References eSeparator, FindSubItem(), GetLabel(), IsSubmenu(), SubItemsBegin(), and SubItemsEnd().

Referenced by x_MergeItems().

void CMenuItem::RemoveItem TChildItem_I  it  ) 
 

Definition at line 502 of file menu_item.cpp.

References CTreeNode< TValue, TKeyGetter >::DetachNode(), and m_ItemNode.

void CMenuItem::SelectRadio bool  b_set  ) 
 

Definition at line 258 of file menu_item.cpp.

References eCheckItem, eRadioItem, eSet, and x_SetState().

void CMenuItem::SetCheck bool  b_set  ) 
 

Definition at line 242 of file menu_item.cpp.

References eCheckItem, eRadioItem, eSet, and x_SetState().

void CMenuItem::SetCommand TCmdID  cmd  ) 
 

Definition at line 182 of file menu_item.cpp.

References m_CommandID.

void CMenuItem::SetImageAlias const string &  image_alias  ) 
 

Definition at line 197 of file menu_item.cpp.

References m_ImageAlias.

void CMenuItem::SetLabel const string &  label  ) 
 

Definition at line 172 of file menu_item.cpp.

References m_Label.

void CMenuItem::SetState int  state  ) 
 

Definition at line 217 of file menu_item.cpp.

References m_State.

void CMenuItem::SetTooltip const string &  tooltip  ) 
 

Definition at line 207 of file menu_item.cpp.

References m_Tooltip.

void CMenuItem::SetType EType  type  ) 
 

Definition at line 147 of file menu_item.cpp.

References m_Type.

CMenuItem::TChildItem_CI CMenuItem::SubItemsBegin  )  const
 

Definition at line 525 of file menu_item.cpp.

References m_ItemNode, and CTreeNode< TValue, TKeyGetter >::SubNodeBegin().

CMenuItem::TChildItem_I CMenuItem::SubItemsBegin  ) 
 

Definition at line 515 of file menu_item.cpp.

References m_ItemNode, and CTreeNode< TValue, TKeyGetter >::SubNodeBegin().

Referenced by Clone(), CreateMenu(), FindEqualSubItem(), FindSubItem(), and Merge().

CMenuItem::TChildItem_CI CMenuItem::SubItemsEnd  )  const
 

Definition at line 530 of file menu_item.cpp.

References m_ItemNode, and CTreeNode< TValue, TKeyGetter >::SubNodeEnd().

CMenuItem::TChildItem_I CMenuItem::SubItemsEnd  ) 
 

Definition at line 520 of file menu_item.cpp.

References m_ItemNode, and CTreeNode< TValue, TKeyGetter >::SubNodeEnd().

Referenced by Clone(), CreateMenu(), FindEqualSubItem(), FindSubItem(), and Merge().

CMenuItem::TChildItem_I CMenuItem::x_FindSubItem TChildItem_I  it_begin,
TChildItem_I  it_end,
const string &  label,
bool  skip_named_groups
[protected]
 

Definition at line 378 of file menu_item.cpp.

void CMenuItem::x_InsertInUnnamedGroup CMenuItem item  )  [protected]
 

Definition at line 407 of file menu_item.cpp.

References m_ItemNode, CTreeNode< TValue, TKeyGetter >::SubNodeRBegin(), and CTreeNode< TValue, TKeyGetter >::SubNodeREnd().

void CMenuItem::x_MergeItems CMenuItem target,
const CMenuItem new_item
[protected]
 

Definition at line 355 of file menu_item.cpp.

References IsSubmenu(), and Merge().

void CMenuItem::x_SetState int  mask,
int  values
[inline, protected]
 

Definition at line 210 of file menu_item.hpp.

References m_State.

void CMenuItem::x_SetState int  mask,
bool  b_en
[inline, protected]
 

Definition at line 202 of file menu_item.hpp.

References m_State.

Referenced by Enable(), SelectRadio(), and SetCheck().


Member Data Documentation

TCmdID CMenuItem::m_CommandID [private]
 

Definition at line 218 of file menu_item.hpp.

Referenced by CMenuItem(), Equal(), GetCommand(), Init(), and SetCommand().

string CMenuItem::m_ImageAlias [private]
 

Definition at line 219 of file menu_item.hpp.

Referenced by CMenuItem(), Equal(), GetImageAlias(), HasImage(), Init(), and SetImageAlias().

TItemNode CMenuItem::m_ItemNode [private]
 

Definition at line 223 of file menu_item.hpp.

Referenced by AddSubItem(), DestroyAllSubNodes(), GetParent(), InsertSubItem(), IsSubmenuEmpty(), RemoveItem(), SubItemsBegin(), SubItemsEnd(), and x_InsertInUnnamedGroup().

string CMenuItem::m_Label [private]
 

Definition at line 217 of file menu_item.hpp.

Referenced by CMenuItem(), Equal(), GetLabel(), Init(), IsValid(), and SetLabel().

int CMenuItem::m_State [private]
 

Definition at line 221 of file menu_item.hpp.

Referenced by CMenuItem(), GetState(), Init(), IsChecked(), IsCheckType(), IsEnabled(), IsRadioSelected(), IsRadioType(), SetState(), and x_SetState().

string CMenuItem::m_Tooltip [private]
 

Definition at line 220 of file menu_item.hpp.

Referenced by CMenuItem(), GetTooltip(), Init(), and SetTooltip().

EType CMenuItem::m_Type [private]
 

Definition at line 216 of file menu_item.hpp.

Referenced by CMenuItem(), Equal(), GetType(), Init(), IsItem(), IsSeparator(), IsSubmenu(), and SetType().


The documentation for this class was generated from the following files:
Generated on Mon Dec 7 12:53:43 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Dec 07 16:23:26 2009 by modify_doxy.py rev. 173732