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