PageRenderTime 30ms CodeModel.GetById 20ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llui/lldockcontrol.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 96 lines | 55 code | 10 blank | 31 comment | 0 complexity | f8720db7fb490d7062b2f683d344fa6a MD5 | raw file
 1/** 
 2 * @file lldockcontrol.h
 3 * @brief Creates a panel of a specific kind for a toast.
 4 *
 5 * $LicenseInfo:firstyear=2003&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_DOCKCONTROL_H
28#define LL_DOCKCONTROL_H
29
30#include "llerror.h"
31#include "llview.h"
32#include "llfloater.h"
33#include "lluiimage.h"
34
35/**
36 * Provides services for docking of specified floater.
37 * This class should be used in case impossibility deriving from LLDockableFloater.
38 */
39class LLDockControl
40{
41public:
42	enum DocAt
43	{
44		TOP,
45		LEFT,
46		RIGHT,
47		BOTTOM
48	};
49
50public:
51	// callback for a function getting a rect valid for control's position
52	typedef boost::function<void (LLRect& )> get_allowed_rect_callback_t;
53
54	LOG_CLASS(LLDockControl);
55	LLDockControl(LLView* dockWidget, LLFloater* dockableFloater,
56			const LLUIImagePtr& dockTongue, DocAt dockAt, get_allowed_rect_callback_t get_rect_callback = NULL);
57	virtual ~LLDockControl();
58
59public:
60	void on();
61	void off();
62	void forceRecalculatePosition();
63	void setDock(LLView* dockWidget);
64	LLView* getDock()
65	{
66		return mDockWidget;
67	}
68	void repositionDockable();
69	void drawToungue();
70	bool isDockVisible();
71
72	// gets a rect that bounds possible positions for a dockable control (EXT-1111)
73	void getAllowedRect(LLRect& rect);
74
75	S32 getTongueWidth() { return mDockTongue->getWidth(); }
76	S32 getTongueHeight() { return mDockTongue->getHeight(); }
77
78private:
79	virtual void moveDockable();
80private:
81	get_allowed_rect_callback_t mGetAllowedRectCallback;
82	bool mEnabled;
83	bool mRecalculateDockablePosition;
84	bool mDockWidgetVisible;
85	DocAt mDockAt;
86	LLView* mDockWidget;
87	LLRect mPrevDockRect;
88	LLRect mRootRect;
89	LLRect mFloaterRect;
90	LLFloater* mDockableFloater;
91	LLUIImagePtr mDockTongue;
92	S32 mDockTongueX;
93	S32 mDockTongueY;
94};
95
96#endif /* LL_DOCKCONTROL_H */