xref: /haiku/headers/os/interface/Input.h (revision cda5b8808fd0262f0fac472f6cfa809f846a83cf)
1 /*
2  * Copyright (c) 2008, Haiku, Inc.
3  * Distributed under the terms of the MIT license.
4  *
5  */
6 
7 #ifndef _INPUT_H
8 #define _INPUT_H
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,
61 									uint32 code,
62 									BMessage* message);
63 
64 private:
65 	friend BInputDevice*	find_input_device(const char* name);
66 	friend status_t			get_input_devices(BList* list);
67 
68 							BInputDevice();
69 	void					_SetNameAndType(const char* name,
70 											  input_device_type	type);
71 
72 	char*					fName;
73 	input_device_type		fType;
74 	uint32					_reserved[4];
75 };
76 
77 #endif
78