EasyGUI  v0.1
Platform independent GUI Library
Slider

Simple slider widget for user interaction. More...

Data Structures

struct  GUI_SLIDER_t
 SLIDER object structure. More...
 

Enumerations

enum  GUI_SLIDER_COLOR_t { GUI_SLIDER_COLOR_BG_NONACTIVE = 0x00, GUI_SLIDER_COLOR_BG_ACTIVE, GUI_SLIDER_COLOR_FG, GUI_SLIDER_COLOR_BORDER }
 List of slider colors. More...
 
enum  GUI_SLIDER_MODE_t { GUI_SLIDER_MODE_LEFT_RIGHT = 0x00, GUI_SLIDER_MODE_RIGHT_LEFT, GUI_SLIDER_MODE_BOTTOM_TOP, GUI_SLIDER_MODE_TOP_BOTTOM }
 List of slider modes. More...
 

Functions

GUI_HANDLE_p gui_slider_create (GUI_ID_t id, GUI_iDim_t x, GUI_iDim_t y, GUI_Dim_t width, GUI_Dim_t height, GUI_HANDLE_p parent, GUI_WIDGET_CALLBACK_t cb, uint16_t flags)
 Create new slider widget. More...
 
uint8_t gui_slider_setcolor (GUI_HANDLE_p h, GUI_SLIDER_COLOR_t index, GUI_Color_t color)
 Set color to specific part of widget. More...
 
uint8_t gui_slider_setmode (GUI_HANDLE_p h, GUI_SLIDER_MODE_t mode)
 Set slider mode (orientation) More...
 
uint8_t gui_slider_setmin (GUI_HANDLE_p h, int32_t val)
 Set slider minimal value. More...
 
uint8_t gui_slider_setmax (GUI_HANDLE_p h, int32_t val)
 Set slider maximal value. More...
 
uint8_t gui_slider_setvalue (GUI_HANDLE_p h, int32_t val)
 Set slider current value. More...
 
int32_t gui_slider_getmin (GUI_HANDLE_p h)
 Get slider minimal value. More...
 
int32_t gui_slider_getmax (GUI_HANDLE_p h)
 Get slider maximal value. More...
 
int32_t gui_slider_getvalue (GUI_HANDLE_p h)
 Get slider current value. More...
 

Detailed Description

Simple slider widget for user interaction.

Simple slider widget to select range between 2 (min, max) values.

image_widget_slider.png
Slider widget in different states. On top is passive state (touch not active) and bottom is when touch is active

Example code of image above:

//Create basic slider
handle = gui_slider_create(0, 10, 10, 300, 50, 0, 0, 0);

Enumeration Type Documentation

List of slider colors.

Enumerator
GUI_SLIDER_COLOR_BG_NONACTIVE 

Background color index on slider part of non-active area

GUI_SLIDER_COLOR_BG_ACTIVE 

Background color index on slider part of active area

GUI_SLIDER_COLOR_FG 

Foreground color index for foreground (circle, ...) part

GUI_SLIDER_COLOR_BORDER 

Border color index for bottom part

List of slider modes.

Enumerator
GUI_SLIDER_MODE_LEFT_RIGHT 

Slider is horizontal, min on the left, max on the right

GUI_SLIDER_MODE_RIGHT_LEFT 

Slider is horizontal, min on the right, max on the left

GUI_SLIDER_MODE_BOTTOM_TOP 

Slider is horizontal, min on the bottom, max on the top

GUI_SLIDER_MODE_TOP_BOTTOM 

Slider is horizontal, min on the top, max on the bottom

Function Documentation

GUI_HANDLE_p gui_slider_create ( GUI_ID_t  id,
GUI_iDim_t  x,
GUI_iDim_t  y,
GUI_Dim_t  width,
GUI_Dim_t  height,
GUI_HANDLE_p  parent,
GUI_WIDGET_CALLBACK_t  cb,
uint16_t  flags 
)

Create new slider widget.

Parameters
[in]idWidget unique ID to use for identity for callback processing
[in]xWidget X position relative to parent widget
[in]yWidget Y position relative to parent widget
[in]widthWidget width in units of pixels
[in]heightWidget height in uints of pixels
[in]parentParent widget handle. Set to NULL to use current active parent widget
[in]cbPointer to GUI_WIDGET_CALLBACK_t callback function. Set to NULL to use default widget callback
[in]flagsFlags for create procedure
Return values
>0: GUI_HANDLE_p object of created widget
0Widget creation failed
int32_t gui_slider_getmax ( GUI_HANDLE_p  h)

Get slider maximal value.

Parameters
[in,out]hWidget handle
Return values
Maximalvalue
See also
gui_slider_setmin, gui_slider_setvalue, gui_slider_setmax, gui_slider_getvalue, gui_slider_getmin
int32_t gui_slider_getmin ( GUI_HANDLE_p  h)

Get slider minimal value.

Parameters
[in,out]hWidget handle
Return values
Minimalvalue
See also
gui_slider_setmin, gui_slider_setvalue, gui_slider_setmax, gui_slider_getvalue, gui_slider_getmax
int32_t gui_slider_getvalue ( GUI_HANDLE_p  h)

Get slider current value.

Parameters
[in,out]hWidget handle
Return values
Currentvalue
See also
gui_slider_setmin, gui_slider_setvalue, gui_slider_setmax, gui_slider_getmin, gui_slider_getmax
uint8_t gui_slider_setcolor ( GUI_HANDLE_p  h,
GUI_SLIDER_COLOR_t  index,
GUI_Color_t  color 
)

Set color to specific part of widget.

Parameters
[in,out]hWidget handle
[in]indexColor index. This parameter can be a value of GUI_SLIDER_COLOR_t enumeration
[in]colorColor value
Return values
1Color was set ok
0Color vas not set
uint8_t gui_slider_setmax ( GUI_HANDLE_p  h,
int32_t  val 
)

Set slider maximal value.

Parameters
[in,out]hWidget handle
[in]valNew maximal value
Return values
1Value was set ok
0Value vas not set
See also
gui_slider_setmin, gui_slider_setvalue, gui_slider_getvalue, gui_slider_getmin, gui_slider_getmax
uint8_t gui_slider_setmin ( GUI_HANDLE_p  h,
int32_t  val 
)

Set slider minimal value.

Parameters
[in,out]hWidget handle
[in]valNew minimal value
Return values
1Value was set ok
0Value vas not set
See also
gui_slider_setvalue, gui_slider_setmax, gui_slider_getvalue, gui_slider_getmin, gui_slider_getmax
uint8_t gui_slider_setmode ( GUI_HANDLE_p  h,
GUI_SLIDER_MODE_t  mode 
)

Set slider mode (orientation)

Parameters
[in]hWidget handle
[in]modeSlider mode. This parameter can be a value of GUI_SLIDER_MODE_t enumeration
Return values
1Mode was set ok
0Mode was not set
uint8_t gui_slider_setvalue ( GUI_HANDLE_p  h,
int32_t  val 
)

Set slider current value.

Parameters
[in,out]hWidget handle
[in]valNew current value
Return values
1Value was set ok
0Value vas not set
See also
gui_slider_setmin, gui_slider_setmax, gui_slider_getvalue, gui_slider_getmin, gui_slider_getmax