Example #1
0
bool LLUICtrl::findHelpTopic(std::string& help_topic_out)
{
	LLUICtrl* ctrl = this;

	// search back through the control's parents for a panel
	// or tab with a help_topic string defined
	while (ctrl)
	{
		LLPanel *panel = dynamic_cast<LLPanel *>(ctrl);

		if (panel)
		{
			// 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)
			}

			// does the panel have an active tab with a help topic?
			LLPanel *tab = panel->childGetVisibleTabWithHelp();
			if (tab)
			{
				help_topic_out = tab->getHelpTopic();
				return true; // success (tab)
			}

			// otherwise, does the panel have a help topic itself?
			if (!panel->getHelpTopic().empty())
			{
				help_topic_out = panel->getHelpTopic();
				return true; // success (panel)
			}		
		}

		ctrl = ctrl->getParentUICtrl();
	}

	return false; // no help topic found
}