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

Functions

gslc_tsElemRefgslc_ElemXRingGaugeCreate (gslc_tsGui *pGui, int16_t nElemId, int16_t nPage, gslc_tsXRingGauge *pXData, gslc_tsRect rElem, char *pStrBuf, uint8_t nStrBufMax, int16_t nFontId)
 Create an XRingGauge element. More...
 
bool gslc_ElemXRingGaugeDraw (void *pvGui, void *pvElemRef, gslc_teRedrawType eRedraw)
 Draw the template element on the screen. More...
 
void gslc_ElemXRingGaugeSetVal (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int16_t nVal)
 Set an Ring Gauge current indicator value. More...
 
void gslc_ElemXRingGaugeSetValRange (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int16_t nValMin, int16_t nValMax)
 Defines the range of values that may be passed into SetVal(), used to scale the input to SetVal(). More...
 
void gslc_ElemXRingGaugeSetAngleRange (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int16_t nStart, int16_t nRange, bool bClockwise)
 Defines the angular range of the gauge, including both the active and inactive regions. More...
 
void gslc_ElemXRingGaugeSetThickness (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int8_t nThickness)
 Defines the thickness of the ring arcs. More...
 
void gslc_ElemXRingGaugeSetColorActiveFlat (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_tsColor colActive)
 Defines the color of the active region to be a flat (constant) color. More...
 
void gslc_ElemXRingGaugeSetColorActiveGradient (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_tsColor colStart, gslc_tsColor colEnd)
 Defines the color of the active region to be a gradient using two color stops. More...
 
void gslc_ElemXRingGaugeSetColorInactive (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_tsColor colInactive)
 Defines the color of the inactive region to be a flat (constant) color. More...
 
void gslc_ElemXRingGaugeSetQuality (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, uint16_t nSegments)
 Sets the quality of the ring drawing by defining the number of segments that are used when rendering a 360 degree gauge.The larger the number, the more segments are used and the smoother the curve. More...
 

Variables

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

Function Documentation

gslc_tsElemRef* gslc_ElemXRingGaugeCreate ( gslc_tsGui pGui,
int16_t  nElemId,
int16_t  nPage,
gslc_tsXRingGauge pXData,
gslc_tsRect  rElem,
char *  pStrBuf,
uint8_t  nStrBufMax,
int16_t  nFontId 
)

Create an XRingGauge 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]rElemThe square box that bounds the ring element. If a rectangular region is provided, then the ring control will be centered in the long axis.
[in]pStrBufString buffer to use for gauge inner text
[in]nStrBufMaxMaximum length of string buffer (pStrBuf)
[in]nFontIdFont ID to use for text display
Returns
Pointer to Element reference or NULL if failure
bool gslc_ElemXRingGaugeDraw ( void *  pvGui,
void *  pvElemRef,
gslc_teRedrawType  eRedraw 
)

Draw the template 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
void gslc_ElemXRingGaugeSetAngleRange ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
int16_t  nStart,
int16_t  nRange,
bool  bClockwise 
)

Defines the angular range of the gauge, including both the active and inactive regions.

  • nStart defines the angle at the beginning of the active region.
  • The current position marks the end of the active region and the beginning of the inactive region.
  • nRange defines the angular range from the start of the active region to the end of the inactive region. In most cases, a range of 360 degrees is used.
  • All angles are measured in units of degrees.
  • Angles are measured with 0 at the top, 90 towards the right, 180 towards the bottom, 270 towards the left, etc.
Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]nStartDefine angle of start of active region (measured in degrees)
[in]nRangeDefine angular range from strt of active region to end of the inactive region (measured in degrees)
[in]bClockwiseDefines the direction in which the active region grows (true for clockwise) [FORCED TRUE, FOR FUTURE IMPLEMENTATION]
Returns
none
void gslc_ElemXRingGaugeSetColorActiveFlat ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
gslc_tsColor  colActive 
)

Defines the color of the active region to be a flat (constant) color.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]colActiveColor of active region
Returns
none
void gslc_ElemXRingGaugeSetColorActiveGradient ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
gslc_tsColor  colStart,
gslc_tsColor  colEnd 
)

Defines the color of the active region to be a gradient using two color stops.

The active region will be filled according to the proportion between nMin and nMax. The gradient is defined by a linear RGB blend between the two color stops(colStart and colEnd)

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]colStartStarting color of gradient fill
[in]colEndEnding color of gradient fill
Returns
none
void gslc_ElemXRingGaugeSetColorInactive ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
gslc_tsColor  colInactive 
)

Defines the color of the inactive region to be a flat (constant) color.

The inactive color is often set to be the same as the background but it can be set to a different color to indicate the remainder of the value range that is yet to be filled.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]colInactiveColor of inactive region
Returns
none
void gslc_ElemXRingGaugeSetQuality ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
uint16_t  nSegments 
)

Sets the quality of the ring drawing by defining the number of segments that are used when rendering a 360 degree gauge.The larger the number, the more segments are used and the smoother the curve.

A larger ring gauge may need a higher quality number to maintain a smoothed curve appearance.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]nSegmentsNumber of arc segments to render a complete circle. The higher the value, the smoother the ring. Note that 360/nSegments should be an integer result, thus the allowable quality settings are: 360 (max quality), 180, 120, 90, 72, 60, 45, 40, 36 (low quality), etc.
Returns
none
void gslc_ElemXRingGaugeSetThickness ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
int8_t  nThickness 
)

Defines the thickness of the ring arcs.

More specifically, it defines the reduction in radius from the outer radius to the inner radius in pixels.

  • Default thickness is 10 pixels
Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]nThicknessThickness of ring
Returns
none
void gslc_ElemXRingGaugeSetVal ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
int16_t  nVal 
)

Set an Ring Gauge current indicator value.

Updates the current value of the ring gauge. The active region will be drawn up to the position defined by nVal within the value range defined by SetValRange(nMin,nMax). A SetVal() close to nMin will cause a very small active region to be drawn and a large remainder drawn in the inactive color, whereas a SetVal() close to nMax will cause a more complete active region to be drawn.When SetVal() equals nMax, the entire angular range will be drawn in the active color (and no inactive region).

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]nValNew position value
Returns
none
void gslc_ElemXRingGaugeSetValRange ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
int16_t  nValMin,
int16_t  nValMax 
)

Defines the range of values that may be passed into SetVal(), used to scale the input to SetVal().

  • Default is 0..100.
Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]nValMinMinimum value
[in]nValMaxMaximum value
Returns
none

Variable Documentation

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