Panda3D
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  */
38 class EXPCL_PANDA_PGUI PGTop : public PandaNode {
39 PUBLISHED:
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 
51 PUBLISHED:
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The "top" node of the new Panda GUI system.
Definition: pgTop.h:38
This TFormer maintains a list of rectangular regions on the screen that are considered special mouse ...
Definition: mouseWatcher.h:61
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
This represents a collection of MouseWatcherRegions that may be managed as a group.
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(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This collects together the pieces of data that are accumulated for each node while walking the scene ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a specialization on MouseWatcherGroup, to associate it with a PGTop.
This is the class that defines a rectangular region on the screen for the MouseWatcher.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual PandaNode * make_copy() const
Returns a newly-allocated PandaNode that is a shallow copy of this one.
Definition: pandaNode.cxx:487
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Encapsulates all the communication with a particular instance of a given rendering backend.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
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:468
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
Definition: cullTraverser.h:45