Panda3D
pgWaitBar.I
1 // Filename: pgWaitBar.I
2 // Created by: drose (14Mar02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: PGWaitBar::set_range
18 // Access: Published
19 // Description: Sets the value at which the WaitBar indicates 100%.
20 ////////////////////////////////////////////////////////////////////
21 INLINE void PGWaitBar::
22 set_range(PN_stdfloat range) {
23  LightReMutexHolder holder(_lock);
24  _range = range;
25  _bar_state = -1;
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: PGWaitBar::get_range
30 // Access: Published
31 // Description: Returns the value at which the WaitBar indicates 100%.
32 ////////////////////////////////////////////////////////////////////
33 INLINE PN_stdfloat PGWaitBar::
34 get_range() const {
35  LightReMutexHolder holder(_lock);
36  return _range;
37 }
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function: PGWaitBar::set_value
41 // Access: Published
42 // Description: Sets the current value of the bar. This should range
43 // between 0 and get_range().
44 ////////////////////////////////////////////////////////////////////
45 INLINE void PGWaitBar::
46 set_value(PN_stdfloat value) {
47  LightReMutexHolder holder(_lock);
48  _value = value;
49  _bar_state = -1;
50 }
51 
52 ////////////////////////////////////////////////////////////////////
53 // Function: PGWaitBar::get_value
54 // Access: Published
55 // Description: Returns the current value of the bar.
56 ////////////////////////////////////////////////////////////////////
57 INLINE PN_stdfloat PGWaitBar::
58 get_value() const {
59  LightReMutexHolder holder(_lock);
60  return _value;
61 }
62 
63 ////////////////////////////////////////////////////////////////////
64 // Function: PGWaitBar::get_percent
65 // Access: Published
66 // Description: Returns the percentage complete.
67 ////////////////////////////////////////////////////////////////////
68 INLINE PN_stdfloat PGWaitBar::
69 get_percent() const {
70  LightReMutexHolder holder(_lock);
71  return (_value / _range) * 100.0f;
72 }
73 
74 ////////////////////////////////////////////////////////////////////
75 // Function: PGWaitBar::set_bar_style
76 // Access: Published
77 // Description: Sets the kind of frame that is drawn on top of the
78 // WaitBar to represent the amount completed.
79 ////////////////////////////////////////////////////////////////////
80 INLINE void PGWaitBar::
81 set_bar_style(const PGFrameStyle &style) {
82  LightReMutexHolder holder(_lock);
83  _bar_style = style;
84  _bar_state = -1;
85 }
86 
87 ////////////////////////////////////////////////////////////////////
88 // Function: PGWaitBar::get_bar_style
89 // Access: Published
90 // Description: Returns the kind of frame that is drawn on top of the
91 // WaitBar to represent the amount completed.
92 ////////////////////////////////////////////////////////////////////
94 get_bar_style() const {
95  LightReMutexHolder holder(_lock);
96  return _bar_style;
97 }
void set_bar_style(const PGFrameStyle &style)
Sets the kind of frame that is drawn on top of the WaitBar to represent the amount completed...
Definition: pgWaitBar.I:81
PN_stdfloat get_percent() const
Returns the percentage complete.
Definition: pgWaitBar.I:69
void set_value(PN_stdfloat value)
Sets the current value of the bar.
Definition: pgWaitBar.I:46
PN_stdfloat get_range() const
Returns the value at which the WaitBar indicates 100%.
Definition: pgWaitBar.I:34
Similar to MutexHolder, but for a light reentrant mutex.
void set_range(PN_stdfloat range)
Sets the value at which the WaitBar indicates 100%.
Definition: pgWaitBar.I:22
PGFrameStyle get_bar_style() const
Returns the kind of frame that is drawn on top of the WaitBar to represent the amount completed...
Definition: pgWaitBar.I:94
PN_stdfloat get_value() const
Returns the current value of the bar.
Definition: pgWaitBar.I:58