GUIslice  0.16.0
Embedded GUI in C
XTemplate.h
Go to the documentation of this file.
1 #ifndef _GUISLICE_EX_XTEMPLATE_H_
2 #define _GUISLICE_EX_XTEMPLATE_H_
3 
4 #include "GUIslice.h"
5 
6 
7 // =======================================================================
8 // GUIslice library extension: Example template
9 // - Calvin Hass
10 // - https://www.impulseadventure.com/elec/guislice-gui.html
11 // - https://github.com/ImpulseAdventure/GUIslice
12 // =======================================================================
13 //
14 // The MIT License
15 //
16 // Copyright 2016-2020 Calvin Hass
17 //
18 // Permission is hereby granted, free of charge, to any person obtaining a copy
19 // of this software and associated documentation files (the "Software"), to deal
20 // in the Software without restriction, including without limitation the rights
21 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
22 // copies of the Software, and to permit persons to whom the Software is
23 // furnished to do so, subject to the following conditions:
24 //
25 // The above copyright notice and this permission notice shall be included in
26 // all copies or substantial portions of the Software.
27 //
28 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
34 // THE SOFTWARE.
35 //
36 // =======================================================================
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif // __cplusplus
42 
43 
44 // ============================================================================
45 // Extended Element: Example template
46 // ============================================================================
47 
48 // Define unique identifier for extended element type
49 // - Select any number above GSLC_TYPE_BASE_EXTEND
50 #define GSLC_TYPEX_TEMPLATE GSLC_TYPE_BASE_EXTEND + 12
51 
53 //typedef bool (*GSLC_CB_XTEMPLATE_POS)(void* pvGui,void* pvElem,int16_t nPos);
54 
55 // Extended element data structures
56 // - These data structures are maintained in the gslc_tsElem
57 // structure via the pXData pointer
58 
60 typedef struct {
61  // Config
62  // Style config
63  // State
64  //int16_t nPos; ///< Example position value
65  // Callbacks
66  //GSLC_CB_XTEXTEX_POS pfuncXPos; ///< Callback func ptr for position update
68 
69 
84 gslc_tsElemRef* gslc_ElemXTemplateCreate(gslc_tsGui* pGui, int16_t nElemId, int16_t nPage,
85  gslc_tsXTemplate* pXData, gslc_tsRect rElem, char* pStrBuf, uint8_t nStrBufMax, int16_t nFontId);
86 
87 
98 bool gslc_ElemXTemplateDraw(void* pvGui,void* pvElemRef,gslc_teRedrawType eRedraw);
99 
112 bool gslc_ElemXTemplateTouch(void* pvGui,void* pvElemRef,gslc_teTouch eTouch,int16_t nRelX,int16_t nRelY);
113 
114 // ============================================================================
115 
116 // ------------------------------------------------------------------------
117 // Read-only element macros
118 // ------------------------------------------------------------------------
119 
120 // Macro initializers for Read-Only Elements in Flash/PROGMEM
121 //
122 
123 
124 #ifdef __cplusplus
125 }
126 #endif // __cplusplus
127 #endif // _GUISLICE_EX_XTEMPLATE_H_
128 
gslc_teRedrawType
Redraw types.
Definition: GUIslice.h:370
Callback function for slider feedback.
Definition: XTemplate.h:60
Rectangular region. Defines X,Y corner coordinates plus dimensions.
Definition: GUIslice.h:519
Element reference structure.
Definition: GUIslice.h:578
gslc_tsElemRef * gslc_ElemXTemplateCreate(gslc_tsGui *pGui, int16_t nElemId, int16_t nPage, gslc_tsXTemplate *pXData, gslc_tsRect rElem, char *pStrBuf, uint8_t nStrBufMax, int16_t nFontId)
Create an Extended Text Field Element.
Definition: XTemplate.c:77
gslc_teTouch
Processed event from input raw events and actions.
Definition: GUIslice.h:305
bool gslc_ElemXTemplateTouch(void *pvGui, void *pvElemRef, gslc_teTouch eTouch, int16_t nRelX, int16_t nRelY)
Handle touch events to template element.
Definition: XTemplate.c:241
GUI structure.
Definition: GUIslice.h:716
bool gslc_ElemXTemplateDraw(void *pvGui, void *pvElemRef, gslc_teRedrawType eRedraw)
Draw the template element on the screen.
Definition: XTemplate.c:132