Panda3D
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
PGTop Class Reference

The "top" node of the new Panda GUI system. More...

#include "pgTop.h"

Inheritance diagram for PGTop:
PandaNode TypedWritable Namable LinkedListNode ReferenceCount TypedObject MemoryBase MemoryBase MemoryBase

List of all members.

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 ()
MouseWatcherGroupget_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.
MouseWatcherget_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 PandaNodemake_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 &copy)

Friends

class PGMouseWatcherGroup

Detailed Description

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.

Definition at line 43 of file pgTop.h.


Member Function Documentation

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.

Definition at line 49 of file pgTop.I.

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.

Definition at line 37 of file pgTop.I.

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

Definition at line 85 of file pgTop.I.

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.

Definition at line 143 of file pgTop.cxx.

PandaNode * PGTop::make_copy ( ) const [virtual]

Returns a newly-allocated Node that is a shallow copy of this one.

It will be a different Node pointer, but its internal data may or may not be shared with that of the original Node.

Reimplemented from PandaNode.

Definition at line 68 of file pgTop.cxx.

Sets the MouseWatcher pointer that the PGTop object registers its PG items with.

This must be set before the PG items are active.

Definition at line 158 of file pgTop.cxx.

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

Definition at line 73 of file pgTop.I.


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