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

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

#include "mouseWatcherBase.h"

Inheritance diagram for MouseWatcherBase:
MouseWatcher MouseWatcherGroup PGMouseWatcherGroup

Public Member Functions

void add_region (PT(MouseWatcherRegion) region)
 Adds the indicated region to the set of regions in the group. More...
 
void clear_regions ()
 Removes all the regions from the group. More...
 
MouseWatcherRegionfind_region (const std::string &name) const
 Returns a pointer to the first region found with the indicated name. More...
 
size_t get_num_regions () const
 
MouseWatcherRegionget_region (size_t n) const
 
bool has_region (MouseWatcherRegion *region) const
 Returns true if the indicated region has already been added to the MouseWatcherBase, false otherwise. More...
 
void hide_regions ()
 Stops the visualization created by a previous call to show_regions(). More...
 
bool is_sorted () const
 
void output (std::ostream &out) const
 
bool remove_region (MouseWatcherRegion *region)
 Removes the indicated region from the group. More...
 
void set_color (const LColor &color)
 Specifies the color used to draw the region rectangles for the regions visualized by show_regions(). More...
 
void show_regions (const NodePath &render2d, const std::string &bin_name, int draw_order)
 Enables the visualization of all of the regions handled by this MouseWatcherBase. More...
 
void sort_regions ()
 Sorts all the regions in this group into pointer order. More...
 
void update_regions ()
 Refreshes the visualization created by show_regions(). More...
 
void write (std::ostream &out, int indent_level=0) const
 

Static Public Member Functions

static TypeHandle get_class_type ()
 
static void init_type ()
 

Public Attributes

 get_num_regions
 Returns the number of regions in the group. More...
 
 get_region
 Returns the nth region of the group; returns NULL if there is no nth region. More...
 
 is_sorted
 Returns true if the group has already been sorted, false otherwise. More...
 

Friends

class BlobWatcher
 
class MouseWatcher
 

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.

Definition at line 32 of file mouseWatcherBase.h.

Member Function Documentation

◆ add_region()

void MouseWatcherBase::add_region ( PT(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.

Definition at line 47 of file mouseWatcherBase.cxx.

◆ clear_regions()

void MouseWatcherBase::clear_regions ( )

Removes all the regions from the group.

Definition at line 124 of file mouseWatcherBase.cxx.

References ordered_vector< Key, Compare, Vector >::clear(), NodePath::node(), and PandaNode::remove_all_children().

◆ find_region()

MouseWatcherRegion * MouseWatcherBase::find_region ( const std::string &  name) const

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.

Definition at line 108 of file mouseWatcherBase.cxx.

◆ has_region()

bool MouseWatcherBase::has_region ( MouseWatcherRegion region) const

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

Definition at line 76 of file mouseWatcherBase.cxx.

◆ hide_regions()

void MouseWatcherBase::hide_regions ( )

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

Definition at line 220 of file mouseWatcherBase.cxx.

◆ remove_region()

bool MouseWatcherBase::remove_region ( 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.

Definition at line 97 of file mouseWatcherBase.cxx.

◆ set_color()

void MouseWatcherBase::set_color ( const LColor &  color)

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

Definition at line 207 of file mouseWatcherBase.cxx.

◆ show_regions()

void MouseWatcherBase::show_regions ( const NodePath render2d,
const std::string &  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.

Definition at line 195 of file mouseWatcherBase.cxx.

Referenced by MouseWatcher::add_group().

◆ sort_regions()

void MouseWatcherBase::sort_regions ( )
inline

Sorts all the regions in this group into pointer order.

Definition at line 18 of file mouseWatcherBase.I.

◆ update_regions()

void MouseWatcherBase::update_regions ( )

Refreshes the visualization created by show_regions().

Definition at line 231 of file mouseWatcherBase.cxx.

Member Data Documentation

◆ get_num_regions

size_t MouseWatcherBase::get_num_regions

Returns the number of regions in the group.

Definition at line 50 of file mouseWatcherBase.h.

◆ get_region

MouseWatcherRegion * MouseWatcherBase::get_region

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.

Definition at line 50 of file mouseWatcherBase.h.

◆ is_sorted

bool MouseWatcherBase::is_sorted
inline

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

Definition at line 46 of file mouseWatcherBase.h.


The documentation for this class was generated from the following files: