31class EXPCL_PANDA_PGUI PGSliderBar :
public PGItem,
public PGButtonNotify {
33 explicit PGSliderBar(
const std::string &name =
"");
34 virtual ~PGSliderBar();
37 PGSliderBar(
const PGSliderBar ©);
42 virtual void xform(
const LMatrix4 &mat);
54 void setup_scroll_bar(
bool vertical, PN_stdfloat length, PN_stdfloat width, PN_stdfloat bevel);
55 void setup_slider(
bool vertical, PN_stdfloat length, PN_stdfloat width, PN_stdfloat bevel);
57 INLINE
void set_axis(
const LVector3 &axis);
58 INLINE
const LVector3 &
get_axis()
const;
60 INLINE
void set_range(PN_stdfloat min_value, PN_stdfloat max_value);
105 virtual void frame_changed();
107 virtual void item_transform_changed(PGItem *item);
108 virtual void item_frame_changed(PGItem *item);
109 virtual void item_draw_mask_changed(PGItem *item);
115 INLINE
void internal_set_ratio(PN_stdfloat ratio);
118 void advance_scroll();
121 void continue_drag();
125 bool _needs_remanage;
126 bool _needs_recompute;
127 bool _needs_reposition;
129 PN_stdfloat _min_value, _max_value;
130 PN_stdfloat _scroll_value, _scroll_ratio;
131 PN_stdfloat _page_value, _page_ratio;
138 PT(PGButton) _thumb_button;
139 PT(PGButton) _left_button;
140 PT(PGButton) _right_button;
142 PN_stdfloat _min_x, _max_x, _thumb_width, _range_x;
143 LPoint3 _thumb_start;
144 PGItem *_scroll_button_held;
145 bool _mouse_button_page;
147 double _next_advance_time;
149 PN_stdfloat _drag_start_x;
155 static void init_type() {
158 PGItem::get_class_type());
161 return get_class_type();
163 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
168 friend class PGButton;
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
This is sent along as a parameter to most events generated for a region to indicate the mouse and but...
void set_notify(PGItemNotify *notify)
Sets the object which will be notified when the PGItem changes.
virtual void press(const MouseWatcherParameter ¶m, bool background)
This is a callback hook function, called whenever a mouse or keyboard button is depressed while the m...
PGItemNotify * get_notify() const
Returns the object which will be notified when the PGItem changes, if any.
virtual void release(const MouseWatcherParameter ¶m, bool background)
This is a callback hook function, called whenever a mouse or keyboard button previously depressed wit...
virtual void move(const MouseWatcherParameter ¶m)
This is a callback hook function, called whenever a mouse is moved while within the region.
virtual void set_active(bool active)
Sets whether the PGItem is active for mouse watching.
Objects that inherit from this class can receive notify messages when a slider bar moves or otherwise...
void setup_scroll_bar(bool vertical, PN_stdfloat length, PN_stdfloat width, PN_stdfloat bevel)
Creates PGSliderBar that represents a vertical or horizontal scroll bar (if vertical is true or false...
PN_stdfloat get_scroll_size() const
Returns the value last set by set_scroll_size().
void set_resize_thumb(bool resize_thumb)
Sets the resize_thumb flag.
virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data)
This function will be called during the cull traversal to perform any additional operations that shou...
void clear_left_button()
Removes the left button object from control of the frame.
const LVector3 & get_axis() const
Returns the axis of the slider bar's motion.
bool get_manage_pieces() const
Returns the manage_pieces flag.
bool is_button_down() const
Returns true if the user is currently holding down the mouse button to manipulate the slider.
virtual PandaNode * make_copy() const
Returns a newly-allocated Node that is a shallow copy of this one.
void set_scroll_size(PN_stdfloat scroll_size)
Specifies the amount the slider will move when the user clicks on the left or right buttons.
void set_page_size(PN_stdfloat page_size)
Specifies the amount of data contained in a single page.
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this node by the indicated matrix, if it means anything to do so.
void remanage()
Manages the position and size of the scroll bars and the thumb.
PN_stdfloat get_max_value() const
Returns the value when the slider is all the way to the right.
void setup_slider(bool vertical, PN_stdfloat length, PN_stdfloat width, PN_stdfloat bevel)
Creates PGSliderBar that represents a slider that the user can use to control an analog quantity.
void set_thumb_button(PGButton *thumb_button)
Sets the PGButton object that will serve as the thumb for this slider.
virtual void adjust()
This is a callback hook function, called whenever the slider value is adjusted by the user or program...
void set_axis(const LVector3 &axis)
Specifies the axis of the slider bar's motion.
PN_stdfloat get_value() const
Returns the current value of the slider.
void set_ratio(PN_stdfloat ratio)
Sets the current value of the slider, expressed in the range 0 .
PGButton * get_thumb_button() const
Returns the PGButton that serves as the thumb for this slider, or NULL if it is not set.
static std::string get_adjust_prefix()
Returns the prefix that is used to define the adjust event for all PGSliderBars.
void set_left_button(PGButton *left_button)
Sets the PGButton object that will serve as the left scroll button for this slider.
PGButton * get_right_button() const
Returns the PGButton that serves as the right scroll button for this slider, if any,...
void clear_thumb_button()
Removes the thumb button object from control of the frame.
PN_stdfloat get_page_size() const
Returns the value last set by set_page_size().
PN_stdfloat get_ratio() const
Returns the current value of the slider, expressed in the range 0 .
bool get_resize_thumb() const
Returns the resize_thumb flag.
void set_range(PN_stdfloat min_value, PN_stdfloat max_value)
Sets the minimum and maxmimum value for the slider.
void set_manage_pieces(bool manage_pieces)
Sets the manage_pieces flag.
void clear_right_button()
Removes the right button object from control of the frame.
std::string get_adjust_event() const
Returns the event name that will be thrown when the slider bar value is adjusted by the user or progr...
PGButton * get_left_button() const
Returns the PGButton that serves as the left scroll button for this slider, if any,...
void recompute()
Recomputes the position and size of the thumb.
void set_right_button(PGButton *right_button)
Sets the PGButton object that will serve as the right scroll button for this slider.
void set_value(PN_stdfloat value)
Sets the current value of the slider programmatically.
PN_stdfloat get_min_value() const
Returns the value when the slider is all the way to the left.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...