00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GRAPHICSWINDOWINPUTDEVICE_H
00020 #define GRAPHICSWINDOWINPUTDEVICE_H
00021
00022 #include "pandabase.h"
00023
00024 #include "buttonEvent.h"
00025 #include "mouseData.h"
00026
00027 #include "pdeque.h"
00028 #include "pvector.h"
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 class EXPCL_PANDA GraphicsWindowInputDevice {
00039 private:
00040 GraphicsWindowInputDevice(const string &name, int flags);
00041
00042 public:
00043 static GraphicsWindowInputDevice pointer_only(const string &name);
00044 static GraphicsWindowInputDevice keyboard_only(const string &name);
00045 static GraphicsWindowInputDevice pointer_and_keyboard(const string &name);
00046
00047 INLINE GraphicsWindowInputDevice();
00048 GraphicsWindowInputDevice(const GraphicsWindowInputDevice ©);
00049 void operator = (const GraphicsWindowInputDevice ©);
00050 ~GraphicsWindowInputDevice();
00051
00052 INLINE string get_name() const;
00053 INLINE bool has_pointer() const;
00054 INLINE bool has_keyboard() const;
00055
00056 INLINE const MouseData &get_mouse_data() const;
00057
00058 bool has_button_event() const;
00059 ButtonEvent get_button_event();
00060
00061 public:
00062
00063
00064 void button_down(ButtonHandle button);
00065 void button_resume_down(ButtonHandle button);
00066 void button_up(ButtonHandle button);
00067 void keystroke(int keycode);
00068 INLINE void set_pointer_in_window(int x, int y);
00069 INLINE void set_pointer_out_of_window();
00070
00071 public:
00072
00073
00074
00075 INLINE bool operator == (const GraphicsWindowInputDevice &other) const;
00076 INLINE bool operator != (const GraphicsWindowInputDevice &other) const;
00077 INLINE bool operator < (const GraphicsWindowInputDevice &other) const;
00078
00079 private:
00080 enum InputDeviceFlags {
00081 IDF_has_pointer = 0x01,
00082 IDF_has_keyboard = 0x02
00083 };
00084 typedef pdeque<ButtonEvent> ButtonEvents;
00085
00086 string _name;
00087 int _flags;
00088 MouseData _mouse_data;
00089 ButtonEvents _button_events;
00090 };
00091
00092 #include "graphicsWindowInputDevice.I"
00093
00094 #define EXPCL EXPCL_PANDA
00095 #define EXPTP EXPTP_PANDA
00096 #define TYPE GraphicsWindowInputDevice
00097 #define NAME vector_GraphicsWindowInputDevice
00098
00099 #include <vector_src.h>
00100
00101
00102 #ifdef __GNUC__
00103 #pragma interface
00104 #endif
00105
00106 #endif