aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lljoystickbutton.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/lljoystickbutton.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/lljoystickbutton.h')
-rw-r--r--linden/indra/newview/lljoystickbutton.h187
1 files changed, 187 insertions, 0 deletions
diff --git a/linden/indra/newview/lljoystickbutton.h b/linden/indra/newview/lljoystickbutton.h
new file mode 100644
index 0000000..8d1817a
--- /dev/null
+++ b/linden/indra/newview/lljoystickbutton.h
@@ -0,0 +1,187 @@
1/**
2 * @file lljoystickbutton.h
3 * @brief LLJoystick class definition
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_LLJOYSTICKBUTTON_H
29#define LL_LLJOYSTICKBUTTON_H
30
31#include "llbutton.h"
32#include "llcoord.h"
33
34typedef enum e_joystick_quadrant
35{
36 JQ_ORIGIN,
37 JQ_UP,
38 JQ_DOWN,
39 JQ_LEFT,
40 JQ_RIGHT
41} EJoystickQuadrant;
42
43class LLJoystick
44: public LLButton
45{
46public:
47 LLJoystick(const LLString& name, LLRect rect, const LLString &default_image, const LLString &selected_image, EJoystickQuadrant initial);
48
49 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
50 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
51 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
52
53 virtual void onMouseUp() {}
54 virtual void onHeldDown() = 0;
55 F32 getElapsedHeldDownTime();
56
57 static void onHeldDown(void *userdata); // called by llbutton callback handler
58 void setInitialQuadrant(EJoystickQuadrant initial) { mInitialQuadrant = initial; };
59
60 virtual LLXMLNodePtr getXML(bool save_children = true) const;
61 static LLString nameFromQuadrant(const EJoystickQuadrant quadrant);
62 static EJoystickQuadrant quadrantFromName(const LLString& name);
63 static EJoystickQuadrant selectQuadrant(LLXMLNodePtr node);
64
65
66protected:
67 virtual void updateSlop(); // recompute slop margins
68
69protected:
70 EJoystickQuadrant mInitialQuadrant; // mousedown = click in this quadrant
71 LLCoordGL mInitialOffset; // pretend mouse started here
72 LLCoordGL mLastMouse; // where was mouse on last hover event
73 LLCoordGL mFirstMouse; // when mouse clicked, where was it
74 S32 mVertSlopNear; // where the slop regions end
75 S32 mVertSlopFar; // where the slop regions end
76 S32 mHorizSlopNear; // where the slop regions end
77 S32 mHorizSlopFar; // where the slop regions end
78 BOOL mHeldDown;
79 LLFrameTimer mHeldDownTimer;
80};
81
82
83// Turn agent left and right, move forward and back
84class LLJoystickAgentTurn
85: public LLJoystick
86{
87public:
88 LLJoystickAgentTurn(const LLString& name, LLRect rect, const LLString &default_image, const LLString &selected_image, EJoystickQuadrant initial)
89 : LLJoystick(name, rect, default_image, selected_image, initial)
90 { }
91
92 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_JOYSTICK_TURN; }
93 virtual LLString getWidgetTag() const { return LL_JOYSTICK_TURN; }
94
95 virtual void onHeldDown();
96
97 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
98
99};
100
101
102// Slide left and right, move forward and back
103class LLJoystickAgentSlide
104: public LLJoystick
105{
106public:
107 LLJoystickAgentSlide(const LLString& name, LLRect rect, const LLString &default_image, const LLString &selected_image, EJoystickQuadrant initial)
108 : LLJoystick(name, rect, default_image, selected_image, initial)
109 { }
110
111 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_JOYSTICK_SLIDE; }
112 virtual LLString getWidgetTag() const { return LL_JOYSTICK_SLIDE; }
113
114
115 virtual void onHeldDown();
116 virtual void onMouseUp();
117
118 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
119};
120
121
122// Rotate camera around the focus point
123class LLJoystickCameraRotate
124: public LLJoystick
125{
126public:
127 LLJoystickCameraRotate(const LLString& name, LLRect rect, const LLString &out_img, const LLString &in_img);
128
129 virtual void setToggleState( BOOL left, BOOL top, BOOL right, BOOL bottom );
130
131 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
132 virtual void onHeldDown();
133 virtual void draw();
134
135protected:
136 F32 getOrbitRate();
137 virtual void updateSlop();
138 void drawRotatedImage( LLImageGL* image, S32 rotations );
139
140protected:
141 BOOL mInLeft;
142 BOOL mInTop;
143 BOOL mInRight;
144 BOOL mInBottom;
145};
146
147
148// Track the camera focus point forward/backward and side to side
149class LLJoystickCameraTrack
150: public LLJoystickCameraRotate
151{
152public:
153 LLJoystickCameraTrack(const LLString& name, LLRect rect, const LLString &out_img, const LLString &in_img)
154 : LLJoystickCameraRotate(name, rect, out_img, in_img)
155 { }
156
157 virtual void onHeldDown();
158};
159
160
161// Zoom the camera in and out
162class LLJoystickCameraZoom
163: public LLJoystick
164{
165public:
166 LLJoystickCameraZoom(const LLString& name, LLRect rect, const LLString &out_img, const LLString &plus_in_img, const LLString &minus_in_img);
167
168 virtual void setToggleState( BOOL top, BOOL bottom );
169
170 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
171 virtual void onHeldDown();
172 virtual void draw();
173
174protected:
175 virtual void updateSlop();
176 F32 getOrbitRate();
177
178protected:
179 BOOL mInTop;
180 BOOL mInBottom;
181 LLPointer<LLViewerImage> mPlusInImage;
182 LLPointer<LLViewerImage> mMinusInImage;
183};
184
185
186
187#endif // LL_LLJOYSTICKBUTTON_H