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