EXT-4197: Search in sub-panels for help IDs too.

In order to support unique help IDs for the Landmark and Place Profile
panels off the Places sidetray, we need to also search within any
embedded (and visible) sub-panels.
meow-7.2.2
Lynx Linden 2010-01-13 17:57:03 +00:00
parent db2321bad2
commit f3bd6481a5
4 changed files with 51 additions and 3 deletions

View File

@ -898,6 +898,44 @@ LLPanel *LLPanel::childGetVisibleTabWithHelp()
return ::childGetVisibleTabWithHelp(this);
}
static LLPanel *childGetVisiblePanelWithHelp(LLView *parent)
{
LLView *child;
// look through immediate children first for an active panel with help
for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child))
{
// do we have a panel with a help topic?
LLPanel *panel = dynamic_cast<LLPanel *>(child);
if (panel && panel->getVisible() && !panel->getHelpTopic().empty())
{
return panel;
}
}
// 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()
{
// 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);

View File

@ -214,7 +214,10 @@ public:
// LLTabContainer
void childShowTab(const std::string& id, const std::string& tabname, bool visible = true);
LLPanel *childGetVisibleTab(const std::string& id) const;
// Find a child with a nonempty Help topic
LLPanel *childGetVisibleTabWithHelp();
LLPanel *childGetVisiblePanelWithHelp();
// LLTextBox/LLTextEditor/LLLineEditor
void childSetText(const std::string& id, const LLStringExplicit& text) { childSetValue(id, LLSD(text)); }

View File

@ -876,6 +876,14 @@ bool LLUICtrl::findHelpTopic(std::string& help_topic_out)
return true; // success (tab)
}
// does the panel have a sub-panel with a help topic?
LLPanel *subpanel = panel->childGetVisiblePanelWithHelp();
if (subpanel)
{
help_topic_out = subpanel->getHelpTopic();
return true; // success (subpanel)
}
// otherwise, does the panel have a help topic itself?
if (!panel->getHelpTopic().empty())
{

View File

@ -46,7 +46,7 @@ background_visible="true"
height="533"
layout="topleft"
left="0"
help_topic="places_info_tab"
help_topic="place_profile"
name="panel_place_profile"
top="5"
visible="false"
@ -58,7 +58,7 @@ background_visible="true"
height="533"
layout="topleft"
left="0"
help_topic="places_info_tab"
help_topic="landmark"
name="panel_landmark_info"
top="5"
visible="false"
@ -67,7 +67,6 @@ background_visible="true"
height="19"
layout="topleft"
left="0"
help_topic="places_button_tab"
name="button_panel"
width="313">
<button