summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llfloatersidepanelcontainer.cpp28
-rw-r--r--indra/newview/llfloatersidepanelcontainer.h9
2 files changed, 32 insertions, 5 deletions
diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp
index 6c5d2570f2..9e577c83a8 100644
--- a/indra/newview/llfloatersidepanelcontainer.cpp
+++ b/indra/newview/llfloatersidepanelcontainer.cpp
@@ -53,9 +53,15 @@ LLFloaterSidePanelContainer::~LLFloaterSidePanelContainer()
LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::GLOBAL, this);
}
+bool LLFloaterSidePanelContainer::postBuild()
+{
+ mMainPanel = getChild<LLPanel>(sMainPanelName);
+ return TRUE;
+}
+
void LLFloaterSidePanelContainer::onOpen(const LLSD& key)
{
- getChild<LLPanel>(sMainPanelName)->onOpen(key);
+ mMainPanel->onOpen(key);
}
void LLFloaterSidePanelContainer::closeFloater(bool app_quitting)
@@ -206,10 +212,16 @@ void LLFloaterSidePanelContainer::showPanel(std::string_view floater_name, std::
LLPanel* LLFloaterSidePanelContainer::getPanel(std::string_view floater_name, std::string_view panel_name)
{
LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name);
-
if (floaterp)
{
- return floaterp->findChild<LLPanel>(panel_name, true);
+ if (panel_name == sMainPanelName)
+ {
+ return floaterp->mMainPanel;
+ }
+ else
+ {
+ return floaterp->findChild<LLPanel>(panel_name, true);
+ }
}
return NULL;
@@ -218,10 +230,16 @@ LLPanel* LLFloaterSidePanelContainer::getPanel(std::string_view floater_name, st
LLPanel* LLFloaterSidePanelContainer::findPanel(std::string_view floater_name, std::string_view panel_name)
{
LLFloaterSidePanelContainer* floaterp = LLFloaterReg::findTypedInstance<LLFloaterSidePanelContainer>(floater_name);
-
if (floaterp)
{
- return floaterp->findChild<LLPanel>(panel_name, true);
+ if (panel_name == sMainPanelName)
+ {
+ return floaterp->mMainPanel;
+ }
+ else
+ {
+ return floaterp->findChild<LLPanel>(panel_name, true);
+ }
}
return NULL;
diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h
index d7f6c309c4..a57a2da4d9 100644
--- a/indra/newview/llfloatersidepanelcontainer.h
+++ b/indra/newview/llfloatersidepanelcontainer.h
@@ -49,6 +49,8 @@ public:
LLFloaterSidePanelContainer(const LLSD& key, const Params& params = getDefaultParams());
~LLFloaterSidePanelContainer();
+ bool postBuild() override;
+
void onOpen(const LLSD& key) override;
void closeFloater(bool app_quitting = false) override;
@@ -77,6 +79,11 @@ public:
* @returns a pointer to the panel of given type T.
*/
template <typename T>
+ static T* findPanel(std::string_view floater_name, std::string_view panel_name = sMainPanelName)
+ {
+ return dynamic_cast<T*>(findPanel(floater_name, panel_name));
+ }
+ template <typename T>
static T* getPanel(std::string_view floater_name, std::string_view panel_name = sMainPanelName)
{
T* panel = dynamic_cast<T*>(getPanel(floater_name, panel_name));
@@ -89,6 +96,8 @@ public:
protected:
void onCloseMsgCallback(const LLSD& notification, const LLSD& response);
+
+ LLPanel* mMainPanel = nullptr;
};
#endif // LL_LLFLOATERSIDEPANELCONTAINER_H