GUIslice  0.16.0
Embedded GUI in C
Element: Update Functions

Functions that configure or modify an existing eleemnt. More...

Collaboration diagram for Element: Update Functions:

Functions

void gslc_ElemSetFillEn (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bFillEn)
 Set the fill state for an Element. More...
 
void gslc_ElemSetFrameEn (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bFrameEn)
 Set the frame state for an Element. More...
 
void gslc_ElemSetRoundEn (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bRoundEn)
 Set the rounded frame/fill state for an Element. More...
 
void gslc_ElemSetCol (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_tsColor colFrame, gslc_tsColor colFill, gslc_tsColor colFillGlow)
 Update the common color selection for an Element. More...
 
void gslc_ElemSetGlowCol (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_tsColor colFrameGlow, gslc_tsColor colFillGlow, gslc_tsColor colTxtGlow)
 Update the common color selection for glowing state of an Element. More...
 
void gslc_ElemSetGroup (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int nGroupId)
 Set the group ID for an element. More...
 
int gslc_ElemGetGroup (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
 Get the group ID for an element. More...
 
void gslc_ElemSetRect (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_tsRect rElem)
 Set the position and size for an element. More...
 
gslc_tsRect gslc_ElemGetRect (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
 Get the rectangular region for an element. More...
 
void gslc_ElemSetTxtAlign (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, unsigned nAlign)
 Set the alignment of a textual element (horizontal and vertical) More...
 
void gslc_ElemSetTxtMargin (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, unsigned nMargin)
 Set the margin around of a textual element. More...
 
void gslc_ElemSetTxtMarginXY (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int8_t nMarginX, int8_t nMarginY)
 Set the margin around of a textual element (X & Y offsets can be different) More...
 
void gslc_StrCopy (char *pDstStr, const char *pSrcStr, uint16_t nDstLen)
 Helper routine to perform string deep copy. More...
 
void gslc_ElemSetTxtStr (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, const char *pStr)
 Update the text string associated with an Element. More...
 
char * gslc_ElemGetTxtStr (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
 Fetch the current text string associated with an Element. More...
 
void gslc_ElemSetTxtCol (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_tsColor colVal)
 Update the text string color associated with an Element ID. More...
 
void gslc_ElemSetTxtMem (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_teTxtFlags eFlags)
 Update the text string location in memory. More...
 
void gslc_ElemSetTxtEnc (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_teTxtFlags eFlags)
 Update the text string encoding mode. More...
 
void gslc_ElemUpdateFont (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int nFontId)
 Update the Font selected for an Element's text. More...
 
void gslc_ElemSetRedraw (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_teRedrawType eRedraw)
 Update the need-redraw status for an element. More...
 
gslc_teRedrawType gslc_ElemGetRedraw (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
 Get the need-redraw status for an element. More...
 
void gslc_ElemSetGlowEn (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bGlowEn)
 Update the glowing enable for an element. More...
 
void gslc_ElemSetClickEn (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bClickEn)
 Update the click enable for an element. More...
 
void gslc_ElemSetTouchFunc (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, GSLC_CB_TOUCH funcCb)
 Update the touch function callback for an element. More...
 
void gslc_ElemSetStyleFrom (gslc_tsGui *pGui, gslc_tsElemRef *pElemRefSrc, gslc_tsElemRef *pElemRefDest)
 Copy style settings from one element to another. More...
 
bool gslc_ElemGetGlowEn (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
 Get the glowing enable for an element. More...
 
void gslc_ElemSetGlow (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bGlowing)
 Update the glowing indicator for an element. More...
 
bool gslc_ElemGetGlow (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
 Get the glowing indicator for an element. More...
 
void gslc_ElemSetVisible (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bVisible)
 Update the visibility status for an element. More...
 
bool gslc_ElemGetVisible (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
 Get the visibility status for an element. More...
 
bool gslc_ElemGetOnScreen (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
 Determine whether an element is visible on the screen. More...
 
void gslc_ElemSetDrawFunc (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, GSLC_CB_DRAW funcCb)
 Assign the drawing callback function for an element. More...
 
void gslc_ElemSetTickFunc (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, GSLC_CB_TICK funcCb)
 Assign the tick callback function for an element. More...
 
bool gslc_ElemOwnsCoord (gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int16_t nX, int16_t nY, bool bOnlyClickEn)
 Determine if a coordinate is inside of an element. More...
 

Detailed Description

Functions that configure or modify an existing eleemnt.

Function Documentation

bool gslc_ElemGetGlow ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef 
)

Get the glowing indicator for an element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
Returns
True if element is glowing
bool gslc_ElemGetGlowEn ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef 
)

Get the glowing enable for an element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
Returns
True if element supports glowing
int gslc_ElemGetGroup ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef 
)

Get the group ID for an element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
Returns
Group ID or GSLC_GROUP_ID_NONE if unassigned
bool gslc_ElemGetOnScreen ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef 
)

Determine whether an element is visible on the screen.

  • This function takes into account both the element's "Visible" state as well as whether the element's associated page is active in the page stack.
Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
Returns
True if element appears on the screen, false otherwise
gslc_tsRect gslc_ElemGetRect ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef 
)

Get the rectangular region for an element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
Returns
Rect region of an element
gslc_teRedrawType gslc_ElemGetRedraw ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef 
)

Get the need-redraw status for an element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
Returns
Redraw status
char* gslc_ElemGetTxtStr ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef 
)

Fetch the current text string associated with an Element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
Returns
Pointer to character array string
bool gslc_ElemGetVisible ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef 
)

