|
|
|
|
Etk_Slider
Detailed Description
An Etk_Slider is a widget with a cursor that the user can drag to change its value.
Etk_Slider is the base class for Etk_HSlider (for horizontal sliders) and Etk_VSlider (for vertical sliders).
Since Etk_Slider inherits from Etk_Range, you can use all the etk_range_*() functions to get or set the value of a slider, or to change its bounds. You can also use the "value-changed" signal to be notified when the value of a slider is changed.
A slider can have different update-policies: by default, it uses a continuous update-policy, meaning the value of the slider will be changed each timer the slider's button is moved. But a slider can also use a discontinuous update-policy (the value will be changed only when the drag-button is released) or a delayed update-policy (the value will be changed after a brief timeout where no slider motion occurs). The update-policy can be changed with etk_slider_update_policy_set().
By default, the maximum bound of an Etk_HSlider is the right end, and the top end for an Etk_VSlider. But you can invert the ends of a slider with etk_slider_inverted_set().
Sliders can also have their own label. For example, if you want to use a slider to control a value in centimeters, you can add the associated label with:
- Object Hierarchy:
-
- Properties:
- "label-format": The format of the slider's label, or NULL if the label is hidden
Type: String (char *)Access: Read/WriteDefault Value: NULL
- "inverted": Whether or not the slider is inverted
Type: Boolean (char *)Access: Read/WriteDefault Value: ETK_FALSE
- "update-policy": The update-policy of the slider (continuous, discontinuous or delayed)
Type: Integer (Etk_Slider_Update_Policy)Access: Read/WriteDefault Value: ETK_SLIDER_CONTINUOUS
|
Data Structures |
struct | Etk_Slider |
| A widget with a cursor that the user can drag to change its value. More...
|
struct | Etk_HSlider |
| An horizontal slider. More...
|
struct | Etk_VSlider |
| A vertical slider. More...
|
Defines |
#define | ETK_SLIDER_TYPE (etk_slider_type_get()) |
#define | ETK_SLIDER(obj) (ETK_OBJECT_CAST((obj), ETK_SLIDER_TYPE, Etk_Slider)) |
#define | ETK_IS_SLIDER(obj) (ETK_OBJECT_CHECK_TYPE((obj), ETK_SLIDER_TYPE)) |
#define | ETK_HSLIDER_TYPE (etk_hslider_type_get()) |
#define | ETK_HSLIDER(obj) (ETK_OBJECT_CAST((obj), ETK_HSLIDER_TYPE, Etk_HSlider)) |
#define | ETK_IS_HSLIDER(obj) (ETK_OBJECT_CHECK_TYPE((obj), ETK_HSLIDER_TYPE)) |
#define | ETK_VSLIDER_TYPE (etk_vslider_type_get()) |
#define | ETK_VSLIDER(obj) (ETK_OBJECT_CAST((obj), ETK_VSLIDER_TYPE, Etk_VSlider)) |
#define | ETK_IS_VSLIDER(obj) (ETK_OBJECT_CHECK_TYPE((obj), ETK_VSLIDER_TYPE)) |
Enumerations |
enum | Etk_Slider_Update_Policy {
ETK_SLIDER_CONTINUOUS,
ETK_SLIDER_DISCONTINUOUS,
ETK_SLIDER_DELAYED
} |
| The different kinds of update policy for a slider. More...
|
Functions |
Etk_Widget * | etk_hslider_new (double lower, double upper, double value, double step_increment, double page_increment) |
| Creates a new horizontal slider.
|
Etk_Widget * | etk_vslider_new (double lower, double upper, double value, double step_increment, double page_increment) |
| Creates a new vertical slider.
|
void | etk_slider_label_set (Etk_Slider *slider, const char *label_format) |
| Sets the format of the label to display next to the slider.
|
const char * | etk_slider_label_get (Etk_Slider *slider) |
| Gets the format of the label displayed next to the slider.
|
void | etk_slider_inverted_set (Etk_Slider *slider, Etk_Bool inverted) |
| Sets whether or not the slider is inverted. An inverted slider has its ends inverted: the maximum bound is at the left end for an Etk_HSlider, or at the bottom end (for an Etk_VSlider).
|
Etk_Bool | etk_slider_inverted_get (Etk_Slider *slider) |
| Gets whether or not the slider is inverted.
|
void | etk_slider_update_policy_set (Etk_Slider *slider, Etk_Slider_Update_Policy policy) |
| Sets the update-policy of the slider.
|
Etk_Slider_Update_Policy | etk_slider_update_policy_get (Etk_Slider *slider) |
| Gets the update-policy of the slider.
|
Define Documentation
#define ETK_SLIDER_TYPE (etk_slider_type_get()) |
Gets the type of a slider
#define ETK_SLIDER |
( |
obj |
|
) |
(ETK_OBJECT_CAST((obj), ETK_SLIDER_TYPE, Etk_Slider)) |
#define ETK_IS_SLIDER |
( |
obj |
|
) |
(ETK_OBJECT_CHECK_TYPE((obj), ETK_SLIDER_TYPE)) |
#define ETK_HSLIDER_TYPE (etk_hslider_type_get()) |
Gets the type of a horizontal slider
#define ETK_HSLIDER |
( |
obj |
|
) |
(ETK_OBJECT_CAST((obj), ETK_HSLIDER_TYPE, Etk_HSlider)) |
#define ETK_IS_HSLIDER |
( |
obj |
|
) |
(ETK_OBJECT_CHECK_TYPE((obj), ETK_HSLIDER_TYPE)) |
#define ETK_VSLIDER_TYPE (etk_vslider_type_get()) |
Gets the type of a vertical slider
#define ETK_VSLIDER |
( |
obj |
|
) |
(ETK_OBJECT_CAST((obj), ETK_VSLIDER_TYPE, Etk_VSlider)) |
#define ETK_IS_VSLIDER |
( |
obj |
|
) |
(ETK_OBJECT_CHECK_TYPE((obj), ETK_VSLIDER_TYPE)) |
Enumeration Type Documentation
The different kinds of update policy for a slider.
- Enumerator:
-
ETK_SLIDER_CONTINUOUS |
The slider will be updated as soon as its button is dragged |
ETK_SLIDER_DISCONTINUOUS |
The slider will be updated as soon as its button gets released |
ETK_SLIDER_DELAYED |
The slider will be updated after a brief timeout where no slider motion occurs |
Function Documentation
Etk_Widget * etk_hslider_new |
( |
double |
lower, |
|
|
double |
upper, |
|
|
double |
value, |
|
|
double |
step_increment, |
|
|
double |
page_increment | |
|
) |
| | |
Creates a new horizontal slider.
- Parameters:
-
| lower | the lower bound of the slider |
| upper | the upper bound of the slider |
| value | the initial value of the slider |
| step_increment | the step-increment value. This value is added or substracted to the current value of the slider when an arrow key is pressed, or when the mouse wheel is used |
| page_increment | the page-increment value. This value is added or substracted to the current value of the slider when the page up/down keys are pressed |
- Returns:
- Returns the new horizontal slider widget
Etk_Widget * etk_vslider_new |
( |
double |
lower, |
|
|
double |
upper, |
|
|
double |
value, |
|
|
double |
step_increment, |
|
|
double |
page_increment | |
|
) |
| | |
Creates a new vertical slider.
- Parameters:
-
| lower | the lower bound of the slider |
| upper | the upper bound of the slider |
| value | the initial value of the slider |
| step_increment | the step-increment value. This value is added or substracted to the current value of the slider when an arrow key is pressed, or when the mouse wheel is used |
| page_increment | the page-increment value. This value is added or substracted to the current value of the slider when the page up/down keys are pressed |
- Returns:
- Returns the new vertical slider widget
void etk_slider_label_set |
( |
Etk_Slider * |
slider, |
|
|
const char * |
label_format | |
|
) |
| | |
Sets the format of the label to display next to the slider.
- Parameters:
-
| slider | a slider |
| label_format | the format of the slider's label. It uses the same format as printf(). Since the value is a double, you have to use "%.2f" if you want to display the value with two digits for example.
NULL will hide the label |
const char * etk_slider_label_get |
( |
Etk_Slider * |
slider |
) |
|
Gets the format of the label displayed next to the slider.
- Parameters:
-
- Returns:
- Returns the format string of the slider's label (NULL means the label is hidden)
void etk_slider_inverted_set |
( |
Etk_Slider * |
slider, |
|
|
Etk_Bool |
inverted | |
|
) |
| | |
Sets whether or not the slider is inverted. An inverted slider has its ends inverted: the maximum bound is at the left end for an Etk_HSlider, or at the bottom end (for an Etk_VSlider).
- Parameters:
-
| slider | a slider |
| inverted | ETK_TRUE to invert the slider, ETK_FALSE otherwise |
Etk_Bool etk_slider_inverted_get |
( |
Etk_Slider * |
slider |
) |
|
Gets whether or not the slider is inverted.
- Parameters:
-
- Returns:
- Returns ETK_TRUE if the slider is inverted, ETK_FALSE otherwise
Sets the update-policy of the slider.
- Parameters:
-
| slider | |
| policy | the update-policy to set to the timer |
Gets the update-policy of the slider.
- Parameters:
-
- Returns:
- Returns the update-policy of the slider
|
|
|
|
|
|