This is a structure representing a single input device that may be associated with a window. More...
#include "graphicsWindowInputDevice.h"
Public Member Functions | |
GraphicsWindowInputDevice (const GraphicsWindowInputDevice ©) | |
void | button_down (ButtonHandle button) |
Records that the indicated button has been depressed. More... | |
void | button_down (ButtonHandle button, double time) |
Records that the indicated button has been depressed. More... | |
void | button_resume_down (ButtonHandle button) |
Records that the indicated button was depressed earlier, and we only just detected the event after the fact. More... | |
void | button_resume_down (ButtonHandle button, double time) |
Records that the indicated button was depressed earlier, and we only just detected the event after the fact. More... | |
void | button_up (ButtonHandle button) |
Records that the indicated button has been released. More... | |
void | button_up (ButtonHandle button, double time) |
Records that the indicated button has been released. More... | |
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. More... | |
void | disable_pointer_events () |
Disables the generation of mouse-movement events. More... | |
void | disable_pointer_mode () |
see enable_pointer_mode. More... | |
void | enable_pointer_events () |
Enables the generation of mouse-movement events. More... | |
void | enable_pointer_mode (double speed) |
There are two modes: raw mode, and pointer mode. More... | |
void | focus_lost () |
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... | |
void | focus_lost (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... | |
ButtonEvent | get_button_event () |
Assuming a previous call to has_button_event() returned true, this returns the pending button event. More... | |
string | get_name () const |
MouseData | get_pointer () const |
Returns the MouseData associated with the input device's pointer. More... | |
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). More... | |
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. More... | |
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. More... | |
void | keystroke (int keycode) |
Records that the indicated keystroke has been generated. More... | |
void | keystroke (int keycode, double time) |
Records that the indicated keystroke has been generated. More... | |
bool | operator!= (const GraphicsWindowInputDevice &other) const |
bool | operator< (const GraphicsWindowInputDevice &other) const |
void | operator= (const GraphicsWindowInputDevice ©) |
bool | operator== (const GraphicsWindowInputDevice &other) const |
PT (PointerEventList) get_pointer_events() | |
void | raw_button_down (ButtonHandle button) |
Records that the indicated button has been depressed. More... | |
void | raw_button_down (ButtonHandle button, double time) |
Records that the indicated button has been depressed. More... | |
void | raw_button_up (ButtonHandle button) |
Records that the indicated button has been released. More... | |
void | raw_button_up (ButtonHandle button, double time) |
Records that the indicated button has been released. More... | |
void | set_device_index (int index) |
Set the device index. More... | |
void | set_pointer (bool inwin, double x, double y, double time) |
Records that a mouse movement has taken place. More... | |
void | set_pointer_in_window (double x, double y) |
To be called by a particular kind of GraphicsWindow to indicate that the pointer is within the window, at the given pixel coordinates. More... | |
void | set_pointer_in_window (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... | |
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. More... | |
void | set_pointer_out_of_window (double time) |
To be called by a particular kind of GraphicsWindow to indicate that the pointer is no longer within the window. More... | |
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. More... | |
static GraphicsWindowInputDevice | pointer_and_keyboard (GraphicsWindow *host, const string &name) |
This named constructor returns an input device that has both a keyboard and pointer. More... | |
static GraphicsWindowInputDevice | pointer_only (GraphicsWindow *host, const string &name) |
This named constructor returns an input device that only has a pointing device, no keyboard. More... | |
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 42 of file graphicsWindowInputDevice.h.
|
inline |
Records that the indicated button has been depressed.
Definition at line 126 of file graphicsWindowInputDevice.I.
References ClockObject::get_global_clock().
void GraphicsWindowInputDevice::button_down | ( | ButtonHandle | button, |
double | time | ||
) |
Records that the indicated button has been depressed.
Definition at line 286 of file graphicsWindowInputDevice.cxx.
|
inline |
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 139 of file graphicsWindowInputDevice.I.
References ClockObject::get_global_clock().
void GraphicsWindowInputDevice::button_resume_down | ( | 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.
Definition at line 301 of file graphicsWindowInputDevice.cxx.
|
inline |
Records that the indicated button has been released.
Definition at line 149 of file graphicsWindowInputDevice.I.
References ClockObject::get_global_clock().
void GraphicsWindowInputDevice::button_up | ( | ButtonHandle | button, |
double | time | ||
) |
Records that the indicated button has been released.
Definition at line 313 of file graphicsWindowInputDevice.cxx.
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 340 of file graphicsWindowInputDevice.cxx.
|
inline |
Disables the generation of mouse-movement events.
Definition at line 114 of file graphicsWindowInputDevice.I.
void GraphicsWindowInputDevice::disable_pointer_mode | ( | ) |
see enable_pointer_mode.
Definition at line 227 of file graphicsWindowInputDevice.cxx.
|
inline |
Enables the generation of mouse-movement events.
Definition at line 103 of file graphicsWindowInputDevice.I.
void GraphicsWindowInputDevice::enable_pointer_mode | ( | double | speed | ) |
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 211 of file graphicsWindowInputDevice.cxx.
|
inline |
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 176 of file graphicsWindowInputDevice.I.
References ClockObject::get_global_clock().
void GraphicsWindowInputDevice::focus_lost | ( | 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.
Definition at line 360 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 157 of file graphicsWindowInputDevice.cxx.
|
inline |
Returns the MouseData associated with the input device's pointer.
Definition at line 66 of file graphicsWindowInputDevice.I.
|
inline |
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.
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 145 of file graphicsWindowInputDevice.cxx.
bool GraphicsWindowInputDevice::has_pointer_event | ( | ) | const |
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 173 of file graphicsWindowInputDevice.cxx.
|
static |
This named constructor returns an input device that only has a keyboard, no pointing device.
Definition at line 75 of file graphicsWindowInputDevice.cxx.
|
inline |
Records that the indicated keystroke has been generated.
Definition at line 160 of file graphicsWindowInputDevice.I.
References ClockObject::get_global_clock().
void GraphicsWindowInputDevice::keystroke | ( | int | keycode, |
double | time | ||
) |
Records that the indicated keystroke has been generated.
Definition at line 326 of file graphicsWindowInputDevice.cxx.
|
static |
This named constructor returns an input device that has both a keyboard and pointer.
Definition at line 86 of file graphicsWindowInputDevice.cxx.
Referenced by CallbackGraphicsWindow::create_input_device().
|
static |
This named constructor returns an input device that only has a pointing device, no keyboard.
Definition at line 64 of file graphicsWindowInputDevice.cxx.
|
inline |
Records that the indicated button has been depressed.
Definition at line 186 of file graphicsWindowInputDevice.I.
References ClockObject::get_global_clock().
void GraphicsWindowInputDevice::raw_button_down | ( | ButtonHandle | button, |
double | time | ||
) |
Records that the indicated button has been depressed.
Definition at line 375 of file graphicsWindowInputDevice.cxx.
|
inline |
Records that the indicated button has been released.
Definition at line 196 of file graphicsWindowInputDevice.I.
References ClockObject::get_global_clock().
void GraphicsWindowInputDevice::raw_button_up | ( | ButtonHandle | button, |
double | time | ||
) |
Records that the indicated button has been released.
Definition at line 386 of file graphicsWindowInputDevice.cxx.
|
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, |
double | x, | ||
double | y, | ||
double | time | ||
) |
Records that a mouse movement has taken place.
Definition at line 241 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().
|
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 208 of file graphicsWindowInputDevice.I.
References ClockObject::get_global_clock(), and set_pointer().
|
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 235 of file graphicsWindowInputDevice.I.
References set_pointer().
|
inline |
To be called by a particular kind of GraphicsWindow to indicate that the pointer is no longer within the window.
Definition at line 221 of file graphicsWindowInputDevice.I.
References ClockObject::get_frame_time(), ClockObject::get_global_clock(), and set_pointer().
|
inline |
To be called by a particular kind of GraphicsWindow to indicate that the pointer is no longer within the window.
Definition at line 248 of file graphicsWindowInputDevice.I.
References set_pointer().