Get the visibility status for an element.

  • Note that the visibility state is independent of whether or not the page associated with the element is actively displayed.
Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
Returns
True if element is marked as visible, false if hidden
bool gslc_ElemOwnsCoord ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
int16_t  nX,
int16_t  nY,
bool  bOnlyClickEn 
)

Determine if a coordinate is inside of an element.

  • This routine is useful in determining if a touch coordinate is inside of a button.
Parameters
[in]pGuiPointer to GUI
[in]pElemRefElement reference used for boundary test
[in]nXX coordinate to test
[in]nYY coordinate to test
[in]bOnlyClickEnOnly output true if element was also marked as "clickable" (eg. bClickEn=true)
Returns
true if inside element, false otherwise
void gslc_ElemSetClickEn ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
bool  bClickEn 
)

Update the click enable for an element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]bClickEnTrue if element should support click events
Returns
none
void gslc_ElemSetCol ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
gslc_tsColor  colFrame,
gslc_tsColor  colFill,
gslc_tsColor  colFillGlow 
)

Update the common color selection for an Element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]colFrameColor for the frame
[in]colFillColor for the fill
[in]colFillGlowColor for the fill when glowing
Returns
none
void gslc_ElemSetDrawFunc ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
GSLC_CB_DRAW  funcCb 
)

Assign the drawing callback function for an element.

  • This allows the user to override the default rendering for an element, enabling the creation of a custom element
Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]funcCbFunction pointer to drawing routine (or NULL for default))
Returns
none
void gslc_ElemSetFillEn ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
bool  bFillEn 
)

Set the fill state for an Element.

  • If not filled, the element can support transparency against an arbitrary background, but this can require full screen redraws if the element is updated.
  • If filled, the background fill color can be changed by gslc_ElemSetCol()
Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]bFillEnTrue if filled, false otherwise
Returns
none
void gslc_ElemSetFrameEn ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
bool  bFrameEn 
)

Set the frame state for an Element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]bFrameEnTrue if framed, false otherwise
Returns
none
void gslc_ElemSetGlow ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
bool  bGlowing 
)

Update the glowing indicator for an element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]bGlowingTrue if element is glowing
Returns
none
void gslc_ElemSetGlowCol ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
gslc_tsColor  colFrameGlow,
gslc_tsColor  colFillGlow,
gslc_tsColor  colTxtGlow 
)

Update the common color selection for glowing state of an Element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]colFrameGlowColor for the frame when glowing
[in]colFillGlowColor for the fill when glowing
[in]colTxtGlowColor for the text when glowing
Returns
none
void gslc_ElemSetGlowEn ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
bool  bGlowEn 
)

Update the glowing enable for an element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]bGlowEnTrue if element should support glowing
Returns
none
void gslc_ElemSetGroup ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
int  nGroupId 
)

Set the group ID for an element.

  • Typically used to associate radio button elements together
Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]nGroupIdGroup ID to assign
Returns
none
void gslc_ElemSetRect ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
gslc_tsRect  rElem 
)

