Panda3D
pgWaitBar.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 pgWaitBar.h
10  * @author drose
11  * @date 2002-03-14
12  */
13 
14 #ifndef PGWAITBAR_H
15 #define PGWAITBAR_H
16 
17 #include "pandabase.h"
18 
19 #include "pgItem.h"
20 
21 /**
22  * This is a particular kind of PGItem that draws a little bar that fills from
23  * left to right to indicate a slow process gradually completing, like a
24  * traditional "wait, loading" bar.
25  */
26 class EXPCL_PANDA_PGUI PGWaitBar : public PGItem {
27 PUBLISHED:
28  explicit PGWaitBar(const std::string &name = "");
29  virtual ~PGWaitBar();
30 
31 protected:
32  PGWaitBar(const PGWaitBar &copy);
33 
34 public:
35  virtual PandaNode *make_copy() const;
36  virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
37 
38 PUBLISHED:
39  void setup(PN_stdfloat width, PN_stdfloat height, PN_stdfloat range);
40 
41  INLINE void set_range(PN_stdfloat range);
42  INLINE PN_stdfloat get_range() const;
43 
44  INLINE void set_value(PN_stdfloat value);
45  INLINE PN_stdfloat get_value() const;
46 
47  INLINE PN_stdfloat get_percent() const;
48 
49  INLINE void set_bar_style(const PGFrameStyle &style);
50  INLINE PGFrameStyle get_bar_style() const;
51 
52 private:
53  void update();
54 
55  PN_stdfloat _range, _value;
56  int _bar_state;
57  PGFrameStyle _bar_style;
58  NodePath _bar;
59 
60 public:
61  static TypeHandle get_class_type() {
62  return _type_handle;
63  }
64  static void init_type() {
65  PGItem::init_type();
66  register_type(_type_handle, "PGWaitBar",
67  PGItem::get_class_type());
68  }
69  virtual TypeHandle get_type() const {
70  return get_class_type();
71  }
72  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
73 
74 private:
75  static TypeHandle _type_handle;
76 };
77 
78 #include "pgWaitBar.I"
79 
80 #endif
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
This is the base class for all the various kinds of gui widget objects.
Definition: pgItem.h:53
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 ...
This is a particular kind of PGItem that draws a little bar that fills from left to right to indicate...
Definition: pgWaitBar.h:26
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:161
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
Definition: cullTraverser.h:45