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
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 */
38class EXPCL_PANDA_PGUI PGTop : public PandaNode {
39PUBLISHED:
40 explicit PGTop(const std::string &name);
41 virtual ~PGTop();
42
43protected:
44 INLINE PGTop(const PGTop &copy);
45
46public:
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
59public:
60 // These methods duplicate the functionality of MouseWatcherGroup.
61 INLINE void add_region(MouseWatcherRegion *region);
62 INLINE void clear_regions();
63
64private:
65 PT(MouseWatcher) _watcher;
66 PT(PGMouseWatcherGroup) _watcher_group;
67 int _start_sort;
68
69public:
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
83private:
84 static TypeHandle _type_handle;
85
86 friend class PGMouseWatcherGroup;
87};
88
89#include "pgTop.I"
90
91#endif
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
Encapsulates all the communication with a particular instance of a given rendering backend.
This represents a collection of MouseWatcherRegions that may be managed as a group.
This is the class that defines a rectangular region on the screen for the MouseWatcher.
This TFormer maintains a list of rectangular regions on the screen that are considered special mouse ...
This is a specialization on MouseWatcherGroup, to associate it with a PGTop.
MouseWatcher * get_mouse_watcher() const
Returns the MouseWatcher pointer that the PGTop object registers its PG items with,...
Definition pgTop.I:30
MouseWatcherGroup * get_group() const
Returns the MouseWatcherGroup pointer that the PGTop object registers its PG items with,...
Definition pgTop.I:39
void add_region(MouseWatcherRegion *region)
Adds the indicated region to the set of regions in the group.
Definition pgTop.I:76
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
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
void set_mouse_watcher(MouseWatcher *watcher)
Sets the MouseWatcher pointer that the PGTop object registers its PG items with.
Definition pgTop.cxx:132
virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data)
This function will be called during the cull traversal to perform any additional operations that shou...
virtual bool is_renderable() const
Returns true if there is some value to visiting this particular node during the cull traversal for an...
virtual PandaNode * make_copy() const
Returns a newly-allocated PandaNode that is a shallow copy of this one.
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...