Panda3D
|
The "top" node of the new Panda GUI system. More...
#include "pgTop.h"
Public Member Functions | |
PGTop (const string &name) | |
void | add_region (MouseWatcherRegion *region) |
Adds the indicated region to the set of regions in the group. | |
void | clear_regions () |
virtual bool | cull_callback (CullTraverser *trav, CullTraverserData &data) |
This function will be called during the cull traversal to perform any additional operations that should be performed at cull time. | |
virtual TypeHandle | force_init_type () |
MouseWatcherGroup * | get_group () const |
Returns the MouseWatcherGroup pointer that the PGTop object registers its PG items with, or NULL if the MouseWatcher has not yet been set. | |
MouseWatcher * | get_mouse_watcher () const |
Returns the MouseWatcher pointer that the PGTop object registers its PG items with, or NULL if the MouseWatcher has not yet been set. | |
int | get_start_sort () const |
Returns the sort index that is assigned during the traversal to the first PGItem that is discovered during traversal. | |
virtual TypeHandle | get_type () const |
virtual bool | is_renderable () const |
Returns true if there is some value to visiting this particular node during the cull traversal for any camera, false otherwise. | |
virtual PandaNode * | make_copy () const |
Returns a newly-allocated Node that is a shallow copy of this one. | |
void | set_mouse_watcher (MouseWatcher *watcher) |
Sets the MouseWatcher pointer that the PGTop object registers its PG items with. | |
void | set_start_sort (int start_sort) |
Specifies the sort index that is assigned during the traversal to the first PGItem that is discovered during traversal. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
Protected Member Functions | |
PGTop (const PGTop ©) | |
Friends | |
class | PGMouseWatcherGroup |
The "top" node of the new Panda GUI system.
This node must be parented to the 2-d scene graph, and all PG objects should be parented to this node or somewhere below it. PG objects not parented within this hierarchy will not be clickable.
This node begins the special traversal of the PG objects that registers each node within the MouseWatcher and forces everything to render in a depth-first, left-to-right order, appropriate for 2-d objects.
void PGTop::add_region | ( | MouseWatcherRegion * | region | ) | [inline] |
Adds the indicated region to the set of regions in the group.
Definition at line 97 of file pgTop.I.
Referenced by PGItem::cull_callback().
bool PGTop::cull_callback | ( | CullTraverser * | trav, |
CullTraverserData & | data | ||
) | [virtual] |
This function will be called during the cull traversal to perform any additional operations that should be performed at cull time.
This may include additional manipulation of render state or additional visible/invisible decisions, or any other arbitrary operation.
Note that this function will *not* be called unless set_cull_callback() is called in the constructor of the derived class. It is necessary to call set_cull_callback() to indicated that we require cull_callback() to be called.
By the time this function is called, the node has already passed the bounding-volume test for the viewing frustum, and the node's transform and state have already been applied to the indicated CullTraverserData object.
The return value is true if this node should be visible, or false if it should be culled.
Reimplemented from PandaNode.
Definition at line 98 of file pgTop.cxx.
References CullTraverser::end_traverse(), ReferenceCount::local_object(), and CullTraverser::traverse_below().
MouseWatcherGroup * PGTop::get_group | ( | ) | const [inline] |
Returns the MouseWatcherGroup pointer that the PGTop object registers its PG items with, or NULL if the MouseWatcher has not yet been set.
MouseWatcher * PGTop::get_mouse_watcher | ( | ) | const [inline] |
Returns the MouseWatcher pointer that the PGTop object registers its PG items with, or NULL if the MouseWatcher has not yet been set.
int PGTop::get_start_sort | ( | ) | const [inline] |
Returns the sort index that is assigned during the traversal to the first PGItem that is discovered during traversal.
See set_start_sort().
bool PGTop::is_renderable | ( | ) | const [virtual] |
Returns true if there is some value to visiting this particular node during the cull traversal for any camera, false otherwise.
This will be used to optimize the result of get_net_draw_show_mask(), so that any subtrees that contain only nodes for which is_renderable() is false need not be visited.
Reimplemented from PandaNode.
PandaNode * PGTop::make_copy | ( | ) | const [virtual] |
void PGTop::set_mouse_watcher | ( | MouseWatcher * | watcher | ) |
Sets the MouseWatcher pointer that the PGTop object registers its PG items with.
This must be set before the PG items are active.
void PGTop::set_start_sort | ( | int | start_sort | ) | [inline] |
Specifies the sort index that is assigned during the traversal to the first PGItem that is discovered during traversal.
Subsequent PGItems will be assigned consecutively higher sort indexes.
This number is used by the MouseWatcher system to rank the clickable mouse regions in the same order in which the items are rendered, so that items on top will receive mouse priority.
Normally, it makes the most sense to leave this initial value at its default value of 0, unless you need the PGItems to have a particular sort value with respect to some other objects in the scene (particularly with a second PGTop node).