Panda3D
|
This represents a collection of MouseWatcherRegions that may be managed as a group. More...
#include "mouseWatcherGroup.h"
Public Member Functions | |
void | add_region (MouseWatcherRegion *region) |
Adds the indicated region to the set of regions in the group. | |
void | clear_regions () |
Removes all the regions from the group. | |
MouseWatcherRegion * | find_region (const string &name) const |
Returns a pointer to the first region found with the indicated name. | |
int | get_num_regions () const |
Returns the number of regions in the group. | |
MouseWatcherRegion * | get_region (int n) const |
Returns the nth region of the group; returns NULL if there is no nth region. | |
bool | has_region (MouseWatcherRegion *region) const |
Returns true if the indicated region has already been added to the MouseWatcherGroup, false otherwise. | |
void | hide_regions () |
Stops the visualization created by a previous call to show_regions(). | |
bool | is_sorted () const |
Returns true if the group has already been sorted, false otherwise. | |
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. | |
void | set_color (const LColor &color) |
Specifies the color used to draw the region rectangles for the regions visualized by show_regions(). | |
void | show_regions (const NodePath &render2d, const string &bin_name, int draw_order) |
Enables the visualization of all of the regions handled by this MouseWatcherGroup. | |
void | sort_regions () |
Sorts all the regions in this group into pointer order. | |
void | update_regions () |
Refreshes the visualization created by show_regions(). | |
void | write (ostream &out, int indent_level=0) const |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
Protected Types | |
typedef pvector< PT(MouseWatcherRegion) > | Regions |
Protected Member Functions | |
virtual void | do_hide_regions () |
The protected implementation of hide_regions(). | |
bool | do_remove_region (MouseWatcherRegion *region) |
The internal implementation of remove_region(); assumes the lock is already held. | |
virtual void | do_show_regions (const NodePath &render2d, const string &bin_name, int draw_order) |
The protected implementation of show_regions(). | |
void | do_sort_regions () |
Sorts all the regions in this group into pointer order. | |
void | do_update_regions () |
Internally regenerates the show_regions() visualization. | |
Protected Attributes | |
LightMutex | _lock |
Regions | _regions |
bool | _sorted |
Friends | |
class | BlobWatcher |
class | MouseWatcher |
This represents a collection of MouseWatcherRegions that may be managed as a group.
Definition at line 32 of file mouseWatcherGroup.h.
void MouseWatcherGroup::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 mouseWatcherGroup.cxx.
void MouseWatcherGroup::clear_regions | ( | ) |
Removes all the regions from the group.
Definition at line 146 of file mouseWatcherGroup.cxx.
References NodePath::node(), and PandaNode::remove_all_children().
void MouseWatcherGroup::do_hide_regions | ( | ) | [protected, virtual] |
The protected implementation of hide_regions().
This assumes the lock is already held.
Reimplemented in MouseWatcher.
Definition at line 383 of file mouseWatcherGroup.cxx.
References NodePath::remove_node().
Referenced by do_show_regions(), hide_regions(), MouseWatcher::remove_group(), and MouseWatcher::replace_group().
bool MouseWatcherGroup::do_remove_region | ( | MouseWatcherRegion * | region | ) | [protected] |
The internal implementation of remove_region(); assumes the lock is already held.
Definition at line 323 of file mouseWatcherGroup.cxx.
References NodePath::node(), and PandaNode::remove_child().
Referenced by remove_region(), and MouseWatcher::remove_region().
void MouseWatcherGroup::do_show_regions | ( | const NodePath & | render2d, |
const string & | bin_name, | ||
int | draw_order | ||
) | [protected, virtual] |
The protected implementation of show_regions().
This assumes the lock is already held.
Reimplemented in MouseWatcher.
Definition at line 365 of file mouseWatcherGroup.cxx.
References NodePath::attach_new_node(), do_hide_regions(), do_update_regions(), and NodePath::set_bin().
Referenced by MouseWatcher::replace_group(), and show_regions().
void MouseWatcherGroup::do_sort_regions | ( | ) | [protected] |
Sorts all the regions in this group into pointer order.
Assumes the lock is already held.
Definition at line 309 of file mouseWatcherGroup.cxx.
Referenced by MouseWatcher::remove_group(), MouseWatcher::replace_group(), and sort_regions().
void MouseWatcherGroup::do_update_regions | ( | ) | [protected] |
Internally regenerates the show_regions() visualization.
Assumes the lock is already held.
Definition at line 399 of file mouseWatcherGroup.cxx.
References LightMutexDirect::debug_is_locked(), NodePath::node(), and PandaNode::remove_all_children().
Referenced by do_show_regions(), MouseWatcher::replace_group(), set_color(), and update_regions().
MouseWatcherRegion * MouseWatcherGroup::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 mouseWatcherGroup.cxx.
int MouseWatcherGroup::get_num_regions | ( | ) | const |
Returns the number of regions in the group.
Definition at line 191 of file mouseWatcherGroup.cxx.
MouseWatcherRegion * MouseWatcherGroup::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 mouseWatcherGroup.cxx.
bool MouseWatcherGroup::has_region | ( | MouseWatcherRegion * | region | ) | const |
Returns true if the indicated region has already been added to the MouseWatcherGroup, false otherwise.
Definition at line 89 of file mouseWatcherGroup.cxx.
void MouseWatcherGroup::hide_regions | ( | ) |
Stops the visualization created by a previous call to show_regions().
Definition at line 281 of file mouseWatcherGroup.cxx.
References do_hide_regions().
Referenced by MouseWatcher::do_hide_regions().
bool MouseWatcherGroup::is_sorted | ( | ) | const |
Returns true if the group has already been sorted, false otherwise.
Definition at line 179 of file mouseWatcherGroup.cxx.
bool MouseWatcherGroup::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.
Reimplemented in MouseWatcher.
Definition at line 113 of file mouseWatcherGroup.cxx.
References do_remove_region().
void MouseWatcherGroup::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 mouseWatcherGroup.cxx.
References do_update_regions().
void MouseWatcherGroup::show_regions | ( | const NodePath & | render2d, |
const string & | bin_name, | ||
int | draw_order | ||
) |
Enables the visualization of all of the regions handled by this MouseWatcherGroup.
The supplied NodePath should be the root of the 2-d scene graph for the window.
Definition at line 250 of file mouseWatcherGroup.cxx.
References do_show_regions().
Referenced by MouseWatcher::add_group(), and MouseWatcher::do_show_regions().
void MouseWatcherGroup::sort_regions | ( | ) |
Sorts all the regions in this group into pointer order.
Definition at line 167 of file mouseWatcherGroup.cxx.
References do_sort_regions().
void MouseWatcherGroup::update_regions | ( | ) |
Refreshes the visualization created by show_regions().
Definition at line 295 of file mouseWatcherGroup.cxx.
References do_update_regions().