PGSliderBar
-
class PGSliderBar
Bases:
PGItem
,PGButtonNotify
This is a particular kind of
PGItem
that draws a little bar with a slider that moves from left to right indicating a value between the ranges.This is used as an implementation for both DirectSlider and for DirectScrollBar.
Inheritance diagram
-
explicit PGSliderBar(std::string const &name = "")
-
void clear_left_button(void)
Removes the left button object from control of the frame. It is your responsibility to actually remove or hide the button itself.
-
void clear_right_button(void)
Removes the right button object from control of the frame. It is your responsibility to actually remove or hide the button itself.
-
void clear_thumb_button(void)
Removes the thumb button object from control of the frame. It is your responsibility to actually remove or hide the button itself.
-
std::string get_adjust_event(void) const
Returns the event name that will be thrown when the slider bar value is adjusted by the user or programmatically.
-
std::string get_adjust_prefix(void)
Returns the prefix that is used to define the adjust event for all
PGSliderBars
. The adjust event is the concatenation of this string followed byget_id()
.
-
LVector3 const &get_axis(void) const
Returns the axis of the slider bar’s motion. See
set_axis()
.
-
static TypeHandle get_class_type(void)
-
PGButton *get_left_button(void) const
Returns the
PGButton
that serves as the left scroll button for this slider, if any, or NULL if it is not set.
-
bool get_manage_pieces(void) const
Returns the manage_pieces flag. See
set_manage_pieces()
.
-
PN_stdfloat get_max_value(void) const
Returns the value when the slider is all the way to the right.
-
PN_stdfloat get_min_value(void) const
Returns the value when the slider is all the way to the left.
-
PN_stdfloat get_page_size(void) const
Returns the value last set by
set_page_size()
.
-
PN_stdfloat get_ratio(void) const
Returns the current value of the slider, expressed in the range 0 .. 1.
-
bool get_resize_thumb(void) const
Returns the resize_thumb flag. See
set_resize_thumb()
.
-
PGButton *get_right_button(void) const
Returns the
PGButton
that serves as the right scroll button for this slider, if any, or NULL if it is not set.
-
PN_stdfloat get_scroll_size(void) const
Returns the value last set by
set_scroll_size()
.
-
PGButton *get_thumb_button(void) const
Returns the
PGButton
that serves as the thumb for this slider, or NULL if it is not set.
-
PN_stdfloat get_value(void) const
Returns the current value of the slider.
-
bool is_button_down(void) const
Returns true if the user is currently holding down the mouse button to manipulate the slider. When true, calls to
set_ratio()
orset_value()
will have no effect.
-
void recompute(void)
Recomputes the position and size of the thumb. Normally this should not need to be called directly.
-
void remanage(void)
Manages the position and size of the scroll bars and the thumb. Normally this should not need to be called directly.
-
virtual void set_active(bool active)
Sets whether the
PGItem
is active for mouse watching. This is not necessarily related to the active/inactive appearance of the item, which is controlled byset_state()
, but it does affect whether it responds to mouse events.
-
void set_axis(LVector3 const &axis)
Specifies the axis of the slider bar’s motion. This should be only one of four vectors: (1, 0, 0), (0, 0, 1), (-1, 0, 0), or (0, 0, -1).
This specifies the vector in which the thumb moves when it is moving from the minimum to the maximum value.
The axis must be parallel to one of the screen axes, and it must be normalized. Hence, it may only be one of the above four possibilities; anything else is an error and will result in indeterminate behavior.
Normally, you should not try to set the axis directly.
-
void set_left_button(PGButton *left_button)
Sets the
PGButton
object that will serve as the left scroll button for this slider. This button is optional; if present, the user can click on it to move scroll_size units at a time to the left.It is the responsibility of the caller to ensure that the button object is parented to the
PGSliderBar
node.
-
void set_manage_pieces(bool manage_pieces)
Sets the manage_pieces flag. When this is true, the sub-pieces of the slider bar–that is, the thumb, and the left and right scroll buttons–are automatically positioned and/or resized when the slider bar’s overall frame is changed.
-
void set_page_size(PN_stdfloat page_size)
Specifies the amount of data contained in a single page. This indicates how much the thumb will jump when the trough is directly clicked; and if resize_thumb is true, it also controls the visible size of the thumb button.
-
void set_range(PN_stdfloat min_value, PN_stdfloat max_value)
Sets the minimum and maxmimum value for the slider.
-
void set_ratio(PN_stdfloat ratio)
Sets the current value of the slider, expressed in the range 0 .. 1.
-
void set_resize_thumb(bool resize_thumb)
Sets the resize_thumb flag. When this is true, the thumb button’s frame will be adjusted so that its width visually represents the page size. When this is false, the thumb button will be left alone.
-
void set_right_button(PGButton *right_button)
Sets the
PGButton
object that will serve as the right scroll button for this slider. This button is optional; if present, the user can click on it to move scroll_size units at a time to the right.It is the responsibility of the caller to ensure that the button object is parented to the
PGSliderBar
node.
-
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_thumb_button(PGButton *thumb_button)
Sets the
PGButton
object that will serve as the thumb for this slider. This button visually represents the position of the slider, and can be dragged left and right by the user.It is the responsibility of the caller to ensure that the button object is parented to the
PGSliderBar
node.
-
void set_value(PN_stdfloat value)
Sets the current value of the slider programmatically. This should range between
get_min_value()
andget_max_value()
.
-
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, respectively), with additional buttons for scrolling, and a range of 0 .. 1.length here is the measurement along the scroll bar, and width is the measurement across the scroll bar, whether it is vertical or horizontal (so for a horizontal scroll bar, the length is actually the x dimension, and the width is the y dimension).
-
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.This is functionally the same as a scroll bar, but it has a distinctive look.
-
explicit PGSliderBar(std::string const &name = "")