comparison ext/guichan-0.8.1/include/guichan/mouseinput.hpp @ 0:4a0efb7baf70

* Datasets becomes the new trunk and retires after that :-)
author mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
date Sun, 29 Jun 2008 18:44:17 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4a0efb7baf70
1 /* _______ __ __ __ ______ __ __ _______ __ __
2 * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
3 * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
4 * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
5 * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
6 * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
7 * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
8 *
9 * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson
10 *
11 *
12 * Per Larsson a.k.a finalman
13 * Olof Naessén a.k.a jansem/yakslem
14 *
15 * Visit: http://guichan.sourceforge.net
16 *
17 * License: (BSD)
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions
20 * are met:
21 * 1. Redistributions of source code must retain the above copyright
22 * notice, this list of conditions and the following disclaimer.
23 * 2. Redistributions in binary form must reproduce the above copyright
24 * notice, this list of conditions and the following disclaimer in
25 * the documentation and/or other materials provided with the
26 * distribution.
27 * 3. Neither the name of Guichan nor the names of its contributors may
28 * be used to endorse or promote products derived from this software
29 * without specific prior written permission.
30 *
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
37 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
38 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
39 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
40 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 */
43
44 #ifndef GCN_MOUSEINPUT_HPP
45 #define GCN_MOUSEINPUT_HPP
46
47 #include "guichan/platform.hpp"
48
49 namespace gcn
50 {
51
52 /**
53 * Internal class that represents mouse input. Generally you won't have to
54 * bother using this class unless you implement an Input class for
55 * a back end.
56 *
57 * @author Olof Naessén
58 * @author Per Larsson
59 * @since 0.1.0
60 */
61 class GCN_CORE_DECLSPEC MouseInput
62 {
63 public:
64
65 /**
66 * Constructor.
67 */
68 MouseInput() { };
69
70 /**
71 * Constructor.
72 *
73 * @param button The button pressed.
74 * @param type The type of mouse input.
75 * @param x The mouse x coordinate.
76 * @param y The mouse y coordinate.
77 * @param timeStamp The timestamp of the mouse input. Used to
78 * check for double clicks.
79 */
80 MouseInput(unsigned int button,
81 unsigned int type,
82 int x,
83 int y,
84 int timeStamp);
85
86 /**
87 * Sets the type of the mouse input.
88 *
89 * @param type The type of the mouse input. Should be a value from the
90 * mouse event type enum
91 * @see getType
92 * @since 0.1.0
93 */
94 void setType(unsigned int type);
95
96 /**
97 * Gets the type of the mouse input.
98 *
99 * @return The type of the mouse input. A value from the mouse event
100 * type enum.
101 * @see setType
102 * @since 0.1.0
103 */
104 unsigned int getType() const;
105
106 /**
107 * Sets the button pressed.
108 *
109 * @param button The button pressed. Should be one of the values
110 * in the mouse event button enum.
111 * @see getButton.
112 * @since 0.1.0
113 */
114 void setButton(unsigned int button);
115
116 /**
117 * Gets the button pressed.
118 *
119 * @return The button pressed. A value from the mouse event
120 * button enum.
121 * @see setButton
122 * @since 0.1.0
123 */
124 unsigned int getButton() const;
125
126 /**
127 * Sets the timestamp for the mouse input.
128 * Used to check for double clicks.
129 *
130 * @param timeStamp The timestamp of the mouse input.
131 * @see getTimeStamp
132 * @since 0.1.0
133 */
134 void setTimeStamp(int timeStamp);
135
136 /**
137 * Gets the time stamp of the input.
138 * Used to check for double clicks.
139 *
140 * @return The time stamp of the mouse input.
141 * @see setTimeStamp
142 * @since 0.1.0
143 */
144 int getTimeStamp() const;
145
146 /**
147 * Sets the x coordinate of the mouse input.
148 *
149 * @param x The x coordinate of the mouse input.
150 * @see getX
151 * @since 0.6.0
152 */
153 void setX(int x);
154
155 /**
156 * Gets the x coordinate of the mouse input.
157 *
158 * @return The x coordinate of the mouse input.
159 * @see setX
160 * @since 0.6.0
161 */
162 int getX() const;
163
164 /**
165 * Sets the y coordinate of the mouse input.
166 *
167 * @param y The y coordinate of the mouse input.
168 * @see getY
169 * @since 0.6.0
170 */
171 void setY(int y);
172
173 /**
174 * Gets the y coordinate of the mouse input.
175 *
176 * @return The y coordinate of the mouse input.
177 * @see setY
178 * @since 0.6.0
179 */
180 int getY() const;
181
182 /**
183 * Mouse input event types. This enum partially corresponds
184 * to the enum with event types in MouseEvent for easy mapping.
185 */
186 enum
187 {
188 MOVED = 0,
189 PRESSED,
190 RELEASED,
191 WHEEL_MOVED_DOWN,
192 WHEEL_MOVED_UP
193 };
194
195 /**
196 * Mouse button types.
197 */
198 enum
199 {
200 EMPTY = 0,
201 LEFT,
202 RIGHT,
203 MIDDLE
204 };
205
206 protected:
207 /**
208 * Holds the type of the mouse input.
209 */
210 unsigned int mType;
211
212 /**
213 * Holds the button of the mouse input.
214 */
215 unsigned int mButton;
216
217 /**
218 * Holds the timestamp of the mouse input. Used to
219 * check for double clicks.
220 */
221 int mTimeStamp;
222
223 /**
224 * Holds the x coordinate of the mouse input.
225 */
226 int mX;
227
228 /**
229 * Holds the y coordinate of the mouse input.
230 */
231 int mY;
232 };
233 }
234
235 #endif // end GCN_MOUSEINPUT_HPP