Panda3D

Loading...
Searching...
No Matches
pgTop.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file pgTop.h
10 * @author drose
11 * @date 2002-03-13
12 */
13
14#ifndef PGTOP_H
15#define PGTOP_H
16
17#include "pandabase.h"
18
19#include "pgMouseWatcherGroup.h"
20
21#include "pandaNode.h"
22#include "mouseWatcher.h"
23#include "pointerTo.h"
24
25 class GraphicsStateGuardian;
26 class PGMouseWatcherGroup;
27
28/**
29 * The "top" node of the new Panda GUI system. This node must be parented to
30 * the 2-d scene graph, and all PG objects should be parented to this node or
31 * somewhere below it. PG objects not parented within this hierarchy will not
32 * be clickable.
33 *
34 * This node begins the special traversal of the PG objects that registers
35 * each node within the MouseWatcher and forces everything to render in a
36 * depth-first, left-to-right order, appropriate for 2-d objects.
37 */
38 class EXPCL_PANDA_PGUI PGTop : public PandaNode {
39PUBLISHED:
40 explicit PGTop(const std::string &name);
41 virtual ~PGTop();
42
43 protected:
44 INLINE PGTop(const PGTop &copy);
45
46 public:
47 virtual PandaNode *make_copy() const;
48 virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
49 virtual bool is_renderable() const;
50
51PUBLISHED:
52 void set_mouse_watcher(MouseWatcher *watcher);
53 INLINE MouseWatcher *get_mouse_watcher() const;
54 INLINE MouseWatcherGroup *get_group() const;
55
56 INLINE void set_start_sort(int start_sort);
57 INLINE int get_start_sort() const;
58
59 public:
60 // These methods duplicate the functionality of MouseWatcherGroup.
61 INLINE void add_region(MouseWatcherRegion *region);
62 INLINE void clear_regions();
63
64 private:
65 PT(MouseWatcher) _watcher;
66 PT(PGMouseWatcherGroup) _watcher_group;
67 int _start_sort;
68
69 public:
70 static TypeHandle get_class_type() {
71 return _type_handle;
72 }
73 static void init_type() {
74 PandaNode::init_type();
75 register_type(_type_handle, "PGTop",
76 PandaNode::get_class_type());
77 }
78 virtual TypeHandle get_type() const {
79 return get_class_type();
80 }
81 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
82
83 private:
84 static TypeHandle _type_handle;
85
86 friend class PGMouseWatcherGroup;
87};
88
89#include "pgTop.I"
90
91#endif
CullTraverser
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
Definition cullTraverser.h:45
GraphicsStateGuardian
Encapsulates all the communication with a particular instance of a given rendering backend.
Definition graphicsStateGuardian.h:65
MouseWatcherGroup
This represents a collection of MouseWatcherRegions that may be managed as a group.
Definition mouseWatcherGroup.h:27
MouseWatcherRegion
This is the class that defines a rectangular region on the screen for the MouseWatcher.
Definition mouseWatcherRegion.h:31
MouseWatcher
This TFormer maintains a list of rectangular regions on the screen that are considered special mouse ...
Definition mouseWatcher.h:61
PGMouseWatcherGroup
This is a specialization on MouseWatcherGroup, to associate it with a PGTop.
Definition pgMouseWatcherGroup.h:29
PGTop::get_mouse_watcher
MouseWatcher * get_mouse_watcher() const
Returns the MouseWatcher pointer that the PGTop object registers its PG items with,...
Definition pgTop.I:30
PGTop::get_group
MouseWatcherGroup * get_group() const
Returns the MouseWatcherGroup pointer that the PGTop object registers its PG items with,...
Definition pgTop.I:39
PGTop::add_region
void add_region(MouseWatcherRegion *region)
Adds the indicated region to the set of regions in the group.
Definition pgTop.I:76
PGTop::set_start_sort
void set_start_sort(int start_sort)
Specifies the sort index that is assigned during the traversal to the first PGItem that is discovered...
Definition pgTop.I:58
PGTop::get_start_sort
int get_start_sort() const
Returns the sort index that is assigned during the traversal to the first PGItem that is discovered d...
Definition pgTop.I:67
PGTop::set_mouse_watcher
void set_mouse_watcher(MouseWatcher *watcher)
Sets the MouseWatcher pointer that the PGTop object registers its PG items with.
Definition pgTop.cxx:132
PandaNode::cull_callback
virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data)
This function will be called during the cull traversal to perform any additional operations that shou...
Definition pandaNode.cxx:386
PandaNode::is_renderable
virtual bool is_renderable() const
Returns true if there is some value to visiting this particular node during the cull traversal for an...
Definition pandaNode.cxx:462
PandaNode::make_copy
virtual PandaNode * make_copy() const
Returns a newly-allocated PandaNode that is a shallow copy of this one.
Definition pandaNode.cxx:481
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
mouseWatcher.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandaNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pgMouseWatcherGroup.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pgTop.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition register_type.I:22