Panda3D
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends
MouseWatcherGroup Class Reference

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

#include "mouseWatcherGroup.h"

Inheritance diagram for MouseWatcherGroup:
ReferenceCount MemoryBase MouseWatcher PGMouseWatcherGroup

List of all members.

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.
MouseWatcherRegionfind_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.
MouseWatcherRegionget_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

Detailed Description

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

Definition at line 32 of file mouseWatcherGroup.h.


Member Function Documentation

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.

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

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

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.

Returns the number of regions in the group.

Definition at line 191 of file mouseWatcherGroup.cxx.

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.

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

Definition at line 89 of file mouseWatcherGroup.cxx.

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

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

Definition at line 179 of file mouseWatcherGroup.cxx.

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

Sorts all the regions in this group into pointer order.

Definition at line 167 of file mouseWatcherGroup.cxx.

References do_sort_regions().

Refreshes the visualization created by show_regions().

Definition at line 295 of file mouseWatcherGroup.cxx.

References do_update_regions().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations