15 #include "pgWaitBar.h"
16 #include "pgMouseWatcherParameter.h"
18 #include "throw_event.h"
28 PGWaitBar(
const string &name) :
PGItem(name)
103 return PGItem::cull_callback(trav, data);
113 setup(PN_stdfloat width, PN_stdfloat height, PN_stdfloat range) {
118 set_frame(-0.5f * width, 0.5f * width, -0.5f * height, 0.5f * height);
120 PN_stdfloat bevel = 0.05f;
126 style.
set_type(PGFrameStyle::T_bevel_in);
130 style.
set_type(PGFrameStyle::T_bevel_out);
147 if (_bar_state == state) {
155 if ((_value != 0.0f) && (_range != 0.0f)) {
161 const LVecBase2 &width = style.get_width();
167 frame[3] - width[1]);
170 PN_stdfloat frac = _value / _range;
171 frac = max(min(frac, (PN_stdfloat)1.0), (PN_stdfloat)0.0);
172 bar_frame[1] = bar_frame[0] + frac * (bar_frame[1] - bar_frame[0]);
const LVecBase4 & get_frame() const
Returns the bounding rectangle of the item.
A basic node of the scene graph or data graph.
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...
void set_width(PN_stdfloat x, PN_stdfloat y)
Sets the width parameter, which has meaning only for certain frame types.
PGFrameStyle get_frame_style(int state)
Returns the kind of frame that will be drawn behind the item when it is in the indicated state...
virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data)
This function will be called during the cull traversal to perform any additional operations that shou...
This is the base class for all the various kinds of gui widget objects.
NodePath & get_state_def(int state)
Returns the Node that is the root of the subgraph that will be drawn when the PGItem is in the indica...
void set_type(Type type)
Sets the basic type of frame.
void set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
Sets the bounding rectangle of the item, in local coordinates.
This collects together the pieces of data that are accumulated for each node while walking the scene ...
void setup(PN_stdfloat width, PN_stdfloat height, PN_stdfloat range)
Creates a PGWaitBar with the indicated dimensions, with the indicated maximum range.
void set_frame_style(int state, const PGFrameStyle &style)
Changes the kind of frame that will be drawn behind the item when it is in the indicated state...
int get_state() const
Returns the "state" of this particular PGItem.
void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a)
Sets the dominant color of the frame.
NodePath generate_into(const NodePath &parent, const LVecBase4 &frame, int sort=0)
Generates geometry representing a frame of the indicated size, and parents it to the indicated node...
This is a particular kind of PGItem that draws a little bar that fills from left to right to indicate...
This is the base class for all two-component vectors and points.
Similar to MutexHolder, but for a light reentrant mutex.
This is the base class for all three-component vectors and points.
void set_state(int state)
Sets the "state" of this particular PGItem.
void remove_node(Thread *current_thread=Thread::get_current_thread())
Disconnects the referenced node from the scene graph.
bool is_empty() const
Returns true if the NodePath contains no nodes.
void clear_state_def(int state)
Resets the NodePath assigned to the indicated state to its initial default, with only a frame represe...
TypeHandle is the identifier used to differentiate C++ class types.
virtual PandaNode * make_copy() const
Returns a newly-allocated Node that is a shallow copy of this one.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling...