PageRenderTime 2ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/newview/llsidetraypanelcontainer.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 93 lines | 44 code | 12 blank | 37 comment | 2 complexity | 6face892c6c2b72e4632d2d4e516f96b MD5 | raw file
 1/** 
 2* @file llsidetraypanelcontainer.cpp
 3* @brief LLSideTrayPanelContainer implementation
 4*
 5* $LicenseInfo:firstyear=2001&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#include "llsidetraypanelcontainer.h"
29
30static LLDefaultChildRegistry::Register<LLSideTrayPanelContainer> r2("panel_container");
31
32std::string LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME = "sub_panel_name";
33
34LLSideTrayPanelContainer::Params::Params()
35:	default_panel_name("default_panel_name")
36{
37	// Always hide tabs.
38	changeDefault(hide_tabs, true);
39}
40
41LLSideTrayPanelContainer::LLSideTrayPanelContainer(const Params& p)
42 : LLTabContainer(p)
43 , mDefaultPanelName(p.default_panel_name)
44{
45}
46
47void LLSideTrayPanelContainer::onOpen(const LLSD& key)
48{
49	// Select specified panel and save navigation history.
50	if(key.has(PARAM_SUB_PANEL_NAME))
51	{
52		//*NOTE dzaporozhan
53		// Navigation history is not used after fix for EXT-3186,
54		// openPreviousPanel() always opens default panel
55
56		// Save panel navigation history
57		std::string panel_name = key[PARAM_SUB_PANEL_NAME];
58
59		selectTabByName(panel_name);
60	}
61	// Will reopen current panel if no panel name was passed.
62	getCurrentPanel()->onOpen(key);
63}
64
65void LLSideTrayPanelContainer::openPanel(const std::string& panel_name, const LLSD& key)
66{
67	LLSD combined_key = key;
68	combined_key[PARAM_SUB_PANEL_NAME] = panel_name;
69	onOpen(combined_key);
70}
71
72void LLSideTrayPanelContainer::openPreviousPanel()
73{
74	if(!mDefaultPanelName.empty())
75	{
76		selectTabByName(mDefaultPanelName);
77	}
78	else
79	{
80		selectTab(0);
81	}
82}
83
84BOOL LLSideTrayPanelContainer::handleKeyHere(KEY key, MASK mask)
85{
86	// No key press handling code for Panel Container - this disables
87	// Tab Container's Alt + Left/Right Button tab switching.
88	
89	// Let default handler process key presses, don't simply return TRUE or FALSE
90	// as this may brake some functionality as it did with Copy/Paste for 
91	// text_editor (ticket EXT-642).
92	return LLPanel::handleKeyHere(key, mask);
93}