GUIslice  0.16.0
Embedded GUI in C
XGauge.h File Reference
#include "GUIslice.h"
Include dependency graph for XGauge.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  gslc_tsXGauge
 Extended data for Gauge element. More...
 

Macros

#define GSLC_TYPEX_GAUGE
 
#define gslc_ElemXGaugeCreate_P(pGui, nElemId, nPage, nX, nY, nW, nH, nMin_, nMax_, nVal_, colFrame_, colFill_, colGauge_, bVert_)
 Create a Gauge Element in Flash. More...
 

Enumerations

enum  gslc_teXGaugeStyle { GSLCX_GAUGE_STYLE_PROG_BAR, GSLCX_GAUGE_STYLE_RADIAL, GSLCX_GAUGE_STYLE_RAMP }
 Gauge drawing style. More...
 

Functions

gslc_tsElemRefgslc_ElemXGaugeCreate (gslc_tsGui *pGui, int16_t nElemId, int16_t nPage, gslc_tsXGauge *pXData, gslc_tsRect rElem, int16_t nMin, int16_t nMax, int16_t nVal, gslc_tsColor colGauge, bool bVert)
 Create a Gauge Element. More...
 
void gslc_ElemXGaugeSetStyle (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_teXGaugeStyle nType)
 Configure the style of a Gauge element. More...
 
void gslc_ElemXGaugeSetIndicator (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_tsColor colGauge, uint16_t nIndicLen, uint16_t nIndicTip, bool bIndicFill)
 Configure the appearance of the Gauge indicator. More...
 
void gslc_ElemXGaugeSetTicks (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_tsColor colTick, uint16_t nTickCnt, uint16_t nTickLen)
 Configure the appearance of the Gauge ticks. More...
 
void gslc_ElemXGaugeUpdate (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int16_t nVal)
 Update a Gauge element's current value. More...
 
void gslc_ElemXGaugeSetFlip (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bFlip)
 Set a Gauge element's fill direction. More...
 
bool gslc_ElemXGaugeDraw (void *pvGui, void *pvElemRef, gslc_teRedrawType eRedraw)
 Draw a gauge element on the screen. More...
 
bool gslc_ElemXGaugeDrawProgressBar (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_teRedrawType eRedraw)
 Helper function to draw a gauge with style: progress bar. More...
 

Macro Definition Documentation

#define gslc_ElemXGaugeCreate_P (   pGui,
  nElemId,
  nPage,
  nX,
  nY,
  nW,
  nH,
  nMin_,
  nMax_,
  nVal_,
  colFrame_,
  colFill_,
  colGauge_,
  bVert_ 
)

Create a Gauge Element in Flash.

Parameters
[in]pGuiPointer to GUI
[in]nElemIdUnique element ID to assign
[in]nPagePage ID to attach element to
[in]nXX coordinate of element
[in]nYY coordinate of element
[in]nWWidth of element
[in]nHHeight of element
[in]nMin_Minimum value of gauge for nVal comparison
[in]nMax_Maximum value of gauge for nVal comparison
[in]nVal_Starting value of gauge
[in]colFrame_Color for the gauge frame
[in]colFill_Color for the gauge background fill
[in]colGauge_Color for the gauge indicator
[in]bVert_Flag to indicate vertical vs horizontal action (true = vertical, false = horizontal)
Returns
none
#define GSLC_TYPEX_GAUGE

Enumeration Type Documentation

Gauge drawing style.

Enumerator
GSLCX_GAUGE_STYLE_PROG_BAR 

Progress bar.

GSLCX_GAUGE_STYLE_RADIAL 

Radial indicator.

GSLCX_GAUGE_STYLE_RAMP 

Ramp indicator.

Function Documentation

gslc_tsElemRef* gslc_ElemXGaugeCreate ( gslc_tsGui pGui,
int16_t  nElemId,
int16_t  nPage,
gslc_tsXGauge pXData,
gslc_tsRect  rElem,
int16_t  nMin,
int16_t  nMax,
int16_t  nVal,
gslc_tsColor  colGauge,
bool  bVert 
)

Create a Gauge Element.

  • Draws a gauge element that represents a proportion (nVal) between nMin and nMax.
  • Support gauge sub-types:
    • GSLC_TYPEX_GAUGE_PROG_BAR: Horizontal or vertical box with filled region
    • GSLC_TYPEX_GAUGE_RADIAL: Radial / compass indicator
  • Default appearance is a horizontal progress bar, but can be changed with gslc_ElemXGaugeSetStyle())
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 gauge size
[in]nMinMinimum value of gauge for nVal comparison
[in]nMaxMaximum value of gauge for nVal comparison
[in]nValStarting value of gauge
[in]colGaugeColor for the gauge indicator
[in]bVertFlag to indicate vertical vs horizontal action (true = vertical, false = horizontal)
Returns
Pointer to Element reference or NULL if failure
bool gslc_ElemXGaugeDraw ( void *  pvGui,
void *  pvElemRef,
gslc_teRedrawType  eRedraw 
)

Draw a gauge 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
bool gslc_ElemXGaugeDrawProgressBar ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
gslc_teRedrawType  eRedraw 
)

Helper function to draw a gauge with style: progress bar.

Parameters
[in]pGuiPtr to GUI
[in]pElemRefPtr to Element reference
[in]eRedrawRedraw status
Returns
true if success, false otherwise
void gslc_ElemXGaugeSetFlip ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
bool  bFlip 
)

Set a Gauge element's fill direction.

  • Setting bFlip reverses the default fill direction
  • Default fill direction for horizontal gauges: left-to-right
  • Default fill direction for vertical gauges: bottom-to-top
Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]bFlipIf set, reverse direction of fill from default
Returns
none
void gslc_ElemXGaugeSetIndicator ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
gslc_tsColor  colGauge,
uint16_t  nIndicLen,
uint16_t  nIndicTip,
bool  bIndicFill 
)

Configure the appearance of the Gauge indicator.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]colGaugeColor of the indicator
[in]nIndicLenLength of the indicator
[in]nIndicTipSize of the indicator tip
[in]bIndicFillFill in the indicator if true
Returns
none
void gslc_ElemXGaugeSetStyle ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
gslc_teXGaugeStyle  nType 
)

Configure the style of a Gauge element.

  • This function is used to select between one of several gauge types (eg. progress bar, radial dial, etc.)
Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]nTypeGauge style enumeration
Returns
none
void gslc_ElemXGaugeSetTicks ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
gslc_tsColor  colTick,
uint16_t  nTickCnt,
uint16_t  nTickLen 
)

Configure the appearance of the Gauge ticks.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]colTickColor of the gauge ticks
[in]nTickCntNumber of ticks to draw around / along gauge
[in]nTickLenLength of the tick marks to draw
Returns
none
void gslc_ElemXGaugeUpdate ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
int16_t  nVal 
)

Update a Gauge element's current value.

  • Note that min & max values are assigned in create()
Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]nValNew value to show in gauge
Returns
none