Set the position and size for an element.

  • This updates the element's rectangular region, which can be used to relocate or resize an element at runtime
Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]rElemRect region (top-left coord, width, height)
Returns
none
void gslc_ElemSetRedraw ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
gslc_teRedrawType  eRedraw 
)

Update the need-redraw status for an element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]eRedrawRedraw state to set
Returns
none
void gslc_ElemSetRoundEn ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
bool  bRoundEn 
)

Set the rounded frame/fill state for an Element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]bRoundEnTrue if rounded, false otherwise
Returns
none
void gslc_ElemSetStyleFrom ( gslc_tsGui pGui,
gslc_tsElemRef pElemRefSrc,
gslc_tsElemRef pElemRefDest 
)

Copy style settings from one element to another.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefSrcPointer to source Element reference
[in]pElemRefDestPointer to destination Element reference
Returns
none
void gslc_ElemSetTickFunc ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
GSLC_CB_TICK  funcCb 
)

Assign the tick callback function for an element.

  • This allows the user to provide background updates to an element triggered by the main loop call to gslc_Update()
Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]funcCbFunction pointer to tick routine (or NULL for none))
Returns
none
void gslc_ElemSetTouchFunc ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
GSLC_CB_TOUCH  funcCb 
)

Update the touch function callback for an element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]funcCbPointer to the touch callback function
Returns
none
void gslc_ElemSetTxtAlign ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
unsigned  nAlign 
)

Set the alignment of a textual element (horizontal and vertical)

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]nAlignAlignment to specify:
  • GSLC_ALIGN_TOP_LEFT
  • GSLC_ALIGN_TOP_MID
  • GSLC_ALIGN_TOP_RIGHT
  • GSLC_ALIGN_MID_LEFT
  • GSLC_ALIGN_MID_MID
  • GSLC_ALIGN_MID_RIGHT
  • GSLC_ALIGN_BOT_LEFT
  • GSLC_ALIGN_BOT_MID
  • GSLC_ALIGN_BOT_RIGHT
Returns
none
void gslc_ElemSetTxtCol ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
gslc_tsColor  colVal 
)

Update the text string color associated with an Element ID.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]colValRGB color to change to
Returns
none
void gslc_ElemSetTxtEnc ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
gslc_teTxtFlags  eFlags 
)

Update the text string encoding mode.

  • This function can be used to indicate that the element's text string is encoded in UTF-8, which supports extended / foreign character maps
Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]eFlagsFlags associated with text encoding (GSLC_TXT_ENC_*)
Returns
none
void gslc_ElemSetTxtMargin ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
unsigned  nMargin 
)

Set the margin around of a textual element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]nMarginNumber of pixels gap to leave surrounding text
Returns
none
void gslc_ElemSetTxtMarginXY ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
int8_t  nMarginX,
int8_t  nMarginY 
)

Set the margin around of a textual element (X & Y offsets can be different)

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]nMarginXNumber of pixels gap to offset text horizontally
[in]nMarginYNumber of pixels gap to offset text vertically
Returns
none
void gslc_ElemSetTxtMem ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
gslc_teTxtFlags  eFlags 
)

Update the text string location in memory.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]eFlagsFlags associated with text memory location (GSLC_TXT_MEM_*)
Returns
none
void gslc_ElemSetTxtStr ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
const char *  pStr 
)

Update the text string associated with an Element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]pStrString to copy into element
Returns
none
void gslc_ElemSetVisible ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
bool  bVisible 
)

Update the visibility status for an element.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]bVisibleTrue if element is shown, false if hidden
Returns
none
void gslc_ElemUpdateFont ( gslc_tsGui pGui,
gslc_tsElemRef pElemRef,
int  nFontId 
)

Update the Font selected for an Element's text.

Parameters
[in]pGuiPointer to GUI
[in]pElemRefPointer to Element reference
[in]nFontIdFont ID to select
Returns
none
void gslc_StrCopy ( char *  pDstStr,
const char *  pSrcStr,
uint16_t  nDstLen 
)

Helper routine to perform string deep copy.

  • Includes termination
  • Similar to strncpy() except:
    • nDstLen is the total buffer size (including terminator)
    • A terminator is added at the end of the buffer
Parameters
[in,out]pDstStrPointer to destination buffer
[in]nDstLenSize of destination buffer (includes NULL)
[in]pSrcStrPointer to source buffer
Returns
none