summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2011-09-26 16:06:57 -0700
committerMerov Linden <merov@lindenlab.com>2011-09-26 16:06:57 -0700
commitbb1776de6865715b2dd96185140d35e46d63c837 (patch)
treef576aa7e9a8b28736f4997d312949c0f64a90013 /indra/llui
parent92368dbdfc5b7ac133a8722202878a109c5341a9 (diff)
EXP-1207 : Introduced an hasCommand() method for toolbars and toolbar view
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/lltoolbar.cpp14
-rw-r--r--indra/llui/lltoolbar.h1
-rw-r--r--indra/llui/lltoolbarview.cpp18
-rw-r--r--indra/llui/lltoolbarview.h2
4 files changed, 35 insertions, 0 deletions
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index a9513b759a..5802d2adda 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -240,6 +240,20 @@ bool LLToolBar::addCommand(LLCommand * command)
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 handle_it_here = !mReadOnly;
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index 5028c39fb8..00e6ed131a 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -122,6 +122,7 @@ public:
void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
bool addCommand(LLCommand * command);
+ bool hasCommand(const std::string& command_name);
protected:
friend class LLUICtrlFactory;
diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp
index 0b0fcef52c..3b4960fdd5 100644
--- a/indra/llui/lltoolbarview.cpp
+++ b/indra/llui/lltoolbarview.cpp
@@ -62,6 +62,24 @@ BOOL LLToolBarView::postBuild()
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()
{
static bool debug_print = true;
diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h
index 24735d69e9..65d339315b 100644
--- a/indra/llui/lltoolbarview.h
+++ b/indra/llui/lltoolbarview.h
@@ -45,6 +45,8 @@ public:
virtual void draw();
+ bool hasCommand(const std::string& command_name);
+
// valid children for LLToolBarView are stored in this registry
typedef LLDefaultChildRegistry child_registry_t;