ClanLib
2.3.7
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
Sources
API
Display
Window
input_device.h
Go to the documentation of this file.
1
/*
2
** ClanLib SDK
3
** Copyright (c) 1997-2011 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
32
33
#pragma once
34
35
#include "../api_display.h"
36
#include "../../Core/System/sharedptr.h"
37
#include "../../Core/System/weakptr.h"
38
#include "../../Core/Text/string_types.h"
39
#include "../../Core/Signals/signal_v2.h"
40
#include "../../Core/Math/point.h"
41
42
class
CL_InputEvent
;
43
class
CL_InputState
;
44
class
CL_InputDeviceProvider
;
45
class
CL_InputDevice_Impl;
46
50
class
CL_API_DISPLAY
CL_InputDevice
51
{
52
public
:
54
enum
Type
55
{
56
keyboard
,
57
pointer
,
58
joystick
,
59
tablet
,
60
unknown
61
};
62
65
66
public
:
68
CL_InputDevice
();
69
73
CL_InputDevice
(
CL_InputDeviceProvider
*provider);
74
78
CL_InputDevice
(CL_WeakPtr<CL_InputDevice_Impl> impl);
79
80
~
CL_InputDevice
();
81
85
86
public
:
88
bool
is_null
()
const
{
return
!impl; }
89
91
void
throw_if_null()
const
;
92
94
CL_InputDeviceProvider
*get_provider()
const
;
95
97
CL_String
get_name()
const
;
98
100
CL_String
get_device_name()
const
;
101
103
Type get_type()
const
;
104
106
108
CL_String
get_key_name(
int
id
)
const
;
109
111
CL_String
keyid_to_string(
int
keycode)
const
;
112
114
int
string_to_keyid(
const
CL_String
&str)
const
;
115
117
118
bool
get_keycode(
int
keycode)
const
;
119
121
122
CL_Point
get_position()
const
;
123
125
126
int
get_x()
const
;
127
129
130
int
get_y()
const
;
131
133
double
get_axis(
int
index)
const
;
134
136
int
get_axis_count()
const
;
137
139
140
int
get_button_count()
const
;
141
143
144
bool
in_proximity()
const
;
145
149
150
public
:
151
CL_InputDevice
&operator =(
const
CL_InputDevice
©);
152
154
155
void
set_position(
int
x,
int
y);
156
162
bool
poll(
bool
peek_only);
163
167
168
public
:
170
CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>
&sig_key_down();
171
173
CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>
&sig_key_up();
174
176
CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>
&sig_pointer_move();
177
179
CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>
&sig_axis_move();
180
182
CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>
&sig_key_dblclk();
183
185
CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>
&sig_proximity_change();
186
190
191
private
:
192
CL_SharedPtr<CL_InputDevice_Impl> impl;
193
194
friend
class
CL_InputContext_Impl;
196
};
197
Generated on Fri Jun 14 2013 13:05:45 for ClanLib by
1.8.4