diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llui/lldraghandle.h | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/linden/indra/llui/lldraghandle.h b/linden/indra/llui/lldraghandle.h new file mode 100644 index 0000000..5344358 --- /dev/null +++ b/linden/indra/llui/lldraghandle.h | |||
@@ -0,0 +1,117 @@ | |||
1 | /** | ||
2 | * @file lldraghandle.h | ||
3 | * @brief LLDragHandle base class | ||
4 | * | ||
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | // A widget for dragging a view around the screen using the mouse. | ||
29 | |||
30 | #ifndef LL_DRAGHANDLE_H | ||
31 | #define LL_DRAGHANDLE_H | ||
32 | |||
33 | #include "llview.h" | ||
34 | #include "v4color.h" | ||
35 | #include "llrect.h" | ||
36 | #include "llcoord.h" | ||
37 | |||
38 | class LLTextBox; | ||
39 | |||
40 | class LLDragHandle : public LLView | ||
41 | { | ||
42 | public: | ||
43 | LLDragHandle(const LLString& name, const LLRect& rect, const LLString& title ); | ||
44 | |||
45 | virtual void setValue(const LLSD& value); | ||
46 | |||
47 | void setForeground(BOOL b) { mForeground = b; } | ||
48 | void setMaxTitleWidth(S32 max_width) {mMaxTitleWidth = llmin(max_width, mMaxTitleWidth); } | ||
49 | void setTitleVisible(BOOL visible); | ||
50 | |||
51 | virtual void setTitle( const LLString& title ) = 0; | ||
52 | virtual const LLString& getTitle() const = 0; | ||
53 | virtual void draw() = 0; | ||
54 | virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE) = 0; | ||
55 | |||
56 | virtual BOOL handleHover(S32 x, S32 y, MASK mask); | ||
57 | virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); | ||
58 | virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); | ||
59 | |||
60 | protected: | ||
61 | S32 mDragLastScreenX; | ||
62 | S32 mDragLastScreenY; | ||
63 | S32 mLastMouseScreenX; | ||
64 | S32 mLastMouseScreenY; | ||
65 | LLCoordGL mLastMouseDir; | ||
66 | LLColor4 mDragHighlightColor; | ||
67 | LLColor4 mDragShadowColor; | ||
68 | LLTextBox* mTitleBox; | ||
69 | S32 mMaxTitleWidth; | ||
70 | BOOL mForeground; | ||
71 | |||
72 | // Pixels near the edge to snap floaters. | ||
73 | static S32 sSnapMargin; | ||
74 | }; | ||
75 | |||
76 | |||
77 | // Use this one for traditional top-of-window draggers | ||
78 | class LLDragHandleTop | ||
79 | : public LLDragHandle | ||
80 | { | ||
81 | public: | ||
82 | LLDragHandleTop(const LLString& name, const LLRect& rect, const LLString& title ); | ||
83 | |||
84 | virtual EWidgetType getWidgetType() const; | ||
85 | virtual LLString getWidgetTag() const; | ||
86 | |||
87 | virtual void setTitle( const LLString& title ); | ||
88 | virtual const LLString& getTitle() const; | ||
89 | virtual void draw(); | ||
90 | virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); | ||
91 | |||
92 | private: | ||
93 | void reshapeTitleBox(); | ||
94 | }; | ||
95 | |||
96 | |||
97 | // Use this for left-side, vertical text draggers | ||
98 | class LLDragHandleLeft | ||
99 | : public LLDragHandle | ||
100 | { | ||
101 | public: | ||
102 | LLDragHandleLeft(const LLString& name, const LLRect& rect, const LLString& title ); | ||
103 | |||
104 | virtual EWidgetType getWidgetType() const; | ||
105 | virtual LLString getWidgetTag() const; | ||
106 | |||
107 | virtual void setTitle( const LLString& title ); | ||
108 | virtual const LLString& getTitle() const; | ||
109 | virtual void draw(); | ||
110 | virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); | ||
111 | |||
112 | }; | ||
113 | |||
114 | const S32 DRAG_HANDLE_HEIGHT = 16; | ||
115 | const S32 DRAG_HANDLE_WIDTH = 16; | ||
116 | |||
117 | #endif // LL_DRAGHANDLE_H | ||