summaryrefslogtreecommitdiff
path: root/indra/llui/llpanel.cpp
diff options
context:
space:
mode:
authorMartin Reddy <lynx@lindenlab.com>2009-10-15 13:08:12 +0000
committerMartin Reddy <lynx@lindenlab.com>2009-10-15 13:08:12 +0000
commit925f01f6a066113049e8c829c6fc3875c69ef566 (patch)
tree4b28ca62ce3de11e3e9727ab09cdfe63466233cf /indra/llui/llpanel.cpp
parent0051f6bc6d421b8f973d801189b9495c311a647b (diff)
DEV-41253: Updated the help context calculation code so that it will
now search through a panel's children to see if there are any visible tabs that have a help topic string defined. If so, we use this string. Updated all of the XUI files that include a tab_container to define help topic strings for their child panels. I named all of these strings with the floater name as the prefix and "tab" at the end. For example, "preferences_display_tab" or "people_nearby_tab".
Diffstat (limited to 'indra/llui/llpanel.cpp')
-rw-r--r--indra/llui/llpanel.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 69ff3dddc3..742427525b 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -810,6 +810,47 @@ LLPanel *LLPanel::childGetVisibleTab(const std::string& id) const
return NULL;
}
+static LLPanel *childGetVisibleTabWithHelp(LLView *parent)
+{
+ LLView *child;
+
+ // look through immediate children first for an active tab with help
+ for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child))
+ {
+ LLTabContainer *tab = dynamic_cast<LLTabContainer *>(child);
+ if (tab && tab->getVisible())
+ {
+ LLPanel *curTabPanel = tab->getCurrentPanel();
+ if (curTabPanel && !curTabPanel->getHelpTopic().empty())
+ {
+ return curTabPanel;
+ }
+ }
+ }
+
+ // 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);
+}
+
void LLPanel::childSetPrevalidate(const std::string& id, BOOL (*func)(const LLWString &) )
{
LLLineEditor* child = findChild<LLLineEditor>(id);