51 _needs_remanage =
true;
52 _needs_recompute =
true;
68 set_range(PN_stdfloat min_value, PN_stdfloat max_value) {
70 nassertv(min_value != max_value);
71 _min_value = min_value;
72 _max_value = max_value;
73 _needs_recompute =
true;
105 _scroll_value = value;
106 _needs_recompute =
true;
115 return _scroll_value;
128 _needs_recompute =
true;
147 set_ratio((value - _min_value) / (_max_value - _min_value));
156 return get_ratio() * (_max_value - _min_value) + _min_value;
166 internal_set_ratio(ratio);
187 return _dragging || _mouse_button_page ||
188 (_scroll_button_held !=
nullptr);
199 _resize_thumb = resize_thumb;
200 _needs_recompute =
true;
209 return _resize_thumb;
221 _manage_pieces = manage_pieces;
222 _needs_remanage =
true;
223 _needs_recompute =
true;
232 return _manage_pieces;
246 if (_thumb_button !=
nullptr) {
247 _thumb_button->set_notify(
nullptr);
249 _thumb_button = thumb_button;
250 if (_thumb_button !=
nullptr) {
253 _needs_remanage =
true;
254 _needs_recompute =
true;
273 return _thumb_button;
287 if (_left_button !=
nullptr) {
288 _left_button->set_notify(
nullptr);
290 _left_button = left_button;
291 if (_left_button !=
nullptr) {
294 _needs_remanage =
true;
295 _needs_recompute =
true;
328 if (_right_button !=
nullptr) {
329 _right_button->set_notify(
nullptr);
331 _right_button = right_button;
332 if (_right_button !=
nullptr) {
335 _needs_remanage =
true;
336 _needs_recompute =
true;
355 return _right_button;
382 INLINE
void PGSliderBar::
383 internal_set_ratio(PN_stdfloat ratio) {
384 _ratio = std::max(std::min(ratio, (PN_stdfloat)1.0), (PN_stdfloat)0.0);
385 _needs_reposition =
true;
bool get_manage_pieces() const
Returns the manage_pieces flag.
void set_page_size(PN_stdfloat page_size)
Specifies the amount of data contained in a single page.
void clear_right_button()
Removes the right button object from control of the frame.
void set_resize_thumb(bool resize_thumb)
Sets the resize_thumb flag.
void clear_left_button()
Removes the left button object from control of the frame.
PN_stdfloat get_page_size() const
Returns the value last set by set_page_size().
const LVector3 & get_axis() const
Returns the axis of the slider bar's motion.
const std::string & get_id() const
Returns the unique ID assigned to this PGItem.
void set_ratio(PN_stdfloat ratio)
Sets the current value of the slider, expressed in the range 0 .
void set_value(PN_stdfloat value)
Sets the current value of the slider programmatically.
PGButton * get_thumb_button() const
Returns the PGButton that serves as the thumb for this slider, or NULL if it is not set.
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,...
virtual void adjust()
This is a callback hook function, called whenever the slider value is adjusted by the user or program...
PN_stdfloat get_min_value() const
Returns the value when the slider is all the way to the left.
void clear_thumb_button()
Removes the thumb button object from control of the frame.
bool has_notify() const
Returns true if there is an object configured to be notified when the PGItem changes,...
PN_stdfloat get_value() const
Returns the current value of the slider.
bool get_resize_thumb() const
Returns the resize_thumb flag.
void set_notify(PGSliderBarNotify *notify)
Sets the object which will be notified when the PGSliderBar changes.
PGItemNotify * get_notify() const
Returns the object which will be notified when the PGItem changes, if any.
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.
bool is_button_down() const
Returns true if the user is currently holding down the mouse button to manipulate the slider.
PN_stdfloat get_max_value() const
Returns the value when the slider is all the way to the right.
PGButton * get_right_button() const
Returns the PGButton that serves as the right scroll button for this slider, if any,...
Similar to MutexHolder, but for a light reentrant mutex.
PGSliderBarNotify * get_notify() const
Returns the object which will be notified when the PGSliderBar changes, if any.
void set_right_button(PGButton *right_button)
Sets the PGButton object that will serve as the right scroll button for this slider.
void set_manage_pieces(bool manage_pieces)
Sets the manage_pieces flag.
void set_thumb_button(PGButton *thumb_button)
Sets the PGButton object that will serve as the thumb for this slider.
void set_left_button(PGButton *left_button)
Sets the PGButton object that will serve as the left scroll button for this slider.
Objects that inherit from this class can receive notify messages when a slider bar moves or otherwise...
void set_range(PN_stdfloat min_value, PN_stdfloat max_value)
Sets the minimum and maxmimum value for the slider.
static std::string get_adjust_prefix()
Returns the prefix that is used to define the adjust event for all PGSliderBars.
void set_axis(const LVector3 &axis)
Specifies the axis of the slider bar's motion.
PN_stdfloat get_ratio() const
Returns the current value of the slider, expressed in the range 0 .
PN_stdfloat get_scroll_size() const
Returns the value last set by set_scroll_size().
void set_notify(PGItemNotify *notify)
Sets the object which will be notified when the PGItem changes.