Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

GraphicsWindowInputDevice Class Reference

This is a structure representing a single input device that may be associated with a window. More...

#include <graphicsWindowInputDevice.h>

List of all members.

Public Member Functions

 GraphicsWindowInputDevice ()
 GraphicsWindowInputDevice (const GraphicsWindowInputDevice &copy)
void operator= (const GraphicsWindowInputDevice &copy)
 ~GraphicsWindowInputDevice ()
string get_name () const
bool has_pointer () const
bool has_keyboard () const
const MouseDataget_mouse_data () const
 Returns the MouseData associated with the nth input device.

bool has_button_event () const
 Returns true if this device has a pending button event (a mouse button or keyboard button down/up), false otherwise.

ButtonEvent get_button_event ()
 Assuming a previous call to has_button_event() returned true, this returns the pending button event.

void button_down (ButtonHandle button)
 Records that the indicated button has been depressed.

void button_resume_down (ButtonHandle button)
 Records that the indicated button was depressed earlier, and we only just detected the event after the fact.

void button_up (ButtonHandle button)
 Records that the indicated button has been released.

void keystroke (int keycode)
 Records that the indicated keystroke has been generated.

void set_pointer_in_window (int x, int y)
 To be called by a particular kind of GraphicsWindow to indicate that the pointer is within the window, at the given pixel coordinates.

void set_pointer_out_of_window ()
 To be called by a particular kind of GraphicsWindow to indicate that the pointer is no longer within the window.

bool operator== (const GraphicsWindowInputDevice &other) const
bool operator!= (const GraphicsWindowInputDevice &other) const
bool operator< (const GraphicsWindowInputDevice &other) const

Static Public Member Functions

GraphicsWindowInputDevice pointer_only (const string &name)
 This named constructor returns an input device that only has a pointing device, no keyboard.

GraphicsWindowInputDevice keyboard_only (const string &name)
 This named constructor returns an input device that only has a keyboard, no pointing device.

GraphicsWindowInputDevice pointer_and_keyboard (const string &name)
 This named constructor returns an input device that has both a keyboard and pointer.


Private Types

typedef pdeque< ButtonEventButtonEvents
enum  InputDeviceFlags { IDF_has_pointer = 0x01, IDF_has_keyboard = 0x02 }

Private Member Functions

 GraphicsWindowInputDevice (const string &name, int flags)
 Defines a new InputDevice for the window.


Private Attributes

string _name
int _flags
MouseData _mouse_data
ButtonEvents _button_events


Detailed Description

This is a structure representing a single input device that may be associated with a window.

Typically this will be a keyboard/mouse pair, and there will be exactly one of these associated with each window, but other variants are possible.

Definition at line 48 of file graphicsWindowInputDevice.h.


Member Typedef Documentation

typedef pdeque<ButtonEvent> GraphicsWindowInputDevice::ButtonEvents [private]
 

Definition at line 94 of file graphicsWindowInputDevice.h.


Member Enumeration Documentation

enum GraphicsWindowInputDevice::InputDeviceFlags [private]
 

Enumeration values:
IDF_has_pointer 
IDF_has_keyboard 

Definition at line 90 of file graphicsWindowInputDevice.h.


Constructor & Destructor Documentation

GraphicsWindowInputDevice::GraphicsWindowInputDevice const string &  name,
int  flags
[private]
 

Defines a new InputDevice for the window.

Most windows will have exactly one InputDevice: a keyboard/mouse pair. Some may also add joystick data, or additional mice or something.

This private constructor is only used internally by the named constructors, below.

Definition at line 60 of file graphicsWindowInputDevice.cxx.

References GraphicsWindowInputDevice(), and IDF_has_pointer.

GraphicsWindowInputDevice::GraphicsWindowInputDevice  )  [inline]
 

Definition at line 30 of file graphicsWindowInputDevice.I.

References _name, and INLINE.

Referenced by GraphicsWindowInputDevice(), and pointer_only().

GraphicsWindowInputDevice::GraphicsWindowInputDevice const GraphicsWindowInputDevice &  copy  ) 
 

Definition at line 120 of file graphicsWindowInputDevice.cxx.

GraphicsWindowInputDevice::~GraphicsWindowInputDevice  ) 
 

Definition at line 151 of file graphicsWindowInputDevice.cxx.

References _button_events, and ButtonEvent::T_down.


Member Function Documentation

void GraphicsWindowInputDevice::button_down ButtonHandle  button  ) 
 

Records that the indicated button has been depressed.

Definition at line 201 of file graphicsWindowInputDevice.cxx.

void GraphicsWindowInputDevice::button_resume_down ButtonHandle  button  ) 
 

Records that the indicated button was depressed earlier, and we only just detected the event after the fact.

This is mainly useful for tracking the state of modifier keys.

Definition at line 220 of file graphicsWindowInputDevice.cxx.

