]>
Commit | Line | Data |
---|---|---|
0e097789 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/mousestate.h | |
3 | // Purpose: Declaration of wxMouseState class | |
4 | // Author: Vadim Zeitlin | |
5 | // Created: 2008-09-19 (extracted from wx/utils.h) | |
6 | // RCS-ID: $Id$ | |
7 | // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org> | |
8 | // Licence: wxWindows licence | |
9 | /////////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_MOUSESTATE_H_ | |
12 | #define _WX_MOUSESTATE_H_ | |
13 | ||
14 | #include "wx/kbdstate.h" | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // wxMouseState contains the information about mouse position, buttons and also | |
18 | // key modifiers | |
19 | // ---------------------------------------------------------------------------- | |
20 | ||
21 | // wxMouseState is used to hold information about button and modifier state | |
22 | // and is what is returned from wxGetMouseState. | |
23 | class WXDLLIMPEXP_CORE wxMouseState : public wxKeyboardState | |
24 | { | |
25 | public: | |
26 | wxMouseState() | |
dfa569f0 VZ |
27 | : m_leftDown(false), m_middleDown(false), m_rightDown(false), |
28 | m_aux1Down(false), m_aux2Down(false), | |
29 | m_x(0), m_y(0) | |
0e097789 VZ |
30 | { |
31 | } | |
32 | ||
33 | // default copy ctor, assignment operator and dtor are ok | |
34 | ||
35 | ||
36 | // accessors for the mouse position | |
37 | wxCoord GetX() const { return m_x; } | |
38 | wxCoord GetY() const { return m_y; } | |
39 | wxPoint GetPosition() const { return wxPoint(m_x, m_y); } | |
40 | ||
41 | // accessors for the pressed buttons | |
42 | bool LeftDown() const { return m_leftDown; } | |
43 | bool MiddleDown() const { return m_middleDown; } | |
44 | bool RightDown() const { return m_rightDown; } | |
45 | bool Aux1Down() const { return m_aux1Down; } | |
46 | bool Aux2Down() const { return m_aux2Down; } | |
47 | ||
48 | // these functions are mostly used by wxWidgets itself | |
49 | void SetX(wxCoord x) { m_x = x; } | |
50 | void SetY(wxCoord y) { m_y = y; } | |
51 | ||
52 | void SetLeftDown(bool down) { m_leftDown = down; } | |
53 | void SetMiddleDown(bool down) { m_middleDown = down; } | |
54 | void SetRightDown(bool down) { m_rightDown = down; } | |
55 | void SetAux1Down(bool down) { m_aux1Down = down; } | |
56 | void SetAux2Down(bool down) { m_aux2Down = down; } | |
57 | ||
58 | private: | |
59 | bool m_leftDown : 1; | |
60 | bool m_middleDown : 1; | |
61 | bool m_rightDown : 1; | |
62 | bool m_aux1Down : 1; | |
63 | bool m_aux2Down : 1; | |
64 | ||
65 | wxCoord m_x, | |
66 | m_y; | |
67 | }; | |
68 | ||
69 | #endif // _WX_MOUSESTATE_H_ | |
70 |