Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

Etk_Spinner


Detailed Description

A spinner is a widget that allows the user to set the value of a setting.

spinner.png
The user can either type the value in the entry, or use the arrows to increment or decrement the value.
The spinner's value can be automatically corrected to the nearest step-increment if you set the "snap_to_ticks" property to ETK_TRUE with etk_spinner_snap_to_ticks_set(). It may be useful if you only want integer values for example.
The spinner's value can also automatically wrap around to the opposite limit when it exceeds one of the spinner's bounds. This setting can be set with etk_spinner_wrap_set().

Since Etk_Spinner inherits from Etk_Range, you can be notified when the value is changed with the signal "value-changed". You can also call etk_range_value_set() and etk_range_value_get() to set or get the value of the spinner.

Object Hierarchy:
  • Etk_Object
    • Etk_Widget
      • Etk_Range
        • Etk_Spinner
Properties:
  • "digits": The number of digits the spinner should display
    • Type: Integer
    • Access: Read/Write
    • Default Value: 0
  • "snap-to-ticks": Whether or not the value of the spinner should be corrected to the nearest step-increment
    • Type: Boolean
    • Access: Read/Write
    • Default Value: ETK_FALSE
  • "wrap": Whether or not the spinner's value wraps around to the opposite limit when it exceeds one of the spinner's bounds
    • Type: Boolean
    • Access: Read/Write
    • Default Value: ETK_FALSE


Data Structures

struct  Etk_Spinner
 [Widget] A widget that allows the user to set the value of a setting More...

Defines

#define ETK_SPINNER_TYPE   (etk_spinner_type_get())
#define ETK_SPINNER(obj)   (ETK_OBJECT_CAST((obj), ETK_SPINNER_TYPE, Etk_Spinner))
#define ETK_IS_SPINNER(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_SPINNER_TYPE))

Functions

Etk_Widget * etk_spinner_new (double lower, double upper, double value, double step_increment, double page_increment)
 Creates a new spinner.
void etk_spinner_digits_set (Etk_Spinner *spinner, int digits)
 Sets the number of digits displayed by the spinner.
int etk_spinner_digits_get (Etk_Spinner *spinner)
 Gets the number of digits displayed by the spinner.
void etk_spinner_snap_to_ticks_set (Etk_Spinner *spinner, Etk_Bool snap_to_ticks)
 Sets whether or not the value of the spinner should be automatically corrected to the nearest step-increment.
Etk_Bool etk_spinner_snap_to_ticks_get (Etk_Spinner *spinner)
 Gets whether or not the value of the spinner are automatically corrected to the nearest step-increment.
void etk_spinner_wrap_set (Etk_Spinner *spinner, Etk_Bool wrap)
 Sets whether or not the spinner's value should wrap around to the opposite limit when the value exceed one of the spinner's bounds.
Etk_Bool etk_spinner_wrap_get (Etk_Spinner *spinner)
 Gets whether or not the spinner's value is wrapped around to the opposite limit when the value exceed one of the spinner's bounds.


Define Documentation

#define ETK_SPINNER_TYPE   (etk_spinner_type_get())

Gets the type of a spinner

#define ETK_SPINNER ( obj   )     (ETK_OBJECT_CAST((obj), ETK_SPINNER_TYPE, Etk_Spinner))

Casts the object to an Etk_Spinner

#define ETK_IS_SPINNER ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_SPINNER_TYPE))

Checks if the object is an Etk_Spinner


Function Documentation

Etk_Widget * etk_spinner_new ( double  lower,
double  upper,
double  value,
double  step_increment,
double  page_increment 
)

Creates a new spinner.

Parameters:
lower the minimal value of the spinner
upper the maximal value of the spinner
value the value to set to the spinner
step_increment specifies by how much the value should be changed when an arrow is clicked
page_increment specifies by how much the value should be changed when the "page down/up" keys are pressed
Returns:
Returns the new spinner widget

void etk_spinner_digits_set ( Etk_Spinner *  spinner,
int  digits 
)

Sets the number of digits displayed by the spinner.

Parameters:
spinner a spinner
digits the number of digits to display

int etk_spinner_digits_get ( Etk_Spinner *  spinner  ) 

Gets the number of digits displayed by the spinner.

Parameters:
spinner a spinner
Returns:
Returns the number of digits displayed by the spinner

void etk_spinner_snap_to_ticks_set ( Etk_Spinner *  spinner,
Etk_Bool  snap_to_ticks 
)

Sets whether or not the value of the spinner should be automatically corrected to the nearest step-increment.

Parameters:
spinner a spinner
snap_to_ticks ETK_TRUE if you want the value to be corrected, ETK_FALSE otherwise

Etk_Bool etk_spinner_snap_to_ticks_get ( Etk_Spinner *  spinner  ) 

Gets whether or not the value of the spinner are automatically corrected to the nearest step-increment.

Parameters:
spinner a spinner
Returns:
Returns ETK_TRUE if the value is automatically corrected, ETK_FALSE otherwise

void etk_spinner_wrap_set ( Etk_Spinner *  spinner,
Etk_Bool  wrap 
)

Sets whether or not the spinner's value should wrap around to the opposite limit when the value exceed one of the spinner's bounds.

Parameters:
spinner a spinner
wrap ETK_TRUE to make the value wrap around, ETK_FALSE otherwise

Etk_Bool etk_spinner_wrap_get ( Etk_Spinner *  spinner  ) 

Gets whether or not the spinner's value is wrapped around to the opposite limit when the value exceed one of the spinner's bounds.

Parameters:
spinner a spinner
Returns:
Returns ETK_TRUE if the spinner's value is wrapped around, ETK_FALSE otherwise