diff options
author | Richard Nelson <none@none> | 2010-07-30 10:07:14 -0700 |
---|---|---|
committer | Richard Nelson <none@none> | 2010-07-30 10:07:14 -0700 |
commit | 50005b81f7788cd7a372ab3009568bdb9e024a6e (patch) | |
tree | 829bd18ebb1ec90234973a980979ca92cebe38ff /indra/llui | |
parent | 2051ba7248f11af083bbda9cd8b67be99d0d844b (diff) | |
parent | 9b526997d93d9290602a86f91a7f096da4395d97 (diff) |
merge
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llcallbackmap.h | 3 | ||||
-rw-r--r-- | indra/llui/llpanel.cpp | 66 | ||||
-rw-r--r-- | indra/llui/llpanel.h | 4 | ||||
-rw-r--r-- | indra/llui/lluictrl.h | 4 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 24 | ||||
-rw-r--r-- | indra/llui/llview.h | 6 |
6 files changed, 41 insertions, 66 deletions
diff --git a/indra/llui/llcallbackmap.h b/indra/llui/llcallbackmap.h index 97b1e2fc50..60c4fc6b6d 100644 --- a/indra/llui/llcallbackmap.h +++ b/indra/llui/llcallbackmap.h @@ -35,12 +35,13 @@ #include <map> #include <string> +#include <boost/function.hpp> class LLCallbackMap { public: // callback definition. - typedef void* (*callback_t)(void* data); + typedef boost::function<void* (void* data)> callback_t; typedef std::map<std::string, LLCallbackMap> map_t; typedef map_t::iterator map_iter_t; diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 9ebdcb87c6..0f769bd6dc 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -661,7 +661,7 @@ void LLPanel::childSetEnabled(const std::string& id, bool enabled) void LLPanel::childSetTentative(const std::string& id, bool tentative) { - LLView* child = findChild<LLView>(id); + LLUICtrl* child = findChild<LLUICtrl>(id); if (child) { child->setTentative(tentative); @@ -860,13 +860,16 @@ LLPanel *LLPanel::childGetVisibleTab(const std::string& id) const return NULL; } -static LLPanel *childGetVisibleTabWithHelp(LLView *parent) +LLPanel* LLPanel::childGetVisibleTabWithHelp() { LLView *child; - // look through immediate children first for an active tab with help - for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child)) + bfs_tree_iterator_t it = beginTreeBFS(); + // skip ourselves + ++it; + for (; it != endTreeBFS(); ++it) { + child = *it; LLPanel *curTabPanel = NULL; // do we have a tab container? @@ -890,36 +893,21 @@ static LLPanel *childGetVisibleTabWithHelp(LLView *parent) } } - // then try a bit harder and recurse through all children - for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child)) - { - if (child->getVisible()) - { - LLPanel* tab = ::childGetVisibleTabWithHelp(child); - if (tab) - { - return tab; - } - } - } - // couldn't find any active tabs with a help topic string return NULL; } -LLPanel *LLPanel::childGetVisibleTabWithHelp() -{ - // find a visible tab with a help topic (to determine help context) - return ::childGetVisibleTabWithHelp(this); -} -static LLPanel *childGetVisiblePanelWithHelp(LLView *parent) +LLPanel *LLPanel::childGetVisiblePanelWithHelp() { LLView *child; - // look through immediate children first for an active panel with help - for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child)) + bfs_tree_iterator_t it = beginTreeBFS(); + // skip ourselves + ++it; + for (; it != endTreeBFS(); ++it) { + child = *it; // do we have a panel with a help topic? LLPanel *panel = dynamic_cast<LLPanel *>(child); if (panel && panel->getVisible() && !panel->getHelpTopic().empty()) @@ -928,39 +916,19 @@ static LLPanel *childGetVisiblePanelWithHelp(LLView *parent) } } - // then try a bit harder and recurse through all children - for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child)) - { - if (child->getVisible()) - { - LLPanel* panel = ::childGetVisiblePanelWithHelp(child); - if (panel) - { - return panel; - } - } - } - // couldn't find any active panels with a help topic string return NULL; } -LLPanel *LLPanel::childGetVisiblePanelWithHelp() +void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_type& function) { - // find a visible tab with a help topic (to determine help context) - return ::childGetVisiblePanelWithHelp(this); -} - -void LLPanel::childSetPrevalidate(const std::string& id, bool (*func)(const LLWString &) ) -{ - LLLineEditor* child = findChild<LLLineEditor>(id); - if (child) + LLButton* button = findChild<LLButton>(id); + if (button) { - child->setPrevalidate(func); + button->setClickedCallback(function); } } - void LLPanel::childSetAction(const std::string& id, boost::function<void(void*)> function, void* value) { LLButton* button = findChild<LLButton>(id); diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 03e3dc0c0e..784054cd86 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -170,6 +170,7 @@ public: std::string getString(const std::string& name) const; // ** Wrappers for setting child properties by name ** -TomY + // WARNING: These are deprecated, please use getChild<T>("name")->doStuff() idiom instead // LLView void childSetVisible(const std::string& name, bool visible); @@ -233,7 +234,8 @@ public: void childSetPrevalidate(const std::string& id, bool (*func)(const LLWString &) ); // LLButton - void childSetAction(const std::string& id, boost::function<void(void*)> function, void* value = NULL); + void childSetAction(const std::string& id, boost::function<void(void*)> function, void* value); + void childSetAction(const std::string& id, const commit_signal_t::slot_type& function); // LLTextBox void childSetActionTextbox(const std::string& id, boost::function<void(void*)> function, void* value = NULL); diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 1f9d2c9049..259104f72c 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -147,8 +147,6 @@ public: // LLView interface /*virtual*/ BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); /*virtual*/ BOOL isCtrl() const; - /*virtual*/ void setTentative(BOOL b); - /*virtual*/ BOOL getTentative() const; /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask); /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); /*virtual*/ BOOL canFocusChildren() const; @@ -180,6 +178,8 @@ public: void setMakeVisibleControlVariable(LLControlVariable* control); void setMakeInvisibleControlVariable(LLControlVariable* control); + virtual void setTentative(BOOL b); + virtual BOOL getTentative() const; virtual void setValue(const LLSD& value); virtual LLSD getValue() const; /// When two widgets are displaying the same data (e.g. during a skin diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 394ec957d5..9e68277b0f 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -434,17 +434,6 @@ BOOL LLView::canFocusChildren() const } //virtual -void LLView::setTentative(BOOL b) -{ -} - -//virtual -BOOL LLView::getTentative() const -{ - return FALSE; -} - -//virtual void LLView::setEnabled(BOOL enabled) { mEnabled = enabled; @@ -2784,6 +2773,19 @@ LLView::tree_post_iterator_t LLView::endTreeDFSPost() return tree_post_iterator_t(); } +LLView::bfs_tree_iterator_t LLView::beginTreeBFS() +{ + return bfs_tree_iterator_t(this, + boost::bind(boost::mem_fn(&LLView::beginChild), _1), + boost::bind(boost::mem_fn(&LLView::endChild), _1)); +} + +LLView::bfs_tree_iterator_t LLView::endTreeBFS() +{ + // an empty iterator is an "end" iterator + return bfs_tree_iterator_t(); +} + LLView::root_to_view_iterator_t LLView::beginRootToView() { diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 8e705ed701..745a1b6e74 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -289,8 +289,6 @@ public: // children, etc. virtual void deleteAllChildren(); - virtual void setTentative(BOOL b); - virtual BOOL getTentative() const; void setAllChildrenEnabled(BOOL b); virtual void setVisible(BOOL visible); @@ -357,6 +355,10 @@ public: tree_post_iterator_t beginTreeDFSPost(); tree_post_iterator_t endTreeDFSPost(); + typedef LLTreeBFSIter<LLView, child_list_const_iter_t> bfs_tree_iterator_t; + bfs_tree_iterator_t beginTreeBFS(); + bfs_tree_iterator_t endTreeBFS(); + typedef LLTreeDownIter<LLView> root_to_view_iterator_t; root_to_view_iterator_t beginRootToView(); |