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