Panda3D
 All Classes Functions Variables Enumerations
pgWaitBar.h
00001 // Filename: pgWaitBar.h
00002 // Created by:  drose (14Mar02)
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 PGWAITBAR_H
00016 #define PGWAITBAR_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "pgItem.h"
00021 
00022 ////////////////////////////////////////////////////////////////////
00023 //       Class : PGWaitBar
00024 // Description : This is a particular kind of PGItem that draws a
00025 //               little bar that fills from left to right to indicate
00026 //               a slow process gradually completing, like a
00027 //               traditional "wait, loading" bar.
00028 ////////////////////////////////////////////////////////////////////
00029 class EXPCL_PANDA_PGUI PGWaitBar : public PGItem {
00030 PUBLISHED:
00031   PGWaitBar(const string &name = "");
00032   virtual ~PGWaitBar();
00033 
00034 protected:
00035   PGWaitBar(const PGWaitBar &copy);
00036 
00037 public:
00038   virtual PandaNode *make_copy() const;
00039   virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
00040 
00041 PUBLISHED:
00042   void setup(PN_stdfloat width, PN_stdfloat height, PN_stdfloat range);
00043 
00044   INLINE void set_range(PN_stdfloat range);
00045   INLINE PN_stdfloat get_range() const;
00046 
00047   INLINE void set_value(PN_stdfloat value);
00048   INLINE PN_stdfloat get_value() const;
00049 
00050   INLINE PN_stdfloat get_percent() const;
00051 
00052   INLINE void set_bar_style(const PGFrameStyle &style);
00053   INLINE PGFrameStyle get_bar_style() const;
00054 
00055 private:
00056   void update();
00057 
00058   PN_stdfloat _range, _value;
00059   int _bar_state;
00060   PGFrameStyle _bar_style;
00061   NodePath _bar;
00062 
00063 public:
00064   static TypeHandle get_class_type() {
00065     return _type_handle;
00066   }
00067   static void init_type() {
00068     PGItem::init_type();
00069     register_type(_type_handle, "PGWaitBar",
00070                   PGItem::get_class_type());
00071   }
00072   virtual TypeHandle get_type() const {
00073     return get_class_type();
00074   }
00075   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00076 
00077 private:
00078   static TypeHandle _type_handle;
00079 };
00080 
00081 #include "pgWaitBar.I"
00082 
00083 #endif
 All Classes Functions Variables Enumerations