From 5a8715f82710d2fe01015c000973f033dca4774f Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 30 Jul 2010 09:56:49 -0700 Subject: added LLPanel::childSetAction() that does not take a void* argument implemented childGetVisibleTab/PanelWithHelp using breadth-first-search iterator moved tentative state from llview to lluictrl changes llcallbackmap to use boost::function --- indra/llui/llpanel.cpp | 66 +++++++++++++------------------------------------- 1 file changed, 17 insertions(+), 49 deletions(-) (limited to 'indra/llui/llpanel.cpp') 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(id); + LLUICtrl* child = findChild(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(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(id); - if (child) + LLButton* button = findChild(id); + if (button) { - child->setPrevalidate(func); + button->setClickedCallback(function); } } - void LLPanel::childSetAction(const std::string& id, boost::function function, void* value) { LLButton* button = findChild(id); -- cgit v1.2.3