void GraphicsWindowInputDevice::button_up ButtonHandle  button  ) 
 

Records that the indicated button has been released.

Definition at line 233 of file graphicsWindowInputDevice.cxx.

ButtonEvent GraphicsWindowInputDevice::get_button_event  ) 
 

Assuming a previous call to has_button_event() returned true, this returns the pending button event.

Definition at line 186 of file graphicsWindowInputDevice.cxx.

References _button_events.

const MouseData & GraphicsWindowInputDevice::get_mouse_data  )  const [inline]
 

Returns the MouseData associated with the nth input device.

Definition at line 81 of file graphicsWindowInputDevice.I.

References _mouse_data, and y.

string GraphicsWindowInputDevice::get_name  )  const [inline]
 

Definition at line 42 of file graphicsWindowInputDevice.I.

References _flags, IDF_has_pointer, and INLINE.

bool GraphicsWindowInputDevice::has_button_event  )  const
 

Returns true if this device has a pending button event (a mouse button or keyboard button down/up), false otherwise.

If this returns true, the particular event may be extracted via get_button_event().

Definition at line 171 of file graphicsWindowInputDevice.cxx.

References _button_events.

bool GraphicsWindowInputDevice::has_keyboard  )  const [inline]
 

Definition at line 66 of file graphicsWindowInputDevice.I.

References _mouse_data.

bool GraphicsWindowInputDevice::has_pointer  )  const [inline]
 

Definition at line 54 of file graphicsWindowInputDevice.I.

References _flags, IDF_has_keyboard, and INLINE.

GraphicsWindowInputDevice GraphicsWindowInputDevice::keyboard_only const string &  name  )  [static]
 

This named constructor returns an input device that only has a keyboard, no pointing device.

Definition at line 92 of file graphicsWindowInputDevice.cxx.

void GraphicsWindowInputDevice::keystroke int  keycode  ) 
 

Records that the indicated keystroke has been generated.

Definition at line 248 of file graphicsWindowInputDevice.cxx.

bool GraphicsWindowInputDevice::operator!= const GraphicsWindowInputDevice &  other  )  const [inline]
 

Definition at line 141 of file graphicsWindowInputDevice.I.

bool GraphicsWindowInputDevice::operator< const GraphicsWindowInputDevice &  other  )  const [inline]
 

Definition at line 153 of file graphicsWindowInputDevice.I.

void GraphicsWindowInputDevice::operator= const GraphicsWindowInputDevice &  copy  ) 
 

Definition at line 136 of file graphicsWindowInputDevice.cxx.

bool GraphicsWindowInputDevice::operator== const GraphicsWindowInputDevice &  other  )  const [inline]
 

Definition at line 129 of file graphicsWindowInputDevice.I.

GraphicsWindowInputDevice GraphicsWindowInputDevice::pointer_and_keyboard const string &  name  )  [static]
 

This named constructor returns an input device that has both a keyboard and pointer.

Definition at line 107 of file graphicsWindowInputDevice.cxx.

References _button_events, _flags, _mouse_data, and _name.

GraphicsWindowInputDevice GraphicsWindowInputDevice::pointer_only const string &  name  )  [static]
 

This named constructor returns an input device that only has a pointing device, no keyboard.

Definition at line 77 of file graphicsWindowInputDevice.cxx.

References GraphicsWindowInputDevice(), IDF_has_keyboard, and IDF_has_pointer.

void GraphicsWindowInputDevice::set_pointer_in_window int  x,
int  y
[inline]
 

To be called by a particular kind of GraphicsWindow to indicate that the pointer is within the window, at the given pixel coordinates.

Definition at line 98 of file graphicsWindowInputDevice.I.

References INLINE.

void GraphicsWindowInputDevice::set_pointer_out_of_window  )  [inline]
 

To be called by a particular kind of GraphicsWindow to indicate that the pointer is no longer within the window.

Definition at line 117 of file graphicsWindowInputDevice.I.

References INLINE.


Member Data Documentation

ButtonEvents GraphicsWindowInputDevice::_button_events [private]
 

Definition at line 99 of file graphicsWindowInputDevice.h.

Referenced by get_button_event(), has_button_event(), pointer_and_keyboard(), and ~GraphicsWindowInputDevice().

int GraphicsWindowInputDevice::_flags [private]
 

Definition at line 97 of file graphicsWindowInputDevice.h.

Referenced by get_name(), has_pointer(), and pointer_and_keyboard().

MouseData GraphicsWindowInputDevice::_mouse_data [private]
 

Definition at line 98 of file graphicsWindowInputDevice.h.

Referenced by get_mouse_data(), has_keyboard(), and pointer_and_keyboard().

string GraphicsWindowInputDevice::_name [private]
 

Definition at line 96 of file graphicsWindowInputDevice.h.

Referenced by GraphicsWindowInputDevice(), and pointer_and_keyboard().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:51:28 2003 for Panda by doxygen1.3