FIRE-3651, Windows hosted in contacts floater share titlebar, by Satomi Ahn

Arrehn 2011-10-29 11:45:02 -04:00
parent 4877e0f602
commit bb7e2458b3
6 changed files with 29 additions and 17 deletions

View File

@ -1612,16 +1612,12 @@ void LLFloater::onClickTearOff(LLFloater* self)
gFloaterView->adjustToFitScreen(self, FALSE);
// give focus to new window to keep continuity for the user
self->setFocus(TRUE);
self->setTornOff(true);
}
else //Attach to parent.
{
self->storeRectControl();
// save the current size and position -Zi
self->setExpandedRect(self->getRect());
// reset torn off before showing the floater in the new host, so the rect change
// doesn't overwrite our remembered rect. -Zi
self->setTornOff(false);
LLMultiFloater* new_host = (LLMultiFloater*)self->mLastHostHandle.get();
if (new_host)
{
@ -1780,6 +1776,7 @@ void LLFloater::draw()
// draw highlight on title bar to indicate focus. RDW
if(hasFocus()
&& mTornOff
&& !getIsChrome()
&& !getCurrentTitle().empty())
{
@ -2012,6 +2009,7 @@ void LLFloater::updateTitleButtons()
mButtons[i]->setVisible(TRUE);
// the restore button should have a tab stop so that it takes action when you Ctrl-Tab to a minimized floater
mButtons[i]->setTabStop(i == BUTTON_RESTORE);
sendChildToFront(mButtons[i]);
}
else
{

View File

@ -31,6 +31,7 @@
#include "llmultifloater.h"
#include "llresizehandle.h"
#include "lldraghandle.h"
//
// LLMultiFloater
@ -55,7 +56,6 @@ void LLMultiFloater::buildTabContainer()
p.name(std::string("Preview Tabs"));
p.rect(LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - floater_header_size, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0));
p.follows.flags(FOLLOWS_ALL);
p.commit_callback.function(boost::bind(&LLMultiFloater::onTabSelected, this));
p.tab_position(mTabPos);
// remove existing tab container
@ -66,8 +66,7 @@ void LLMultiFloater::buildTabContainer()
mTabContainer = NULL;
}
mTabContainer = LLUICtrlFactory::create<LLTabContainer>(p);
addChild(mTabContainer);
addChild(LLUICtrlFactory::create<LLTabContainer>(p));
if (isResizable())
{
@ -197,6 +196,12 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater,
floater_data.mCanMinimize = floaterp->isMinimizeable();
floater_data.mCanResize = floaterp->isResizable();
// update torn off status and remove title bar
floaterp->setTornOff(FALSE);
floaterp->setTitleVisible(FALSE);
LLRect rect = floaterp->getRect();
rect.mTop -= floaterp->getHeaderHeight();
floaterp->setRect(rect);
// remove minimize and close buttons
floaterp->setCanMinimize(FALSE);
floaterp->setCanResize(FALSE);
@ -294,6 +299,13 @@ void LLMultiFloater::removeFloater(LLFloater* floaterp)
if (!floaterp || floaterp->getHost() != this )
return;
// update torn off status and add title bar
floaterp->setTornOff(TRUE);
floaterp->setTitleVisible(TRUE);
LLRect rect = floaterp->getRect();
rect.mTop += floaterp->getHeaderHeight();
floaterp->setRect(rect);
floater_data_map_t::iterator found_data_it = mFloaterDataMap.find(floaterp->getHandle());
if (found_data_it != mFloaterDataMap.end())
{
@ -439,6 +451,16 @@ void LLMultiFloater::onTabSelected()
if (floaterp)
{
tabOpen(floaterp, true);
mDragHandle->setTitle(mTitle.getString() + " - " + floaterp->getTitle());
}
}
void LLMultiFloater::setTabContainer(LLTabContainer* tab_container)
{
if (!mTabContainer)
{
mTabContainer = tab_container;
mTabContainer->setCommitCallback(boost::bind(&LLMultiFloater::onTabSelected, this));
}
}
@ -468,7 +490,7 @@ BOOL LLMultiFloater::postBuild()
return TRUE;
}
mTabContainer = getChild<LLTabContainer>("Preview Tabs");
setTabContainer(getChild<LLTabContainer>("Preview Tabs"));
setCanResize(mResizable);
return TRUE;

View File

@ -70,7 +70,7 @@ 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
void setTabContainer(LLTabContainer* tab_container) { if (!mTabContainer) mTabContainer = tab_container; }
void setTabContainer(LLTabContainer* tab_container);
void onTabSelected();
virtual void updateResizeLimits();

View File

@ -181,8 +181,6 @@ void FSFloaterContacts::onOpen(const LLSD& key)
setHost(NULL);
// reparent to floater view
gFloaterView->addChild(this);
// and remember we are torn off
setTornOff(TRUE);
}
else
{

View File

@ -90,12 +90,9 @@ void LLIMFloaterContainer::onOpen(const LLSD& key)
floater->setHost(NULL);
// reparent to floater view
gFloaterView->addChild(floater);
// and remember we are torn off
floater->setTornOff(TRUE);
}
else
{
floater->setTornOff(FALSE);
LLMultiFloater::showFloater(floater);
}
}

View File

@ -192,12 +192,9 @@ BOOL LLNearbyChat::postBuild()
setHost(NULL);
// reparent the floater to the main view
gFloaterView->addChild(this);
// and remember we are torn off
setTornOff(TRUE);
}
else
{
setTornOff(FALSE);
floater_container->addFloater(this, FALSE);
}
floater_container->setVisible(FALSE);