Panda3D
 All Classes Functions Variables Enumerations
pgTop.h
00001 // Filename: pgTop.h
00002 // Created by:  drose (13Mar02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef PGTOP_H
00016 #define PGTOP_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "pgMouseWatcherGroup.h"
00021 
00022 #include "pandaNode.h"
00023 #include "mouseWatcher.h"
00024 #include "pointerTo.h"
00025 
00026 class GraphicsStateGuardian;
00027 class PGMouseWatcherGroup;
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //       Class : PGTop
00031 // Description : The "top" node of the new Panda GUI system.  This
00032 //               node must be parented to the 2-d scene graph, and all
00033 //               PG objects should be parented to this node or
00034 //               somewhere below it.  PG objects not parented within
00035 //               this hierarchy will not be clickable.
00036 //
00037 //               This node begins the special traversal of the PG
00038 //               objects that registers each node within the
00039 //               MouseWatcher and forces everything to render in a
00040 //               depth-first, left-to-right order, appropriate for 2-d
00041 //               objects.
00042 ////////////////////////////////////////////////////////////////////
00043 class EXPCL_PANDA_PGUI PGTop : public PandaNode {
00044 PUBLISHED:
00045   PGTop(const string &name);
00046   virtual ~PGTop();
00047 
00048 protected:
00049   INLINE PGTop(const PGTop &copy);
00050 
00051 public:
00052   virtual PandaNode *make_copy() const;
00053   virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
00054   virtual bool is_renderable() const;
00055 
00056 PUBLISHED:
00057   void set_mouse_watcher(MouseWatcher *watcher);
00058   INLINE MouseWatcher *get_mouse_watcher() const;
00059   INLINE MouseWatcherGroup *get_group() const;
00060 
00061   INLINE void set_start_sort(int start_sort);
00062   INLINE int get_start_sort() const;
00063 
00064 public:
00065   // These methods duplicate the functionality of MouseWatcherGroup.
00066   INLINE void add_region(MouseWatcherRegion *region);
00067   INLINE void clear_regions();
00068 
00069 private:
00070   PT(MouseWatcher) _watcher;
00071   PT(PGMouseWatcherGroup) _watcher_group;
00072   int _start_sort;
00073   
00074 public:
00075   static TypeHandle get_class_type() {
00076     return _type_handle;
00077   }
00078   static void init_type() {
00079     PandaNode::init_type();
00080     register_type(_type_handle, "PGTop",
00081                   PandaNode::get_class_type());
00082   }
00083   virtual TypeHandle get_type() const {
00084     return get_class_type();
00085   }
00086   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00087 
00088 private:
00089   static TypeHandle _type_handle;
00090 
00091   friend class PGMouseWatcherGroup;
00092 };
00093 
00094 #include "pgTop.I"
00095 
00096 #endif
 All Classes Functions Variables Enumerations