Panda3D
|
This represents a collection of MouseWatcherRegions that may be managed as a group. More...
#include "mouseWatcherBase.h"
Public Member Functions | |
void | add_region (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... | |
MouseWatcherRegion * | find_region (const string &name) const |
Returns a pointer to the first region found with the indicated name. More... | |
int | get_num_regions () const |
Returns the number of regions in the group. More... | |
MouseWatcherRegion * | get_region (int n) const |
Returns the nth region of the group; returns NULL if there is no nth region. More... | |
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 |
Returns true if the group has already been sorted, false otherwise. More... | |
MAKE_SEQ (get_regions, get_num_regions, get_region) | |
void | output (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 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 (ostream &out, int indent_level=0) const |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
Friends | |
class | BlobWatcher |
class | MouseWatcher |
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 34 of file mouseWatcherBase.h.
void MouseWatcherBase::add_region | ( | MouseWatcherRegion * | region | ) |
Adds the indicated region to the set of regions in the group.
It is an error to add the same region to the set more than once.
Definition at line 55 of file mouseWatcherBase.cxx.
References has_region().
void MouseWatcherBase::clear_regions | ( | ) |
Removes all the regions from the group.
Definition at line 146 of file mouseWatcherBase.cxx.
References sort_regions().
Referenced by find_region().
MouseWatcherRegion * MouseWatcherBase::find_region | ( | const 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 126 of file mouseWatcherBase.cxx.
References clear_regions().
Referenced by remove_region().
int MouseWatcherBase::get_num_regions | ( | ) | const |
Returns the number of regions in the group.
Definition at line 191 of file mouseWatcherBase.cxx.
References get_region().
Referenced by is_sorted().
MouseWatcherRegion * MouseWatcherBase::get_region | ( | int | n | ) | const |
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 206 of file mouseWatcherBase.cxx.
References show_regions().
Referenced by get_num_regions().
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 89 of file mouseWatcherBase.cxx.
References remove_region().
Referenced by add_region().
void MouseWatcherBase::hide_regions | ( | ) |
Stops the visualization created by a previous call to show_regions().
Definition at line 281 of file mouseWatcherBase.cxx.
References update_regions().
Referenced by MouseWatcher::note_activity(), and set_color().
bool MouseWatcherBase::is_sorted | ( | ) | const |
Returns true if the group has already been sorted, false otherwise.
Definition at line 179 of file mouseWatcherBase.cxx.
References get_num_regions().
Referenced by sort_regions().
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 113 of file mouseWatcherBase.cxx.
References find_region().
Referenced by has_region().
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 265 of file mouseWatcherBase.cxx.
References hide_regions().
Referenced by show_regions().
void MouseWatcherBase::show_regions | ( | const NodePath & | render2d, |
const 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 250 of file mouseWatcherBase.cxx.
References set_color().
Referenced by MouseWatcher::add_group(), get_region(), and MouseWatcher::note_activity().
void MouseWatcherBase::sort_regions | ( | ) |
Sorts all the regions in this group into pointer order.
Definition at line 167 of file mouseWatcherBase.cxx.
References is_sorted().
Referenced by clear_regions().
void MouseWatcherBase::update_regions | ( | ) |
Refreshes the visualization created by show_regions().
Definition at line 295 of file mouseWatcherBase.cxx.
References NodePath::attach_new_node(), LVector3f::rfu(), and NodePath::set_bin().
Referenced by hide_regions().