2008-02-07 13:50:39 +03:00
|
|
|
/*
|
2009-08-27 15:12:41 +04:00
|
|
|
* Copyright 2008, Haiku, Inc. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
2008-02-07 13:50:39 +03:00
|
|
|
*
|
|
|
|
*/
|
2002-07-09 16:24:59 +04:00
|
|
|
#ifndef _INPUT_H
|
|
|
|
#define _INPUT_H
|
|
|
|
|
2008-10-19 17:17:29 +04:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <Messenger.h>
|
|
|
|
|
|
|
|
|
|
|
|
enum input_method_op {
|
|
|
|
B_INPUT_METHOD_STARTED = 0,
|
|
|
|
B_INPUT_METHOD_STOPPED = 1,
|
2008-02-07 13:50:39 +03:00
|
|
|
B_INPUT_METHOD_CHANGED = 2,
|
2002-07-09 16:24:59 +04:00
|
|
|
B_INPUT_METHOD_LOCATION_REQUEST = 3
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum input_device_type {
|
|
|
|
B_POINTING_DEVICE = 0,
|
|
|
|
B_KEYBOARD_DEVICE = 1,
|
|
|
|
B_UNDEFINED_DEVICE = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum input_device_notification {
|
2008-02-07 13:50:39 +03:00
|
|
|
B_INPUT_DEVICE_ADDED = 0x0001,
|
2002-07-09 16:24:59 +04:00
|
|
|
B_INPUT_DEVICE_STARTED = 0x0002,
|
|
|
|
B_INPUT_DEVICE_STOPPED = 0x0004,
|
|
|
|
B_INPUT_DEVICE_REMOVED = 0x0008
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class BInputDevice;
|
2008-02-07 13:50:39 +03:00
|
|
|
class BList;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2008-02-07 13:50:39 +03:00
|
|
|
BInputDevice* find_input_device(const char* name);
|
|
|
|
status_t get_input_devices(BList* list);
|
2007-10-16 00:13:55 +04:00
|
|
|
status_t watch_input_devices(BMessenger target, bool start);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
|
|
|
|
class BInputDevice {
|
|
|
|
public:
|
2008-10-19 17:17:29 +04:00
|
|
|
~BInputDevice();
|
|
|
|
|
|
|
|
const char* Name() const;
|
|
|
|
input_device_type Type() const;
|
|
|
|
bool IsRunning() const;
|
|
|
|
|
|
|
|
status_t Start();
|
|
|
|
status_t Stop();
|
|
|
|
status_t Control(uint32 code, BMessage* message);
|
|
|
|
|
|
|
|
static status_t Start(input_device_type type);
|
|
|
|
static status_t Stop(input_device_type type);
|
|
|
|
static status_t Control(input_device_type type, uint32 code,
|
2008-02-07 13:50:39 +03:00
|
|
|
BMessage* message);
|
2008-10-19 17:17:29 +04:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
private:
|
2008-10-19 17:17:29 +04:00
|
|
|
friend BInputDevice* find_input_device(const char* name);
|
|
|
|
friend status_t get_input_devices(BList* list);
|
|
|
|
|
|
|
|
BInputDevice();
|
|
|
|
void _SetNameAndType(const char* name,
|
|
|
|
input_device_type type);
|
|
|
|
|
|
|
|
char* fName;
|
|
|
|
input_device_type fType;
|
|
|
|
uint32 _reserved[4];
|
2002-07-09 16:24:59 +04:00
|
|
|
};
|
|
|
|
|
2008-10-19 17:17:29 +04:00
|
|
|
#endif // _INPUT_H
|