Rewrote Input.h, adjusted Input.cpp accordingly, added nothrow on

allocations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23905 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2008-02-07 10:50:39 +00:00
parent f38b49f162
commit d082779211
2 changed files with 50 additions and 73 deletions
+20 -33
View File
@@ -1,12 +1,8 @@
/******************************************************************************
/
/ File: Input.h
/
/ Description: Functions and class to manage input devices.
/
/ Copyright 1998, Be Incorporated, All Rights Reserved.
/
******************************************************************************/
/*
* Copyright (c) 2008, Haiku, Inc.
* Distributed under the terms of the MIT license.
*
*/
#ifndef _INPUT_H
#define _INPUT_H
@@ -15,13 +11,11 @@
#include <Messenger.h>
#include <SupportDefs.h>
class BList;
enum input_method_op {
B_INPUT_METHOD_STARTED = 0,
B_INPUT_METHOD_STOPPED = 1,
B_INPUT_METHOD_CHANGED = 2,
B_INPUT_METHOD_CHANGED = 2,
B_INPUT_METHOD_LOCATION_REQUEST = 3
};
@@ -32,14 +26,9 @@ enum input_device_type {
B_UNDEFINED_DEVICE = 2
};
/*
what == B_INPUT_DEVICES_CHANGED
FindString("name", name_of_device);
FindInt32("opcode", input_device_notification);
*/
enum input_device_notification {
B_INPUT_DEVICE_ADDED = 0x0001,
B_INPUT_DEVICE_ADDED = 0x0001,
B_INPUT_DEVICE_STARTED = 0x0002,
B_INPUT_DEVICE_STOPPED = 0x0004,
B_INPUT_DEVICE_REMOVED = 0x0008
@@ -47,10 +36,10 @@ enum input_device_notification {
class BInputDevice;
class BList;
BInputDevice* find_input_device(const char *name);
status_t get_input_devices(BList *list);
BInputDevice* find_input_device(const char* name);
status_t get_input_devices(BList* list);
status_t watch_input_devices(BMessenger target, bool start);
@@ -64,27 +53,25 @@ public:
status_t Start();
status_t Stop();
status_t Control(uint32 code,
BMessage *message);
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,
BMessage *message);
static status_t Control(input_device_type type,
uint32 code,
BMessage* message);
private:
friend BInputDevice* find_input_device(const char *name);
friend status_t get_input_devices(BList *list);
friend BInputDevice* find_input_device(const char* name);
friend status_t get_input_devices(BList* list);
BInputDevice();
void set_name_and_type(const char *name,
void _SetNameAndType(const char* name,
input_device_type type);
char* fName;
input_device_type fType;
uint32 _reserved[4];
};
#endif