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

This represents a collection of MouseWatcherRegions that may be managed as a group. More...

Inheritance diagram for MouseWatcherBase:
MouseWatcher MouseWatcherGroup

Public Member Functions

 addRegion (MouseWatcherRegion region)
 Adds the indicated region to the set of regions in the group. More...
 
 clearRegions ()
 Removes all the regions from the group. More...
 
MouseWatcherRegion findRegion (str name)
 Returns a pointer to the first region found with the indicated name. More...
 
int getNumRegions ()
 Returns the number of regions in the group. More...
 
MouseWatcherRegion getRegion (int n)
 Returns the nth region of the group; returns NULL if there is no nth region. More...
 
list getRegions ()
 
bool hasRegion (MouseWatcherRegion region)
 Returns true if the indicated region has already been added to the MouseWatcherBase, false otherwise. More...
 
 hideRegions ()
 Stops the visualization created by a previous call to show_regions(). More...
 
bool isSorted ()
 Returns true if the group has already been sorted, false otherwise. More...
 
 output (Ostream out)
 
bool removeRegion (MouseWatcherRegion region)
 Removes the indicated region from the group. More...
 
 setColor (const LColor color)
 Specifies the color used to draw the region rectangles for the regions visualized by show_regions(). More...
 
 showRegions (const NodePath render2d, str bin_name, int draw_order)
 Enables the visualization of all of the regions handled by this MouseWatcherBase. More...
 
 sortRegions ()
 Sorts all the regions in this group into pointer order. More...
 
 updateRegions ()
 Refreshes the visualization created by show_regions(). More...
 
 write (Ostream out, int indent_level)
 

Static Public Member Functions

static TypeHandle getClassType ()
 

Public Attributes

MouseWatcherRegion regions []
 
bool sorted
 Returns true if the group has already been sorted, false otherwise. More...
 

Detailed Description

This represents a collection of MouseWatcherRegions that may be managed as a group.

This is the base class for both MouseWatcherGroup and MouseWatcher, and exists so that we don't have to make MouseWatcher inherit from ReferenceCount more than once.

Member Function Documentation

◆ addRegion()

addRegion ( MouseWatcherRegion  region)

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()

clearRegions ( )

Removes all the regions from the group.

◆ findRegion()

MouseWatcherRegion findRegion ( str  name)

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.

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getNumRegions()

int getNumRegions ( )

Returns the number of regions in the group.

◆ getRegion()

MouseWatcherRegion getRegion ( int  n)

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.

◆ getRegions()

list getRegions ( )

◆ hasRegion()

bool hasRegion ( MouseWatcherRegion  region)

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

◆ hideRegions()

hideRegions ( )

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

◆ isSorted()

bool isSorted ( )

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

◆ output()

output ( Ostream  out)

◆ removeRegion()

bool removeRegion ( 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.

◆ setColor()

setColor ( const LColor  color)

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

◆ showRegions()

showRegions ( const NodePath  render2d,
str  bin_name,
int  draw_order 
)

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()

sortRegions ( )

Sorts all the regions in this group into pointer order.

◆ updateRegions()

updateRegions ( )

Refreshes the visualization created by show_regions().

◆ write()

write ( Ostream  out,
int  indent_level 
)

Member Data Documentation

◆ regions

MouseWatcherRegion regions[]

◆ sorted

bool sorted

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