65 _needs_remanage =
true;
66 _needs_recompute =
true;
87 set_range(PN_stdfloat min_value, PN_stdfloat max_value) {
89 nassertv(min_value != max_value);
90 _min_value = min_value;
91 _max_value = max_value;
92 _needs_recompute =
true;
132 _scroll_value = value;
133 _needs_recompute =
true;
144 return _scroll_value;
160 _needs_recompute =
true;
184 set_ratio((value - _min_value) / (_max_value - _min_value));
195 return get_ratio() * (_max_value - _min_value) + _min_value;
208 internal_set_ratio(ratio);
235 return _dragging || _mouse_button_page ||
236 (_scroll_button_held != (
PGItem *)NULL);
250 _resize_thumb = resize_thumb;
251 _needs_recompute =
true;
263 return _resize_thumb;
278 _manage_pieces = manage_pieces;
279 _needs_remanage =
true;
280 _needs_recompute =
true;
292 return _manage_pieces;
310 if (_thumb_button != (
PGButton *)NULL) {
311 _thumb_button->set_notify(NULL);
313 _thumb_button = thumb_button;
314 if (_thumb_button != (
PGButton *)NULL) {
317 _needs_remanage =
true;
318 _needs_recompute =
true;
342 return _thumb_button;
360 if (_left_button != (
PGButton *)NULL) {
361 _left_button->set_notify(NULL);
363 _left_button = left_button;
364 if (_left_button != (
PGButton *)NULL) {
367 _needs_remanage =
true;
368 _needs_recompute =
true;
411 if (_right_button != (
PGButton *)NULL) {
412 _right_button->set_notify(NULL);
414 _right_button = right_button;
415 if (_right_button != (
PGButton *)NULL) {
418 _needs_remanage =
true;
419 _needs_recompute =
true;
444 return _right_button;
479 INLINE
void PGSliderBar::
480 internal_set_ratio(PN_stdfloat ratio) {
481 _ratio = max(min(ratio, (PN_stdfloat)1.0), (PN_stdfloat)0.0);
482 _needs_reposition =
true;
PGButton * get_right_button() const
Returns the PGButton that serves as the right scroll button for this slider, if any, or NULL if it is not set.
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.
PN_stdfloat get_scroll_size() const
Returns the value last set by set_scroll_size().
This is the base class for all the various kinds of gui widget objects.
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...
PN_stdfloat get_max_value() const
Returns the value when the slider is all the way to the right.
void clear_left_button()
Removes the left button object from control of the frame.
PGSliderBarNotify * get_notify() const
Returns the object which will be notified when the PGSliderBar changes, if any.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
void set_ratio(PN_stdfloat ratio)
Sets the current value of the slider, expressed in the range 0 .
const string & get_id() const
Returns the unique ID assigned to this PGItem.
void set_value(PN_stdfloat value)
Sets the current value of the slider programmatically.
virtual void adjust()
This is a callback hook function, called whenever the slider value is adjusted by the user or program...
PGItemNotify * get_notify() const
Returns the object which will be notified when the PGItem changes, if any.
void clear_thumb_button()
Removes the thumb button object from control of the frame.
bool is_button_down() const
Returns true if the user is currently holding down the mouse button to manipulate the slider...
void set_notify(PGSliderBarNotify *notify)
Sets the object which will be notified when the PGSliderBar changes.
bool has_notify() const
Returns true if there is an object configured to be notified when the PGItem changes, false otherwise.
bool get_manage_pieces() const
Returns the manage_pieces flag.
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 get_resize_thumb() const
Returns the resize_thumb flag.
static string get_adjust_prefix()
Returns the prefix that is used to define the adjust event for all PGSliderBars.
Similar to MutexHolder, but for a light reentrant mutex.
PN_stdfloat get_page_size() const
Returns the value last set by set_page_size().
void set_right_button(PGButton *right_button)
Sets the PGButton object that will serve as the right scroll button for this slider.
PGButton * get_left_button() const
Returns the PGButton that serves as the left scroll button for this slider, if any, or NULL if it is not set.
void set_manage_pieces(bool manage_pieces)
Sets the manage_pieces flag.
PN_stdfloat get_min_value() const
Returns the value when the slider is all the way to the left.
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.
PN_stdfloat get_value() const
Returns the current value of the 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.
PGButton * get_thumb_button() const
Returns the PGButton that serves as the thumb for this slider, or NULL if it is not set...
void set_axis(const LVector3 &axis)
Specifies the axis of the slider bar's motion.
const LVector3 & get_axis() const
Returns 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 .
void set_notify(PGItemNotify *notify)
Sets the object which will be notified when the PGItem changes.