Panda3D
Public Member Functions | Static Public Member Functions | List of all members
GraphicsWindowInputDevice Class Reference

This is a virtual input device that represents the keyboard and mouse pair that is associated with a particular window. More...

Inheritance diagram for GraphicsWindowInputDevice:
InputDevice TypedReferenceCount TypedObject ReferenceCount

Public Member Functions

 buttonDown (ButtonHandle button, double time)
 
 buttonResumeDown (ButtonHandle button, double time)
 Records that the indicated button was depressed earlier, and we only just detected the event after the fact. More...
 
 buttonUp (ButtonHandle button, double time)
 Records that the indicated button has been released. More...
 
 candidate (str candidate_string, int highlight_start, int highlight_end, int cursor_pos)
 Records that the indicated candidate string has been highlighted. More...
 
 focusLost (double time)
 This should be called when the window focus is lost, so that we may miss upcoming button events (especially "up" events) for the next period of time. More...
 
PointerData getPointer ()
 Returns the PointerData associated with the input device's pointer. More...
 
 keystroke (int keycode, double time)
 Records that the indicated keystroke has been generated. More...
 
 pointerMoved (double x, double y, double time)
 To be called by a particular kind of GraphicsWindow to indicate that the pointer has moved by the given relative amount. More...
 
 rawButtonDown (ButtonHandle button, double time)
 Records that the indicated button has been depressed. More...
 
 rawButtonUp (ButtonHandle button, double time)
 Records that the indicated button has been released. More...
 
 removePointer (int id)
 To be called by a particular kind of GraphicsWindow to indicate that the pointer no longer exists. More...
 
 setPointerInWindow (double x, double y, double time)
 To be called by a particular kind of GraphicsWindow to indicate that the pointer is within the window, at the given pixel coordinates. More...
 
 setPointerOutOfWindow (double time)
 To be called by a particular kind of GraphicsWindow to indicate that the pointer is no longer within the window. More...
 
 updatePointer (PointerData data, double time)
 To be called by a particular kind of GraphicsWindow to indicate that the pointer data has changed. More...
 
- Public Member Functions inherited from InputDevice
 disablePointerEvents ()
 Disables the generation of mouse-movement events. More...
 
 enablePointerEvents ()
 Enables the generation of mouse-movement events. More...
 
InputDevice::AxisState findAxis (InputDevice::Axis axis)
 Returns the first AnalogAxis found with the given axis, or throw an assert if the axis was not found in the list. More...
 
InputDevice::ButtonState findButton (ButtonHandle handle)
 Returns the first ButtonState found with the given axis, or throw an assert if the button handle was not found in the list. More...
 
ButtonEventList getButtonEvents ()
 Returns the list of recently-generated ButtonEvents. More...
 
PointerEventList getPointerEvents ()
 Returns a PointerEventList containing all the recent pointer events. More...
 
bool hasButtonEvent ()
 Returns true if this device has a pending button event (a mouse button or keyboard button down/up), false otherwise. More...
 
bool hasFeature (InputDevice::Feature feature)
 Returns true if the device supports the indicated feature. More...
 
bool hasPointerEvent ()
 Returns true if this device has a pending pointer event (a mouse movement), or false otherwise. More...
 
 mapAxis (int index, InputDevice::Axis axis)
 Associates the indicated Axis with the axis of the indicated index number. More...
 
 mapButton (int index, ButtonHandle handle)
 Associates the indicated ButtonHandle with the button of the indicated index number. More...
 
 output (Ostream out)
 Writes a one-line string describing the device. More...
 
 poll ()
 Polls the input device for new activity, to ensure it contains the latest events. More...
 
 setVibration (double strong, double weak)
 Sets the strength of the vibration effect, if supported. More...
 
- Public Member Functions inherited from TypedObject
TypeHandle getType ()
 
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly. More...
 
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type. More...
 
- Public Member Functions inherited from ReferenceCount
int getRefCount ()
 Returns the current reference count. More...
 
 ref ()
 Explicitly increments the reference count. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
bool unref ()
 Explicitly decrements the reference count. More...
 

Static Public Member Functions

static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from InputDevice
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle getClassType ()
 

Additional Inherited Members

