input_event.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2015 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 ** Harry Storbacka
28 */
29
30
31 #pragma once
32
33 #include "input_device.h"
34 #include "keys.h"
35 #include "../../Core/Math/point.h"
36
37 namespace clan
38 {
41
43 class InputEvent
44 {
45 public:
47 enum Type
48 {
49 no_key = 0,
50 pressed = 1,
51 released = 2,
52 doubleclick = 3,
53 pointer_moved = 4,
54 axis_moved = 5,
55 proximity_change = 6
56 };
57
60
61 public:
63 InputEvent();
64
65 ~InputEvent();
66
70
71 public:
72
76
77 public:
79 InputCode id;
80
82 int id_offset;
83
90 std::string str;
91
93 Type type;
94
96 InputDevice device;
97
99 Pointf mouse_pos;
100
102 Point mouse_device_pos;
103
105 double axis_pos;
106
110 int repeat_count;
111
113 bool alt;
114 bool shift;
115 bool ctrl;
116
120
121 private:
122
124 };
125
126 }
127
clan::InputEvent::~InputEvent
~InputEvent()
clan
Definition: clanapp.h:35
clan::InputEvent::repeat_count
int repeat_count
The repeat count for this event. Contains the number of times the keystroke has auto-repeated as a re...
Definition: input_event.h:110
clan::InputEvent::proximity_change
Definition: input_event.h:55
clan::InputEvent::InputEvent
InputEvent()
Constructs a 'NoKey' key.
clan::InputEvent::axis_moved
Definition: input_event.h:54
clan::InputEvent::Type
Type
Event types.
Definition: input_event.h:47
clan::InputEvent::released
Definition: input_event.h:51
clan::InputEvent::str
std::string str
Character sequence generated by event. A key press can generate one, none or multiple characters...
Definition: input_event.h:90
clan::InputEvent::id
InputCode id
The exact input.
Definition: input_event.h:79
clan::InputEvent::ctrl
bool ctrl
Definition: input_event.h:115
clan::InputDevice
InputDevice.
Definition: input_device.h:47
clan::InputEvent::axis_pos
double axis_pos
Axis position.
Definition: input_event.h:105
clan::StyleTokenType::string
@ keyword
clan::InputEvent::mouse_device_pos
Point mouse_device_pos
Mouse actual position at event time.
Definition: input_event.h:102
clan::InputEvent::id_offset
int id_offset
Contains the value (0 to x) for certains InputCode types that have a variable output identifier (for ...
Definition: input_event.h:82
clan::InputEvent::no_key
Definition: input_event.h:49
clan::InputCode
InputCode
Definition: input_code.h:46
clan::InputEvent::type
Type type
Event type.
Definition: input_event.h:93
clan::Point
2D (x,y) point structure - Integer
Definition: point.h:62
clan::InputEvent::doubleclick
Definition: input_event.h:52
clan::InputEvent::device
InputDevice device
Device that event originates from.
Definition: input_event.h:96
clan::InputEvent::pointer_moved
Definition: input_event.h:53
clan::InputEvent::pressed
Definition: input_event.h:50
clan::Pointf
2D (x,y) point structure - Float
Definition: point.h:72
clan::InputEvent
Input event class.
Definition: input_event.h:43
clan::InputEvent::shift
bool shift
Definition: input_event.h:114
clan::InputEvent::alt
bool alt
State of modifier keys.
Definition: input_event.h:113
clan::InputEvent::mouse_pos
Pointf mouse_pos
Mouse position at event time.
Definition: input_event.h:99