panda3d.core.MouseWatcherBase

class MouseWatcherBase

This represents a collection of MouseWatcherRegions that may be managed as a group. This is the base class for both MouseWatcherGroup and :class:`~MouseWatcher`, and exists so that we don’t have to make :class:`~MouseWatcher` inherit from ReferenceCount more than once.

Inheritance diagram

Inheritance diagram of MouseWatcherBase

addRegion(region: MouseWatcherRegion) → None

Adds the indicated region to the set of regions in the group. It is no longer an error to call this for the same region more than once.

clearRegions() → None

Removes all the regions from the group.

findRegion(name: str) → MouseWatcherRegion

Returns a pointer to the first region found with the indicated name. If multiple regions share the same name, the one that is returned is indeterminate.

Return type

MouseWatcherRegion

static getClassType() → TypeHandle
Return type

TypeHandle

getNumRegions() → size_t

Returns the number of regions in the group.

Return type

size_t

getRegion(n: size_t) → MouseWatcherRegion

Returns the nth region of the group; returns NULL if there is no nth region. Note that this is not thread-safe; another thread might have removed the nth region before you called this method.

Return type

MouseWatcherRegion

getRegions() → list
hasRegion(region: MouseWatcherRegion) → bool

Returns true if the indicated region has already been added to the MouseWatcherBase, false otherwise.

hideRegions() → None

Stops the visualization created by a previous call to showRegions().

isSorted() → bool

Returns true if the group has already been sorted, false otherwise.

output(out: ostream) → None
property regions

Returns the nth region of the group; returns NULL if there is no nth region. Note that this is not thread-safe; another thread might have removed the nth region before you called this method.

Return type

Sequence[MouseWatcherRegion]

removeRegion(region: MouseWatcherRegion) → bool

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.

setColor(color: LColor) → None

Specifies the color used to draw the region rectangles for the regions visualized by showRegions().

showRegions(render2d: NodePath, bin_name: str, draw_order: int) → None

Enables the visualization of all of the regions handled by this MouseWatcherBase. The supplied NodePath should be the root of the 2-d scene graph for the window.

sortRegions() → None

Sorts all the regions in this group into pointer order.

property sorted

Returns true if the group has already been sorted, false otherwise.

Return type

bool

updateRegions() → None

Refreshes the visualization created by showRegions().

write(out: ostream, indent_level: int) → None