MouseWatcher
from panda3d.core import MouseWatcher
- class MouseWatcher
Bases:
DataNode
,MouseWatcherBase
This TFormer maintains a list of rectangular regions on the screen that are considered special mouse regions; typically these will be click buttons. When the mouse passes in or out of one of these regions, or when a button is clicked while the mouse is in one of these regions, an event is thrown.
Mouse events may also be suppressed from the rest of the datagraph in these special regions.
This class can also implement a software mouse pointer by automatically generating a transform to apply to a piece of geometry placed under the 2-d scene graph. It will move the geometry around according to the mouse’s known position.
Finally, this class can keep a record of the mouse trail. This is useful if you want to know, not just where the mouse is, but the exact sequence of movements it took to get there. This information is mainly useful for gesture-recognition code. To use trail logging, you need to enable the generation of pointer events in the GraphicsWindowInputDevice and set the trail log duration in the MouseWatcher. Otherwise, the trail log will be empty.
Inheritance diagram
- __init__(*args, **kwargs)
- addGroup()
C++ Interface: add_group(const MouseWatcher self, MouseWatcherGroup group)
- /**
Adds the indicated group of regions to the set of regions the MouseWatcher
will monitor each frame.
Since the MouseWatcher itself inherits from MouseWatcherBase, this
operation is normally not necessary–you can simply add the Regions you
care about one at a time. Adding a complete group is useful when you may
want to explicitly remove the regions as a group later.
Returns true if the group was successfully added, or false if it was
already on the list.
*/
- add_group()
C++ Interface: add_group(const MouseWatcher self, MouseWatcherGroup group)
- /**
Adds the indicated group of regions to the set of regions the MouseWatcher
will monitor each frame.
Since the MouseWatcher itself inherits from MouseWatcherBase, this
operation is normally not necessary–you can simply add the Regions you
care about one at a time. Adding a complete group is useful when you may
want to explicitly remove the regions as a group later.
Returns true if the group was successfully added, or false if it was
already on the list.
*/
- clearDisplayRegion()
C++ Interface: clear_display_region(const MouseWatcher self)
- /**
Removes the display region constraint from the MouseWatcher, and restores
it to the default behavior of watching the whole window.
*/
- clearGeometry()
C++ Interface: clear_geometry(const MouseWatcher self)
- /**
Stops the use of the software cursor set up via set_geometry().
*/
- clearInactivityTimeout()
C++ Interface: clear_inactivity_timeout(const MouseWatcher self)
- /**
Removes the inactivity timeout and restores the MouseWatcher to its default
behavior of allowing a key to be held indefinitely.
*/
- clearTrailLog()
C++ Interface: clear_trail_log(const MouseWatcher self)
- /**
Clears the mouse trail log. This does not prevent further accumulation of
the log given future events.
*/
- clearTrailNode()
C++ Interface: clear_trail_node(const MouseWatcher self)
- /**
If you have previously fetched the trail node using get_trail_node, then
the MouseWatcher is continually updating the trail node every frame. Using
clear_trail_node causes the MouseWatcher to forget the trail node and stop
updating it.
*/
- clear_display_region()
C++ Interface: clear_display_region(const MouseWatcher self)
- /**
Removes the display region constraint from the MouseWatcher, and restores
it to the default behavior of watching the whole window.
*/
- clear_geometry()
C++ Interface: clear_geometry(const MouseWatcher self)
- /**
Stops the use of the software cursor set up via set_geometry().
*/
- clear_inactivity_timeout()
C++ Interface: clear_inactivity_timeout(const MouseWatcher self)
- /**
Removes the inactivity timeout and restores the MouseWatcher to its default
behavior of allowing a key to be held indefinitely.
*/
- clear_trail_log()
C++ Interface: clear_trail_log(const MouseWatcher self)
- /**
Clears the mouse trail log. This does not prevent further accumulation of
the log given future events.
*/
- clear_trail_node()
C++ Interface: clear_trail_node(const MouseWatcher self)
- /**
If you have previously fetched the trail node using get_trail_node, then
the MouseWatcher is continually updating the trail node every frame. Using
clear_trail_node causes the MouseWatcher to forget the trail node and stop
updating it.
*/
- getButtonDownPattern()
C++ Interface: get_button_down_pattern(MouseWatcher self)
- /**
Returns the string that indicates how event names are generated when a
button is depressed. See set_button_down_pattern().
*/
- getButtonRepeatPattern()
C++ Interface: get_button_repeat_pattern(MouseWatcher self)
- /**
Returns the string that indicates how event names are names are generated
when a button is continuously held and generates keyrepeat “down” events.
See set_button_repeat_pattern().
*/
- getButtonUpPattern()
C++ Interface: get_button_up_pattern(MouseWatcher self)
- /**
Returns the string that indicates how event names are generated when a
button is released. See set_button_down_pattern().
*/
- getClassType()
C++ Interface: get_class_type()
- getDisplayRegion()
C++ Interface: get_display_region(MouseWatcher self)
- /**
Returns the display region the MouseWatcher is constrained to by
set_display_region(), or NULL if it is not constrained.
*/
- getEnterPattern()
C++ Interface: get_enter_pattern(MouseWatcher self)
- /**
Returns the string that indicates how event names are generated when the
mouse enters a region. This is different from within_pattern, in that a
mouse is only “entered” in the topmost region at a given time, while it
might be “within” multiple nested regions.
*/
- getExtraHandler()
C++ Interface: get_extra_handler(MouseWatcher self)
- /**
As an optimization for the C++ Gui, an extra handler can be registered with
a mouseWatcher so that events can be dealt with much sooner.
*/
- getFrame()
C++ Interface: get_frame(MouseWatcher self)
- /**
Returns the frame of the MouseWatcher. See set_frame().
*/
- getGeometry()
C++ Interface: get_geometry(MouseWatcher self)
- /**
Returns the node that has been set as the software mouse pointer, or NULL
if no node has been set. See has_geometry() and set_geometry().
*/
- getGroup()
C++ Interface: get_group(MouseWatcher self, int n)
- /**
Returns the nth group added to the MouseWatcher via add_group().
*/
- getGroups()
- getInactivityTimeout()
C++ Interface: get_inactivity_timeout(MouseWatcher self)
- /**
Returns the inactivity timeout that has been set. It is an error to call
this if has_inactivity_timeout() returns false.
*/
- getInactivityTimeoutEvent()
C++ Interface: get_inactivity_timeout_event(MouseWatcher self)
- /**
Returns the event string that will be generated when the inactivity timeout
counter expires. See set_inactivity_timeout().
*/
- getLeavePattern()
C++ Interface: get_leave_pattern(MouseWatcher self)
- /**
Returns the string that indicates how event names are generated when the
mouse leaves a region. This is different from without_pattern, in that a
mouse is only “entered” in the topmost region at a given time, while it
might be “within” multiple nested regions.
*/
- getModifierButtons()
C++ Interface: get_modifier_buttons(MouseWatcher self)
- /**
Returns the set of buttons that are being monitored as modifier buttons, as
well as their current state.
*/
- getMouse()
C++ Interface: get_mouse(MouseWatcher self)
- /**
It is only valid to call this if has_mouse() returns true. If so, this
returns the current position of the mouse within the window.
*/
- getMouseX()
C++ Interface: get_mouse_x(MouseWatcher self)
- /**
It is only valid to call this if has_mouse() returns true. If so, this
returns the current X position of the mouse within the window.
*/
- getMouseY()
C++ Interface: get_mouse_y(MouseWatcher self)
- /**
It is only valid to call this if has_mouse() returns true. If so, this
returns the current Y position of the mouse within the window.
*/
- getNumGroups()
C++ Interface: get_num_groups(MouseWatcher self)
- /**
Returns the number of separate groups added to the MouseWatcher via
add_group().
*/
- getOverRegion()
C++ Interface: get_over_region(MouseWatcher self) get_over_region(MouseWatcher self, const LPoint2f pos) get_over_region(MouseWatcher self, float x, float y)
- /**
Returns the smallest region the mouse is currently over, or NULL if it is
over no region.
*/
- /**
Returns the smallest region the indicated point is over, or NULL if it is
over no region.
*/
- /**
Returns the preferred region the mouse is over. In the case of overlapping
regions, the region with the largest sort order is preferred; if two
regions have the same sort order, then the smaller region is preferred.
*/
- getTrailLog()
C++ Interface: get_trail_log(MouseWatcher self)
- /**
Obtain the mouse trail log. This is a PointerEventList. Does not make a
copy, therefore, this PointerEventList will be updated each time
process_events gets called.
To use trail logging, you need to enable the generation of pointer events
in the GraphicsWindowInputDevice and set the trail log duration in the
MouseWatcher. Otherwise, the trail log will be empty.
*/
- getTrailNode()
C++ Interface: get_trail_node(const MouseWatcher self)
- /**
Returns a GeomNode that represents the mouse trail. The intent is that you
should reparent this GeomNode to Render2D, and then forget about it. The
MouseWatcher will continually update the trail node. There is only one
trail node, it does not create a new one each time you call get_trail_node.
This is not a particularly beautiful way to render a mouse trail. It is
intended more for debugging purposes than for finished applications. Even
so, It is suggested that you might want to apply a line thickness and
antialias mode to the line — doing so makes it look a lot better.
*/
- getWithinPattern()
C++ Interface: get_within_pattern(MouseWatcher self)
- /**
Returns the string that indicates how event names are generated when the
mouse wanders over a region. This is different from enter_pattern, in that
a mouse is only “entered” in the topmost region at a given time, while it
might be “within” multiple nested regions.
*/
- getWithoutPattern()
C++ Interface: get_without_pattern(MouseWatcher self)
- /**
Returns the string that indicates how event names are generated when the
mouse wanders out of a region. This is different from leave_pattern, in
that a mouse is only “entered” in the topmost region at a given time, while
it might be “within” multiple nested regions.
*/
- get_button_down_pattern()
C++ Interface: get_button_down_pattern(MouseWatcher self)
- /**
Returns the string that indicates how event names are generated when a
button is depressed. See set_button_down_pattern().
*/
- get_button_repeat_pattern()
C++ Interface: get_button_repeat_pattern(MouseWatcher self)
- /**
Returns the string that indicates how event names are names are generated
when a button is continuously held and generates keyrepeat “down” events.
See set_button_repeat_pattern().
*/
- get_button_up_pattern()
C++ Interface: get_button_up_pattern(MouseWatcher self)
- /**
Returns the string that indicates how event names are generated when a
button is released. See set_button_down_pattern().
*/
- get_class_type()
C++ Interface: get_class_type()
- get_display_region()
C++ Interface: get_display_region(MouseWatcher self)
- /**
Returns the display region the MouseWatcher is constrained to by
set_display_region(), or NULL if it is not constrained.
*/
- get_enter_pattern()
C++ Interface: get_enter_pattern(MouseWatcher self)
- /**
Returns the string that indicates how event names are generated when the
mouse enters a region. This is different from within_pattern, in that a
mouse is only “entered” in the topmost region at a given time, while it
might be “within” multiple nested regions.
*/
- get_extra_handler()
C++ Interface: get_extra_handler(MouseWatcher self)
- /**
As an optimization for the C++ Gui, an extra handler can be registered with
a mouseWatcher so that events can be dealt with much sooner.
*/
- get_frame()
C++ Interface: get_frame(MouseWatcher self)
- /**
Returns the frame of the MouseWatcher. See set_frame().
*/
- get_geometry()
C++ Interface: get_geometry(MouseWatcher self)
- /**
Returns the node that has been set as the software mouse pointer, or NULL
if no node has been set. See has_geometry() and set_geometry().
*/
- get_group()
C++ Interface: get_group(MouseWatcher self, int n)
- /**
Returns the nth group added to the MouseWatcher via add_group().
*/
- get_groups()
- get_inactivity_timeout()
C++ Interface: get_inactivity_timeout(MouseWatcher self)
- /**
Returns the inactivity timeout that has been set. It is an error to call
this if has_inactivity_timeout() returns false.
*/
- get_inactivity_timeout_event()
C++ Interface: get_inactivity_timeout_event(MouseWatcher self)
- /**
Returns the event string that will be generated when the inactivity timeout
counter expires. See set_inactivity_timeout().
*/
- get_leave_pattern()
C++ Interface: get_leave_pattern(MouseWatcher self)
- /**
Returns the string that indicates how event names are generated when the
mouse leaves a region. This is different from without_pattern, in that a
mouse is only “entered” in the topmost region at a given time, while it
might be “within” multiple nested regions.
*/
- get_modifier_buttons()
C++ Interface: get_modifier_buttons(MouseWatcher self)
- /**
Returns the set of buttons that are being monitored as modifier buttons, as
well as their current state.
*/
- get_mouse()
C++ Interface: get_mouse(MouseWatcher self)
- /**
It is only valid to call this if has_mouse() returns true. If so, this
returns the current position of the mouse within the window.
*/
- get_mouse_x()
C++ Interface: get_mouse_x(MouseWatcher self)
- /**
It is only valid to call this if has_mouse() returns true. If so, this
returns the current X position of the mouse within the window.
*/
- get_mouse_y()
C++ Interface: get_mouse_y(MouseWatcher self)
- /**
It is only valid to call this if has_mouse() returns true. If so, this
returns the current Y position of the mouse within the window.
*/
- get_num_groups()
C++ Interface: get_num_groups(MouseWatcher self)
- /**
Returns the number of separate groups added to the MouseWatcher via
add_group().
*/
- get_over_region()
C++ Interface: get_over_region(MouseWatcher self) get_over_region(MouseWatcher self, const LPoint2f pos) get_over_region(MouseWatcher self, float x, float y)
- /**
Returns the smallest region the mouse is currently over, or NULL if it is
over no region.
*/
- /**
Returns the smallest region the indicated point is over, or NULL if it is
over no region.
*/
- /**
Returns the preferred region the mouse is over. In the case of overlapping
regions, the region with the largest sort order is preferred; if two
regions have the same sort order, then the smaller region is preferred.
*/
- get_trail_log()
C++ Interface: get_trail_log(MouseWatcher self)
- /**
Obtain the mouse trail log. This is a PointerEventList. Does not make a
copy, therefore, this PointerEventList will be updated each time
process_events gets called.
To use trail logging, you need to enable the generation of pointer events
in the GraphicsWindowInputDevice and set the trail log duration in the
MouseWatcher. Otherwise, the trail log will be empty.
*/
- get_trail_node()
C++ Interface: get_trail_node(const MouseWatcher self)
- /**
Returns a GeomNode that represents the mouse trail. The intent is that you
should reparent this GeomNode to Render2D, and then forget about it. The
MouseWatcher will continually update the trail node. There is only one
trail node, it does not create a new one each time you call get_trail_node.
This is not a particularly beautiful way to render a mouse trail. It is
intended more for debugging purposes than for finished applications. Even
so, It is suggested that you might want to apply a line thickness and
antialias mode to the line — doing so makes it look a lot better.
*/
- get_within_pattern()
C++ Interface: get_within_pattern(MouseWatcher self)
- /**
Returns the string that indicates how event names are generated when the
mouse wanders over a region. This is different from enter_pattern, in that
a mouse is only “entered” in the topmost region at a given time, while it
might be “within” multiple nested regions.
*/
- get_without_pattern()
C++ Interface: get_without_pattern(MouseWatcher self)
- /**
Returns the string that indicates how event names are generated when the
mouse wanders out of a region. This is different from leave_pattern, in
that a mouse is only “entered” in the topmost region at a given time, while
it might be “within” multiple nested regions.
*/
- hasDisplayRegion()
C++ Interface: has_display_region(MouseWatcher self)
- /**
Returns true if the MouseWatcher has been constrained to a particular
region of the screen via set_display_region(), or false otherwise. If this
returns true, get_display_region() may be used to return the particular
region.
*/
- hasGeometry()
C++ Interface: has_geometry(MouseWatcher self)
- /**
Returns true if a software mouse pointer has been setup via set_geometry(),
or false otherwise. See set_geometry().
*/
- hasInactivityTimeout()
C++ Interface: has_inactivity_timeout(MouseWatcher self)
- /**
Returns true if an inactivity timeout has been set, false otherwise.
*/
- hasMouse()
C++ Interface: has_mouse(MouseWatcher self)
- /**
Returns true if the mouse is anywhere within the window, false otherwise.
Also see is_mouse_open().
*/
- has_display_region()
C++ Interface: has_display_region(MouseWatcher self)
- /**
Returns true if the MouseWatcher has been constrained to a particular
region of the screen via set_display_region(), or false otherwise. If this
returns true, get_display_region() may be used to return the particular
region.
*/
- has_geometry()
C++ Interface: has_geometry(MouseWatcher self)
- /**
Returns true if a software mouse pointer has been setup via set_geometry(),
or false otherwise. See set_geometry().
*/
- has_inactivity_timeout()
C++ Interface: has_inactivity_timeout(MouseWatcher self)
- /**
Returns true if an inactivity timeout has been set, false otherwise.
*/
- has_mouse()
C++ Interface: has_mouse(MouseWatcher self)
- /**
Returns true if the mouse is anywhere within the window, false otherwise.
Also see is_mouse_open().
*/
- isButtonDown()
C++ Interface: is_button_down(MouseWatcher self, ButtonHandle button)
- /**
Returns true if the indicated button is currently being held down, false
otherwise.
*/
- isMouseOpen()
C++ Interface: is_mouse_open(MouseWatcher self)
- /**
Returns true if the mouse is within the window and not over some particular
MouseWatcherRegion that is marked to suppress mouse events; that is, that
the mouse is in open space within the window.
*/
- isOverRegion()
C++ Interface: is_over_region(MouseWatcher self) is_over_region(MouseWatcher self, const LPoint2f pos) is_over_region(MouseWatcher self, float x, float y)
- isRawButtonDown()
C++ Interface: is_raw_button_down(MouseWatcher self, ButtonHandle button)
- /**
Similar to is_button_down(), but uses the raw button handle as reported by
the raw- prefixed events, and is not subject to the inactivity timer.
@since 1.11.0
*/
- is_button_down()
C++ Interface: is_button_down(MouseWatcher self, ButtonHandle button)
- /**
Returns true if the indicated button is currently being held down, false
otherwise.
*/
- is_mouse_open()
C++ Interface: is_mouse_open(MouseWatcher self)
- /**
Returns true if the mouse is within the window and not over some particular
MouseWatcherRegion that is marked to suppress mouse events; that is, that
the mouse is in open space within the window.
*/
- is_over_region()
C++ Interface: is_over_region(MouseWatcher self) is_over_region(MouseWatcher self, const LPoint2f pos) is_over_region(MouseWatcher self, float x, float y)
- is_raw_button_down()
C++ Interface: is_raw_button_down(MouseWatcher self, ButtonHandle button)
- /**
Similar to is_button_down(), but uses the raw button handle as reported by
the raw- prefixed events, and is not subject to the inactivity timer.
@since 1.11.0
*/
- noteActivity()
C++ Interface: note_activity(const MouseWatcher self)
- /**
Can be used in conjunction with the inactivity timeout to inform the
MouseWatcher that the user has just performed some action which proves
he/she is present. It may be necessary to call this for external events,
such as joystick action, that the MouseWatcher might otherwise not know
about. This will reset the current inactivity timer. When the inactivity
timer reaches the length of time specified by set_inactivity_timeout(),
with no keyboard or mouse activity and no calls to note_activity(), then
any buttons held will be automatically released.
*/
- note_activity()
C++ Interface: note_activity(const MouseWatcher self)
- /**
Can be used in conjunction with the inactivity timeout to inform the
MouseWatcher that the user has just performed some action which proves
he/she is present. It may be necessary to call this for external events,
such as joystick action, that the MouseWatcher might otherwise not know
about. This will reset the current inactivity timer. When the inactivity
timer reaches the length of time specified by set_inactivity_timeout(),
with no keyboard or mouse activity and no calls to note_activity(), then
any buttons held will be automatically released.
*/
- numTrailRecent()
C++ Interface: num_trail_recent(MouseWatcher self)
- /**
This counter indicates how many events were added to the trail log this
frame. The trail log is updated once per frame, during the process_events
operation.
*/
- num_trail_recent()
C++ Interface: num_trail_recent(MouseWatcher self)
- /**
This counter indicates how many events were added to the trail log this
frame. The trail log is updated once per frame, during the process_events
operation.
*/
- removeGroup()
C++ Interface: remove_group(const MouseWatcher self, MouseWatcherGroup group)
- /**
Removes the indicated group from the set of extra groups associated with
the MouseWatcher. Returns true if successful, or false if the group was
already removed or was never added via add_group().
*/
- removeRegion()
C++ Interface: remove_region(const MouseWatcher self, MouseWatcherRegion region)
- /**
Removes the indicated region from the group. Returns true if it was
successfully removed, or false if it wasn’t there in the first place.
*/
- remove_group()
C++ Interface: remove_group(const MouseWatcher self, MouseWatcherGroup group)
- /**
Removes the indicated group from the set of extra groups associated with
the MouseWatcher. Returns true if successful, or false if the group was
already removed or was never added via add_group().
*/
- remove_region()
C++ Interface: remove_region(const MouseWatcher self, MouseWatcherRegion region)
- /**
Removes the indicated region from the group. Returns true if it was
successfully removed, or false if it wasn’t there in the first place.
*/
- replaceGroup()
C++ Interface: replace_group(const MouseWatcher self, MouseWatcherGroup old_group, MouseWatcherGroup new_group)
- /**
Atomically removes old_group from the MouseWatcher, and replaces it with
new_group. Presumably old_group and new_group might have some regions in
common; these are handled properly.
If old_group is not already present, simply adds new_group and returns
false. Otherwise, removes old_group and adds new_group, and then returns
true.
*/
- replace_group()
C++ Interface: replace_group(const MouseWatcher self, MouseWatcherGroup old_group, MouseWatcherGroup new_group)
- /**
Atomically removes old_group from the MouseWatcher, and replaces it with
new_group. Presumably old_group and new_group might have some regions in
common; these are handled properly.
If old_group is not already present, simply adds new_group and returns
false. Otherwise, removes old_group and adds new_group, and then returns
true.
*/
- setButtonDownPattern()
C++ Interface: set_button_down_pattern(const MouseWatcher self, str pattern)
- /**
Sets the pattern string that indicates how the event names are generated
when a button is depressed. This is a string that may contain any of the
following:
%r - the name of the region the mouse is over %b - the name of the button
pressed.
The event name will be based on the in_pattern string specified here, with
all occurrences of the above strings replaced with the corresponding
values.
*/
- setButtonRepeatPattern()
C++ Interface: set_button_repeat_pattern(const MouseWatcher self, str pattern)
- /**
Sets the pattern string that indicates how the event names are generated
when a button is continuously held and generates keyrepeat “down” events.
This is a string that may contain any of the following:
%r - the name of the region the mouse is over %b - the name of the button
pressed.
The event name will be based on the in_pattern string specified here, with
all occurrences of the above strings replaced with the corresponding
values.
*/
- setButtonUpPattern()
C++ Interface: set_button_up_pattern(const MouseWatcher self, str pattern)
- /**
Sets the pattern string that indicates how the event names are generated
when a button is released. See set_button_down_pattern().
*/
- setDisplayRegion()
C++ Interface: set_display_region(const MouseWatcher self, DisplayRegion dr)
- /**
Constrains the MouseWatcher to watching the mouse within a particular
indicated region of the screen. DataNodes parented under the MouseWatcher
will observe the mouse and keyboard events only when the mouse is within
the indicated region, and the observed range will be from -1 .. 1 across
the region.
Do not delete the DisplayRegion while it is owned by the MouseWatcher.
*/
- setEnterPattern()
C++ Interface: set_enter_pattern(const MouseWatcher self, str pattern)
- /**
Sets the pattern string that indicates how the event names are generated
when the mouse enters a region. This is different from within_pattern, in
that a mouse is only “entered” in the topmost region at a given time, while
it might be “within” multiple nested regions.
*/
- setExtraHandler()
C++ Interface: set_extra_handler(const MouseWatcher self, EventHandler eh)
- /**
As an optimization for the C++ Gui, an extra handler can be registered with
a mouseWatcher so that events can be dealt with much sooner.
*/
- setFrame()
C++ Interface: set_frame(const MouseWatcher self, const LVecBase4f frame) set_frame(const MouseWatcher self, float left, float right, float bottom, float top)
- /**
Sets the frame of the MouseWatcher. See the next flavor of this method for
a more verbose explanation.
*/
- /**
Sets the frame of the MouseWatcher. This determines the coordinate space
in which the MouseWatcherRegions should be expected to live. Normally,
this is left at -1, 1, -1, 1, which is the default setting, and matches the
mouse coordinate range.
Whatever values you specify here indicate the shape of the full screen, and
the MouseWatcherRegions will be given in coordinate space matching it. For
instance, if you specify (0, 1, 0, 1), then a MouseWatcherRegion with the
frame (0, 1, 0, .5) will cover the lower half of the screen.
*/
- setGeometry()
C++ Interface: set_geometry(const MouseWatcher self, PandaNode node)
- /**
Sets the node that will be transformed each frame by the mouse’s
coordinates. It will also be hidden when the mouse goes outside the
window. This can be used to implement a software mouse pointer for when a
hardware (or system) mouse pointer is unavailable.
*/
- setInactivityTimeout()
C++ Interface: set_inactivity_timeout(const MouseWatcher self, double timeout)
- /**
Sets an inactivity timeout on the mouse activity. When this timeout (in
seconds) is exceeded with no keyboard or mouse activity, all currently-held
buttons are automatically released. This is intended to help protect
against people who inadvertently (or intentionally) leave a keyboard key
stuck down and then wander away from the keyboard.
Also, when this timeout expires, the event specified by
set_inactivity_timeout_event() will be generated.
*/
- setInactivityTimeoutEvent()
C++ Interface: set_inactivity_timeout_event(const MouseWatcher self, str event)
- /**
Specifies the event string that will be generated when the inactivity
timeout counter expires. See set_inactivity_timeout().
*/
- setLeavePattern()
C++ Interface: set_leave_pattern(const MouseWatcher self, str pattern)
- /**
Sets the pattern string that indicates how the event names are generated
when the mouse leaves a region. This is different from without_pattern, in
that a mouse is only “entered” in the topmost region at a given time, while
it might be “within” multiple nested regions.
*/
- setModifierButtons()
C++ Interface: set_modifier_buttons(const MouseWatcher self, const ModifierButtons mods)
- /**
Sets the buttons that should be monitored as modifier buttons for
generating events to the MouseWatcherRegions.
*/
- setTrailLogDuration()
C++ Interface: set_trail_log_duration(const MouseWatcher self, double duration)
- /**
If the duration is nonzero, causes the MouseWatcher to log the mouse’s
trail. Events older than the specified duration are discarded. If the
duration is zero, logging is disabled.
*/
- setWithinPattern()
C++ Interface: set_within_pattern(const MouseWatcher self, str pattern)
- /**
Sets the pattern string that indicates how the event names are generated
when the mouse wanders over a region. This is different from
enter_pattern, in that a mouse is only “entered” in the topmost region at a
given time, while it might be “within” multiple nested regions.
*/
- setWithoutPattern()
C++ Interface: set_without_pattern(const MouseWatcher self, str pattern)
- /**
Sets the pattern string that indicates how the event names are generated
when the mouse wanders out of a region. This is different from
leave_pattern, in that a mouse is only “entered” in the topmost region at a
given time, while it might be “within” multiple nested regions.
*/
- set_button_down_pattern()
C++ Interface: set_button_down_pattern(const MouseWatcher self, str pattern)
- /**
Sets the pattern string that indicates how the event names are generated
when a button is depressed. This is a string that may contain any of the
following:
%r - the name of the region the mouse is over %b - the name of the button
pressed.
The event name will be based on the in_pattern string specified here, with
all occurrences of the above strings replaced with the corresponding
values.
*/
- set_button_repeat_pattern()
C++ Interface: set_button_repeat_pattern(const MouseWatcher self, str pattern)
- /**
Sets the pattern string that indicates how the event names are generated
when a button is continuously held and generates keyrepeat “down” events.
This is a string that may contain any of the following:
%r - the name of the region the mouse is over %b - the name of the button
pressed.
The event name will be based on the in_pattern string specified here, with
all occurrences of the above strings replaced with the corresponding
values.
*/
- set_button_up_pattern()
C++ Interface: set_button_up_pattern(const MouseWatcher self, str pattern)
- /**
Sets the pattern string that indicates how the event names are generated
when a button is released. See set_button_down_pattern().
*/
- set_display_region()
C++ Interface: set_display_region(const MouseWatcher self, DisplayRegion dr)
- /**
Constrains the MouseWatcher to watching the mouse within a particular
indicated region of the screen. DataNodes parented under the MouseWatcher
will observe the mouse and keyboard events only when the mouse is within
the indicated region, and the observed range will be from -1 .. 1 across
the region.
Do not delete the DisplayRegion while it is owned by the MouseWatcher.
*/
- set_enter_pattern()
C++ Interface: set_enter_pattern(const MouseWatcher self, str pattern)
- /**
Sets the pattern string that indicates how the event names are generated
when the mouse enters a region. This is different from within_pattern, in
that a mouse is only “entered” in the topmost region at a given time, while
it might be “within” multiple nested regions.
*/
- set_extra_handler()
C++ Interface: set_extra_handler(const MouseWatcher self, EventHandler eh)
- /**
As an optimization for the C++ Gui, an extra handler can be registered with
a mouseWatcher so that events can be dealt with much sooner.
*/
- set_frame()
C++ Interface: set_frame(const MouseWatcher self, const LVecBase4f frame) set_frame(const MouseWatcher self, float left, float right, float bottom, float top)
- /**
Sets the frame of the MouseWatcher. See the next flavor of this method for
a more verbose explanation.
*/
- /**
Sets the frame of the MouseWatcher. This determines the coordinate space
in which the MouseWatcherRegions should be expected to live. Normally,
this is left at -1, 1, -1, 1, which is the default setting, and matches the
mouse coordinate range.
Whatever values you specify here indicate the shape of the full screen, and
the MouseWatcherRegions will be given in coordinate space matching it. For
instance, if you specify (0, 1, 0, 1), then a MouseWatcherRegion with the
frame (0, 1, 0, .5) will cover the lower half of the screen.
*/
- set_geometry()
C++ Interface: set_geometry(const MouseWatcher self, PandaNode node)
- /**
Sets the node that will be transformed each frame by the mouse’s
coordinates. It will also be hidden when the mouse goes outside the
window. This can be used to implement a software mouse pointer for when a
hardware (or system) mouse pointer is unavailable.
*/
- set_inactivity_timeout()
C++ Interface: set_inactivity_timeout(const MouseWatcher self, double timeout)
- /**
Sets an inactivity timeout on the mouse activity. When this timeout (in
seconds) is exceeded with no keyboard or mouse activity, all currently-held
buttons are automatically released. This is intended to help protect
against people who inadvertently (or intentionally) leave a keyboard key
stuck down and then wander away from the keyboard.
Also, when this timeout expires, the event specified by
set_inactivity_timeout_event() will be generated.
*/
- set_inactivity_timeout_event()
C++ Interface: set_inactivity_timeout_event(const MouseWatcher self, str event)
- /**
Specifies the event string that will be generated when the inactivity
timeout counter expires. See set_inactivity_timeout().
*/
- set_leave_pattern()
C++ Interface: set_leave_pattern(const MouseWatcher self, str pattern)
- /**
Sets the pattern string that indicates how the event names are generated
when the mouse leaves a region. This is different from without_pattern, in
that a mouse is only “entered” in the topmost region at a given time, while
it might be “within” multiple nested regions.
*/
- set_modifier_buttons()
C++ Interface: set_modifier_buttons(const MouseWatcher self, const ModifierButtons mods)
- /**
Sets the buttons that should be monitored as modifier buttons for
generating events to the MouseWatcherRegions.
*/
- set_trail_log_duration()
C++ Interface: set_trail_log_duration(const MouseWatcher self, double duration)
- /**
If the duration is nonzero, causes the MouseWatcher to log the mouse’s
trail. Events older than the specified duration are discarded. If the
duration is zero, logging is disabled.
*/
- set_within_pattern()
C++ Interface: set_within_pattern(const MouseWatcher self, str pattern)
- /**
Sets the pattern string that indicates how the event names are generated
when the mouse wanders over a region. This is different from
enter_pattern, in that a mouse is only “entered” in the topmost region at a
given time, while it might be “within” multiple nested regions.
*/
- set_without_pattern()
C++ Interface: set_without_pattern(const MouseWatcher self, str pattern)
- /**
Sets the pattern string that indicates how the event names are generated
when the mouse wanders out of a region. This is different from
leave_pattern, in that a mouse is only “entered” in the topmost region at a
given time, while it might be “within” multiple nested regions.
*/
- upcastToDataNode()
C++ Interface: upcast_to_DataNode(const MouseWatcher self)
upcast from MouseWatcher to DataNode
- upcastToMouseWatcherBase()
C++ Interface: upcast_to_MouseWatcherBase(const MouseWatcher self)
upcast from MouseWatcher to MouseWatcherBase
- upcast_to_DataNode()
C++ Interface: upcast_to_DataNode(const MouseWatcher self)
upcast from MouseWatcher to DataNode
- upcast_to_MouseWatcherBase()
C++ Interface: upcast_to_MouseWatcherBase(const MouseWatcher self)
upcast from MouseWatcher to MouseWatcherBase