Panda3D
pgWaitBar.I
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.I
10  * @author drose
11  * @date 2002-03-14
12  */
13 
14 /**
15  * Sets the value at which the WaitBar indicates 100%.
16  */
17 INLINE void PGWaitBar::
18 set_range(PN_stdfloat range) {
19  LightReMutexHolder holder(_lock);
20  _range = range;
21  _bar_state = -1;
22 }
23 
24 /**
25  * Returns the value at which the WaitBar indicates 100%.
26  */
27 INLINE PN_stdfloat PGWaitBar::
28 get_range() const {
29  LightReMutexHolder holder(_lock);
30  return _range;
31 }
32 
33 /**
34  * Sets the current value of the bar. This should range between 0 and
35  * get_range().
36  */
37 INLINE void PGWaitBar::
38 set_value(PN_stdfloat value) {
39  LightReMutexHolder holder(_lock);
40  _value = value;
41  _bar_state = -1;
42 }
43 
44 /**
45  * Returns the current value of the bar.
46  */
47 INLINE PN_stdfloat PGWaitBar::
48 get_value() const {
49  LightReMutexHolder holder(_lock);
50  return _value;
51 }
52 
53 /**
54  * Returns the percentage complete.
55  */
56 INLINE PN_stdfloat PGWaitBar::
57 get_percent() const {
58  LightReMutexHolder holder(_lock);
59  return (_value / _range) * 100.0f;
60 }
61 
62 /**
63  * Sets the kind of frame that is drawn on top of the WaitBar to represent the
64  * amount completed.
65  */
66 INLINE void PGWaitBar::
67 set_bar_style(const PGFrameStyle &style) {
68  LightReMutexHolder holder(_lock);
69  _bar_style = style;
70  _bar_state = -1;
71 }
72 
73 /**
74  * Returns the kind of frame that is drawn on top of the WaitBar to represent
75  * the amount completed.
76  */
78 get_bar_style() const {
79  LightReMutexHolder holder(_lock);
80  return _bar_style;
81 }
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:67
PN_stdfloat get_percent() const
Returns the percentage complete.
Definition: pgWaitBar.I:57
void set_value(PN_stdfloat value)
Sets the current value of the bar.
Definition: pgWaitBar.I:38
PN_stdfloat get_range() const
Returns the value at which the WaitBar indicates 100%.
Definition: pgWaitBar.I:28
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:18
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:78
PN_stdfloat get_value() const
Returns the current value of the bar.
Definition: pgWaitBar.I:48