EasyGUI  Version v1.0
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, float x, float y, float width, float height, gui_handle_p parent, gui_widget_evt_fn evt_fn, 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:

Enumeration Type Documentation

◆ gui_slider_color_t

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

◆ gui_slider_mode_t

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_slider_create()

gui_handle_p gui_slider_create ( gui_id_t  id,
float  x,
float  y,
float  width,
float  height,
gui_handle_p  parent,
gui_widget_evt_fn  evt_fn,
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 units of pixels
[in]parentParent widget handle. Set to NULL to use current active parent widget
[in]evt_fnCustom widget callback function. Set to NULL to use default callback
[in]flagsflags for create procedure
Returns
Widget handle on success, NULL otherwise

◆ gui_slider_getmax()

int32_t gui_slider_getmax ( gui_handle_p  h)

Get slider maximal value.

Parameters
[in]hWidget handle
Returns
Maximal value

◆ gui_slider_getmin()

int32_t gui_slider_getmin ( gui_handle_p  h)

Get slider minimal value.

Parameters
[in]hWidget handle
Returns
Minimal value

◆ gui_slider_getvalue()

int32_t gui_slider_getvalue ( gui_handle_p  h)

Get slider current value.

Parameters
[in]hWidget handle
Returns
Current value

◆ gui_slider_setcolor()

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]hWidget handle
[in]indexColor index
[in]colorColor value
Returns
1 on success, 0 otherwise

◆ gui_slider_setmax()

uint8_t gui_slider_setmax ( gui_handle_p  h,
int32_t  val 
)

Set slider maximal value.

Parameters
[in]hWidget handle
[in]valNew maximal value
Returns
1 on success, 0 otherwise

◆ gui_slider_setmin()

uint8_t gui_slider_setmin ( gui_handle_p  h,
int32_t  val 
)

Set slider minimal value.

Parameters
[in]hWidget handle
[in]valNew minimal value
Returns
1 on success, 0 otherwise

◆ gui_slider_setmode()

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
Returns
1 on success, 0 otherwise

◆ gui_slider_setvalue()

uint8_t gui_slider_setvalue ( gui_handle_p  h,
int32_t  val 
)

Set slider current value.

Parameters
[in]hWidget handle
[in]valNew current value
Returns
1 on success, 0 otherwise