Re-apply hosted floater header improvements

master
Ansariel 2013-06-30 23:24:36 +02:00
parent b134a1d66f
commit 2f688b41d6
2 changed files with 44 additions and 5 deletions

View File

@ -31,7 +31,7 @@
#include "llmultifloater.h"
#include "llresizehandle.h"
//#include "lldraghandle.h" <FS:TM> CHUI Merge Check
#include "lldraghandle.h"
//
// LLMultiFloater
@ -57,7 +57,8 @@ void LLMultiFloater::buildTabContainer()
p.rect(LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - floater_header_size, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0));
p.tab_position(mTabPos);
p.follows.flags(FOLLOWS_ALL);
p.commit_callback.function(boost::bind(&LLMultiFloater::onTabSelected, this));
// <FS> Update torn off status and add title bar
//p.commit_callback.function(boost::bind(&LLMultiFloater::onTabSelected, this));
mTabContainer = LLUICtrlFactory::create<LLTabContainer>(p);
addChild(mTabContainer);
@ -191,6 +192,13 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater,
floater_data.mCanResize = floaterp->isResizable();
floater_data.mSaveRect = floaterp->mSaveRect;
// <FS> Update torn off status and add title bar
floaterp->getDragHandle()->setTitleVisible(FALSE);
LLRect rect = floaterp->getRect();
rect.mTop -= floaterp->getHeaderHeight();
floaterp->setRect(rect);
// </FS>
// remove minimize and close buttons
floaterp->setCanMinimize(FALSE);
floaterp->setCanResize(FALSE);
@ -241,6 +249,14 @@ void LLMultiFloater::updateFloaterTitle(LLFloater* floaterp)
if (index != -1)
{
mTabContainer->setPanelTitle(index, floaterp->getShortTitle());
// <FS:TS> If the tab we're updating is the current tab, then
// update the overall title too, since we're showing it
// exclusively now.
if (floaterp == mTabContainer->getCurrentPanel())
{
mDragHandle->setTitle(mTitle.getString() + " - " + floaterp->getTitle());
}
// </FS:TS>
}
}
@ -289,6 +305,13 @@ void LLMultiFloater::removeFloater(LLFloater* floaterp)
if (!floaterp || floaterp->getHost() != this )
return;
// <FS> Update torn off status and add title bar
floaterp->getDragHandle()->setTitleVisible(TRUE);
LLRect rect = floaterp->getRect();
rect.mTop += floaterp->getHeaderHeight();
floaterp->setRect(rect);
// </FS>
floater_data_map_t::iterator found_data_it = mFloaterDataMap.find(floaterp->getHandle());
if (found_data_it != mFloaterDataMap.end())
{
@ -438,9 +461,22 @@ void LLMultiFloater::onTabSelected()
if (floaterp)
{
tabOpen(floaterp, true);
// <FS> Update torn off status and add title bar
mDragHandle->setTitle(mTitle.getString() + " - " + floaterp->getTitle());
}
}
// <FS> Update torn off status and add title bar
void LLMultiFloater::setTabContainer(LLTabContainer* tab_container)
{
if (!mTabContainer)
{
mTabContainer = tab_container;
mTabContainer->setCommitCallback(boost::bind(&LLMultiFloater::onTabSelected, this));
}
}
// </FS>
void LLMultiFloater::setCanResize(BOOL can_resize)
{
LLFloater::setCanResize(can_resize);
@ -467,7 +503,10 @@ BOOL LLMultiFloater::postBuild()
return TRUE;
}
mTabContainer = getChild<LLTabContainer>("Preview Tabs");
// <FS> Update torn off status and add title bar
//mTabContainer = getChild<LLTabContainer>("Preview Tabs");
setTabContainer(getChild<LLTabContainer>("Preview Tabs"));
// </FS>
setCanResize(mResizable);
return TRUE;

View File

@ -71,8 +71,8 @@ public:
virtual void setFloaterFlashing(LLFloater* floaterp, BOOL flashing);
virtual BOOL closeAllFloaters(); //Returns FALSE if the floater could not be closed due to pending confirmation dialogs
// <FS> Update torn off status and add title bar
void setTabContainer(LLTabContainer* tab_container) { if (!mTabContainer) mTabContainer = tab_container; } // LL Code
//void setTabContainer(LLTabContainer* tab_container); // FS Code - CHUI merge
//void setTabContainer(LLTabContainer* tab_container) { if (!mTabContainer) mTabContainer = tab_container; } // LL Code
void setTabContainer(LLTabContainer* tab_container);
// </FS> Update torn off status and add title bar
void onTabSelected();