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_pointing_device_subtype { 29 B_UNKNOWN_DEVICE_SUBTYPE = 0, 30 B_MOUSE_DEVICE_SUBTYPE = 1, 31 B_TOUCHPAD_DEVICE_SUBTYPE = 2, 32 B_TABLET_DEVICE_SUBTYPE = 3 33 }; 34 35 36 enum input_device_notification { 37 B_INPUT_DEVICE_ADDED = 0x0001, 38 B_INPUT_DEVICE_STARTED = 0x0002, 39 B_INPUT_DEVICE_STOPPED = 0x0004, 40 B_INPUT_DEVICE_REMOVED = 0x0008 41 }; 42 43 44 class BInputDevice; 45 class BList; 46 47 BInputDevice* find_input_device(const char* name); 48 status_t get_input_devices(BList* list); 49 status_t watch_input_devices(BMessenger target, bool start); 50 51 52 class BInputDevice { 53 public: 54 ~BInputDevice(); 55 56 const char* Name() const; 57 input_device_type Type() const; 58 bool IsRunning() const; 59 60 status_t Start(); 61 status_t Stop(); 62 status_t Control(uint32 code, BMessage* message); 63 64 static status_t Start(input_device_type type); 65 static status_t Stop(input_device_type type); 66 static status_t Control(input_device_type type, uint32 code, 67 BMessage* message); 68 69 private: 70 friend BInputDevice* find_input_device(const char* name); 71 friend status_t get_input_devices(BList* list); 72 73 BInputDevice(); 74 void _SetNameAndType(const char* name, 75 input_device_type type); 76 77 char* fName; 78 input_device_type fType; 79 uint32 _reserved[4]; 80 }; 81 82 #endif // _INPUT_H 83