GUIslice  0.16.0
Embedded GUI in C
XSlider.c File Reference
#include "GUIslice.h"
#include "GUIslice_drv.h"
#include "elem/XSlider.h"
#include <stdio.h>
Include dependency graph for XSlider.c:

Functions

gslc_tsElemRefgslc_ElemXSliderCreate (gslc_tsGui *pGui, int16_t nElemId, int16_t nPage, gslc_tsXSlider *pXData, gslc_tsRect rElem, int16_t nPosMin, int16_t nPosMax, int16_t nPos, uint16_t nThumbSz, bool bVert)
 Create a Slider Element. More...
 
void gslc_ElemXSliderSetStyle (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bTrim, gslc_tsColor colTrim, uint16_t nTickDiv, int16_t nTickLen, gslc_tsColor colTick)
 Set a Slider element's current position. More...
 
void gslc_ElemXSliderSetSnapEn (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bSnapEn)
 Enable touch to snap to the nearest tick mark. More...
 
int gslc_ElemXSliderGetPos (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
 Get a Slider element's current position. More...
 
void gslc_ElemXSliderSetPos (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int16_t nPos)
 Set a Slider element's current position. More...
 
void gslc_ElemXSliderSetPosFunc (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, GSLC_CB_XSLIDER_POS funcCb)
 Assign the position callback function for a slider. More...
 
bool gslc_ElemXSliderDraw (void *pvGui, void *pvElemRef, gslc_teRedrawType eRedraw)
 Draw a Slider element on the screen. More...
 
bool gslc_ElemXSliderTouch (void *pvGui, void *pvElemRef, gslc_teTouch eTouch, int16_t nRelX, int16_t nRelY)
 Handle touch events to Slider element. More...
 

Variables

const char GSLC_PMEM ERRSTR_NULL []
 
const char GSLC_PMEM ERRSTR_PXD_NULL []
 

Function Documentation

gslc_tsElemRef* gslc_ElemXSliderCreate ( gslc_tsGui pGui,
int16_t  nElemId,
int16_t  nPage,
gslc_tsXSlider pXData,
gslc_tsRect  rElem,
int16_t  nPosMin,
int16_t  nPosMax,
int16_t  nPos,
uint16_t  nThumbSz,
bool  bVert 
)

Create a Slider Element.

Parameters
[in]pGuiPointer to GUI
[in]nElemIdElement ID to assign (0..16383 or GSLC_ID_AUTO to autogen)
[in]nPagePage ID to attach element to
[in]pXDataPtr to extended element data structure
[in]rElemRectangle coordinates defining checkbox size
[in]nPosMinMinimum position value
[in]nPosMaxMaximum position value
[in]nPosStarting position value
[in]nThumbSzSize of the thumb control
[in]bVertOrientation (true for vertical)
Returns
Pointer to Element reference or NULL if failure
bool gslc_ElemXSliderDraw ( void *  pvGui,
void *  pvElemRef,
gslc_teRedrawType  eRedraw 
)

Draw a Slider element on the screen.

Parameters
[in]pvGuiVoid ptr to GUI (typecast to gslc_tsGui*)
[in]pvElemRefVoid ptr to Element reference (typecast to gslc_tsElemRef*)
[in]eRedrawRedraw mode
Returns
true if success, false otherwise
int gslc_ElemXSliderGetPos ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef 
)

Get a Slider element's current position.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
Returns
Current slider position
void gslc_ElemXSliderSetPos ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
int16_t  nPos 
)

Set a Slider element's current position.

Parameters
[in]pGuiPointer to GUI
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]nPosNew position value
Returns
none
void gslc_ElemXSliderSetPosFunc ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
GSLC_CB_XSLIDER_POS  funcCb 
)

Assign the position callback function for a slider.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]funcCbFunction pointer to position routine (or NULL for none)
Returns
none
void gslc_ElemXSliderSetSnapEn ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
bool  bSnapEn 
)

Enable touch to snap to the nearest tick mark.

  • nTickDiv (in SetStyle) must be non-zero for snap to be active
Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]bSnapEnEnable snap function if true
Returns
none
void gslc_ElemXSliderSetStyle ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
bool  bTrim,
gslc_tsColor  colTrim,
uint16_t  nTickDiv,
int16_t  nTickLen,
gslc_tsColor  colTick 
)

Set a Slider element's current position.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]bTrimShow a colored trim?
[in]colTrimColor of trim
[in]nTickDivNumber of tick divisions to show (0 for none)
[in]nTickLenLength of tickmarks
[in]colTickColor of ticks
Returns
none
bool gslc_ElemXSliderTouch ( void *  pvGui,
void *  pvElemRef,
gslc_teTouch  eTouch,
int16_t  nRelX,
int16_t  nRelY 
)

Handle touch events to Slider element.

Parameters
[in]pvGuiVoid ptr to GUI (typecast to gslc_tsGui*)
[in]pvElemRefVoid ptr to Element reference (typecast to gslc_tsElemRef*)
[in]eTouchTouch event type
[in]nRelXTouch X coord relative to element
[in]nRelYTouch Y coord relative to element
Returns
true if success, false otherwise

Variable Documentation

const char GSLC_PMEM ERRSTR_NULL[]
const char GSLC_PMEM ERRSTR_PXD_NULL[]