diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/lltoolcomp.h | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/lltoolcomp.h')
-rw-r--r-- | linden/indra/newview/lltoolcomp.h | 235 |
1 files changed, 235 insertions, 0 deletions
diff --git a/linden/indra/newview/lltoolcomp.h b/linden/indra/newview/lltoolcomp.h new file mode 100644 index 0000000..143b5b1 --- /dev/null +++ b/linden/indra/newview/lltoolcomp.h | |||
@@ -0,0 +1,235 @@ | |||
1 | /** | ||
2 | * @file lltoolcomp.h | ||
3 | * @brief Composite tools | ||
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 | #ifndef LL_TOOLCOMP_H | ||
29 | #define LL_TOOLCOMP_H | ||
30 | |||
31 | #include "lltool.h" | ||
32 | |||
33 | class LLManip; | ||
34 | class LLToolSelectRect; | ||
35 | class LLToolPlacer; | ||
36 | |||
37 | class LLView; | ||
38 | class LLTextBox; | ||
39 | |||
40 | //----------------------------------------------------------------------- | ||
41 | // LLToolComposite | ||
42 | |||
43 | class LLToolComposite : public LLTool | ||
44 | { | ||
45 | public: | ||
46 | LLToolComposite(const LLString& name); | ||
47 | |||
48 | virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0; // Sets the current tool | ||
49 | virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); // Returns to the default tool | ||
50 | virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0; | ||
51 | |||
52 | // Map virtual functions to the currently active internal tool | ||
53 | virtual BOOL handleHover(S32 x, S32 y, MASK mask) { return mCur->handleHover( x, y, mask ); } | ||
54 | virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) { return mCur->handleScrollWheel( x, y, clicks ); } | ||
55 | virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) { return mCur->handleRightMouseDown( x, y, mask ); } | ||
56 | |||
57 | virtual LLViewerObject* getEditingObject() { return mCur->getEditingObject(); } | ||
58 | virtual LLVector3d getEditingPointGlobal() { return mCur->getEditingPointGlobal(); } | ||
59 | virtual BOOL isEditing() { return mCur->isEditing(); } | ||
60 | virtual void stopEditing() { mCur->stopEditing(); mCur = mDefault; } | ||
61 | |||
62 | virtual BOOL clipMouseWhenDown() { return mCur->clipMouseWhenDown(); } | ||
63 | |||
64 | virtual void handleSelect(); | ||
65 | virtual void handleDeselect() { mCur->handleDeselect(); mCur = mDefault; mSelected = FALSE; } | ||
66 | |||
67 | virtual void render() { mCur->render(); } | ||
68 | virtual void draw() { mCur->draw(); } | ||
69 | |||
70 | virtual BOOL handleKey(KEY key, MASK mask) { return mCur->handleKey( key, mask ); } | ||
71 | |||
72 | virtual void onMouseCaptureLost(); | ||
73 | |||
74 | virtual void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const | ||
75 | { mCur->screenPointToLocal(screen_x, screen_y, local_x, local_y); } | ||
76 | |||
77 | virtual void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const | ||
78 | { mCur->localPointToScreen(local_x, local_y, screen_x, screen_y); } | ||
79 | |||
80 | BOOL isSelecting(); | ||
81 | protected: | ||
82 | void setCurrentTool( LLTool* new_tool ); | ||
83 | LLTool* getCurrentTool() { return mCur; } | ||
84 | // In hover handler, call this to auto-switch tools | ||
85 | void setToolFromMask( MASK mask, LLTool *normal ); | ||
86 | |||
87 | protected: | ||
88 | LLTool* mCur; // The tool to which we're delegating. | ||
89 | LLTool* mDefault; | ||
90 | BOOL mSelected; | ||
91 | BOOL mMouseDown; | ||
92 | LLManip* mManip; | ||
93 | LLToolSelectRect* mSelectRect; | ||
94 | |||
95 | public: | ||
96 | static const LLString sNameComp; | ||
97 | }; | ||
98 | |||
99 | |||
100 | //----------------------------------------------------------------------- | ||
101 | // LLToolCompTranslate | ||
102 | |||
103 | class LLToolCompInspect : public LLToolComposite | ||
104 | { | ||
105 | public: | ||
106 | LLToolCompInspect(); | ||
107 | virtual ~LLToolCompInspect(); | ||
108 | |||
109 | // Overridden from LLToolComposite | ||
110 | virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); | ||
111 | virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); | ||
112 | |||
113 | static void pickCallback(S32 x, S32 y, MASK mask); | ||
114 | }; | ||
115 | |||
116 | //----------------------------------------------------------------------- | ||
117 | // LLToolCompTranslate | ||
118 | |||
119 | class LLToolCompTranslate : public LLToolComposite | ||
120 | { | ||
121 | public: | ||
122 | LLToolCompTranslate(); | ||
123 | virtual ~LLToolCompTranslate(); | ||
124 | |||
125 | // Overridden from LLToolComposite | ||
126 | virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); | ||
127 | virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); | ||
128 | virtual BOOL handleHover(S32 x, S32 y, MASK mask); | ||
129 | virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); // Returns to the default tool | ||
130 | virtual void render(); | ||
131 | |||
132 | static void pickCallback(S32 x, S32 y, MASK mask); | ||
133 | }; | ||
134 | |||
135 | //----------------------------------------------------------------------- | ||
136 | // LLToolCompScale | ||
137 | |||
138 | class LLToolCompScale : public LLToolComposite | ||
139 | { | ||
140 | public: | ||
141 | LLToolCompScale(); | ||
142 | virtual ~LLToolCompScale(); | ||
143 | |||
144 | // Overridden from LLToolComposite | ||
145 | virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); | ||
146 | virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); | ||
147 | virtual BOOL handleHover(S32 x, S32 y, MASK mask); | ||
148 | virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); // Returns to the default tool | ||
149 | virtual void render(); | ||
150 | |||
151 | static void pickCallback(S32 x, S32 y, MASK mask); | ||
152 | |||
153 | }; | ||
154 | |||
155 | |||
156 | //----------------------------------------------------------------------- | ||
157 | // LLToolCompRotate | ||
158 | |||
159 | class LLToolCompRotate : public LLToolComposite | ||
160 | { | ||
161 | public: | ||
162 | LLToolCompRotate(); | ||
163 | virtual ~LLToolCompRotate(); | ||
164 | |||
165 | // Overridden from LLToolComposite | ||
166 | virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); | ||
167 | virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); | ||
168 | virtual BOOL handleHover(S32 x, S32 y, MASK mask); | ||
169 | virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); | ||
170 | virtual void render(); | ||
171 | |||
172 | static void pickCallback(S32 x, S32 y, MASK mask); | ||
173 | |||
174 | protected: | ||
175 | }; | ||
176 | |||
177 | //----------------------------------------------------------------------- | ||
178 | // LLToolCompCreate | ||
179 | |||
180 | class LLToolCompCreate : public LLToolComposite | ||
181 | { | ||
182 | public: | ||
183 | LLToolCompCreate(); | ||
184 | virtual ~LLToolCompCreate(); | ||
185 | |||
186 | // Overridden from LLToolComposite | ||
187 | virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); | ||
188 | virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); | ||
189 | virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); | ||
190 | |||
191 | static void pickCallback(S32 x, S32 y, MASK mask); | ||
192 | protected: | ||
193 | LLToolPlacer* mPlacer; | ||
194 | BOOL mObjectPlacedOnMouseDown; | ||
195 | }; | ||
196 | |||
197 | |||
198 | //----------------------------------------------------------------------- | ||
199 | // LLToolCompGun | ||
200 | |||
201 | class LLToolGun; | ||
202 | class LLToolGrab; | ||
203 | class LLToolSelect; | ||
204 | |||
205 | class LLToolCompGun : public LLToolComposite | ||
206 | { | ||
207 | public: | ||
208 | LLToolCompGun(); | ||
209 | virtual ~LLToolCompGun(); | ||
210 | |||
211 | // Overridden from LLToolComposite | ||
212 | virtual BOOL handleHover(S32 x, S32 y, MASK mask); | ||
213 | virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); | ||
214 | virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); | ||
215 | virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); | ||
216 | virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); | ||
217 | virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); | ||
218 | virtual void onMouseCaptureLost(); | ||
219 | virtual void handleSelect(); | ||
220 | virtual void handleDeselect(); | ||
221 | |||
222 | protected: | ||
223 | LLToolGun* mGun; | ||
224 | LLToolGrab* mGrab; | ||
225 | LLTool* mNull; | ||
226 | }; | ||
227 | |||
228 | extern LLToolCompInspect *gToolInspect; | ||
229 | extern LLToolCompTranslate *gToolTranslate; | ||
230 | extern LLToolCompScale *gToolStretch; | ||
231 | extern LLToolCompRotate *gToolRotate; | ||
232 | extern LLToolCompCreate *gToolCreate; | ||
233 | extern LLToolCompGun *gToolGun; | ||
234 | |||
235 | #endif // LL_TOOLCOMP_H | ||