PageRenderTime 103ms CodeModel.GetById 61ms app.highlight 4ms RepoModel.GetById 36ms app.codeStats 0ms

/indra/newview/llfloatersidepanelcontainer.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 81 lines | 27 code | 11 blank | 43 comment | 1 complexity | 4f2ab5cd106d9b0406b87ee2f2a28418 MD5 | raw file
 1/** 
 2 * @file llfloatersidepanelcontainer.h
 3 * @brief LLFloaterSidePanelContainer class
 4 *
 5 *
 6 * $LicenseInfo:firstyear=2011&license=viewerlgpl$
 7 * Second Life Viewer Source Code
 8 * Copyright (C) 2011, Linden Research, Inc.
 9 * 
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation;
13 * version 2.1 of the License only.
14 * 
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 * Lesser General Public License for more details.
19 * 
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
23 * 
24 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
25 * $/LicenseInfo$
26 */
27
28#ifndef LL_LLFLOATERSIDEPANELCONTAINER_H
29#define LL_LLFLOATERSIDEPANELCONTAINER_H
30
31#include "llfloater.h"
32
33/**
34 * Class LLFloaterSidePanelContainer
35 *
36 * Provides an interface for all former Side Tray panels.
37 *
38 * This class helps to make sure that clicking a floater containing the side panel
39 * doesn't make transient floaters (e.g. IM windows) hide, so that it's possible to
40 * drag an inventory item from My Inventory window to a docked IM window,
41 * i.e. share the item (see VWR-22891).
42 */
43class LLFloaterSidePanelContainer : public LLFloater
44{
45private:
46	static const std::string sMainPanelName;
47
48public:
49	LLFloaterSidePanelContainer(const LLSD& key, const Params& params = getDefaultParams());
50	~LLFloaterSidePanelContainer();
51
52	/*virtual*/ void onOpen(const LLSD& key);
53
54	LLPanel* openChildPanel(const std::string& panel_name, const LLSD& params);
55
56	static void showPanel(const std::string& floater_name, const LLSD& key);
57
58	static void showPanel(const std::string& floater_name, const std::string& panel_name, const LLSD& key);
59	
60	static LLPanel* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName);
61	
62	/**
63	 * Gets the panel of given type T (doesn't show it or do anything else with it).
64	 *
65	 * @param floater_name a string specifying the floater to be searched for a child panel.
66	 * @param panel_name a string specifying the child panel to get.
67	 * @returns a pointer to the panel of given type T.
68	 */
69	template <typename T>
70	static T* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName)
71	{
72		T* panel = dynamic_cast<T*>(getPanel(floater_name, panel_name));
73		if (!panel)
74		{
75			llwarns << "Child named \"" << panel_name << "\" of type " << typeid(T*).name() << " not found" << llendl;
76		}
77		return panel;
78	}
79};
80
81#endif // LL_LLFLOATERSIDEPANELCONTAINER_H