PageRenderTime 61ms CodeModel.GetById 20ms app.highlight 4ms RepoModel.GetById 16ms app.codeStats 0ms

/indra/newview/llsidetraypanelcontainer.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 96 lines | 24 code | 13 blank | 59 comment | 0 complexity | 04c787c0f3be6ac1bfba5bc7a6670ac1 MD5 | raw file
 1/** 
 2* @file llsidetraypanelcontainer.h
 3* @brief LLSideTrayPanelContainer class declaration
 4*
 5* $LicenseInfo:firstyear=2009&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#ifndef LL_LLSIDETRAY_PANEL_CONTAINER_H
28#define LL_LLSIDETRAY_PANEL_CONTAINER_H
29
30#include "lltabcontainer.h"
31
32/**
33* LLSideTrayPanelContainer class acts like LLTabContainer with invisible tabs.
34* It is designed to make panel switching easier, avoid setVisible(TRUE) setVisible(FALSE)
35* calls and related workarounds.
36* use onOpen to open sub panel, pass the name of panel to open
37* in key[PARAM_SUB_PANEL_NAME].
38* LLSideTrayPanelContainer also implements panel navigation history - it allows to 
39* open previous or next panel if navigation history is available(after user 
40* has opened two or more panels). *NOTE - only back navigation is implemented so far.
41*/
42class LLSideTrayPanelContainer : public LLTabContainer
43{
44public:
45
46	struct Params :	public LLInitParam::Block<Params, LLTabContainer::Params>
47	{
48		Optional<std::string> default_panel_name;
49		Params();
50	};
51
52	/**
53	* Opens sub panel
54	* @param key - params to be passed to panel, use key[PARAM_SUB_PANEL_NAME]
55	* to specify panel name to be opened.
56	*/
57	/*virtual*/ void onOpen(const LLSD& key);
58
59	/**
60	 * Opens given subpanel.
61	 */
62	void openPanel(const std::string& panel_name, const LLSD& key = LLSD::emptyMap());
63
64	/**
65	* Opens previous panel from panel navigation history.
66	*/
67	void openPreviousPanel();
68
69	/**
70	* Overrides LLTabContainer::handleKeyHere to disable panel switch on 
71	* Alt + Left/Right button press.
72	*/
73	BOOL handleKeyHere(KEY key, MASK mask);
74
75	/**
76	* Name of parameter that stores panel name to open.
77	*/
78	static std::string PARAM_SUB_PANEL_NAME;
79
80protected:
81	LLSideTrayPanelContainer(const Params& p);
82	friend class LLUICtrlFactory;
83
84	/**
85	* std::string - name of panel
86	* S32 - index of previous panel
87	* *NOTE - no forward navigation implemented yet
88	*/
89	typedef std::map<std::string, S32> panel_navigation_history_t;
90
91	// Navigation history
92	panel_navigation_history_t mPanelHistory;
93	std::string mDefaultPanelName;
94};
95
96#endif //LL_LLSIDETRAY_PANEL_CONTAINER_H