Skip to content
Snippets Groups Projects
Commit bb1776de authored by Merov Linden's avatar Merov Linden
Browse files

EXP-1207 : Introduced an hasCommand() method for toolbars and toolbar view

parent 92368dbd
No related branches found
No related tags found
No related merge requests found
...@@ -240,6 +240,20 @@ bool LLToolBar::addCommand(LLCommand * command) ...@@ -240,6 +240,20 @@ bool LLToolBar::addCommand(LLCommand * command)
return true; return true;
} }
bool LLToolBar::hasCommand(const std::string& command_name)
{
bool has_command = false;
for (std::list<LLToolBarButton*>::iterator cmd = mButtons.begin(); cmd != mButtons.end(); cmd++)
{
if ((*cmd)->getName() == command_name)
{
has_command = true;
break;
}
}
return has_command;
}
BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask)
{ {
BOOL handle_it_here = !mReadOnly; BOOL handle_it_here = !mReadOnly;
......
...@@ -122,6 +122,7 @@ class LLToolBar ...@@ -122,6 +122,7 @@ class LLToolBar
void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
bool addCommand(LLCommand * command); bool addCommand(LLCommand * command);
bool hasCommand(const std::string& command_name);
protected: protected:
friend class LLUICtrlFactory; friend class LLUICtrlFactory;
......
...@@ -62,6 +62,24 @@ BOOL LLToolBarView::postBuild() ...@@ -62,6 +62,24 @@ BOOL LLToolBarView::postBuild()
return TRUE; return TRUE;
} }
bool LLToolBarView::hasCommand(const std::string& command_name)
{
bool has_command = false;
if (mToolbarLeft && !has_command)
{
has_command = mToolbarLeft->hasCommand(command_name);
}
if (mToolbarRight && !has_command)
{
has_command = mToolbarRight->hasCommand(command_name);
}
if (mToolbarBottom && !has_command)
{
has_command = mToolbarBottom->hasCommand(command_name);
}
return has_command;
}
void LLToolBarView::draw() void LLToolBarView::draw()
{ {
static bool debug_print = true; static bool debug_print = true;
......
...@@ -45,6 +45,8 @@ class LLToolBarView : public LLUICtrl ...@@ -45,6 +45,8 @@ class LLToolBarView : public LLUICtrl
virtual void draw(); virtual void draw();
bool hasCommand(const std::string& command_name);
// valid children for LLToolBarView are stored in this registry // valid children for LLToolBarView are stored in this registry
typedef LLDefaultChildRegistry child_registry_t; typedef LLDefaultChildRegistry child_registry_t;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment