xref: /haiku/headers/os/interface/Input.h (revision 2b76973fa2401f7a5edf68e6470f3d3210cbcff3)
1 /*
2  * Copyright 2008, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  */
6 #ifndef _INPUT_H
7 #define _INPUT_H
8 
9 
10 #include <Messenger.h>
11 
12 
13 enum input_method_op {
14 	B_INPUT_METHOD_STARTED			= 0,
15 	B_INPUT_METHOD_STOPPED			= 1,
16 	B_INPUT_METHOD_CHANGED			= 2,
17 	B_INPUT_METHOD_LOCATION_REQUEST	= 3
18 };
19 
20 
21 enum input_device_type {
22 	B_POINTING_DEVICE	= 0,
23 	B_KEYBOARD_DEVICE	= 1,
24 	B_UNDEFINED_DEVICE	= 2
25 };
26 
27 
28 enum input_device_notification {
29 	B_INPUT_DEVICE_ADDED	= 0x0001,
30 	B_INPUT_DEVICE_STARTED	= 0x0002,
31 	B_INPUT_DEVICE_STOPPED	= 0x0004,
32 	B_INPUT_DEVICE_REMOVED	= 0x0008
33 };
34 
35 
36 class BInputDevice;
37 class BList;
38 
39 BInputDevice*	find_input_device(const char* name);
40 status_t		get_input_devices(BList* list);
41 status_t		watch_input_devices(BMessenger target, bool start);
42 
43 
44 class BInputDevice {
45 public:
46 								~BInputDevice();
47 
48 			const char*			Name() const;
49 			input_device_type	Type() const;
50 			bool				IsRunning() const;
51 
52 			status_t			Start();
53 			status_t			Stop();
54 			status_t			Control(uint32 code, BMessage* message);
55 
56 	static	status_t			Start(input_device_type type);
57 	static	status_t			Stop(input_device_type type);
58 	static	status_t			Control(input_device_type type, uint32 code,
59 									BMessage* message);
60 
61 private:
62 	friend BInputDevice* find_input_device(const char* name);
63 	friend status_t get_input_devices(BList* list);
64 
65 								BInputDevice();
66 			void				_SetNameAndType(const char* name,
67 									input_device_type type);
68 
69 			char*				fName;
70 			input_device_type	fType;
71 			uint32				_reserved[4];
72 };
73 
74 #endif	// _INPUT_H
75