- Public Types inherited from InputDevice
enum  Axis {
  none = 0, x = 1, y = 2, z = 3,
  yaw = 4, pitch = 5, roll = 6, left_x = 7,
  left_y = 8, left_trigger = 9, right_x = 10, right_y = 11,
  right_trigger = 12, throttle = 13, rudder = 14, wheel = 15,
  accelerator = 16, brake = 17
}
 
enum  DeviceClass {
  unknown = 0, virtual_device = 1, keyboard = 2, mouse = 3,
  touch = 4, gamepad = 5, flight_stick = 6, steering_wheel = 7,
  dance_pad = 8, hmd = 9, spatial_mouse = 10
}
 
enum  Feature {
  pointer = 0, keyboard = 2, tracker = 2, vibration = 3,
  battery = 4
}
 
enum  State { S_unknown = 0, S_up = 1, S_down = 2 }
 
- Public Attributes inherited from InputDevice
InputDevice::Axes _axes
 
InputDevice::BatteryData _battery_data
 
InputDevice::Buttons _buttons
 
PointerData _pointer_data
 
TrackerData _tracker_data
 
InputDevice::AxisState axes []
 
InputDevice::BatteryData battery
 Returns a rough indication of the battery level, ranging from 0 (completely empty battery) to the indicated max_level value. More...
 
InputDevice::ButtonState buttons []
 Make device buttons and axes iterable. More...
 
bool connected
 This is false if we know that the device is not currently connected. May report false positives if we can't know this with certainty. More...
 
InputDevice::DeviceClass device_class
 This contains an identification of the general type of device. If this could not be determined, it is set to DC_unknown. More...
 
String manufacturer
 The device's manufacturer, or the empty string if not known. More...
 
String name
 The human-readable name of this input device. More...
 
unsigned short int product_id
 USB product ID of the device, or 0 if not known. More...
 
String serial_number
 The device's serial number, or the empty string if not known. More...
 
TrackerData tracker
 Getters for the various types of device data. More...
 
unsigned short int vendor_id
 USB vendor ID of the device, or 0 if not known. More...
 
- Public Attributes inherited from TypedObject
TypeHandle type
 Returns the TypeHandle representing this object's type. More...
 
- Public Attributes inherited from ReferenceCount
int ref_count
 The current reference count. More...
 

Detailed Description

This is a virtual input device that represents the keyboard and mouse pair that is associated with a particular window.

It collects mouse and keyboard events from the windowing system while the window is in focus.

Member Function Documentation

◆ buttonDown()

buttonDown ( ButtonHandle  button,
double  time 
)

◆ buttonResumeDown()

buttonResumeDown ( ButtonHandle  button,
double  time 
)

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.

◆ buttonUp()

buttonUp ( ButtonHandle  button,
double  time 
)

Records that the indicated button has been released.

◆ candidate()

candidate ( str  candidate_string,
int  highlight_start,
int  highlight_end,
int  cursor_pos 
)

Records that the indicated candidate string has been highlighted.

This is used to implement IME support for typing in international languages, especially Chinese/Japanese/Korean.

◆ focusLost()

focusLost ( double  time)

This should be called when the window focus is lost, so that we may miss upcoming button events (especially "up" events) for the next period of time.

It generates keyboard and mouse "up" events for those buttons that we previously sent unpaired "down" events, so that the Panda application will believe all buttons are now released.

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getPointer()

PointerData getPointer ( )

Returns the PointerData associated with the input device's pointer.

This only makes sense if has_pointer() also returns true.

◆ keystroke()

keystroke ( int  keycode,
double  time 
)

Records that the indicated keystroke has been generated.

◆ pointerMoved()

pointerMoved ( double  x,
double  y,
double  time 
)

To be called by a particular kind of GraphicsWindow to indicate that the pointer has moved by the given relative amount.

◆ rawButtonDown()

rawButtonDown ( ButtonHandle  button,
double  time 
)

Records that the indicated button has been depressed.

◆ rawButtonUp()

rawButtonUp ( ButtonHandle  button,
double  time 
)

Records that the indicated button has been released.

◆ removePointer()

removePointer ( int  id)

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

◆ setPointerInWindow()

setPointerInWindow ( double  x,
double  y,
double  time 
)

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

◆ setPointerOutOfWindow()

setPointerOutOfWindow ( double  time)

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

◆ updatePointer()

updatePointer ( PointerData  data,
double  time 
)

To be called by a particular kind of GraphicsWindow to indicate that the pointer data has changed.