aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lltoolcomp.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/lltoolcomp.h
parentREADME.txt (diff)
downloadmeta-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.h235
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
33class LLManip;
34class LLToolSelectRect;
35class LLToolPlacer;
36
37class LLView;
38class LLTextBox;
39
40//-----------------------------------------------------------------------
41// LLToolComposite
42
43class LLToolComposite : public LLTool
44{
45public:
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();
81protected:
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
87protected:
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
95public:
96 static const LLString sNameComp;
97};
98
99
100//-----------------------------------------------------------------------
101// LLToolCompTranslate
102
103class LLToolCompInspect : public LLToolComposite
104{
105public:
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
119class LLToolCompTranslate : public LLToolComposite
120{
121public:
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
138class LLToolCompScale : public LLToolComposite
139{
140public:
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
159class LLToolCompRotate : public LLToolComposite
160{
161public:
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
174protected:
175};
176
177//-----------------------------------------------------------------------
178// LLToolCompCreate
179
180class LLToolCompCreate : public LLToolComposite
181{
182public:
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);
192protected:
193 LLToolPlacer* mPlacer;
194 BOOL mObjectPlacedOnMouseDown;
195};
196
197
198//-----------------------------------------------------------------------
199// LLToolCompGun
200
201class LLToolGun;
202class LLToolGrab;
203class LLToolSelect;
204
205class LLToolCompGun : public LLToolComposite
206{
207public:
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
222protected:
223 LLToolGun* mGun;
224 LLToolGrab* mGrab;
225 LLTool* mNull;
226};
227
228extern LLToolCompInspect *gToolInspect;
229extern LLToolCompTranslate *gToolTranslate;
230extern LLToolCompScale *gToolStretch;
231extern LLToolCompRotate *gToolRotate;
232extern LLToolCompCreate *gToolCreate;
233extern LLToolCompGun *gToolGun;
234
235#endif // LL_TOOLCOMP_H