1 /*      _______   __   __   __   ______   __   __   _______   __   __
2  *     / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___  /\ /  |\/ /\
3  *    / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
4  *   / / /__   / / // / // / // / /    / ___  / // ___  / // /| ' / /
5  *  / /_// /\ / /_// / // / // /_/_   / / // / // /\_/ / // / |  / /
6  * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
7  * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
8  *
9  * Copyright (c) 2004, 2005 darkbits                        Js_./
10  * Per Larsson a.k.a finalman                          _RqZ{a<^_aa
11  * Olof Naess�n a.k.a jansem/yakslem                _asww7!uY`>  )\a//
12  *                                                 _Qhm`] _f "'c  1!5m
13  * Visit: http://guichan.darkbits.org             )Qk<P ` _: :+' .'  "{[
14  *                                               .)j(] .d_/ '-(  P .   S
15  * License: (BSD)                                <Td/Z <fP"5(\"??"\a.  .L
16  * Redistribution and use in source and          _dV>ws?a-?'      ._/L  #'
17  * binary forms, with or without                 )4d[#7r, .   '     )d`)[
18  * modification, are permitted provided         _Q-5'5W..j/?'   -?!\)cam'
19  * that the following conditions are met:       j<<WP+k/);.        _W=j f
20  * 1. Redistributions of source code must       .$%w\/]Q  . ."'  .  mj$
21  *    retain the above copyright notice,        ]E.pYY(Q]>.   a     J@\
22  *    this list of conditions and the           j(]1u<sE"L,. .   ./^ ]{a
23  *    following disclaimer.                     4'_uomm\.  )L);-4     (3=
24  * 2. Redistributions in binary form must        )_]X{Z('a_"a7'<a"a,  ]"[
25  *    reproduce the above copyright notice,       #}<]m7`Za??4,P-"'7. ).m
26  *    this list of conditions and the            ]d2e)Q(<Q(  ?94   b-  LQ/
27  *    following disclaimer in the                <B!</]C)d_, '(<' .f. =C+m
28  *    documentation and/or other materials      .Z!=J ]e []('-4f _ ) -.)m]'
29  *    provided with the distribution.          .w[5]' _[ /.)_-"+?   _/ <W"
30  * 3. Neither the name of Guichan nor the      :$we` _! + _/ .        j?
31  *    names of its contributors may be used     =3)= _f  (_yQmWW$#(    "
32  *    to endorse or promote products derived     -   W,  sQQQQmZQ#Wwa]..
33  *    from this software without specific        (js, \[QQW$QWW#?!V"".
34  *    prior written permission.                    ]y:.<\..          .
35  *                                                 -]n w/ '         [.
36  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT       )/ )/           !
37  * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY         <  (; sac    ,    '
38  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,               ]^ .-  %
39  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF            c <   r
40  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR            aga<  <La
41  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE          5%  )P'-3L
42  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR        _bQf` y`..)a
43  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,          ,J?4P'.P"_(\?d'.,
44  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES               _Pa,)!f/<[]/  ?"
45  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT      _2-..:. .r+_,.. .
46  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     ?a.<%"'  " -'.a_ _,
47  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION)                     ^
48  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
49  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
50  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
51  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
52  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53  */
54 
55 #ifndef GCN_MOUSEINPUT_HPP
56 #define GCN_MOUSEINPUT_HPP
57 
58 #include "guichan/platform.h"
59 
60 namespace gcn
61 {
62 
63     /**
64      * Internal class representing mouse input. Generally you won't have to
65      * bother using this class.
66      */
67     class GCN_CORE_DECLSPEC MouseInput
68     {
69     public:
70 
71         /**
72          * Constructor.
73          */
MouseInput()74         MouseInput(){};
75 
76         /**
77          * Constructor.
78          *
79          * @param button the button pressed.
80          * @param type the type of input.
81          * @param mousex the mouse x coordinate.
82          * @param mousey the mouse y coordinate.
83          * @param timeStamp the mouse inputs time stamp.
84          */
85         MouseInput(int button, int type, int mousex, int mousey, int timeStamp);
86 
87         /**
88          * Sets the input type.
89          *
90          * @param type the type of input.
91          */
92         void setType(int type);
93 
94         /**
95          * Gets the input type.
96          *
97          * @return the input type.
98          */
99         int getType() const;
100 
101         /**
102          * Sets the button pressed.
103          *
104          * @param button the button pressed.
105          */
106         void setButton(int button);
107 
108         /**
109          * Gets the button pressed.
110          *
111          * @return the button pressed.
112          */
113         int getButton() const;
114 
115         /**
116          * Sets the timestamp for the input.
117          *
118          * @param timeStamp the timestamp of the input.
119          */
120         void setTimeStamp(int timeStamp);
121 
122         /**
123          * Gets the time stamp of the input.
124          *
125          * @return the time stamp of the input.
126          */
127         int getTimeStamp() const;
128 
129         /**
130          * Enum with mouse input values.
131          */
132         enum
133         {
134             EMPTY = 0,
135             LEFT,
136             RIGHT,
137             MIDDLE,
138             WHEEL_UP,
139             WHEEL_DOWN,
140             PRESS,
141             RELEASE,
142             MOTION
143         };
144 
145         int x, y;
146 
147     protected:
148         int mType;
149         int mButton;
150         int mTimeStamp;
151     };
152 }
153 
154 #endif // end GCN_MOUSEINPUT_HPP
155