00001 // Filename: pgWaitBar.I 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 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: PGWaitBar::set_range 00018 // Access: Published 00019 // Description: Sets the value at which the WaitBar indicates 100%. 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE void PGWaitBar:: 00022 set_range(PN_stdfloat range) { 00023 LightReMutexHolder holder(_lock); 00024 _range = range; 00025 _bar_state = -1; 00026 } 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Function: PGWaitBar::get_range 00030 // Access: Published 00031 // Description: Returns the value at which the WaitBar indicates 100%. 00032 //////////////////////////////////////////////////////////////////// 00033 INLINE PN_stdfloat PGWaitBar:: 00034 get_range() const { 00035 LightReMutexHolder holder(_lock); 00036 return _range; 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function: PGWaitBar::set_value 00041 // Access: Published 00042 // Description: Sets the current value of the bar. This should range 00043 // between 0 and get_range(). 00044 //////////////////////////////////////////////////////////////////// 00045 INLINE void PGWaitBar:: 00046 set_value(PN_stdfloat value) { 00047 LightReMutexHolder holder(_lock); 00048 _value = value; 00049 _bar_state = -1; 00050 } 00051 00052 //////////////////////////////////////////////////////////////////// 00053 // Function: PGWaitBar::get_value 00054 // Access: Published 00055 // Description: Returns the current value of the bar. 00056 //////////////////////////////////////////////////////////////////// 00057 INLINE PN_stdfloat PGWaitBar:: 00058 get_value() const { 00059 LightReMutexHolder holder(_lock); 00060 return _value; 00061 } 00062 00063 //////////////////////////////////////////////////////////////////// 00064 // Function: PGWaitBar::get_percent 00065 // Access: Published 00066 // Description: Returns the percentage complete. 00067 //////////////////////////////////////////////////////////////////// 00068 INLINE PN_stdfloat PGWaitBar:: 00069 get_percent() const { 00070 LightReMutexHolder holder(_lock); 00071 return (_value / _range) * 100.0f; 00072 } 00073 00074 //////////////////////////////////////////////////////////////////// 00075 // Function: PGWaitBar::set_bar_style 00076 // Access: Published 00077 // Description: Sets the kind of frame that is drawn on top of the 00078 // WaitBar to represent the amount completed. 00079 //////////////////////////////////////////////////////////////////// 00080 INLINE void PGWaitBar:: 00081 set_bar_style(const PGFrameStyle &style) { 00082 LightReMutexHolder holder(_lock); 00083 _bar_style = style; 00084 _bar_state = -1; 00085 } 00086 00087 //////////////////////////////////////////////////////////////////// 00088 // Function: PGWaitBar::get_bar_style 00089 // Access: Published 00090 // Description: Returns the kind of frame that is drawn on top of the 00091 // WaitBar to represent the amount completed. 00092 //////////////////////////////////////////////////////////////////// 00093 INLINE PGFrameStyle PGWaitBar:: 00094 get_bar_style() const { 00095 LightReMutexHolder holder(_lock); 00096 return _bar_style; 00097 }