libt3widget
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
mouse.h
1 /* Copyright (C) 2012 G.P. Halkes
2  This program is free software: you can redistribute it and/or modify
3  it under the terms of the GNU General Public License version 3, as
4  published by the Free Software Foundation.
5 
6  This program is distributed in the hope that it will be useful,
7  but WITHOUT ANY WARRANTY; without even the implied warranty of
8  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  GNU General Public License for more details.
10 
11  You should have received a copy of the GNU General Public License
12  along with this program. If not, see <http://www.gnu.org/licenses/>.
13 */
14 #ifndef T3_WIDGET_MOUSE_H
15 #define T3_WIDGET_MOUSE_H
16 
17 #include <t3window/window.h>
18 #include <t3widget/widget_api.h>
19 
20 namespace t3_widget {
21 
23 struct mouse_event_t {
24  t3_window_t *window;
25  short type,
26  x,
27  y,
28  previous_button_state,
29  button_state,
30  modifier_state;
31 };
32 
33 enum {
34  EMOUSE_BUTTON_LEFT = (1<<0),
35  EMOUSE_BUTTON_MIDDLE = (1<<1),
36  EMOUSE_BUTTON_RIGHT = (1<<2),
37  EMOUSE_SCROLL_UP = (1<<3),
38  EMOUSE_SCROLL_DOWN = (1<<4),
39  EMOUSE_CLICKED_LEFT = (1<<5),
40  EMOUSE_CLICKED_MIDDLE = (1<<6),
41  EMOUSE_CLICKED_RIGHT = (1<<7),
42  EMOUSE_DOUBLE_CLICKED_LEFT = (1<<8),
43  EMOUSE_DOUBLE_CLICKED_MIDDLE = (1<<9),
44  EMOUSE_DOUBLE_CLICKED_RIGHT = (1<<10),
45  EMOUSE_TRIPLE_CLICKED_LEFT = (1<<11),
46  EMOUSE_TRIPLE_CLICKED_MIDDLE = (1<<12),
47  EMOUSE_TRIPLE_CLICKED_RIGHT = (1<<13),
48  EMOUSE_ALL_BUTTONS = EMOUSE_BUTTON_LEFT | EMOUSE_BUTTON_MIDDLE | EMOUSE_BUTTON_RIGHT | EMOUSE_SCROLL_UP | EMOUSE_SCROLL_DOWN,
49  EMOUSE_ALL_BUTTONS_COUNT = 5,
50  EMOUSE_CLICK_BUTTONS_COUNT = 3,
51  EMOUSE_CLICK_BUTTONS = EMOUSE_BUTTON_LEFT | EMOUSE_BUTTON_MIDDLE | EMOUSE_BUTTON_RIGHT,
52 };
53 
54 enum {
55  EMOUSE_SHIFT = (1<<0),
56  EMOUSE_META = (1<<1),
57  EMOUSE_CTRL = (1<<2),
58 };
59 
60 enum {
61  EMOUSE_BUTTON_PRESS,
62  EMOUSE_BUTTON_RELEASE,
63  EMOUSE_MOTION,
64 
65  /* Bit to set when reporting events outside the grabing window. */
66  EMOUSE_OUTSIDE_GRAB = (1<<14)
67 };
68 
70 T3_WIDGET_API mouse_event_t read_mouse_event(void);
71 }; // namespace
72 #endif