Panda3D
Public Member Functions | Static Public Member Functions
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 (const GraphicsWindowInputDevice &copy)
void button_down (ButtonHandle button, double time=ClockObject::get_global_clock()->get_frame_time())
 Records that the indicated button has been depressed.
void button_resume_down (ButtonHandle button, double time=ClockObject::get_global_clock()->get_frame_time())
 Records that the indicated button was depressed earlier, and we only just detected the event after the fact.
void button_up (ButtonHandle button, double time=ClockObject::get_global_clock()->get_frame_time())
 Records that the indicated button has been released.
void candidate (const wstring &candidate_string, size_t highlight_start, size_t highlight_end, size_t cursor_pos)
 Records that the indicated candidate string has been highlighted.
void disable_pointer_events ()
 Disables the generation of mouse-movement events.
void disable_pointer_mode ()
 see enable_pointer_mode.
void enable_pointer_events ()
 Enables the generation of mouse-movement events.
void enable_pointer_mode (double speed)
 There are two modes: raw mode, and pointer mode.
void focus_lost (double time=ClockObject::get_global_clock()->get_frame_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.
ButtonEvent get_button_event ()
 Assuming a previous call to has_button_event() returned true, this returns the pending button event.
string get_name () const
MouseData get_pointer () const
 Returns the MouseData associated with the input device's pointer.
MouseData get_raw_pointer () const
 Returns the MouseData associated with the input device's pointer, in raw form (ie, prior to any pointer_mode interpretation).
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.
bool has_keyboard () const
bool has_pointer () const
bool has_pointer_event () const
 Returns true if this device has a pending pointer event (a mouse movement), or false otherwise.
void keystroke (int keycode, double time=ClockObject::get_global_clock()->get_frame_time())
 Records that the indicated keystroke has been generated.
bool operator!= (const GraphicsWindowInputDevice &other) const
bool operator< (const GraphicsWindowInputDevice &other) const
void operator= (const GraphicsWindowInputDevice &copy)
bool operator== (const GraphicsWindowInputDevice &other) const
 PT (PointerEventList) get_pointer_events()
void set_device_index (int index)
 Set the device index.
void set_pointer (bool inwin, int x, int y, double time)
 Records that a mouse movement has taken place.
void set_pointer_in_window (int x, int y, double time=ClockObject::get_global_clock()->get_frame_time())
 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 (double time=ClockObject::get_global_clock()->get_frame_time())
 To be called by a particular kind of GraphicsWindow to indicate that the pointer is no longer within the window.

Static Public Member Functions

static GraphicsWindowInputDevice keyboard_only (GraphicsWindow *host, const string &name)
 This named constructor returns an input device that only has a keyboard, no pointing device.
static GraphicsWindowInputDevice pointer_and_keyboard (GraphicsWindow *host, const string &name)
 This named constructor returns an input device that has both a keyboard and pointer.
static GraphicsWindowInputDevice pointer_only (GraphicsWindow *host, const string &name)
 This named constructor returns an input device that only has a pointing device, no keyboard.

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 40 of file graphicsWindowInputDevice.h.


Member Function Documentation

void GraphicsWindowInputDevice::button_down ( ButtonHandle  button,
double  time = ClockObject::get_global_clock()->get_frame_time() 
)

Records that the indicated button has been depressed.

Definition at line 291 of file graphicsWindowInputDevice.cxx.

Referenced by x11GraphicsWindow::poll_raw_mice().

void GraphicsWindowInputDevice::button_resume_down ( ButtonHandle  button,
double  time = ClockObject::get_global_clock()->get_frame_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.

Definition at line 306 of file graphicsWindowInputDevice.cxx.

void GraphicsWindowInputDevice::button_up ( ButtonHandle  button,
double  time = ClockObject::get_global_clock()->get_frame_time() 
)

Records that the indicated button has been released.

Definition at line 319 of file graphicsWindowInputDevice.cxx.

Referenced by x11GraphicsWindow::poll_raw_mice().

void GraphicsWindowInputDevice::candidate ( const wstring &  candidate_string,
size_t  highlight_start,
size_t  highlight_end,
size_t  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.

Definition at line 346 of file graphicsWindowInputDevice.cxx.

Disables the generation of mouse-movement events.

Definition at line 114 of file graphicsWindowInputDevice.I.

see enable_pointer_mode.

Definition at line 232 of file graphicsWindowInputDevice.cxx.

Enables the generation of mouse-movement events.

Definition at line 103 of file graphicsWindowInputDevice.I.

There are two modes: raw mode, and pointer mode.

In pointer mode, the mouse stops when it reaches the edges of the window. In raw mode, the mouse ignores the screen boundaries and can continue indefinitely, even into negative coordinates. In raw mode, each "blip" from the mouse hardware corresponds to a change of 1 unit in the mouse's (x,y) coordinate. In pointer mode, a variety of speed adjustment factors and concepts like "mouse acceleration" may be applied.

Mouse zero represents the system mouse pointer. This is by definition a pointer, not a raw mouse. It is an error to try to enable or disable pointer mode on mouse zero.

Definition at line 214 of file graphicsWindowInputDevice.cxx.

void GraphicsWindowInputDevice::focus_lost ( double  time = ClockObject::get_global_clock()->get_frame_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.

Definition at line 366 of file graphicsWindowInputDevice.cxx.

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

Definition at line 160 of file graphicsWindowInputDevice.cxx.

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

Definition at line 66 of file graphicsWindowInputDevice.I.

Returns the MouseData associated with the input device's pointer, in raw form (ie, prior to any pointer_mode interpretation).

Definition at line 79 of file graphicsWindowInputDevice.I.

Referenced by x11GraphicsWindow::poll_raw_mice().

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 148 of file graphicsWindowInputDevice.cxx.

Returns true if this device has a pending pointer event (a mouse movement), or false otherwise.

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

Definition at line 176 of file graphicsWindowInputDevice.cxx.

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

Definition at line 76 of file graphicsWindowInputDevice.cxx.

void GraphicsWindowInputDevice::keystroke ( int  keycode,
double  time = ClockObject::get_global_clock()->get_frame_time() 
)

Records that the indicated keystroke has been generated.

Definition at line 332 of file graphicsWindowInputDevice.cxx.

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

Definition at line 87 of file graphicsWindowInputDevice.cxx.

Referenced by CallbackGraphicsWindow::create_input_device().

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

Definition at line 65 of file graphicsWindowInputDevice.cxx.

Referenced by x11GraphicsWindow::open_raw_mice().

void GraphicsWindowInputDevice::set_device_index ( int  index) [inline]

Set the device index.

This is reported in pointer events. The device index will be equal to the position of the GraphicsWindowInputDevice in the window's list.

Definition at line 92 of file graphicsWindowInputDevice.I.

void GraphicsWindowInputDevice::set_pointer ( bool  inwin,
int  x,
int  y,
double  time 
)

Records that a mouse movement has taken place.

Definition at line 248 of file graphicsWindowInputDevice.cxx.

References GraphicsOutput::get_x_size(), and GraphicsOutput::get_y_size().

Referenced by set_pointer_in_window(), and set_pointer_out_of_window().

void GraphicsWindowInputDevice::set_pointer_in_window ( int  x,
int  y,
double  time = ClockObject::get_global_clock()->get_frame_time() 
) [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 128 of file graphicsWindowInputDevice.I.

References set_pointer().

Referenced by x11GraphicsWindow::poll_raw_mice().

void GraphicsWindowInputDevice::set_pointer_out_of_window ( double  time = ClockObject::get_global_clock()->get_frame_time()) [inline]

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

Definition at line 141 of file graphicsWindowInputDevice.I.

References set_pointer().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations