61 const string& tooltip,
int state)
71 const string& image_alias,
const string& tooltip,
int state)
97 const string& image_alias,
const string& tooltip,
int state)
108 const string& tooltip)
114 const string& tooltip,
int state)
135 CMenuItem* p_subitem = (*it)->GetValue();
269 if(b_check && b_radio) {
271 }
else if((b_check || b_radio) && !
IsItem()) {
281 static const char*
kCannotMerge =
"CMenuItem::Merge() cannot merge item ";
296 const CMenuItem* sub_item = (*it)->GetValue();
309 for( grp_end = grp_begin; grp_end !=
SubItemsEnd(); ++grp_end) {
310 const CMenuItem* it_item = (*grp_end)->GetValue();
328 if(it_target == grp_end) {
337 CMenuItem* target_sub_item = (*it_target)->GetValue();
345 <<
", because they are not submenus.");
349 <<
", because they have different labels.");
359 target.
Merge(new_item);
360 }
else if(target.
IsItem()) {
364 s_error =
", because it is not a command item.";
366 s_error =
", because they have different commands.";
379 const string&
label,
bool skip_named_groups)
381 if(skip_named_groups) {
384 const CMenuItem* sub_item = (*it)->GetValue();
385 const string& s = sub_item->
GetLabel();
396 const CMenuItem* sub_item = (*it)->GetValue();
397 const string& s = sub_item->
GetLabel();
413 const CMenuItem* it_item = (*it)->GetValue();
415 named = ! it_item->
GetLabel().empty();
430 return parent_node ? parent_node->GetValue() :
NULL;
456 delete node->GetValue();
482 const string& image_alias,
const string& tooltip,
538 if(curr->
Equal(item))
547 const CMenuItem* curr = (*it)->GetValue();
548 if(curr->
Equal(item))
557 if((*it)->GetValue() == &item)
566 if((*it)->GetValue() == &item)
575 if((*it)->GetValue()->GetLabel() ==
label)
584 if((*it)->GetValue()->GetLabel() ==
label)
594 const CMenuItem* item = (*it)->GetValue();
605 const CMenuItem* item = (*it)->GetValue();
618 vector<CMenuItem*> path;
628 path.back()->AddSubItem(item);
632 path.push_back(item);
646 path.back()->AddSubItem(item);
650 path.back()->AddSubItem(item);
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
CMenuItem * AddSubItem(CMenuItem *item)
CMenuItem * FindEqualSubItem(const CMenuItem &item)
void RemoveItem(TChildItem_I it)
CMenuItem * Clone() const
clones item and its subitems
TChildItem_I FindSubItem(const CMenuItem &item)
void InitItem(const string &label, TCmdID cmd, const string &image_alias="", const string &tooltip="", int state=eDefault)
void Init(EType type, const string &label="", TCmdID cmd=eCmdNone, const string &image_alias="", const string &tooltip="", int state=eDefault)
CMenuItem * AddSeparator()
Adds Separator.
void x_MergeItems(CMenuItem &target, const CMenuItem &new_item)
void DestroyAllSubNodes()
const char * m_ImageAlias
void SelectRadio(bool b_set)
TItemNode::TNodeList_CI TChildItem_CI
bool IsSubMenuEnd() const
TChildItem_I SubItemsBegin()
bool Equal(const CMenuItem &item) const
void SetImageAlias(const string &image_alias)
TChildItem_I SubItemsEnd()
bool IsRadioSelected() const
const string & GetImageAlias() const
void SetCheck(bool b_set)
TChildItem_I x_FindSubItem(TChildItem_I it_begin, TChildItem_I it_end, const string &label, bool skip_named_groups)
CMenuItem * AddSubMenu(const string &Label, const string &image_alias="")
it is recommended that labels start with '-'
const string & GetLabel() const
void Merge(const CMenuItem &item)
merges menu tree represented by "item" into menu tree represented by "this"
void x_InsertInUnnamedGroup(CMenuItem &item)
TItemNode::TNodeList_I TChildItem_I
void SetCommand(TCmdID cmd)
CTreeNode< CMenuItem * > TItemNode
void SetTooltip(const string &tooltip)
CMenuItem * CreateMenuItems(const SMenuItemRec *items)
creates hierarchy of CMenuItem objects from the array of SMenuItemRec descriptors
void InitPopup(const string &label, const string &image_alias="", const string &tooltip="")
void SetLabel(const string &label)
CMenuItem()
creates a separator item
CMenuItem * InsertSubItem(TChildItem_I it, CMenuItem *item)
const TCmdID & GetCommand() const
void x_SetState(int mask, bool b_en)
const string & GetTooltip() const
@ eCmdNone
not a valid command
@ eRadioItem
"check-box" item
@ eCheckItem
item is disabled (visible but inactive)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
TNodeList::iterator TNodeList_I
TTreeType * DetachNode(TTreeType *subnode)
Remove the subtree from the tree without destroying it.
TNodeList_CRI SubNodeREnd(void) const
Return last const reverse iterator on subnode list.
TNodeList::reverse_iterator TNodeList_RI
TNodeList_CRI SubNodeRBegin(void) const
Return first const reverse iterator on subnode list.
TNodeList_CI SubNodeBegin(void) const
Return first const iterator on subnode list.
void AddNode(TTreeType *subnode)
Add new subnode.
TNodeList_CI SubNodeEnd(void) const
Return last const iterator on subnode list.
void InsertNode(TNodeList_I it, TTreeType *subnode)
Insert new subnode before the specified location in the subnode list.
const TValue & GetValue(void) const
Return node's value.
const TTreeType * GetParent(void) const
Get node's parent.
static const char label[]