PageRenderTime 52ms CodeModel.GetById 30ms app.highlight 5ms RepoModel.GetById 15ms app.codeStats 0ms

/indra/newview/lltransientfloatermgr.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 91 lines | 43 code | 13 blank | 35 comment | 0 complexity | 37091159cb57cbc4f30a6f3c184d85d9 MD5 | raw file
 1/** 
 2 * @file lltransientfloatermgr.h
 3 * @brief LLFocusMgr base class
 4 *
 5 * $LicenseInfo:firstyear=2002&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_LLTRANSIENTFLOATERMGR_H
28#define LL_LLTRANSIENTFLOATERMGR_H
29
30#include "llui.h"
31#include "llsingleton.h"
32#include "llfloater.h"
33
34class LLTransientFloater;
35
36/**
37 * Provides functionality to hide transient floaters.
38 */
39class LLTransientFloaterMgr: public LLSingleton<LLTransientFloaterMgr>
40{
41protected:
42	LLTransientFloaterMgr();
43	friend class LLSingleton<LLTransientFloaterMgr>;
44
45public:
46	enum ETransientGroup
47	{
48		GLOBAL, DOCKED, IM
49	};
50
51	void registerTransientFloater(LLTransientFloater* floater);
52	void unregisterTransientFloater(LLTransientFloater* floater);
53	void addControlView(ETransientGroup group, LLView* view);
54	void removeControlView(ETransientGroup group, LLView* view);
55	void addControlView(LLView* view);
56	void removeControlView(LLView* view);
57
58private:
59	typedef std::set<LLHandle<LLView> > controls_set_t;
60	typedef std::map<ETransientGroup, controls_set_t > group_controls_t;
61
62	void hideTransientFloaters(S32 x, S32 y);
63	void leftMouseClickCallback(S32 x, S32 y, MASK mask);
64	bool isControlClicked(ETransientGroup group, controls_set_t& set, S32 x, S32 y);
65
66	std::set<LLTransientFloater*> mTransSet;
67
68	group_controls_t mGroupControls;
69};
70
71/**
72 * An abstract class declares transient floater interfaces.
73 */
74class LLTransientFloater
75{
76protected:
77	/**
78	 * Class initialization method.
79	 * Should be called from descendant constructor.
80	 */
81	void init(LLFloater* thiz);
82public:
83	virtual LLTransientFloaterMgr::ETransientGroup getGroup() = 0;
84	bool isTransientDocked() { return mFloater->isDocked(); };
85	void setTransientVisible(BOOL visible) {mFloater->setVisible(visible); }
86
87private:
88	LLFloater* mFloater;
89};
90
91#endif  // LL_LLTRANSIENTFLOATERMGR_H