PageRenderTime 28ms CodeModel.GetById 17ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/lltransientdockablefloater.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 99 lines | 65 code | 9 blank | 25 comment | 13 complexity | 8cb69de208ecd10faad5fa9c571fb3c2 MD5 | raw file
 1/** 
 2 * @file lltransientdockablefloater.cpp
 3 * @brief Creates a panel of a specific kind for a toast
 4 *
 5 * $LicenseInfo:firstyear=2000&license=viewerlgpl$
 6 * Second Life Viewer Source Code
 7 * Copyright (C) 2010, Linden Research, Inc.
 8 * 
 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation;
12 * version 2.1 of the License only.
13 * 
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 * 
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 * 
23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
24 * $/LicenseInfo$
25 */
26
27#include "llviewerprecompiledheaders.h"
28
29#include "lltransientfloatermgr.h"
30#include "lltransientdockablefloater.h"
31#include "llfloaterreg.h"
32
33
34LLTransientDockableFloater::LLTransientDockableFloater(LLDockControl* dockControl, bool uniqueDocking,
35		const LLSD& key, const Params& params) :
36		LLDockableFloater(dockControl, uniqueDocking, key, params)
37{
38	LLTransientFloaterMgr::getInstance()->registerTransientFloater(this);
39	LLTransientFloater::init(this);
40}
41
42LLTransientDockableFloater::~LLTransientDockableFloater()
43{
44	LLTransientFloaterMgr::getInstance()->unregisterTransientFloater(this);
45	LLView* dock = getDockWidget();
46	LLTransientFloaterMgr::getInstance()->removeControlView(
47			LLTransientFloaterMgr::DOCKED, this);
48	if (dock != NULL)
49	{
50		LLTransientFloaterMgr::getInstance()->removeControlView(
51				LLTransientFloaterMgr::DOCKED, dock);
52	}
53}
54
55void LLTransientDockableFloater::setVisible(BOOL visible)
56{
57	LLView* dock = getDockWidget();
58	if(visible && isDocked())
59	{
60		LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, this);
61		if (dock != NULL)
62		{
63			LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, dock);
64		}
65	}
66	else
67	{
68		LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, this);
69		if (dock != NULL)
70		{
71			LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, dock);
72		}
73	}
74
75	LLDockableFloater::setVisible(visible);
76}
77
78void LLTransientDockableFloater::setDocked(bool docked, bool pop_on_undock)
79{
80	LLView* dock = getDockWidget();
81	if(docked)
82	{
83		LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, this);
84		if (dock != NULL)
85		{
86			LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, dock);
87		}
88	}
89	else
90	{
91		LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, this);
92		if (dock != NULL)
93		{
94			LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, dock);
95		}
96	}
97
98	LLDockableFloater::setDocked(docked, pop_on_undock);
99}