diff options
Diffstat (limited to 'indra/newview/llsidetray.cpp')
-rw-r--r-- | indra/newview/llsidetray.cpp | 84 |
1 files changed, 49 insertions, 35 deletions
diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 3ec1855484..78890fae93 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -2,31 +2,25 @@ * @file llsidetray.cpp * @brief SideBar implementation * - * $LicenseInfo:firstyear=2009&license=viewergpl$ - * - * Copyright (c) 2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -35,6 +29,7 @@ #include "lltextbox.h" #include "llagentcamera.h" +#include "llappviewer.h" #include "llbottomtray.h" #include "llsidetray.h" #include "llviewerwindow.h" @@ -48,12 +43,15 @@ #include "llfloater.h" //for gFloaterView #include "lliconctrl.h"//for OpenClose tab icon #include "llsidetraypanelcontainer.h" +#include "llscreenchannel.h" +#include "llchannelmanager.h" #include "llwindow.h"//for SetCursor #include "lltransientfloatermgr.h" //#include "llscrollcontainer.h" using namespace std; +using namespace LLNotificationsUI; static LLRootViewRegistry::Register<LLSideTray> t1("side_tray"); static LLDefaultChildRegistry::Register<LLSideTrayTab> t2("sidetray_tab"); @@ -226,15 +224,15 @@ LLSideTrayTab* LLSideTrayTab::createInstance () LLSideTray::Params::Params() : collapsed("collapsed",false), - tab_btn_image_normal("tab_btn_image","sidebar_tab_left.tga"), - tab_btn_image_selected("tab_btn_image_selected","button_enabled_selected_32x128.tga"), + tab_btn_image_normal("tab_btn_image",LLUI::getUIImage("sidebar_tab_left.tga")), + tab_btn_image_selected("tab_btn_image_selected",LLUI::getUIImage("button_enabled_selected_32x128.tga")), default_button_width("tab_btn_width",32), default_button_height("tab_btn_height",32), default_button_margin("tab_btn_margin",0) {} //virtual -LLSideTray::LLSideTray(Params& params) +LLSideTray::LLSideTray(const Params& params) : LLPanel(params) ,mActiveTab(0) ,mCollapsed(false) @@ -272,9 +270,28 @@ BOOL LLSideTray::postBuild() collapseSideBar(); setMouseOpaque(false); + + LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSideTray::handleLoginComplete, this)); + + //EXT-8045 + //connect all already created channels to reflect sidetray collapse/expand + std::vector<LLChannelManager::ChannelElem>& channels = LLChannelManager::getInstance()->getChannelList(); + for(std::vector<LLChannelManager::ChannelElem>::iterator it = channels.begin();it!=channels.end();++it) + { + if ((*it).channel) + { + getCollapseSignal().connect(boost::bind(&LLScreenChannelBase::resetPositionAndSize, (*it).channel, _2)); + } + } return true; } +void LLSideTray::handleLoginComplete() +{ + //reset tab to "home" tab if it was changesd during login process + selectTabByName("sidebar_home"); +} + LLSideTrayTab* LLSideTray::getTab(const std::string& name) { return getChild<LLSideTrayTab>(name,false); @@ -350,10 +367,10 @@ LLButton* LLSideTray::createButton (const std::string& name,const std::string& i bparams.follows.flags (FOLLOWS_LEFT | FOLLOWS_TOP); bparams.rect (rect); bparams.tab_stop(false); - bparams.image_unselected.name(sidetray_params.tab_btn_image_normal); - bparams.image_selected.name(sidetray_params.tab_btn_image_selected); - bparams.image_disabled.name(sidetray_params.tab_btn_image_normal); - bparams.image_disabled_selected.name(sidetray_params.tab_btn_image_selected); + bparams.image_unselected(sidetray_params.tab_btn_image_normal); + bparams.image_selected(sidetray_params.tab_btn_image_selected); + bparams.image_disabled(sidetray_params.tab_btn_image_normal); + bparams.image_disabled_selected(sidetray_params.tab_btn_image_selected); LLButton* button = LLUICtrlFactory::create<LLButton> (bparams); button->setLabel(name); @@ -469,6 +486,9 @@ void LLSideTray::reflectCollapseChange() } gFloaterView->refresh(); + + LLSD new_value = mCollapsed; + mCollapseSignal(this,new_value); } void LLSideTray::arrange() @@ -546,7 +566,6 @@ void LLSideTray::collapseSideBar() //mActiveTab->setVisible(FALSE); reflectCollapseChange(); setFocus( FALSE ); - } void LLSideTray::expandSideBar() @@ -571,7 +590,6 @@ void LLSideTray::expandSideBar() LLButton* btn = btn_it->second; btn->setImageOverlay( mActiveTab->mImageSelected ); } - } void LLSideTray::highlightFocused() @@ -638,6 +656,7 @@ LLPanel* LLSideTray::showPanel (const std::string& panel_name, const LLSD& para { panel->onOpen(params); } + return panel; } } @@ -720,11 +739,6 @@ bool LLSideTray::isPanelActive(const std::string& panel_name) return (panel->getName() == panel_name); } - -// *TODO: Eliminate magic constants. -static const S32 fake_offset = 132; -static const S32 fake_top_offset = 18; - void LLSideTray::updateSidetrayVisibility() { // set visibility of parent container based on collapsed state |