Skip to content
Snippets Groups Projects
Commit d872325e authored by Vadim Savchuk's avatar Vadim Savchuk
Browse files

VWR-20926 FIXED Fixed displaying the fake "Sidebar Toggle" tab when you detach all sidebar tabs.

parent 24d1900c
No related branches found
No related tags found
No related merge requests found
...@@ -65,6 +65,7 @@ static const std::string TAB_PANEL_CAPTION_TITLE_BOX = "sidetray_tab_title"; ...@@ -65,6 +65,7 @@ static const std::string TAB_PANEL_CAPTION_TITLE_BOX = "sidetray_tab_title";
LLSideTray* LLSideTray::sInstance = 0; LLSideTray* LLSideTray::sInstance = 0;
// static
LLSideTray* LLSideTray::getInstance() LLSideTray* LLSideTray::getInstance()
{ {
if (!sInstance) if (!sInstance)
...@@ -76,6 +77,7 @@ LLSideTray* LLSideTray::getInstance() ...@@ -76,6 +77,7 @@ LLSideTray* LLSideTray::getInstance()
return sInstance; return sInstance;
} }
// static
bool LLSideTray::instanceCreated () bool LLSideTray::instanceCreated ()
{ {
return sInstance!=0; return sInstance!=0;
...@@ -369,6 +371,11 @@ LLSideTrayTab* LLSideTray::getTab(const std::string& name) ...@@ -369,6 +371,11 @@ LLSideTrayTab* LLSideTray::getTab(const std::string& name)
return getChild<LLSideTrayTab>(name,false); return getChild<LLSideTrayTab>(name,false);
} }
bool LLSideTray::hasTabs()
{
// The open/close tab doesn't count.
return mTabs.size() > 1;
}
void LLSideTray::toggleTabButton(LLSideTrayTab* tab) void LLSideTray::toggleTabButton(LLSideTrayTab* tab)
{ {
...@@ -406,10 +413,6 @@ bool LLSideTray::selectTabByName (const std::string& name) ...@@ -406,10 +413,6 @@ bool LLSideTray::selectTabByName (const std::string& name)
if (mActiveTab) if (mActiveTab)
{ {
toggleTabButton(mActiveTab); toggleTabButton(mActiveTab);
if(mActiveTab)
{
mActiveTab->setVisible(false);
}
} }
//select new tab //select new tab
...@@ -420,8 +423,6 @@ bool LLSideTray::selectTabByName (const std::string& name) ...@@ -420,8 +423,6 @@ bool LLSideTray::selectTabByName (const std::string& name)
toggleTabButton(mActiveTab); toggleTabButton(mActiveTab);
LLSD key;//empty LLSD key;//empty
mActiveTab->onOpen(key); mActiveTab->onOpen(key);
mActiveTab->setVisible(true);
} }
//arrange(); //arrange();
...@@ -431,7 +432,9 @@ bool LLSideTray::selectTabByName (const std::string& name) ...@@ -431,7 +432,9 @@ bool LLSideTray::selectTabByName (const std::string& name)
for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it)
{ {
LLSideTrayTab* sidebar_tab = *child_it; LLSideTrayTab* sidebar_tab = *child_it;
sidebar_tab->setVisible(sidebar_tab == mActiveTab); // When the last tab gets detached, for a short moment the "Toggle Sidebar" pseudo-tab
// is shown. So, to avoid the flicker we make sure it never gets visible.
sidebar_tab->setVisible(sidebar_tab == mActiveTab && (*child_it)->getName() != "sidebar_openclose");
} }
return true; return true;
} }
...@@ -716,6 +719,9 @@ void LLSideTray::arrange() ...@@ -716,6 +719,9 @@ void LLSideTray::arrange()
LLSideTrayTab* sidebar_tab = *child_it; LLSideTrayTab* sidebar_tab = *child_it;
sidebar_tab->setShape(getLocalRect()); sidebar_tab->setShape(getLocalRect());
} }
// The tab buttons should be shown only if there is at least one non-detached tab.
mButtonsPanel->setVisible(hasTabs());
} }
void LLSideTray::collapseSideBar() void LLSideTray::collapseSideBar()
......
...@@ -163,6 +163,7 @@ public: ...@@ -163,6 +163,7 @@ public:
protected: protected:
LLSideTrayTab* getTab (const std::string& name); LLSideTrayTab* getTab (const std::string& name);
bool hasTabs ();
void createButtons (); void createButtons ();
LLButton* createButton (const std::string& name,const std::string& image,const std::string& tooltip, LLButton* createButton (const std::string& name,const std::string& image,const std::string& tooltip,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment