GUIslice  0.16.0
Embedded GUI in C
GUIslice.h
Go to the documentation of this file.
1 #ifndef _GUISLICE_H_
2 #define _GUISLICE_H_
3 
4 // =======================================================================
5 // GUIslice library
6 // - Calvin Hass
7 // - https://www.impulseadventure.com/elec/guislice-gui.html
8 // - https://github.com/ImpulseAdventure/GUIslice
9 //
10 // - Version 0.16.0
11 // =======================================================================
12 //
13 // The MIT License
14 //
15 // Copyright 2016-2020 Calvin Hass
16 //
17 // Permission is hereby granted, free of charge, to any person obtaining a copy
18 // of this software and associated documentation files (the "Software"), to deal
19 // in the Software without restriction, including without limitation the rights
20 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21 // copies of the Software, and to permit persons to whom the Software is
22 // furnished to do so, subject to the following conditions:
23 //
24 // The above copyright notice and this permission notice shall be included in
25 // all copies or substantial portions of the Software.
26 //
27 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
33 // THE SOFTWARE.
34 //
35 // =======================================================================
37 
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif // __cplusplus
42 
43 #include <stdio.h>
44 #include <stdlib.h>
45 #include <stdbool.h>
46 #include <string.h>
47 #include <inttypes.h>
48 
49 
50 // -----------------------------------------------------------------------
51 // Configuration
52 // -----------------------------------------------------------------------
53 
54 // Import configuration ( which will import a sub-config depending on device type)
55 #include "GUIslice_config.h"
56 
57 // Provide an alias for PROGMEM so that we can disable
58 // it on devices that don't use it when defining constant
59 // strings in FLASH memory.
60 #if (GSLC_USE_PROGMEM)
61  #define GSLC_PMEM PROGMEM
62 #else
63  #define GSLC_PMEM
64 #endif
65 
66 
67 
68 // -----------------------------------------------------------------------
69 // Globals
70 // -----------------------------------------------------------------------
71 
72 // Type for user-provided debug output function
73 typedef int16_t (*GSLC_CB_DEBUG_OUT)(char ch);
74 
78 
79 
80 // -----------------------------------------------------------------------
81 // Constants
82 // -----------------------------------------------------------------------
83 #define GSLC_2PI 6.28318530718
84 
85 // -----------------------------------------------------------------------
86 // Enumerations
87 // -----------------------------------------------------------------------
88 
98  typedef enum {
99  // Public usage
101  GSLC_ID_NONE = -1999,
104  // Internal usage
106  } gslc_teElemId;
108 
109 
116  typedef enum {
117  // Public usage
119  // Internal usage
120  GSLC_PAGE_NONE = -2999,
121  } gslc_tePageId;
122 
124  typedef enum {
128 
131 
133  typedef enum {
134  // Public usage
136  // Internal usage
138  } gslc_teGroupId;
139 
146  typedef enum {
147  // Public usage
149  GSLC_FONT_NONE = -4999,
150  } gslc_teFontId;
151 
152 
155  // into the GUI's array of elements
156  typedef enum {
157  // Internal usage
158  GSLC_IND_NONE = -9999,
160  } gslc_teElemInd;
161 
162 
164 typedef enum {
165  // Core elements:
172 
176 
178 #define GSLC_ELEM_FEA_VALID 0x80
179 #define GSLC_ELEM_FEA_EDIT_EN 0x20
180 #define GSLC_ELEM_FEA_ROUND_EN 0x10
181 #define GSLC_ELEM_FEA_CLICK_EN 0x08
182 #define GSLC_ELEM_FEA_GLOW_EN 0x04
183 #define GSLC_ELEM_FEA_FRAME_EN 0x02
184 #define GSLC_ELEM_FEA_FILL_EN 0x01
185 #define GSLC_ELEM_FEA_NONE 0x00
186 
187 
189 #define GSLC_ALIGNV_TOP 0x10
190 #define GSLC_ALIGNV_MID 0x20
191 #define GSLC_ALIGNV_BOT 0x40
192 #define GSLC_ALIGNH_LEFT 0x01
193 #define GSLC_ALIGNH_MID 0x02
194 #define GSLC_ALIGNH_RIGHT 0x04
195 #define GSLC_ALIGN_TOP_LEFT GSLC_ALIGNH_LEFT | GSLC_ALIGNV_TOP
196 #define GSLC_ALIGN_TOP_MID GSLC_ALIGNH_MID | GSLC_ALIGNV_TOP
197 #define GSLC_ALIGN_TOP_RIGHT GSLC_ALIGNH_RIGHT | GSLC_ALIGNV_TOP
198 #define GSLC_ALIGN_MID_LEFT GSLC_ALIGNH_LEFT | GSLC_ALIGNV_MID
199 #define GSLC_ALIGN_MID_MID GSLC_ALIGNH_MID | GSLC_ALIGNV_MID
200 #define GSLC_ALIGN_MID_RIGHT GSLC_ALIGNH_RIGHT | GSLC_ALIGNV_MID
201 #define GSLC_ALIGN_BOT_LEFT GSLC_ALIGNH_LEFT | GSLC_ALIGNV_BOT
202 #define GSLC_ALIGN_BOT_MID GSLC_ALIGNH_MID | GSLC_ALIGNV_BOT
203 #define GSLC_ALIGN_BOT_RIGHT GSLC_ALIGNH_RIGHT | GSLC_ALIGNV_BOT
204 
205 
207 #define GSLC_COL_RED_DK4 (gslc_tsColor) {128, 0, 0}
208 #define GSLC_COL_RED_DK3 (gslc_tsColor) {160, 0, 0}
209 #define GSLC_COL_RED_DK2 (gslc_tsColor) {192, 0, 0}
210 #define GSLC_COL_RED_DK1 (gslc_tsColor) {224, 0, 0}
211 #define GSLC_COL_RED (gslc_tsColor) {255, 0, 0}
212 #define GSLC_COL_RED_LT1 (gslc_tsColor) {255, 32, 32}
213 #define GSLC_COL_RED_LT2 (gslc_tsColor) {255, 64, 64}
214 #define GSLC_COL_RED_LT3 (gslc_tsColor) {255, 96, 96}
215 #define GSLC_COL_RED_LT4 (gslc_tsColor) {255,128,128}
216 #define GSLC_COL_GREEN_DK4 (gslc_tsColor) { 0,128, 0}
217 #define GSLC_COL_GREEN_DK3 (gslc_tsColor) { 0,160, 0}
218 #define GSLC_COL_GREEN_DK2 (gslc_tsColor) { 0,192, 0}
219 #define GSLC_COL_GREEN_DK1 (gslc_tsColor) { 0,224, 0}
220 #define GSLC_COL_GREEN (gslc_tsColor) { 0,255, 0}
221 #define GSLC_COL_GREEN_LT1 (gslc_tsColor) { 32,255, 32}
222 #define GSLC_COL_GREEN_LT2 (gslc_tsColor) { 64,255, 64}
223 #define GSLC_COL_GREEN_LT3 (gslc_tsColor) { 96,255, 96}
224 #define GSLC_COL_GREEN_LT4 (gslc_tsColor) {128,255,128}
225 #define GSLC_COL_BLUE_DK4 (gslc_tsColor) { 0, 0,128}
226 #define GSLC_COL_BLUE_DK3 (gslc_tsColor) { 0, 0,160}
227 #define GSLC_COL_BLUE_DK2 (gslc_tsColor) { 0, 0,192}
228 #define GSLC_COL_BLUE_DK1 (gslc_tsColor) { 0, 0,224}
229 #define GSLC_COL_BLUE (gslc_tsColor) { 0, 0,255}
230 #define GSLC_COL_BLUE_LT1 (gslc_tsColor) { 32, 32,255}
231 #define GSLC_COL_BLUE_LT2 (gslc_tsColor) { 64, 64,255}
232 #define GSLC_COL_BLUE_LT3 (gslc_tsColor) { 96, 96,255}
233 #define GSLC_COL_BLUE_LT4 (gslc_tsColor) {128,128,255}
234 #define GSLC_COL_BLACK (gslc_tsColor) { 0, 0, 0}
235 #define GSLC_COL_GRAY_DK3 (gslc_tsColor) { 32, 32, 32}
236 #define GSLC_COL_GRAY_DK2 (gslc_tsColor) { 64, 64, 64}
237 #define GSLC_COL_GRAY_DK1 (gslc_tsColor) { 96, 96, 96}
238 #define GSLC_COL_GRAY (gslc_tsColor) {128,128,128}
239 #define GSLC_COL_GRAY_LT1 (gslc_tsColor) {160,160,160}
240 #define GSLC_COL_GRAY_LT2 (gslc_tsColor) {192,192,192}
241 #define GSLC_COL_GRAY_LT3 (gslc_tsColor) {224,224,224}
242 #define GSLC_COL_WHITE (gslc_tsColor) {255,255,255}
243 
244 #define GSLC_COL_YELLOW (gslc_tsColor) {255,255,0}
245 #define GSLC_COL_YELLOW_DK (gslc_tsColor) {64,64,0}
246 #define GSLC_COL_PURPLE (gslc_tsColor) {128,0,128}
247 #define GSLC_COL_CYAN (gslc_tsColor) {0,255,255}
248 #define GSLC_COL_MAGENTA (gslc_tsColor) {255,0,255}
249 #define GSLC_COL_TEAL (gslc_tsColor) {0,128,128}
250 #define GSLC_COL_ORANGE (gslc_tsColor) {255,165,0}
251 #define GSLC_COL_BROWN (gslc_tsColor) {165,42,42}
252 
253 // Monochrome definitions
254 #define GSLC_COLMONO_BLACK (gslc_tsColor) {255,255,255}
255 #define GSLC_COLMONO_WHITE (gslc_tsColor) { 0, 0, 0}
256 
257 
258 
260 typedef enum {
268 
269 
272 typedef enum {
281 } gslc_teAction;
282 
283 
285 typedef enum {
301 } gslc_tePin;
302 
303 
305 typedef enum {
307 
308  // Indexed state (ie. key/GPIO selects specific element vs touch coordinate)
310  GSLC_TOUCH_COORD = (0<<7),
311  GSLC_TOUCH_DIRECT = (1<<7),
312 
314 
315  // Coordinate-based events
325  // Index-based events
331 
332 } gslc_teTouch;
333 
335 typedef enum {
341 
342 
343 
347  #define TOUCH_ROTATION_DATA 0x6350
348  #define TOUCH_ROTATION_SWAPXY(rotation) ((( TOUCH_ROTATION_DATA >> ((rotation&0x03)*4) ) >> 2 ) & 0x01 )
349  #define TOUCH_ROTATION_FLIPX(rotation) ((( TOUCH_ROTATION_DATA >> ((rotation&0x03)*4) ) >> 1 ) & 0x01 )
350  #define TOUCH_ROTATION_FLIPY(rotation) ((( TOUCH_ROTATION_DATA >> ((rotation&0x03)*4) ) >> 0 ) & 0x01 )
351 
352 
354 typedef enum {
361 
363 typedef enum {
368 
370 typedef enum {
375 
376 
383 typedef enum {
387 
388 
395 typedef enum {
401 
402 
405 typedef enum {
407  // Define element sources
409  GSLC_ELEMREF_SRC_PROG = (2<<0),
412  GSLC_ELEMREF_SRC_CONST = (3<<0),
415  // Element State
421 
424 
425  // Mask values for bitfield comparisons
426  GSLC_ELEMREF_SRC = (3<<0),
428 
430 
432 #define GSLC_ELEMREF_DEFAULT (GSLC_ELEMREF_SRC_RAM | GSLC_ELEMREF_VISIBLE)
433 
434 
436 typedef enum {
438  // Define image sources
443  // Define image types
444 
449 
450  // Mask values for bitfield comparisons
451  GSLC_IMGREF_SRC = (7<<0),
452  GSLC_IMGREF_FMT = (7<<4),
454 
463 typedef enum {
464  // Values
465  GSLC_TXT_MEM_RAM = (0<<0),
466  GSLC_TXT_MEM_PROG = (1<<0),
471  GSLC_TXT_ENC_UTF8 = (1<<4),
472 
473  // Masks
474  GSLC_TXT_MEM = (3<<0),
475  GSLC_TXT_ALLOC = (3<<2),
476  GSLC_TXT_ENC = (3<<4),
477  // Defaults
480 
481 
482 // -----------------------------------------------------------------------
483 // Forward declarations
484 // -----------------------------------------------------------------------
485 
486 typedef struct gslc_tsElem gslc_tsElem;
487 typedef struct gslc_tsEvent gslc_tsEvent;
488 
489 
490 // -----------------------------------------------------------------------
491 // Callback functions
492 // -----------------------------------------------------------------------
493 
494 
496 typedef bool (*GSLC_CB_EVENT)(void* pvGui,gslc_tsEvent sEvent);
497 
499 typedef bool (*GSLC_CB_DRAW)(void* pvGui,void* pvElemRef,gslc_teRedrawType eRedraw);
500 
502 typedef bool (*GSLC_CB_TOUCH)(void* pvGui,void* pvElemRef,gslc_teTouch eTouch,int16_t nX,int16_t nY);
503 
505 typedef bool (*GSLC_CB_TICK)(void* pvGui,void* pvElemRef);
506 
508 typedef bool (*GSLC_CB_PIN_POLL)(void* pvGui,int16_t* pnPinInd,int16_t* pnPinVal);
509 
511 typedef bool (*GSLC_CB_INPUT)(void* pvGui,void* pvElemRef,int16_t nStatus,void* pvData);
512 
513 // -----------------------------------------------------------------------
514 // Structures
515 // -----------------------------------------------------------------------
516 
517 
519 typedef struct gslc_tsRect {
520  int16_t x;
521  int16_t y;
522  uint16_t w;
523  uint16_t h;
524 } gslc_tsRect;
525 
526 
528 typedef struct gslc_tsPt {
529  int16_t x;
530  int16_t y;
531 } gslc_tsPt;
532 
534 typedef struct gslc_tsColor {
535  uint8_t r;
536  uint8_t g;
537  uint8_t b;
538 } gslc_tsColor;
539 
541 typedef struct gslc_tsEvent {
542  gslc_teEventType eType;
543  uint8_t nSubType;
544  void* pvScope;
545  void* pvData;
546 } gslc_tsEvent;
550 
552 typedef struct gslc_tsEventTouch {
554  int16_t nX;
555  int16_t nY;
557 
559 typedef struct {
560  int16_t nId;
561  gslc_teFontRefType eFontRefType;
562  gslc_teFontRefMode eFontRefMode;
563  const void* pvFont;
564  uint16_t nSize;
565 } gslc_tsFont;
566 
567 
569 typedef struct {
570  const unsigned char* pImgBuf;
571  const char* pFname;
573  void* pvImgRaw;
574 } gslc_tsImgRef;
575 
576 
578 typedef struct {
582 
593 typedef struct gslc_tsElem {
594 
595  int16_t nId;
596  uint8_t nFeatures;
597 
598  int16_t nType;
600  int16_t nGroup;
601 
606 
609 
610  // if (GSLC_FEATURE_COMPOUND)
619  // endif
620 
621  // Text handling
622 #if (GSLC_LOCAL_STR)
623  char pStrBuf[GSLC_LOCAL_STR_LEN];
624 #else
625  char* pStrBuf;
626 #endif
627  uint8_t nStrBufMax;
628  gslc_teTxtFlags eTxtFlags;
629 
630 
633  int8_t eTxtAlign;
634  int8_t nTxtMarginX;
635  int8_t nTxtMarginY;
637 
638  // Extended data elements
639  void* pXData;
640 
641  // Callback functions
643 
647 } gslc_tsElem;
648 
649 
650 
651 
656 typedef struct {
658  uint16_t nElemMax;
659  uint16_t nElemCnt;
660  int16_t nElemAutoIdNext;
661 
663  uint16_t nElemRefMax;
664  uint16_t nElemRefCnt;
665 
666  // Touch tracking
668 
669  // Input focus
670  int16_t nElemIndFocused;
671 
672  // Callback functions
673  //GSLC_CB_EVENT pfuncXEvent; ///< UNUSED: Callback func ptr for events
674 
676 
677 
678 
679 
684 typedef struct {
685 
687 
688  int16_t nPageId;
689 
690  // Callback functions
691  //GSLC_CB_EVENT pfuncXEvent; ///< UNUSED: Callback func ptr for events
692 
693  // Bounding region
695 
696 } gslc_tsPage;
697 
698 
705 typedef struct {
706  gslc_teInputRawEvent eEvent;
707  int16_t nVal;
708  gslc_teAction eAction;
709  int16_t nActionVal;
711 
712 
716 typedef struct {
717 
718  uint16_t nDispW;
719  uint16_t nDispH;
720  uint16_t nDisp0W;
721  uint16_t nDisp0H;
722  uint8_t nDispDepth;
723 
724  // NOTE: The following config is currently only used by the Adafruit-GFX & TFT_eSPI drivers
725  uint8_t nRotation;
726  #if !defined(DRV_TOUCH_NONE)
727  // Touch remapping
728  uint8_t nTouchRotation;
729  uint8_t nSwapXY;
730  uint8_t nFlipX;
731  uint8_t nFlipY;
732  // Calibration for resistive touch displays
733  int16_t nTouchCalXMin;
734  int16_t nTouchCalXMax;
735  int16_t nTouchCalYMin;
736  int16_t nTouchCalYMax;
739  #endif
740 
742  uint8_t nFontMax;
743  uint8_t nFontCnt;
744 
745  uint8_t nRoundRadius;
746 
748 
749 #if (GSLC_FEATURE_COMPOUND)
752 #endif
753 
755 
756  gslc_teInitStat eInitStatTouch;
757  // TODO: exclude these in DRV_TOUCH_NONE
758  int16_t nTouchLastX;
759  int16_t nTouchLastY;
760  uint16_t nTouchLastPress;
763 
764 
765  void* pvDriver;
767 
773  // Primary surface definitions
775 
776  uint8_t nFrameRateCnt;
777  uint8_t nFrameRateStart;
778 
779 
780  // Pages
782  uint8_t nPageMax;
783  uint8_t nPageCnt;
784 
785  gslc_tsPage* apPageStack[GSLC_STACK__MAX];
786  bool abPageStackActive[GSLC_STACK__MAX];
787  bool abPageStackDoDraw[GSLC_STACK__MAX];
788 
789  // Redraw of screen (ie. across page stack)
792 
793  // Current clip region
796 
797  // Callback functions
798  //GSLC_CB_EVENT pfuncXEvent; ///< UNUSED: Callback func ptr for events
800 
801 
802  // Key/pin input control mapping
804  uint8_t nInputMapMax;
805  uint8_t nInputMapCnt;
806  uint8_t nInputMode;
807 
808 } gslc_tsGui;
809 
810 
811 #define GSLC_MIN(a,b) (a<b)?a:b
812 #define GSLC_MAX(a,b) (a>b)?a:b
813 
814 // ------------------------------------------------------------------------
818 // ------------------------------------------------------------------------
819 
827 char* gslc_GetVer(gslc_tsGui* pGui);
828 
836 const char* gslc_GetNameDisp(gslc_tsGui* pGui);
837 
845 const char* gslc_GetNameTouch(gslc_tsGui* pGui);
846 
859 void* gslc_GetDriverDisp(gslc_tsGui* pGui);
860 
873 void* gslc_GetDriverTouch(gslc_tsGui* pGui);
874 
893 bool gslc_Init(gslc_tsGui* pGui,void* pvDriver,gslc_tsPage* asPage,uint8_t nMaxPage,gslc_tsFont* asFont,uint8_t nMaxFont);
894 
895 
907 
908 
918 void gslc_DebugPrintf(const char* pFmt, ...);
919 
920 
932 bool gslc_GuiRotate(gslc_tsGui* pGui, uint8_t nRotation);
933 
934 
944 void gslc_Quit(gslc_tsGui* pGui);
945 
946 
956 void gslc_Update(gslc_tsGui* pGui);
957 
958 
968 bool gslc_SetBkgndImage(gslc_tsGui* pGui,gslc_tsImgRef sImgRef);
969 
980 
993 
1002 
1011 bool gslc_SetClipRect(gslc_tsGui* pGui,gslc_tsRect* pRect);
1012 
1013 
1014 
1015 // ------------------------------------------------------------------------
1020 // ------------------------------------------------------------------------
1021 
1022 
1034 bool gslc_IsInRect(int16_t nSelX,int16_t nSelY,gslc_tsRect rRect);
1035 
1036 
1049 gslc_tsRect gslc_ExpandRect(gslc_tsRect rRect,int16_t nExpandW,int16_t nExpandH);
1050 
1051 
1064 bool gslc_IsInWH(int16_t nSelX,int16_t nSelY,uint16_t nWidth,uint16_t nHeight);
1065 
1076 void gslc_UnionRect(gslc_tsRect* pRect, gslc_tsRect rAddRect);
1077 
1086 
1095 void gslc_InvalidateRgnPage(gslc_tsGui* pGui, gslc_tsPage* pPage);
1096 
1105 
1115 void gslc_InvalidateRgnAdd(gslc_tsGui* pGui, gslc_tsRect rAddRect);
1116 
1126 bool gslc_ClipPt(gslc_tsRect* pClipRect,int16_t nX,int16_t nY);
1127 
1141 bool gslc_ClipLine(gslc_tsRect* pClipRect,int16_t* pnX0,int16_t* pnY0,int16_t* pnX1,int16_t* pnY1);
1142 
1152 bool gslc_ClipRect(gslc_tsRect* pClipRect,gslc_tsRect* pRect);
1153 
1154 
1163 gslc_tsImgRef gslc_GetImageFromFile(const char* pFname,gslc_teImgRefFlags eFmt);
1164 
1165 
1174 gslc_tsImgRef gslc_GetImageFromSD(const char* pFname,gslc_teImgRefFlags eFmt);
1175 
1176 
1185 gslc_tsImgRef gslc_GetImageFromRam(unsigned char* pImgBuf,gslc_teImgRefFlags eFmt);
1186 
1187 
1196 gslc_tsImgRef gslc_GetImageFromProg(const unsigned char* pImgBuf,gslc_teImgRefFlags eFmt);
1197 
1198 
1199 
1200 
1211 void gslc_PolarToXY(uint16_t nRad,int16_t n64Ang,int16_t* nDX,int16_t* nDY);
1212 
1213 
1225 int16_t gslc_sinFX(int16_t n64Ang);
1226 
1227 
1239 int16_t gslc_cosFX(int16_t n64Ang);
1240 
1253 gslc_tsColor gslc_ColorBlend2(gslc_tsColor colStart,gslc_tsColor colEnd,uint16_t nMidAmt,uint16_t nBlendAmt);
1254 
1268 gslc_tsColor gslc_ColorBlend3(gslc_tsColor colStart,gslc_tsColor colMid,gslc_tsColor colEnd,uint16_t nMidAmt,uint16_t nBlendAmt);
1269 
1279 
1280 
1281 // ------------------------------------------------------------------------
1287 // ------------------------------------------------------------------------
1288 
1289 
1302 void gslc_DrawSetPixel(gslc_tsGui* pGui,int16_t nX,int16_t nY,gslc_tsColor nCol);
1303 
1304 
1317 void gslc_DrawLine(gslc_tsGui* pGui,int16_t nX0,int16_t nY0,int16_t nX1,int16_t nY1,gslc_tsColor nCol);
1318 
1319 
1332 void gslc_DrawLineH(gslc_tsGui* pGui,int16_t nX, int16_t nY, uint16_t nW,gslc_tsColor nCol);
1333 
1334 
1347 void gslc_DrawLineV(gslc_tsGui* pGui,int16_t nX, int16_t nY, uint16_t nH,gslc_tsColor nCol);
1348 
1349 
1364 void gslc_DrawLinePolar(gslc_tsGui* pGui,int16_t nX,int16_t nY,uint16_t nRadStart,uint16_t nRadEnd,int16_t n64Ang,gslc_tsColor nCol);
1365 
1366 
1376 void gslc_DrawFrameRect(gslc_tsGui* pGui,gslc_tsRect rRect,gslc_tsColor nCol);
1377 
1388 void gslc_DrawFrameRoundRect(gslc_tsGui* pGui, gslc_tsRect rRect, int16_t nRadius, gslc_tsColor nCol);
1389 
1399 void gslc_DrawFillRect(gslc_tsGui* pGui,gslc_tsRect rRect,gslc_tsColor nCol);
1400 
1411 void gslc_DrawFillRoundRect(gslc_tsGui* pGui, gslc_tsRect rRect, int16_t nRadius, gslc_tsColor nCol);
1412 
1424 void gslc_DrawFrameCircle(gslc_tsGui* pGui,int16_t nMidX,int16_t nMidY,
1425  uint16_t nRadius,gslc_tsColor nCol);
1426 
1438 void gslc_DrawFillCircle(gslc_tsGui* pGui,int16_t nMidX,int16_t nMidY,
1439  uint16_t nRadius,gslc_tsColor nCol);
1440 
1441 
1456 void gslc_DrawFrameTriangle(gslc_tsGui* pGui,int16_t nX0,int16_t nY0,
1457  int16_t nX1,int16_t nY1,int16_t nX2,int16_t nY2,gslc_tsColor nCol);
1458 
1459 
1474 void gslc_DrawFillTriangle(gslc_tsGui* pGui,int16_t nX0,int16_t nY0,
1475  int16_t nX1,int16_t nY1,int16_t nX2,int16_t nY2,gslc_tsColor nCol);
1476 
1477 
1487 void gslc_DrawFrameQuad(gslc_tsGui* pGui,gslc_tsPt* psPt,gslc_tsColor nCol);
1488 
1489 
1499 void gslc_DrawFillQuad(gslc_tsGui* pGui,gslc_tsPt* psPt,gslc_tsColor nCol);
1500 
1531 void gslc_DrawFillGradSector(gslc_tsGui* pGui, int16_t nQuality, int16_t nMidX, int16_t nMidY, int16_t nRad1, int16_t nRad2,
1532  gslc_tsColor cArcStart, gslc_tsColor cArcEnd, int16_t nAngSecStart, int16_t nAngSecEnd, int16_t nAngGradStart, int16_t nAngGradRange);
1533 
1555 void gslc_DrawFillSector(gslc_tsGui* pGui, int16_t nQuality, int16_t nMidX, int16_t nMidY, int16_t nRad1, int16_t nRad2,
1556  gslc_tsColor cArc, int16_t nAngSecStart, int16_t nAngSecEnd);
1557 
1558 // -----------------------------------------------------------------------
1563 // -----------------------------------------------------------------------
1564 
1581 bool gslc_FontAdd(gslc_tsGui* pGui,int16_t nFontId,gslc_teFontRefType eFontRefType,
1582  const void* pvFontRef,uint16_t nFontSz);
1583 
1601 bool gslc_FontSet(gslc_tsGui* pGui, int16_t nFontId, gslc_teFontRefType eFontRefType,
1602  const void* pvFontRef, uint16_t nFontSz);
1603 
1613 gslc_tsFont* gslc_FontGet(gslc_tsGui* pGui,int16_t nFontId);
1614 
1615 
1616 
1627 bool gslc_FontSetMode(gslc_tsGui* pGui, int16_t nFontId, gslc_teFontRefMode eFontMode);
1628 
1629 
1630 // ------------------------------------------------------------------------
1635 // ------------------------------------------------------------------------
1636 
1644 
1645 int gslc_GetPageCur(gslc_tsGui* pGui);
1646 
1647 
1657 void gslc_SetStackPage(gslc_tsGui* pGui,uint8_t nStackPos,int16_t nPageId);
1658 
1659 
1676 void gslc_SetStackState(gslc_tsGui* pGui, uint8_t nStackPos, bool bActive, bool bDoDraw);
1677 
1678 
1687 void gslc_SetPageBase(gslc_tsGui* pGui, int16_t nPageId);
1688 
1689 
1698 void gslc_SetPageCur(gslc_tsGui* pGui,int16_t nPageId);
1699 
1700 
1709 void gslc_SetPageOverlay(gslc_tsGui* pGui,int16_t nPageId);
1710 
1711 
1723 void gslc_PopupShow(gslc_tsGui* pGui, int16_t nPageId, bool bModal);
1724 
1725 
1733 void gslc_PopupHide(gslc_tsGui* pGui);
1734 
1735 
1744 void gslc_PageRedrawSet(gslc_tsGui* pGui,bool bRedraw);
1745 
1746 
1754 bool gslc_PageRedrawGet(gslc_tsGui* pGui);
1755 
1756 
1757 
1780 void gslc_PageAdd(gslc_tsGui* pGui,int16_t nPageId,gslc_tsElem* psElem,uint16_t nMaxElem,
1781  gslc_tsElemRef* psElemRef,uint16_t nMaxElemRef);
1782 
1791 gslc_tsElemRef* gslc_PageFindElemById(gslc_tsGui* pGui,int16_t nPageId,int16_t nElemId);
1792 
1793 
1794 // ------------------------------------------------------------------------
1799 // ------------------------------------------------------------------------
1800 
1801 
1802 // ------------------------------------------------------------------------
1806 // ------------------------------------------------------------------------
1807 
1808 
1824 gslc_tsElemRef* gslc_ElemCreateTxt(gslc_tsGui* pGui,int16_t nElemId,int16_t nPage,
1825  gslc_tsRect rElem,char* pStrBuf,uint8_t nStrBufMax,int16_t nFontId);
1826 
1827 
1845 gslc_tsElemRef* gslc_ElemCreateBtnTxt(gslc_tsGui* pGui,int16_t nElemId,int16_t nPage,
1846  gslc_tsRect rElem,char* pStrBuf,uint8_t nStrBufMax,
1847  int16_t nFontId,GSLC_CB_TOUCH cbTouch);
1848 
1865 gslc_tsElemRef* gslc_ElemCreateBtnImg(gslc_tsGui* pGui,int16_t nElemId,int16_t nPage,
1866  gslc_tsRect rElem,gslc_tsImgRef sImgRef,gslc_tsImgRef sImgRefSel,GSLC_CB_TOUCH cbTouch);
1867 
1868 
1880 gslc_tsElemRef* gslc_ElemCreateBox(gslc_tsGui* pGui,int16_t nElemId,int16_t nPage,gslc_tsRect rElem);
1881 
1896 gslc_tsElemRef* gslc_ElemCreateLine(gslc_tsGui* pGui,int16_t nElemId,int16_t nPage,int16_t nX0,int16_t nY0,int16_t nX1,int16_t nY1);
1897 
1910 gslc_tsElemRef* gslc_ElemCreateImg(gslc_tsGui* pGui,int16_t nElemId,int16_t nPage,gslc_tsRect rElem,
1911  gslc_tsImgRef sImgRef);
1912 
1913 
1914 // ------------------------------------------------------------------------
1919 // ------------------------------------------------------------------------
1920 
1921 
1930 int gslc_ElemGetId(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef);
1931 
1932 
1933 // ------------------------------------------------------------------------
1938 // ------------------------------------------------------------------------
1939 
1953 void gslc_ElemSetFillEn(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,bool bFillEn);
1954 
1964 void gslc_ElemSetFrameEn(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,bool bFrameEn);
1965 
1975 void gslc_ElemSetRoundEn(gslc_tsGui* pGui, gslc_tsElemRef* pElemRef, bool bRoundEn);
1976 
1988 void gslc_ElemSetCol(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,gslc_tsColor colFrame,gslc_tsColor colFill,gslc_tsColor colFillGlow);
1989 
2001 void gslc_ElemSetGlowCol(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,gslc_tsColor colFrameGlow,gslc_tsColor colFillGlow,gslc_tsColor colTxtGlow);
2002 
2003 
2014 void gslc_ElemSetGroup(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,int nGroupId);
2015 
2016 
2025 int gslc_ElemGetGroup(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef);
2026 
2027 
2039 void gslc_ElemSetRect(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,gslc_tsRect rElem);
2040 
2041 
2051 
2052 
2070 void gslc_ElemSetTxtAlign(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,unsigned nAlign);
2071 
2080 void gslc_ElemSetTxtMargin(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,unsigned nMargin);
2081 
2091 void gslc_ElemSetTxtMarginXY(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,int8_t nMarginX,int8_t nMarginY);
2092 
2106 void gslc_StrCopy(char* pDstStr,const char* pSrcStr,uint16_t nDstLen);
2107 
2117 void gslc_ElemSetTxtStr(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,const char* pStr);
2118 
2119 
2128 char* gslc_ElemGetTxtStr(gslc_tsGui* pGui, gslc_tsElemRef* pElemRef);
2129 
2130 
2140 void gslc_ElemSetTxtCol(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,gslc_tsColor colVal);
2141 
2142 
2152 void gslc_ElemSetTxtMem(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,gslc_teTxtFlags eFlags);
2153 
2154 
2166 void gslc_ElemSetTxtEnc(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,gslc_teTxtFlags eFlags);
2167 
2168 
2178 void gslc_ElemUpdateFont(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,int nFontId);
2179 
2189 void gslc_ElemSetRedraw(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,gslc_teRedrawType eRedraw);
2190 
2199 gslc_teRedrawType gslc_ElemGetRedraw(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef);
2200 
2210 void gslc_ElemSetGlowEn(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,bool bGlowEn);
2211 
2221 void gslc_ElemSetClickEn(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,bool bClickEn);
2222 
2232 void gslc_ElemSetTouchFunc(gslc_tsGui* pGui, gslc_tsElemRef* pElemRef, GSLC_CB_TOUCH funcCb);
2233 
2243 void gslc_ElemSetStyleFrom(gslc_tsGui* pGui,gslc_tsElemRef* pElemRefSrc,gslc_tsElemRef* pElemRefDest);
2244 
2253 bool gslc_ElemGetGlowEn(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef);
2254 
2255 
2265 void gslc_ElemSetGlow(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,bool bGlowing);
2266 
2275 bool gslc_ElemGetGlow(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef);
2276 
2286 void gslc_ElemSetVisible(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,bool bVisible);
2287 
2299 bool gslc_ElemGetVisible(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef);
2300 
2312 bool gslc_ElemGetOnScreen(gslc_tsGui* pGui, gslc_tsElemRef* pElemRef);
2313 
2314 /* UNUSED
2324 void gslc_ElemSetEventFunc(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,GSLC_CB_EVENT funcCb);
2325 */
2326 
2327 
2339 void gslc_ElemSetDrawFunc(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,GSLC_CB_DRAW funcCb);
2340 
2352 void gslc_ElemSetTickFunc(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,GSLC_CB_TICK funcCb);
2353 
2354 
2369 bool gslc_ElemOwnsCoord(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,int16_t nX,int16_t nY,bool bOnlyClickEn);
2370 
2371 
2372 
2373 
2374 
2376 
2377 #if !defined(DRV_TOUCH_NONE)
2378 
2379 // ------------------------------------------------------------------------
2384 // ------------------------------------------------------------------------
2385 
2386 // Define the transformation matrix from rotation (0..3) to SWAP / FLIPX / FLIPY
2387 #define TOUCH_ROTATION_DATA 0x6350
2388 #define TOUCH_ROTATION_SWAPXY(rotation) ((( TOUCH_ROTATION_DATA >> ((rotation&0x03)*4) ) >> 2 ) & 0x01 )
2389 #define TOUCH_ROTATION_FLIPX(rotation) ((( TOUCH_ROTATION_DATA >> ((rotation&0x03)*4) ) >> 1 ) & 0x01 )
2390 #define TOUCH_ROTATION_FLIPY(rotation) ((( TOUCH_ROTATION_DATA >> ((rotation&0x03)*4) ) >> 0 ) & 0x01 )
2391 
2392 
2402 bool gslc_InitTouch(gslc_tsGui* pGui,const char* acDev);
2403 
2404 
2417 bool gslc_GetTouch(gslc_tsGui* pGui, int16_t* pnX, int16_t* pnY, uint16_t* pnPress, gslc_teInputRawEvent* peInputEvent, int16_t* pnInputVal);
2418 
2419 
2428 void gslc_SetTouchRemapEn(gslc_tsGui* pGui, bool bEn);
2429 
2442 void gslc_SetTouchRemapCal(gslc_tsGui* pGui,uint16_t nXMin, uint16_t nXMax, uint16_t nYMin, uint16_t nYMax);
2443 
2454 void gslc_SetTouchPressCal(gslc_tsGui* pGui,uint16_t nPressMin, uint16_t nPressMax);
2455 
2464 void gslc_SetTouchRemapYX(gslc_tsGui* pGui, bool bSwap);
2465 
2466 #endif // !DRV_TOUCH_NONE
2467 
2468 // ------------------------------------------------------------------------
2473 // ------------------------------------------------------------------------
2474 
2475 
2478 
2480 void gslc_InitInputMap(gslc_tsGui* pGui,gslc_tsInputMap* asInputMap,uint8_t nInputMapMax);
2481 
2483 void gslc_InputMapAdd(gslc_tsGui* pGui,gslc_teInputRawEvent eInputEvent,int16_t nInputVal,gslc_teAction eAction,int16_t nActionVal);
2484 
2485 
2486 // ------------------------------------------------------------------------
2491 // ------------------------------------------------------------------------
2492 
2493 // Create debug macro to selectively include the output code
2494 
2508 
2509 #if (GSLC_USE_PROGMEM)
2510  // Debug print macro for CPUs that support PROGMEM (Flash)
2511  #define GSLC_DEBUG_PRINT(sFmt, ...) \
2512  do { \
2513  if (DEBUG_ERR) { \
2514  gslc_DebugPrintf(PSTR(sFmt),__VA_ARGS__); \
2515  } \
2516  } while (0)
2517  #define GSLC_DEBUG2_PRINT(sFmt, ...) \
2518  do { \
2519  if (DEBUG_ERR >= 2) { \
2520  gslc_DebugPrintf(PSTR(sFmt),__VA_ARGS__); \
2521  } \
2522  } while (0)
2523 #else
2524  // Debug print macro for CPUs that don't support PROGMEM (Flash)
2525  #define GSLC_DEBUG_PRINT(sFmt, ...) \
2526  do { \
2527  if (DEBUG_ERR) { \
2528  gslc_DebugPrintf(sFmt,__VA_ARGS__); \
2529  } \
2530  } while (0)
2531  #define GSLC_DEBUG2_PRINT(sFmt, ...) \
2532  do { \
2533  if (DEBUG_ERR >= 2) { \
2534  gslc_DebugPrintf(sFmt,__VA_ARGS__); \
2535  } \
2536  } while (0)
2537 #endif
2538 
2539  #define GSLC_DEBUG_PRINT_CONST(sFmt, ...) \
2540  do { \
2541  if (DEBUG_ERR) { \
2542  gslc_DebugPrintf(sFmt,__VA_ARGS__); \
2543  } \
2544  } while (0)
2545  #define GSLC_DEBUG2_PRINT_CONST(sFmt, ...) \
2546  do { \
2547  if (DEBUG_ERR >= 2) { \
2548  gslc_DebugPrintf(sFmt,__VA_ARGS__); \
2549  } \
2550  } while (0)
2551 
2552 
2553 
2554 // ------------------------------------------------------------------------
2559 // ------------------------------------------------------------------------
2560 
2561 // Macro initializers for Read-Only Elements in Flash/PROGMEM
2562 //
2563 // - Generally useful in Arduino sketches targeting low-RAM CPUs (such as ATmega328)
2564 // - These macros perform initialization of a static tsElem variable (located
2565 // in PROGMEM). If a string is required, then it too is allocated in
2566 // PROGMEM space.
2567 // - The benefit of this macro is in providing significant RAM savings for
2568 // programs that instantiate a number of read-only GUI elements. The net
2569 // cost of each read-only GUI element is approximately 4B when using these
2570 // methods.
2571 // - Unlike the normal ElemCreate*() functions, these ElemCreate*_P() macros
2572 // don't return a tsElem pointer. Since the element definition is in
2573 // Flash/PROGMEM, it is read-only and no updates should be attempted.
2574 // - These macros have to match the current definition and order of gslc_tsElem
2575 // exactly, so any changes to the element definition must be reflected here
2576 // as well.
2577 
2578 
2599 
2621 
2653 
2672 
2673 
2686 
2687 
2712 
2713 
2714 #if (GSLC_USE_PROGMEM)
2715 
2716 #define gslc_ElemCreateTxt_P(pGui,nElemId,nPage,nX,nY,nW,nH,strTxt,pFont,colTxt,colFrame,colFill,nAlignTxt,bFrameEn,bFillEn) \
2717  static const char str##nElemId[] PROGMEM = strTxt; \
2718  static const uint8_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID | \
2719  (bFrameEn?GSLC_ELEM_FEA_FRAME_EN:0) | (bFillEn?GSLC_ELEM_FEA_FILL_EN:0); \
2720  static const gslc_tsElem sElem##nElemId PROGMEM = { \
2721  nElemId, \
2722  nFeatures##nElemId, \
2723  GSLC_TYPE_TXT, \
2724  (gslc_tsRect){nX,nY,nW,nH}, \
2725  GSLC_GROUP_ID_NONE, \
2726  colFrame,colFill,GSLC_COL_BLACK,GSLC_COL_BLACK, \
2727  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2728  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2729  NULL, \
2730  (char*)str##nElemId, \
2731  0, \
2732  (gslc_teTxtFlags)(GSLC_TXT_MEM_PROG | GSLC_TXT_ALLOC_EXT), \
2733  colTxt, \
2734  colTxt, \
2735  nAlignTxt, \
2736  0, \
2737  0, \
2738  pFont, \
2739  NULL, \
2740  NULL, \
2741  NULL, \
2742  NULL, \
2743  NULL, \
2744  }; \
2745  gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \
2746  (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_PROG | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL));
2747 
2748 
2749 #define gslc_ElemCreateTxt_P_R(pGui,nElemId,nPage,nX,nY,nW,nH,strTxt,strLength,pFont,colTxt,colFrame,colFill,nAlignTxt,bFrameEn,bFillEn) \
2750  static const uint8_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID | \
2751  (bFrameEn?GSLC_ELEM_FEA_FRAME_EN:0) | (bFillEn?GSLC_ELEM_FEA_FILL_EN:0); \
2752  static const gslc_tsElem sElem##nElemId PROGMEM = { \
2753  nElemId, \
2754  nFeatures##nElemId, \
2755  GSLC_TYPE_TXT, \
2756  (gslc_tsRect){nX,nY,nW,nH}, \
2757  GSLC_GROUP_ID_NONE, \
2758  colFrame,colFill,GSLC_COL_BLACK,GSLC_COL_BLACK, \
2759  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2760  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2761  NULL, \
2762  (char*)strTxt, \
2763  strLength, \
2764  (gslc_teTxtFlags)(GSLC_TXT_MEM_RAM | GSLC_TXT_ALLOC_EXT), \
2765  colTxt, \
2766  colTxt, \
2767  nAlignTxt, \
2768  0, \
2769  0, \
2770  pFont, \
2771  NULL, \
2772  NULL, \
2773  NULL, \
2774  NULL, \
2775  NULL, \
2776  }; \
2777  gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \
2778  (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_PROG | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL));
2779 
2780 #define gslc_ElemCreateTxt_P_R_ext(pGui,nElemId,nPage,nX,nY,nW,nH,strTxt,strLength,pFont,colTxt,colTxtGlow,colFrame,colFill,nAlignTxt,nMarginX,nMarginY,bFrameEn,bFillEn,bClickEn,bGlowEn,pfuncXEvent,pfuncXDraw,pfuncXTouch,pfuncXTick) \
2781  static const uint8_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID | \
2782  (bFrameEn?GSLC_ELEM_FEA_FRAME_EN:0) | (bFillEn?GSLC_ELEM_FEA_FILL_EN:0) | (bClickEn?GSLC_ELEM_FEA_CLICK_EN:0) | (bGlowEn?GSLC_ELEM_FEA_GLOW_EN:0); \
2783  static const gslc_tsElem sElem##nElemId PROGMEM = { \
2784  nElemId, \
2785  nFeatures##nElemId, \
2786  GSLC_TYPE_TXT, \
2787  (gslc_tsRect){nX,nY,nW,nH}, \
2788  GSLC_GROUP_ID_NONE, \
2789  colFrame,colFill,GSLC_COL_BLACK,GSLC_COL_BLACK, \
2790  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2791  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2792  NULL, \
2793  (char*)strTxt, \
2794  strLength, \
2795  (gslc_teTxtFlags)(GSLC_TXT_MEM_RAM | GSLC_TXT_ALLOC_EXT), \
2796  colTxt, \
2797  colTxtGlow, \
2798  nAlignTxt, \
2799  nMarginX, \
2800  nMarginY, \
2801  pFont, \
2802  NULL, \
2803  pfuncXEvent, \
2804  pfuncXDraw, \
2805  pfuncXTouch, \
2806  pfuncXTick, \
2807  }; \
2808  gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \
2809  (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_PROG | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL));
2810 
2811 
2812 
2813 #define gslc_ElemCreateBox_P(pGui,nElemId,nPage,nX,nY,nW,nH,colFrame,colFill,bFrameEn,bFillEn,pfuncXDraw,pfuncXTick) \
2814  static const uint8_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID | \
2815  (bFrameEn?GSLC_ELEM_FEA_FRAME_EN:0) | (bFillEn?GSLC_ELEM_FEA_FILL_EN:0); \
2816  static const gslc_tsElem sElem##nElemId PROGMEM = { \
2817  nElemId, \
2818  nFeatures##nElemId, \
2819  GSLC_TYPE_BOX, \
2820  (gslc_tsRect){nX,nY,nW,nH}, \
2821  GSLC_GROUP_ID_NONE, \
2822  colFrame,colFill,GSLC_COL_BLACK,GSLC_COL_BLACK, \
2823  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2824  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2825  NULL, \
2826  NULL, \
2827  0, \
2828  GSLC_TXT_DEFAULT, \
2829  GSLC_COL_WHITE, \
2830  GSLC_COL_WHITE, \
2831  GSLC_ALIGN_MID_MID, \
2832  0, \
2833  0, \
2834  NULL, \
2835  NULL, \
2836  NULL, \
2837  pfuncXDraw, \
2838  NULL, \
2839  pfuncXTick, \
2840  }; \
2841  gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \
2842  (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_PROG | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL));
2843 
2844 #define gslc_ElemCreateLine_P(pGui,nElemId,nPage,nX0,nY0,nX1,nY1,colFill) \
2845  static const uint8_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID; \
2846  static const gslc_tsElem sElem##nElemId PROGMEM = { \
2847  nElemId, \
2848  nFeatures##nElemId, \
2849  GSLC_TYPE_LINE, \
2850  (gslc_tsRect){nX0,nY0,nX1-nX0+1,nY1-nY0+1}, \
2851  GSLC_GROUP_ID_NONE, \
2852  colFill,colFill,GSLC_COL_BLACK,GSLC_COL_BLACK, \
2853  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2854  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2855  NULL, \
2856  NULL, \
2857  0, \
2858  GSLC_TXT_DEFAULT, \
2859  GSLC_COL_WHITE, \
2860  GSLC_COL_WHITE, \
2861  GSLC_ALIGN_MID_MID, \
2862  0, \
2863  0, \
2864  NULL, \
2865  NULL, \
2866  NULL, \
2867  NULL, \
2868  NULL, \
2869  NULL, \
2870  }; \
2871  gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \
2872  (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_PROG | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL));
2873 
2874 #define gslc_ElemCreateBtnTxt_P(pGui,nElemId,nPage,nX,nY,nW,nH,strTxt,pFont,colTxt,colFrame,colFill,colFrameGlow,colFillGlow,nAlignTxt,bFrameEn,bFillEn,callFunc,extraData) \
2875  static const char str##nElemId[] PROGMEM = strTxt; \
2876  static const uint8_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID | \
2877  GSLC_ELEM_FEA_CLICK_EN | GSLC_ELEM_FEA_GLOW_EN | \
2878  (bFrameEn?GSLC_ELEM_FEA_FRAME_EN:0) | (bFillEn?GSLC_ELEM_FEA_FILL_EN:0); \
2879  static const gslc_tsElem sElem##nElemId PROGMEM = { \
2880  nElemId, \
2881  nFeatures##nElemId, \
2882  GSLC_TYPE_BTN, \
2883  (gslc_tsRect){nX,nY,nW,nH}, \
2884  GSLC_GROUP_ID_NONE, \
2885  colFrame,colFill,colFrameGlow,colFillGlow, \
2886  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2887  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2888  NULL, \
2889  (char*)str##nElemId, \
2890  0, \
2891  (gslc_teTxtFlags)(GSLC_TXT_MEM_PROG | GSLC_TXT_ALLOC_EXT), \
2892  colTxt, \
2893  colTxt, \
2894  nAlignTxt, \
2895  0, \
2896  0, \
2897  pFont, \
2898  (void*)extraData, \
2899  NULL, \
2900  NULL, \
2901  callFunc, \
2902  NULL, \
2903  }; \
2904  gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \
2905  (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_PROG | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL));
2906 
2907 #define gslc_ElemCreateBtnTxt_P_R(pGui,nElemId,nPage,nX,nY,nW,nH,strTxt,strLength,pFont,colTxt,colFrame,colFill,colFrameGlow,colFillGlow,nAlignTxt,bFrameEn,bFillEn,callFunc,extraData) \
2908  static const uint8_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID | \
2909  GSLC_ELEM_FEA_CLICK_EN | GSLC_ELEM_FEA_GLOW_EN | \
2910  (bFrameEn?GSLC_ELEM_FEA_FRAME_EN:0) | (bFillEn?GSLC_ELEM_FEA_FILL_EN:0); \
2911  static const gslc_tsElem sElem##nElemId PROGMEM = { \
2912  nElemId, \
2913  nFeatures##nElemId, \
2914  GSLC_TYPE_BTN, \
2915  (gslc_tsRect){nX,nY,nW,nH}, \
2916  GSLC_GROUP_ID_NONE, \
2917  colFrame,colFill,colFrameGlow,colFillGlow, \
2918  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2919  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2920  NULL, \
2921  (char*)strTxt, \
2922  strLength, \
2923  (gslc_teTxtFlags)(GSLC_TXT_MEM_RAM | GSLC_TXT_ALLOC_EXT), \
2924  colTxt, \
2925  colTxt, \
2926  nAlignTxt, \
2927  0, \
2928  0, \
2929  pFont, \
2930  (void*)extraData, \
2931  NULL, \
2932  NULL, \
2933  callFunc, \
2934  NULL, \
2935  }; \
2936  gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \
2937  (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_PROG | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL));
2938 
2939 
2940 
2941 #else
2942 
2943 #define gslc_ElemCreateTxt_P(pGui,nElemId,nPage,nX,nY,nW,nH,strTxt,pFont,colTxt,colFrame,colFill,nAlignTxt,bFrameEn,bFillEn) \
2944  static const char str##nElemId[] = strTxt; \
2945  static const uint8_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID | \
2946  (bFrameEn?GSLC_ELEM_FEA_FRAME_EN:0) | (bFillEn?GSLC_ELEM_FEA_FILL_EN:0); \
2947  static const gslc_tsElem sElem##nElemId = { \
2948  nElemId, \
2949  nFeatures##nElemId, \
2950  GSLC_TYPE_TXT, \
2951  (gslc_tsRect){nX,nY,nW,nH}, \
2952  GSLC_GROUP_ID_NONE, \
2953  colFrame,colFill,GSLC_COL_BLACK,GSLC_COL_BLACK, \
2954  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2955  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2956  NULL, \
2957  (char*)str##nElemId, \
2958  0, \
2959  (gslc_teTxtFlags)(GSLC_TXT_MEM_RAM | GSLC_TXT_ALLOC_EXT), \
2960  colTxt, \
2961  colTxt, \
2962  nAlignTxt, \
2963  0, \
2964  0, \
2965  pFont, \
2966  NULL, \
2967  NULL, \
2968  NULL, \
2969  NULL, \
2970  NULL, \
2971  }; \
2972  gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \
2973  (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_CONST | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL));
2974 
2975 
2976 #define gslc_ElemCreateTxt_P_R(pGui,nElemId,nPage,nX,nY,nW,nH,strTxt,strLength,pFont,colTxt,colFrame,colFill,nAlignTxt,bFrameEn,bFillEn) \
2977  static const uint8_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID | \
2978  (bFrameEn?GSLC_ELEM_FEA_FRAME_EN:0) | (bFillEn?GSLC_ELEM_FEA_FILL_EN:0); \
2979  static const gslc_tsElem sElem##nElemId = { \
2980  nElemId, \
2981  nFeatures##nElemId, \
2982  GSLC_TYPE_TXT, \
2983  (gslc_tsRect){nX,nY,nW,nH}, \
2984  GSLC_GROUP_ID_NONE, \
2985  colFrame,colFill,GSLC_COL_BLACK,GSLC_COL_BLACK, \
2986  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2987  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
2988  NULL, \
2989  (char*)strTxt, \
2990  strLength, \
2991  (gslc_teTxtFlags)(GSLC_TXT_MEM_RAM | GSLC_TXT_ALLOC_EXT), \
2992  colTxt, \
2993  colTxt, \
2994  nAlignTxt, \
2995  0, \
2996  0, \
2997  pFont, \
2998  NULL, \
2999  NULL, \
3000  NULL, \
3001  NULL, \
3002  NULL, \
3003  }; \
3004  gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \
3005  (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_CONST | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL));
3006 
3007 #define gslc_ElemCreateTxt_P_R_ext(pGui,nElemId,nPage,nX,nY,nW,nH,strTxt,strLength,pFont,colTxt,colTxtGlow,colFrame,colFill,nAlignTxt,nMarginX,nMarginY,bFrameEn,bFillEn,bClickEn,bGlowEn,pfuncXEvent,pfuncXDraw,pfuncXTouch,pfuncXTick) \
3008  static const uint8_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID | \
3009  (bFrameEn?GSLC_ELEM_FEA_FRAME_EN:0) | (bFillEn?GSLC_ELEM_FEA_FILL_EN:0) | (bClickEn?GSLC_ELEM_FEA_CLICK_EN:0) | (bGlowEn?GSLC_ELEM_FEA_GLOW_EN:0); \
3010  static const gslc_tsElem sElem##nElemId = { \
3011  nElemId, \
3012  nFeatures##nElemId, \
3013  GSLC_TYPE_TXT, \
3014  (gslc_tsRect){nX,nY,nW,nH}, \
3015  GSLC_GROUP_ID_NONE, \
3016  colFrame,colFill,GSLC_COL_BLACK,GSLC_COL_BLACK, \
3017  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
3018  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
3019  NULL, \
3020  (char*)strTxt, \
3021  strLength, \
3022  (gslc_teTxtFlags)(GSLC_TXT_MEM_RAM | GSLC_TXT_ALLOC_EXT), \
3023  colTxt, \
3024  colTxtGlow, \
3025  nAlignTxt, \
3026  nMarginX, \
3027  nMarginY, \
3028  pFont, \
3029  NULL, \
3030  pfuncXEvent, \
3031  pfuncXDraw, \
3032  pfuncXTouch, \
3033  pfuncXTick, \
3034  }; \
3035  gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \
3036  (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_CONST | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL));
3037 
3038 
3039 #define gslc_ElemCreateBox_P(pGui,nElemId,nPage,nX,nY,nW,nH,colFrame,colFill,bFrameEn,bFillEn,pfuncXDraw,pfuncXTick) \
3040  static const uint8_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID | \
3041  (bFrameEn?GSLC_ELEM_FEA_FRAME_EN:0) | (bFillEn?GSLC_ELEM_FEA_FILL_EN:0); \
3042  static const gslc_tsElem sElem##nElemId = { \
3043  nElemId, \
3044  nFeatures##nElemId, \
3045  GSLC_TYPE_BOX, \
3046  (gslc_tsRect){nX,nY,nW,nH}, \
3047  GSLC_GROUP_ID_NONE, \
3048  colFrame,colFill,GSLC_COL_BLACK,GSLC_COL_BLACK, \
3049  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
3050  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
3051  NULL, \
3052  NULL, \
3053  0, \
3054  GSLC_TXT_DEFAULT, \
3055  GSLC_COL_WHITE, \
3056  GSLC_COL_WHITE, \
3057  GSLC_ALIGN_MID_MID, \
3058  0, \
3059  0, \
3060  NULL, \
3061  NULL, \
3062  NULL, \
3063  pfuncXDraw, \
3064  NULL, \
3065  pfuncXTick, \
3066  }; \
3067  gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \
3068  (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_CONST | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL));
3069 
3070 #define gslc_ElemCreateLine_P(pGui,nElemId,nPage,nX0,nY0,nX1,nY1,colFill) \
3071  static const uint8_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID; \
3072  static const gslc_tsElem sElem##nElemId = { \
3073  nElemId, \
3074  nFeatures##nElemId, \
3075  GSLC_TYPE_LINE, \
3076  (gslc_tsRect){nX0,nY0,nX1-nX0+1,nY1-nY0+1}, \
3077  GSLC_GROUP_ID_NONE, \
3078  colFill,colFill,GSLC_COL_BLACK,GSLC_COL_BLACK, \
3079  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
3080  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
3081  NULL, \
3082  NULL, \
3083  0, \
3084  GSLC_TXT_DEFAULT, \
3085  GSLC_COL_WHITE, \
3086  GSLC_COL_WHITE, \
3087  GSLC_ALIGN_MID_MID, \
3088  0, \
3089  0, \
3090  NULL, \
3091  NULL, \
3092  NULL, \
3093  NULL, \
3094  NULL, \
3095  NULL, \
3096  }; \
3097  gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \
3098  (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_CONST | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL));
3099 
3100 #define gslc_ElemCreateBtnTxt_P(pGui,nElemId,nPage,nX,nY,nW,nH,strTxt,pFont,colTxt,colFrame,colFill,colFrameGlow,colFillGlow,nAlignTxt,bFrameEn,bFillEn,callFunc,extraData) \
3101  static const char str##nElemId[] = strTxt; \
3102  static const uint8_t nFeatures##nElemId = GSLC_ELEM_FEA_VALID | \
3103  GSLC_ELEM_FEA_CLICK_EN | GSLC_ELEM_FEA_GLOW_EN | \
3104  (bFrameEn?GSLC_ELEM_FEA_FRAME_EN:0) | (bFillEn?GSLC_ELEM_FEA_FILL_EN:0); \
3105  static const gslc_tsElem sElem##nElemId = { \
3106  nElemId, \
3107  nFeatures##nElemId, \
3108  GSLC_TYPE_BTN, \
3109  (gslc_tsRect){nX,nY,nW,nH}, \
3110  GSLC_GROUP_ID_NONE, \
3111  colFrame,colFill,colFrameGlow,colFillGlow, \
3112  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
3113  (gslc_tsImgRef){NULL,NULL,GSLC_IMGREF_NONE,NULL}, \
3114  NULL, \
3115  (char*)str##nElemId, \
3116  0, \
3117  (gslc_teTxtFlags)(GSLC_TXT_MEM_RAM | GSLC_TXT_ALLOC_EXT), \
3118  colTxt, \
3119  colTxt, \
3120  nAlignTxt, \
3121  0, \
3122  0, \
3123  pFont, \
3124  (void*)extraData, \
3125  NULL, \
3126  NULL, \
3127  callFunc, \
3128  NULL, \
3129  }; \
3130  gslc_ElemAdd(pGui,nPage,(gslc_tsElem*)&sElem##nElemId, \
3131  (gslc_teElemRefFlags)(GSLC_ELEMREF_SRC_CONST | GSLC_ELEMREF_VISIBLE | GSLC_ELEMREF_REDRAW_FULL));
3132 
3133 
3134 #endif // GSLC_USE_PROGMEM
3135 
3136 
3137 
3138 // ========================================================================
3148 // ========================================================================
3149 
3150 // ------------------------------------------------------------------------
3153 // ------------------------------------------------------------------------
3154 
3161 
3162 
3163 // ------------------------------------------------------------------------
3167 // ------------------------------------------------------------------------
3186 gslc_tsElem gslc_ElemCreate(gslc_tsGui* pGui,int16_t nElemId,int16_t nPageId,int16_t nType,
3187  gslc_tsRect rElem,char* pStrBuf,uint8_t nStrBufMax,int16_t nFontId);
3188 
3189 
3206 gslc_tsElemRef* gslc_ElemAdd(gslc_tsGui* pGui,int16_t nPageId,gslc_tsElem* pElem,gslc_teElemRefFlags eFlags);
3207 
3208 
3218 uint8_t gslc_GetElemRefFlag(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,uint8_t nFlagMask);
3219 
3230 void gslc_SetElemRefFlag(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,uint8_t nFlagMask,uint8_t nFlagVal);
3231 
3232 
3243 // TODO: Mark this as public API
3245 
3246 
3257 gslc_tsElem* gslc_GetElemFromRefD(gslc_tsGui* pGui, gslc_tsElemRef* pElemRef, int16_t nLineNum);
3258 
3270 void* gslc_GetXDataFromRef(gslc_tsGui* pGui, gslc_tsElemRef* pElemRef, int16_t nType, int16_t nLineNum);
3271 
3272 
3283 void gslc_ElemSetImage(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,gslc_tsImgRef sImgRef,
3284  gslc_tsImgRef sImgRefSel);
3285 
3286 
3287 
3297 bool gslc_ElemDrawByRef(gslc_tsGui* pGui,gslc_tsElemRef* pElemRef,gslc_teRedrawType eRedraw);
3298 
3299 
3311 void gslc_ElemDraw(gslc_tsGui* pGui,int16_t nPageId,int16_t nElemId);
3312 
3313 
3332 void gslc_DrawTxtBase(gslc_tsGui* pGui, char* pStrBuf, gslc_tsRect rTxt, gslc_tsFont* pTxtFont, gslc_teTxtFlags eTxtFlags,
3333  int8_t eTxtAlign, gslc_tsColor colTxt, gslc_tsColor colBg, int16_t nMarginW, int16_t nMarginH);
3334 
3335 
3345 void gslc_SetRoundRadius(gslc_tsGui* pGui, uint8_t nRadius);
3346 
3347 // ------------------------------------------------------------------------
3351 // ------------------------------------------------------------------------
3352 
3361 bool gslc_PageEvent(void* pvGui,gslc_tsEvent sEvent);
3362 
3363 /* UNUSED
3373 void gslc_PageSetEventFunc(gslc_tsGui* pGui,gslc_tsPage* pPage,GSLC_CB_EVENT funcCb);
3374 */
3375 
3386 void gslc_PageRedrawGo(gslc_tsGui* pGui);
3387 
3399 void gslc_PageFlipSet(gslc_tsGui* pGui,bool bNeeded);
3400 
3401 
3409 bool gslc_PageFlipGet(gslc_tsGui* pGui);
3410 
3411 
3421 void gslc_PageFlipGo(gslc_tsGui* pGui);
3422 
3430 gslc_tsPage* gslc_PageFindById(gslc_tsGui* pGui,int16_t nPageId);
3431 
3443 void gslc_PageRedrawCalc(gslc_tsGui* pGui);
3444 
3445 
3447 int16_t gslc_PageFocusStep(gslc_tsGui* pGui,gslc_tsPage* pPage,bool bNext);
3448 
3449 
3463 gslc_tsEvent gslc_EventCreate(gslc_tsGui* pGui,gslc_teEventType eType,uint8_t nSubType,void* pvScope,void* pvData);
3464 
3465 
3474 bool gslc_ElemEvent(void* pvGui,gslc_tsEvent sEvent);
3475 
3476 
3477 #if !defined(DRV_TOUCH_NONE)
3478 bool gslc_ElemSendEventTouch(gslc_tsGui* pGui,gslc_tsElemRef* pElemRefTracked,
3491  gslc_teTouch eTouch,int16_t nX,int16_t nY);
3492 #endif // !DRV_TOUCH_NONE
3493 
3494 
3495 // ------------------------------------------------------------------------
3496 // Internal: Element Collection Functions
3497 // ------------------------------------------------------------------------
3501 
3502 
3522 void gslc_CollectReset(gslc_tsCollect* pCollect,gslc_tsElem* asElem,uint16_t nElemMax,
3523  gslc_tsElemRef* asElemRef,uint16_t nElemRefMax);
3524 
3525 
3542 
3543 
3552 bool gslc_CollectGetRedraw(gslc_tsGui* pGui,gslc_tsCollect* pCollect);
3553 
3554 
3564 gslc_tsElemRef* gslc_CollectFindElemById(gslc_tsGui* pGui,gslc_tsCollect* pCollect,int16_t nElemId);
3565 
3566 
3579 gslc_tsElemRef* gslc_CollectFindElemFromCoord(gslc_tsGui* pGui,gslc_tsCollect* pCollect,int16_t nX, int16_t nY);
3580 
3581 
3589 int gslc_CollectGetNextId(gslc_tsGui* pGui,gslc_tsCollect* pCollect);
3590 
3591 
3602 
3603 
3612 void gslc_CollectSetElemTracked(gslc_tsGui* pGui,gslc_tsCollect* pCollect,gslc_tsElemRef* pElemRef);
3613 
3614 
3615 
3623 int16_t gslc_CollectGetFocus(gslc_tsGui* pGui, gslc_tsCollect* pCollect);
3624 
3625 
3634 void gslc_CollectSetFocus(gslc_tsGui* pGui, gslc_tsCollect* pCollect, int16_t nElemInd);
3635 
3636 
3638 bool gslc_CollectFindFocusStep(gslc_tsGui* pGui,gslc_tsCollect* pCollect,bool bNext,bool* pbWrapped,int16_t* pnElemInd);
3639 
3640 
3652 void gslc_CollectSetParent(gslc_tsGui* pGui,gslc_tsCollect* pCollect,gslc_tsElemRef* pElemRefParent);
3653 
3654 
3655 // ------------------------------------------------------------------------
3656 // Internal: Collect Event Handlers
3657 // ------------------------------------------------------------------------
3661 
3662 /* UNUSED
3672 void gslc_CollectSetEventFunc(gslc_tsGui* pGui,gslc_tsCollect* pCollect,GSLC_CB_EVENT funcCb);
3673 */
3674 
3683 bool gslc_CollectEvent(void* pvGui,gslc_tsEvent sEvent);
3684 
3685 
3686 #if !defined(DRV_TOUCH_NONE)
3687 
3696 void gslc_CollectTouch(gslc_tsGui* pGui,gslc_tsCollect* pCollect,gslc_tsEventTouch* pEventTouch);
3697 
3709 bool gslc_CollectTouchCompound(void* pvGui, void* pvElemRef, gslc_teTouch eTouch, int16_t nRelX, int16_t nRelY, gslc_tsCollect* pCollect);
3710 
3711 
3720 void gslc_CollectInput(gslc_tsGui* pGui,gslc_tsCollect* pCollect,gslc_tsEventTouch* pEventTouch);
3721 
3722 
3723 
3724 // ------------------------------------------------------------------------
3728 // ------------------------------------------------------------------------
3729 
3730 
3744 void gslc_TrackTouch(gslc_tsGui* pGui,gslc_tsPage* pPage,int16_t nX,int16_t nY,uint16_t nPress);
3745 
3758 void gslc_TrackInput(gslc_tsGui* pGui,gslc_tsPage* pPage,gslc_teInputRawEvent eInputEvent,int16_t nInputVal);
3759 
3761 bool gslc_InputMapLookup(gslc_tsGui* pGui,gslc_teInputRawEvent eInputEvent,int16_t nInputVal,gslc_teAction* peAction,int16_t* pnActionVal);
3762 
3763 #endif // !DRV_TOUCH_NONE
3764 
3765 
3766 // ------------------------------------------------------------------------
3770 // ------------------------------------------------------------------------
3771 
3772 
3773 
3784 void gslc_GuiDestruct(gslc_tsGui* pGui);
3785 
3786 
3795 void gslc_PageDestruct(gslc_tsGui* pGui,gslc_tsPage* pPage);
3796 
3805 void gslc_CollectDestruct(gslc_tsGui* pGui,gslc_tsCollect* pCollect);
3806 
3814 void gslc_ElemDestruct(gslc_tsElem* pElem);
3815 
3823 void gslc_ResetFont(gslc_tsFont* pFont);
3824 
3832 void gslc_ResetElem(gslc_tsElem* pElem);
3833 
3834 
3837 
3838 
3839 #ifdef __cplusplus
3840 }
3841 #endif // __cplusplus
3842 #endif // _GUISLICE_H_
void gslc_CollectSetParent(gslc_tsGui *pGui, gslc_tsCollect *pCollect, gslc_tsElemRef *pElemRefParent)
Assign the parent element reference to all elements within a collection.
Definition: GUIslice.c:5270
Module is enabled but failed to init.
Definition: GUIslice.h:338
gslc_tsElem sElemTmpProg
Temporary element for Flash compatibility.
Definition: GUIslice.h:754
Button element type.
Definition: GUIslice.h:168
Mask for subtype.
Definition: GUIslice.h:313
void gslc_ElemDraw(gslc_tsGui *pGui, int16_t nPageId, int16_t nElemId)
Draw an element to the active display.
Definition: GUIslice.c:2927
gslc_tsImgRef sImgRefBkgnd
Image reference for background.
Definition: GUIslice.h:774
const void * pvFont
Void ptr to the font reference (type defined by driver)
Definition: GUIslice.h:563
char * gslc_ElemGetTxtStr(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
Fetch the current text string associated with an Element.
Definition: GUIslice.c:3374
void gslc_PageFlipGo(gslc_tsGui *pGui)
Update the visible screen if page has been marked for flipping.
Definition: GUIslice.c:2366
gslc_tsPage * gslc_PageFindById(gslc_tsGui *pGui, int16_t nPageId)
Find a page in the GUI by its ID.
Definition: GUIslice.c:2381
void * pvScope
Event target scope (eg. Page,Collection,Event)
Definition: GUIslice.h:544
bool(* GSLC_CB_INPUT)(void *pvGui, void *pvElemRef, int16_t nStatus, void *pvData)
Callback function for element input ready.
Definition: GUIslice.h:511
void gslc_ElemSetTxtMargin(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, unsigned nMargin)
Set the margin around of a textual element.
Definition: GUIslice.c:3316
void gslc_InvalidateRgnScreen(gslc_tsGui *pGui)
Mark the entire screen as invalidated.
Definition: GUIslice.c:1427
gslc_tsElemRef * pElemRefParent
Parent element reference.
Definition: GUIslice.h:618
gslc_tsRect gslc_ExpandRect(gslc_tsRect rRect, int16_t nExpandW, int16_t nExpandH)
Expand or contract a rectangle in width and/or height (equal amounts on both side), based on the centerpoint of the rectangle.
Definition: GUIslice.c:1351
void gslc_CollectInput(gslc_tsGui *pGui, gslc_tsCollect *pCollect, gslc_tsEventTouch *pEventTouch)
Handle direct input events within the element collection.
Definition: GUIslice.c:3732
int gslc_CollectGetNextId(gslc_tsGui *pGui, gslc_tsCollect *pCollect)
Allocate the next available Element ID in a collection.
Definition: GUIslice.c:5202
void gslc_DrawLineH(gslc_tsGui *pGui, int16_t nX, int16_t nY, uint16_t nW, gslc_tsColor nCol)
Draw a horizontal line.
Definition: GUIslice.c:1227
Starting Font ID for user assignments.
Definition: GUIslice.h:148
No text string present.
Definition: GUIslice.h:467
bool gslc_ElemGetVisible(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
Get the visibility status for an element.
Definition: GUIslice.c:3567
gslc_teInitStat eInitStatTouch
Status of touch initialization.
Definition: GUIslice.h:756
int16_t nY
Touch Y coordinate (or param2)
Definition: GUIslice.h:555
Current page.
Definition: GUIslice.h:126
Starting Page ID for user assignments.
Definition: GUIslice.h:118
gslc_teTxtFlags eTxtFlags
Flags associated with text buffer.
Definition: GUIslice.h:628
Button A (short press)
Definition: GUIslice.h:286
void gslc_SetTouchRemapYX(gslc_tsGui *pGui, bool bSwap)
Configure touchscreen XY swap.
Definition: GUIslice.c:4391
Advance focus to the next GUI element.
Definition: GUIslice.h:276
gslc_tsElemRef * gslc_CollectFindElemFromCoord(gslc_tsGui *pGui, gslc_tsCollect *pCollect, int16_t nX, int16_t nY)
Find an element in a collection by a coordinate coordinate.
Definition: GUIslice.c:5226
Line element type.
Definition: GUIslice.h:171
gslc_tsElemRef * gslc_ElemCreateImg(gslc_tsGui *pGui, int16_t nElemId, int16_t nPage, gslc_tsRect rElem, gslc_tsImgRef sImgRef)
Create an image Element.
Definition: GUIslice.c:2775
Event structure.
Definition: GUIslice.h:541
void gslc_DrawFrameQuad(gslc_tsGui *pGui, gslc_tsPt *psPt, gslc_tsColor nCol)
Draw a framed quadrilateral.
Definition: GUIslice.c:1706
void gslc_SetPageOverlay(gslc_tsGui *pGui, int16_t nPageId)
Select a page for the overlay layer in the page stack.
Definition: GUIslice.c:2100
gslc_tsColor sTransCol
Color used for transparent image regions (GSLC_BMP_TRANS_EN=1)
Definition: GUIslice.h:747
int16_t gslc_sinFX(int16_t n64Ang)
Calculate fixed-point sine function from fractional degrees.
Definition: GUIslice.c:1002
No Font ID has been assigned.
Definition: GUIslice.h:149
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.
Definition: GUIslice.c:3234
uint8_t b
RGB blue value.
Definition: GUIslice.h:537
Touch event (move inside tracked element)
Definition: GUIslice.h:323
gslc_tsColor colElemFillGlow
Color to use for fill when glowing.
Definition: GUIslice.h:605
uint8_t nInputMapCnt
Current number of input maps.
Definition: GUIslice.h:805
void gslc_CollectSetElemTracked(gslc_tsGui *pGui, gslc_tsCollect *pCollect, gslc_tsElemRef *pElemRef)
Set the element within a collection that is currently being tracked.
Definition: GUIslice.c:5216
Touch event (move outside tracked element)
Definition: GUIslice.h:324
gslc_tsColor colElemText
Color of overlay text.
Definition: GUIslice.h:631
uint8_t nFlipX
Adafruit GFX Touch Flip x axis.
Definition: GUIslice.h:730
int16_t nElemAutoIdNext
Next Element ID for auto-assignment.
Definition: GUIslice.h:660
gslc_teFontRefType
Font Reference types.
Definition: GUIslice.h:383
Text string allocated in external memory (GSLC_STR_LOCAL=0), ie. user code.
Definition: GUIslice.h:469
int16_t nTouchCalPressMax
Calibration maximum pressure threshold.
Definition: GUIslice.h:738
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.
Definition: GUIslice.c:3249
struct gslc_tsElem gslc_tsElem
Element Struct.
Definition: GUIslice.h:486
Definition: GUIslice.h:478
Image is stored on SD card.
Definition: GUIslice.h:440
gslc_tsFont * asFont
Collection of loaded fonts.
Definition: GUIslice.h:741
Touch event (down)
Definition: GUIslice.h:316
void gslc_PageAdd(gslc_tsGui *pGui, int16_t nPageId, gslc_tsElem *psElem, uint16_t nMaxElem, gslc_tsElemRef *psElemRef, uint16_t nMaxElemRef)
Add a page to the GUI.
Definition: GUIslice.c:1977
gslc_teInitStat
Status of a module&#39;s initialization.
Definition: GUIslice.h:335
gslc_tsColor colElemTextGlow
Color of overlay text when glowing.
Definition: GUIslice.h:632
bool bInvalidateEn
A region of the display has been invalidated.
Definition: GUIslice.h:794
void gslc_DrawFrameRoundRect(gslc_tsGui *pGui, gslc_tsRect rRect, int16_t nRadius, gslc_tsColor nCol)
Draw a framed rounded rectangle.
Definition: GUIslice.c:1287
Button D (long press)
Definition: GUIslice.h:293
gslc_tsElemRef * gslc_ElemCreateBox(gslc_tsGui *pGui, int16_t nElemId, int16_t nPage, gslc_tsRect rElem)
Create a Box Element.
Definition: GUIslice.c:2719
Touch event (up outside tracked element)
Definition: GUIslice.h:321
void gslc_SetPinPollFunc(gslc_tsGui *pGui, GSLC_CB_PIN_POLL pfunc)
Definition: GUIslice.c:284
uint8_t nSwapXY
Adafruit GFX Touch Swap x and y axes.
Definition: GUIslice.h:729
Module is enabled and initalized OK.
Definition: GUIslice.h:339
Direct event select focus element.
Definition: GUIslice.h:328
Force a full redraw.
Definition: GUIslice.h:366
void gslc_StrCopy(char *pDstStr, const char *pSrcStr, uint16_t nDstLen)
Helper routine to perform string deep copy.
Definition: GUIslice.c:3337
Encoding is plain text (LATIN1))
Definition: GUIslice.h:470
struct gslc_tsRect gslc_tsRect
Rectangular region. Defines X,Y corner coordinates plus dimensions.
int16_t nTouchLastY
Last touch event Y coord.
Definition: GUIslice.h:759
void gslc_ElemUpdateFont(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int nFontId)
Update the Font selected for an Element&#39;s text.
Definition: GUIslice.c:3422
uint8_t nDispDepth
Bit depth of display (bits per pixel)
Definition: GUIslice.h:722
gslc_teElemId
Element ID enumerations.
Definition: GUIslice.h:98
const unsigned char * pImgBuf
Pointer to input image buffer in memory [RAM,FLASH].
Definition: GUIslice.h:570
int16_t nPageId
Page identifier.
Definition: GUIslice.h:688
int16_t nTouchCalPressMin
Calibration minimum pressure threshold.
Definition: GUIslice.h:737
void gslc_ElemSetTxtEnc(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_teTxtFlags eFlags)
Update the text string encoding mode.
Definition: GUIslice.c:3413
Base page.
Definition: GUIslice.h:125
gslc_tsInputMap * asInputMap
Array of input maps.
Definition: GUIslice.h:803
Box / frame element type.
Definition: GUIslice.h:170
void gslc_PageDestruct(gslc_tsGui *pGui, gslc_tsPage *pPage)
Free up any members associated with a page.
Definition: GUIslice.c:5006
Button A (long press)
Definition: GUIslice.h:287
int16_t nTouchLastX
Last touch event X coord.
Definition: GUIslice.h:758
void gslc_SetRoundRadius(gslc_tsGui *pGui, uint8_t nRadius)
Set the global rounded radius.
Definition: GUIslice.c:2605
gslc_tePin
General purpose pin/button constants.
Definition: GUIslice.h:285
bool gslc_SetBkgndColor(gslc_tsGui *pGui, gslc_tsColor nCol)
Configure the background to use a solid color.
Definition: GUIslice.c:4841
gslc_tsImgRef gslc_ResetImage()
Create a blank image reference structure.
Definition: GUIslice.c:932
bool gslc_GetTouch(gslc_tsGui *pGui, int16_t *pnX, int16_t *pnY, uint16_t *pnPress, gslc_teInputRawEvent *peInputEvent, int16_t *pnInputVal)
Initialize the touchscreen device driver.
Definition: GUIslice.c:4331
gslc_teRedrawType
Redraw types.
Definition: GUIslice.h:370
Touch event (down inside tracked element)
Definition: GUIslice.h:317
Button B (short press)
Definition: GUIslice.h:288
Default font mode.
Definition: GUIslice.h:396
bool gslc_ColorEqual(gslc_tsColor a, gslc_tsColor b)
Check whether two colors are equal.
Definition: GUIslice.c:1145
void gslc_ElemSetGlow(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bGlowing)
Update the glowing indicator for an element.
Definition: GUIslice.c:3516
Button Left (short press)
Definition: GUIslice.h:298
int16_t nGroup
Group ID that the element belongs to.
Definition: GUIslice.h:600
void gslc_InvalidateRgnAdd(gslc_tsGui *pGui, gslc_tsRect rAddRect)
Add a rectangular region to the invalidation region.
Definition: GUIslice.c:1451
uint16_t nDisp0H
Height of the display (pixels) in native orientation.
Definition: GUIslice.h:721
uint16_t h
Height of region.
Definition: GUIslice.h:523
bool gslc_SetTransparentColor(gslc_tsGui *pGui, gslc_tsColor nCol)
Configure the color to use for image transparency.
Definition: GUIslice.c:4851
Key press up (released)
Definition: GUIslice.h:264
gslc_tsElemRef * pElemRefTracked
Element reference currently being touch-tracked (NULL for none)
Definition: GUIslice.h:667
void gslc_PageRedrawCalc(gslc_tsGui *pGui)
Perform a redraw calculation on the page to determine if additional elements should also be redrawn...
Definition: GUIslice.c:2164
struct gslc_tsEvent gslc_tsEvent
Event structure.
Definition: GUIslice.h:487
Full redraw of element requested.
Definition: GUIslice.h:372
Encoding is UTF-8.
Definition: GUIslice.h:471
void gslc_ElemSetFillEn(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bFillEn)
Set the fill state for an Element.
Definition: GUIslice.c:3193
Touch event (down outside tracked element)
Definition: GUIslice.h:318
void * pvDriver
Driver-specific members (gslc_tsDriver*)
Definition: GUIslice.h:765
User elements start at index 0.
Definition: GUIslice.h:159
Font mode 1.
Definition: GUIslice.h:397
Module status has not been defined yet.
Definition: GUIslice.h:336
gslc_tsImgRef sImgRefNorm
Image reference to draw (normal)
Definition: GUIslice.h:607
uint8_t nFontMax
Maximum number of fonts to allocate.
Definition: GUIslice.h:742
gslc_teTypeCore
Element type.
Definition: GUIslice.h:164
gslc_tsCollect sCollect
Collection of elements on page.
Definition: GUIslice.h:686
Font reference is a pointer to a font structure.
Definition: GUIslice.h:385
int gslc_GetPageCur(gslc_tsGui *pGui)
Fetch the current page ID.
Definition: GUIslice.c:2015
int16_t x
X coordinate.
Definition: GUIslice.h:529
Element is read/write Stored in RAM (internal element array)) Access directly.
Definition: GUIslice.h:408
void gslc_DrawFrameRect(gslc_tsGui *pGui, gslc_tsRect rRect, gslc_tsColor nCol)
Draw a framed rectangle.
Definition: GUIslice.c:1260
Image reference structure.
Definition: GUIslice.h:569
bool gslc_CollectGetRedraw(gslc_tsGui *pGui, gslc_tsCollect *pCollect)
Determine if any elements in a collection need redraw.
Definition: GUIslice.c:4701
gslc_teElemRefFlags
Element reference flags: Describes characteristics of an element.
Definition: GUIslice.h:405
Incremental redraw (as needed)
Definition: GUIslice.h:365
gslc_teTxtFlags
Text reference flags: Describes the characteristics of a text string (ie.
Definition: GUIslice.h:463
int8_t nTxtMarginY
Margin of overlay text within rect region (y offset)
Definition: GUIslice.h:635
gslc_tsColor gslc_ColorBlend2(gslc_tsColor colStart, gslc_tsColor colEnd, uint16_t nMidAmt, uint16_t nBlendAmt)
Create a color based on a blend between two colors.
Definition: GUIslice.c:1113
gslc_tsElemRef * gslc_ElemCreateBtnTxt(gslc_tsGui *pGui, int16_t nElemId, int16_t nPage, gslc_tsRect rElem, char *pStrBuf, uint8_t nStrBufMax, int16_t nFontId, GSLC_CB_TOUCH cbTouch)
Create a textual Button Element.
Definition: GUIslice.c:2646
gslc_teAction eAction
Resulting action.
Definition: GUIslice.h:708
void gslc_InputMapAdd(gslc_tsGui *pGui, gslc_teInputRawEvent eInputEvent, int16_t nInputVal, gslc_teAction eAction, int16_t nActionVal)
Definition: GUIslice.c:305
Starting Element ID to start auto-assignment (when GSLC_ID_AUTO is specified)
Definition: GUIslice.h:105
Direct event focus on element.
Definition: GUIslice.h:326
Image is stored in file system.
Definition: GUIslice.h:439
void gslc_ResetFont(gslc_tsFont *pFont)
Initialize a Font struct.
Definition: GUIslice.c:4937
GSLC_CB_TOUCH pfuncXTouch
Callback func ptr for touch.
Definition: GUIslice.h:645
gslc_tsRect rElem
Rect region containing element.
Definition: GUIslice.h:599
uint16_t nDispW
Width of the display (pixels)
Definition: GUIslice.h:718
void gslc_DrawLine(gslc_tsGui *pGui, int16_t nX0, int16_t nY0, int16_t nX1, int16_t nY1, gslc_tsColor nCol)
Draw an arbitrary line using Bresenham&#39;s algorithm.
Definition: GUIslice.c:1169
Font mode 2.
Definition: GUIslice.h:398
bool gslc_IsInRect(int16_t nSelX, int16_t nSelY, gslc_tsRect rRect)
Determine if a coordinate is inside of a rectangular region.
Definition: GUIslice.c:766
No redraw requested.
Definition: GUIslice.h:418
void gslc_ResetElem(gslc_tsElem *pElem)
Initialize an Element struct.
Definition: GUIslice.c:4887
Perform background tick handling.
Definition: GUIslice.h:358
Incremental redraw of element requested.
Definition: GUIslice.h:420
bool bTouchRemapYX
Enable touch controller swapping of X & Y.
Definition: GUIslice.h:762
void gslc_ElemSetStyleFrom(gslc_tsGui *pGui, gslc_tsElemRef *pElemRefSrc, gslc_tsElemRef *pElemRefDest)
Copy style settings from one element to another.
Definition: GUIslice.c:3637
uint16_t nElemCnt
Number of elements allocated.
Definition: GUIslice.h:659
void gslc_PageFlipSet(gslc_tsGui *pGui, bool bNeeded)
Indicate whether the screen requires page flip.
Definition: GUIslice.c:2341
void gslc_ElemSetRect(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_tsRect rElem)
Set the position and size for an element.
Definition: GUIslice.c:3280
gslc_tsPage * asPage
Array of all pages defined in system.
Definition: GUIslice.h:781
Key press down / pin input asserted.
Definition: GUIslice.h:263
gslc_tsRect rInvalidateRect
The rect region that has been invalidated.
Definition: GUIslice.h:795
Element state is glowing.
Definition: GUIslice.h:422
gslc_teElemRefFlags eElemFlags
Element reference flags.
Definition: GUIslice.h:580
uint8_t r
RGB red value.
Definition: GUIslice.h:535
void gslc_CollectSetFocus(gslc_tsGui *pGui, gslc_tsCollect *pCollect, int16_t nElemInd)
Set the element index within a collection that is currently in focus.
Definition: GUIslice.c:5260
bool gslc_ElemGetGlowEn(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
Get the glowing enable for an element.
Definition: GUIslice.c:3607
int8_t nTxtMarginX
Margin of overlay text within rect region (x offset)
Definition: GUIslice.h:634
void gslc_DrawFrameCircle(gslc_tsGui *pGui, int16_t nMidX, int16_t nMidY, uint16_t nRadius, gslc_tsColor nCol)
Draw a framed circle.
Definition: GUIslice.c:1464
void gslc_ElemSetFrameEn(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bFrameEn)
Set the frame state for an Element.
Definition: GUIslice.c:3207
Text label element type.
Definition: GUIslice.h:169
bool gslc_PageFlipGet(gslc_tsGui *pGui)
Get state of pending page flip state.
Definition: GUIslice.c:2357
void gslc_PageRedrawGo(gslc_tsGui *pGui)
Redraw all elements on the active page.
Definition: GUIslice.c:2235
bool gslc_FontSetMode(gslc_tsGui *pGui, int16_t nFontId, gslc_teFontRefMode eFontMode)
Set the font operating mode.
Definition: GUIslice.c:1918
gslc_teRedrawType gslc_ElemGetRedraw(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
Get the need-redraw status for an element.
Definition: GUIslice.c:3495
void gslc_PopupHide(gslc_tsGui *pGui)
Hides the currently active popup dialog.
Definition: GUIslice.c:2125
gslc_tsFont * gslc_FontGet(gslc_tsGui *pGui, int16_t nFontId)
Fetch a font from its ID value.
Definition: GUIslice.c:1907
uint8_t nSubType
Event sub-type.
Definition: GUIslice.h:543
bool gslc_ElemEvent(void *pvGui, gslc_tsEvent sEvent)
Common event handler function for an element.
Definition: GUIslice.c:2809
gslc_teAction
GUI Action Requested These actions are usually the result of an InputMap lookup.
Definition: GUIslice.h:272
void gslc_ElemSetTickFunc(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, GSLC_CB_TICK funcCb)
Assign the tick callback function for an element.
Definition: GUIslice.c:3706
Button Select (short press)
Definition: GUIslice.h:300
bool bTouchRemapEn
Enable touch remapping?
Definition: GUIslice.h:761
int16_t y
Y coordinate.
Definition: GUIslice.h:530
void gslc_TrackTouch(gslc_tsGui *pGui, gslc_tsPage *pPage, int16_t nX, int16_t nY, uint16_t nPress)
Handles a touch event and performs the necessary tracking, glowing and selection actions depending on...
Definition: GUIslice.c:4211
void gslc_DrawTxtBase(gslc_tsGui *pGui, char *pStrBuf, gslc_tsRect rTxt, gslc_tsFont *pTxtFont, gslc_teTxtFlags eTxtFlags, int8_t eTxtAlign, gslc_tsColor colTxt, gslc_tsColor colBg, int16_t nMarginW, int16_t nMarginH)
Draw text with full text justification.
Definition: GUIslice.c:2934
uint8_t nRotation
Adafruit GFX Rotation of display.
Definition: GUIslice.h:725
void gslc_SetTouchPressCal(gslc_tsGui *pGui, uint16_t nPressMin, uint16_t nPressMax)
Configure touchscreen calibration pressure values.
Definition: GUIslice.c:4380
Button Right (short press)
Definition: GUIslice.h:299
int gslc_ElemGetId(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
Get an Element ID from an element structure.
Definition: GUIslice.c:2481
uint8_t nFontCnt
Number of fonts allocated.
Definition: GUIslice.h:743
int16_t x
X coordinate of corner.
Definition: GUIslice.h:520
Incremental redraw of element requested.
Definition: GUIslice.h:373
gslc_tsElemRef * gslc_CollectElemAdd(gslc_tsGui *pGui, gslc_tsCollect *pCollect, const gslc_tsElem *pElem, gslc_teElemRefFlags eFlags)
Add an element to a collection.
Definition: GUIslice.c:4603
No input event.
Definition: GUIslice.h:261
gslc_tsImgRef gslc_GetImageFromFile(const char *pFname, gslc_teImgRefFlags eFmt)
Create an image reference to a bitmap file in LINUX filesystem.
Definition: GUIslice.c:942
gslc_tsElemRef * gslc_CollectGetElemRefTracked(gslc_tsGui *pGui, gslc_tsCollect *pCollect)
Get the element within a collection that is currently being tracked.
Definition: GUIslice.c:5210
int16_t nActionVal
The value for the output action.
Definition: GUIslice.h:709
void gslc_DebugPrintf(const char *pFmt,...)
Optimized printf routine for GUIslice debug/error output.
Definition: GUIslice.c:392
GSLC_CB_EVENT pfuncXEvent
UNUSED: Callback func ptr for event tree (draw,touch,tick)
Definition: GUIslice.h:642
uint8_t nStrBufMax
Size of string buffer.
Definition: GUIslice.h:627
gslc_teEventType eType
Event type.
Definition: GUIslice.h:542
Module is not enabled.
Definition: GUIslice.h:337
bool gslc_CollectFindFocusStep(gslc_tsGui *pGui, gslc_tsCollect *pCollect, bool bNext, bool *pbWrapped, int16_t *pnElemInd)
Definition: GUIslice.c:5090
Mask for type: coord/direct mode.
Definition: GUIslice.h:309
Defines maximum number of pages in stack.
Definition: GUIslice.h:129
void gslc_CollectDestruct(gslc_tsGui *pGui, gslc_tsCollect *pCollect)
Free up any members associated with an element collection.
Definition: GUIslice.c:4979
void gslc_SetStackPage(gslc_tsGui *pGui, uint8_t nStackPos, int16_t nPageId)
Assign a page to the page stack.
Definition: GUIslice.c:2024
struct gslc_tsPt gslc_tsPt
Define point coordinates.
Image format is JPG (ESP32/ESP8366)
Definition: GUIslice.h:448
void gslc_DrawFillTriangle(gslc_tsGui *pGui, int16_t nX0, int16_t nY0, int16_t nX1, int16_t nY1, int16_t nX2, int16_t nY2, gslc_tsColor nCol)
Draw a filled triangle.
Definition: GUIslice.c:1619
gslc_tsElemRef * gslc_PageFindElemById(gslc_tsGui *pGui, int16_t nPageId, int16_t nElemId)
Find an element in the GUI by its Page ID and Element ID.
Definition: GUIslice.c:2406
gslc_tsElemRef * asElemRef
Array of element references.
Definition: GUIslice.h:662
int16_t nTouchCalYMax
Calibration Y maximum reading.
Definition: GUIslice.h:736
gslc_tsElemRef * gslc_ElemCreateLine(gslc_tsGui *pGui, int16_t nElemId, int16_t nPage, int16_t nX0, int16_t nY0, int16_t nX1, int16_t nY1)
Create a Line Element.
Definition: GUIslice.c:2745
void gslc_DrawFrameTriangle(gslc_tsGui *pGui, int16_t nX0, int16_t nY0, int16_t nX1, int16_t nY1, int16_t nX2, int16_t nY2, gslc_tsColor nCol)
Draw a framed triangle.
Definition: GUIslice.c:1588
bool gslc_CollectTouchCompound(void *pvGui, void *pvElemRef, gslc_teTouch eTouch, int16_t nRelX, int16_t nRelY, gslc_tsCollect *pCollect)
Handle dispatch of touch (up,down,move) events to compound elements sub elements. ...
Definition: GUIslice.c:3972
void gslc_DrawLinePolar(gslc_tsGui *pGui, int16_t nX, int16_t nY, uint16_t nRadStart, uint16_t nRadEnd, int16_t n64Ang, gslc_tsColor nCol)
Draw a polar ray segment.
Definition: GUIslice.c:1249
Button C (short press)
Definition: GUIslice.h:290
int16_t gslc_cosFX(int16_t n64Ang)
Calculate fixed-point cosine function from fractional degrees.
Definition: GUIslice.c:1070
uint8_t nPageMax
Maximum number of pages that can be defined.
Definition: GUIslice.h:782
void gslc_DrawFillGradSector(gslc_tsGui *pGui, int16_t nQuality, int16_t nMidX, int16_t nMidY, int16_t nRad1, int16_t nRad2, gslc_tsColor cArcStart, gslc_tsColor cArcEnd, int16_t nAngSecStart, int16_t nAngSecEnd, int16_t nAngGradStart, int16_t nAngGradRange)
Draw a gradient filled sector of a circle with support for inner and outer radius.
Definition: GUIslice.c:1818
void gslc_ElemSetTxtStr(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, const char *pStr)
Update the text string associated with an Element.
Definition: GUIslice.c:3353
gslc_teStackPage
Define page stack.
Definition: GUIslice.h:124
Definition: GUIslice.h:364
const char * pFname
Pathname to input image file [FILE,SD].
Definition: GUIslice.h:571
bool gslc_InitTouch(gslc_tsGui *pGui, const char *acDev)
Initialize the touchscreen device driver.
Definition: GUIslice.c:4301
bool gslc_ElemDrawByRef(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_teRedrawType eRedraw)
Draw an element to the active display.
Definition: GUIslice.c:3033
No redraw requested.
Definition: GUIslice.h:371
struct gslc_tsEventTouch gslc_tsEventTouch
Structure used to pass touch data through event.
uint16_t nDispH
Height of the display (pixels)
Definition: GUIslice.h:719
gslc_tePageId
Page ID enumerations.
Definition: GUIslice.h:116
No element defined.
Definition: GUIslice.h:406
gslc_tsColor colElemFrameGlow
Color to use for frame when glowing.
Definition: GUIslice.h:604
Rectangular region. Defines X,Y corner coordinates plus dimensions.
Definition: GUIslice.h:519
bool gslc_IsInWH(int16_t nSelX, int16_t nSelY, uint16_t nWidth, uint16_t nHeight)
Determine if a coordinate is inside of a width x height region.
Definition: GUIslice.c:776
void gslc_SetStackState(gslc_tsGui *pGui, uint8_t nStackPos, bool bActive, bool bDoDraw)
Change the status of a page in a page stack.
Definition: GUIslice.c:2079
gslc_teInputRawEvent
Raw input event types: touch, key, GPIOs.
Definition: GUIslice.h:260
Direct event set value (relative) on focus element.
Definition: GUIslice.h:329
Image format is raw monochrome (1-bit)
Definition: GUIslice.h:447
Text string is in PROGMEM (read-only)
Definition: GUIslice.h:466
void gslc_PopupShow(gslc_tsGui *pGui, int16_t nPageId, bool bModal)
Show a popup dialog.
Definition: GUIslice.c:2105
int16_t(* GSLC_CB_DEBUG_OUT)(char ch)
Definition: GUIslice.h:73
uint8_t nPageCnt
Current number of pages defined.
Definition: GUIslice.h:783
uint16_t w
Width of region.
Definition: GUIslice.h:522
bool gslc_ClipPt(gslc_tsRect *pClipRect, int16_t nX, int16_t nY)
Perform basic clipping of a single point to a clipping region.
Definition: GUIslice.c:804
gslc_tsFont * pTxtFont
Ptr to Font for overlay text.
Definition: GUIslice.h:636
bool gslc_ElemSendEventTouch(gslc_tsGui *pGui, gslc_tsElemRef *pElemRefTracked, gslc_teTouch eTouch, int16_t nX, int16_t nY)
Trigger an element&#39;s touch event.
Definition: GUIslice.c:4869
Base value for extended type enumerations.
Definition: GUIslice.h:174
GPIO pin input deasserted (eg. set to 0 / Low)
Definition: GUIslice.h:266
GSLC_CB_DEBUG_OUT g_pfDebugOut
Global debug output function.
Definition: GUIslice.c:76
Custom event.
Definition: GUIslice.h:359
void gslc_InitDebug(GSLC_CB_DEBUG_OUT pfunc)
Initialize debug output.
Definition: GUIslice.c:360
void * gslc_GetXDataFromRef(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int16_t nType, int16_t nLineNum)
Returns a pointer to the data structure associated with an extended element.
Definition: GUIslice.c:2576
Input mapping.
Definition: GUIslice.h:705
Direct event set value (absolute) on focus element.
Definition: GUIslice.h:330
uint16_t nElemMax
Maximum number of elements to allocate (in RAM)
Definition: GUIslice.h:658
void gslc_DrawSetPixel(gslc_tsGui *pGui, int16_t nX, int16_t nY, gslc_tsColor nCol)
Set a pixel on the active screen to the given color with lock.
Definition: GUIslice.c:1154
No event; ignore.
Definition: GUIslice.h:355
void gslc_InvalidateRgnReset(gslc_tsGui *pGui)
Reset the invalidation region.
Definition: GUIslice.c:1418
uint8_t nRoundRadius
Radius for rounded elements.
Definition: GUIslice.h:745
bool gslc_FontAdd(gslc_tsGui *pGui, int16_t nFontId, gslc_teFontRefType eFontRefType, const void *pvFontRef, uint16_t nFontSz)
Load a font into the local font cache and assign font ID (nFontId).
Definition: GUIslice.c:1886
void gslc_DrawLineV(gslc_tsGui *pGui, int16_t nX, int16_t nY, uint16_t nH, gslc_tsColor nCol)
Draw a vertical line.
Definition: GUIslice.c:1237
Advance focus to the previous GUI element.
Definition: GUIslice.h:275
gslc_tsElemRef * gslc_ElemAdd(gslc_tsGui *pGui, int16_t nPageId, gslc_tsElem *pElem, gslc_teElemRefFlags eFlags)
Add the Element to the list of generated elements in the GUI environment.
Definition: GUIslice.c:4732
Auto-assigned Element ID requested.
Definition: GUIslice.h:102
int16_t nId
Element ID specified by user.
Definition: GUIslice.h:595
bool bScreenNeedFlip
Screen requires a page flip.
Definition: GUIslice.h:791
gslc_teImgRefFlags eImgFlags
Image reference flags.
Definition: GUIslice.h:572
void gslc_SetTouchRemapCal(gslc_tsGui *pGui, uint16_t nXMin, uint16_t nXMax, uint16_t nYMin, uint16_t nYMax)
Configure touchscreen calibration remapping values.
Definition: GUIslice.c:4367
bool gslc_PageRedrawGet(gslc_tsGui *pGui)
Get the need-redraw status for the current page.
Definition: GUIslice.c:2146
bool bScreenNeedRedraw
Screen requires a redraw.
Definition: GUIslice.h:790
void gslc_ElemSetGroup(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int nGroupId)
Set the group ID for an element.
Definition: GUIslice.c:3264
void gslc_DrawFillSector(gslc_tsGui *pGui, int16_t nQuality, int16_t nMidX, int16_t nMidY, int16_t nRad1, int16_t nRad2, gslc_tsColor cArc, int16_t nAngSecStart, int16_t nAngSecEnd)
Draw a flat filled sector of a circle with support for inner and outer radius.
Definition: GUIslice.c:1825
Touch event (up inside tracked element)
Definition: GUIslice.h:320
uint16_t nDisp0W
Width of the display (pixels) in native orientation.
Definition: GUIslice.h:720
Mask for Redraw flags.
Definition: GUIslice.h:427
bool gslc_CollectEvent(void *pvGui, gslc_tsEvent sEvent)
Common event handler function for an element collection.
Definition: GUIslice.c:4535
No element type specified.
Definition: GUIslice.h:166
bool(* GSLC_CB_TOUCH)(void *pvGui, void *pvElemRef, gslc_teTouch eTouch, int16_t nX, int16_t nY)
Callback function for element touch tracking.
Definition: GUIslice.h:502
uint8_t g
RGB green value.
Definition: GUIslice.h:536
gslc_tsColor gslc_ColorBlend3(gslc_tsColor colStart, gslc_tsColor colMid, gslc_tsColor colEnd, uint16_t nMidAmt, uint16_t nBlendAmt)
Create a color based on a blend between three colors.
Definition: GUIslice.c:1122
gslc_teInputRawEvent eEvent
The input event.
Definition: GUIslice.h:706
bool gslc_ClipRect(gslc_tsRect *pClipRect, gslc_tsRect *pRect)
Perform basic clipping of a rectangle to a clipping region.
Definition: GUIslice.c:905
gslc_tsElem * gslc_GetElemFromRef(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
Returns a pointer to an element from an element reference, copying from FLASH to RAM if element is st...
Definition: GUIslice.c:2519
Touch event (move)
Definition: GUIslice.h:322
gslc_tsElemRef * gslc_ElemCreateTxt(gslc_tsGui *pGui, int16_t nElemId, int16_t nPage, gslc_tsRect rElem, char *pStrBuf, uint8_t nStrBufMax, int16_t nFontId)
Create a Text Element.
Definition: GUIslice.c:2617
gslc_tsImgRef sImgRefGlow
Image reference to draw (glowing)
Definition: GUIslice.h:608
gslc_tsEvent gslc_EventCreate(gslc_tsGui *pGui, gslc_teEventType eType, uint8_t nSubType, void *pvScope, void *pvData)
Create an event structure.
Definition: GUIslice.c:749
Button E (long press)
Definition: GUIslice.h:295
void * gslc_GetDriverDisp(gslc_tsGui *pGui)
Get the native display driver instance.
Definition: GUIslice.c:115
Text string is in SRAM (read-write)
Definition: GUIslice.h:465
const char * gslc_GetNameTouch(gslc_tsGui *pGui)
Get the GUIslice touch driver name.
Definition: GUIslice.c:110
Button D (short press)
Definition: GUIslice.h:292
void * gslc_GetDriverTouch(gslc_tsGui *pGui)
Get the native touch driver instance.
Definition: GUIslice.c:120
void gslc_ElemSetDrawFunc(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, GSLC_CB_DRAW funcCb)
Assign the drawing callback function for an element.
Definition: GUIslice.c:3697
gslc_teElemInd
Element Index enumerations.
Definition: GUIslice.h:156
void gslc_SetTouchRemapEn(gslc_tsGui *pGui, bool bEn)
Configure touchscreen remapping.
Definition: GUIslice.c:4357
gslc_teImgRefFlags
Image reference flags: Describes characteristics of an image reference.
Definition: GUIslice.h:436
bool gslc_SetBkgndImage(gslc_tsGui *pGui, gslc_tsImgRef sImgRef)
Configure the background to use a bitmap image.
Definition: GUIslice.c:4831
No Element ID has been assigned.
Definition: GUIslice.h:101
bool gslc_ElemGetGlow(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
Get the glowing indicator for an element.
Definition: GUIslice.c:3534
int16_t gslc_CollectGetFocus(gslc_tsGui *pGui, gslc_tsCollect *pCollect)
Get the element index within a collection that is currently in focus.
Definition: GUIslice.c:5254
No image defined.
Definition: GUIslice.h:437
const char * gslc_GetNameDisp(gslc_tsGui *pGui)
Get the GUIslice display driver name.
Definition: GUIslice.c:105
Element is currently shown (ie. visible)
Definition: GUIslice.h:423
int16_t y
Y coordinate of corner.
Definition: GUIslice.h:521
gslc_tsElemRef sElemRefTmp
Temporary element reference.
Definition: GUIslice.h:751
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.
Definition: GUIslice.c:3714
uint8_t nTouchRotation
Touchscreen rotation offset vs display.
Definition: GUIslice.h:728
void gslc_TrackInput(gslc_tsGui *pGui, gslc_tsPage *pPage, gslc_teInputRawEvent eInputEvent, int16_t nInputVal)
Handles a direct input event and performs the necessary tracking, glowing and selection actions depen...
Definition: GUIslice.c:4024
uint16_t nSize
Font size.
Definition: GUIslice.h:564
Track touch event.
Definition: GUIslice.h:357
Element collection struct.
Definition: GUIslice.h:656
Structure used to pass touch data through event.
Definition: GUIslice.h:552
void gslc_ElemSetVisible(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bVisible)
Update the visibility status for an element.
Definition: GUIslice.c:3544
bool gslc_PageEvent(void *pvGui, gslc_tsEvent sEvent)
Common event handler function for a page.
Definition: GUIslice.c:1936
Image is stored in program memory (PROGMEM)
Definition: GUIslice.h:442
void gslc_ElemSetTxtAlign(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, unsigned nAlign)
Set the alignment of a textual element (horizontal and vertical)
Definition: GUIslice.c:3307
uint16_t nElemRefMax
Maximum number of element references to allocate.
Definition: GUIslice.h:663
void * pvImgRaw
Ptr to raw output image data (for pre-loaded images)
Definition: GUIslice.h:573
Button B (long press)
Definition: GUIslice.h:289
bool gslc_InputMapLookup(gslc_tsGui *pGui, gslc_teInputRawEvent eInputEvent, int16_t nInputVal, gslc_teAction *peAction, int16_t *pnActionVal)
Definition: GUIslice.c:329
bool gslc_ElemGetOnScreen(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
Determine whether an element is visible on the screen.
Definition: GUIslice.c:3577
Text string allocated in internal element memory (GSLC_STR_LOCAL=1)
Definition: GUIslice.h:468
Element reference structure.
Definition: GUIslice.h:578
gslc_teEventType
Event types.
Definition: GUIslice.h:354
void gslc_ElemSetGlowEn(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bGlowEn)
Update the glowing enable for an element.
Definition: GUIslice.c:3594
uint16_t nElemRefCnt
Number of element references allocated.
Definition: GUIslice.h:664
GSLC_CB_TICK pfuncXTick
Callback func ptr for timer/main loop tick.
Definition: GUIslice.h:646
gslc_teFontRefMode
Font Reference modes.
Definition: GUIslice.h:395
Mask for Source flags.
Definition: GUIslice.h:426
No Element Index is available.
Definition: GUIslice.h:158
gslc_tsElem * asElem
Array of elements.
Definition: GUIslice.h:657
gslc_tsElem * gslc_GetElemFromRefD(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, int16_t nLineNum)
Returns a pointer to an element from an element reference.
Definition: GUIslice.c:2561
No touch event active.
Definition: GUIslice.h:306
Event based on touch coordinate.
Definition: GUIslice.h:310
bool gslc_Init(gslc_tsGui *pGui, void *pvDriver, gslc_tsPage *asPage, uint8_t nMaxPage, gslc_tsFont *asFont, uint8_t nMaxFont)
Initialize the GUIslice library.
Definition: GUIslice.c:126
int16_t nX
Touch X coordinate (or param1)
Definition: GUIslice.h:554
int16_t gslc_PageFocusStep(gslc_tsGui *pGui, gslc_tsPage *pPage, bool bNext)
Definition: GUIslice.c:2447
Image format is BMP (16-bit RGB565)
Definition: GUIslice.h:446
Mask for updating location of text string buffer allocation.
Definition: GUIslice.h:475
uint8_t nInputMapMax
Maximum number of input maps.
Definition: GUIslice.h:804
bool gslc_ClipLine(gslc_tsRect *pClipRect, int16_t *pnX0, int16_t *pnY0, int16_t *pnX1, int16_t *pnY1)
Perform basic clipping of a line to a clipping region.
Definition: GUIslice.c:818
void gslc_ElemSetTxtCol(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_tsColor colVal)
Update the text string color associated with an Element ID.
Definition: GUIslice.c:3381
void * pvData
Generic data pointer for event.
Definition: GUIslice.h:545
void gslc_ElemSetImage(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_tsImgRef sImgRef, gslc_tsImgRef sImgRefSel)
Set an element to use a bitmap image.
Definition: GUIslice.c:4804
int16_t nTouchCalXMin
Calibration X minimum reading.
Definition: GUIslice.h:733
gslc_tsElem * pElem
Pointer to element in memory [RAM,FLASH].
Definition: GUIslice.h:579
Adjust value (relative) of focused element.
Definition: GUIslice.h:278
Select the currently focused GUI element.
Definition: GUIslice.h:277
void gslc_ElemSetRedraw(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_teRedrawType eRedraw)
Update the need-redraw status for an element.
Definition: GUIslice.c:3432
void gslc_SetElemRefFlag(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, uint8_t nFlagMask, uint8_t nFlagVal)
Set the flags associated with an element reference.
Definition: GUIslice.c:2504
void gslc_DrawFillRect(gslc_tsGui *pGui, gslc_tsRect rRect, gslc_tsColor nCol)
Draw a filled rectangle.
Definition: GUIslice.c:1306
void gslc_CollectReset(gslc_tsCollect *pCollect, gslc_tsElem *asElem, uint16_t nElemMax, gslc_tsElemRef *asElemRef, uint16_t nElemRefMax)
Reset the members of an element collection.
Definition: GUIslice.c:5052
Invalid action.
Definition: GUIslice.h:273
uint16_t nTouchLastPress
Last touch event pressure (0=none))
Definition: GUIslice.h:760
gslc_tsElemRef * gslc_CollectFindElemById(gslc_tsGui *pGui, gslc_tsCollect *pCollect, int16_t nElemId)
Find an element in a collection by its Element ID.
Definition: GUIslice.c:5169
gslc_teGroupId
Group ID enumerations.
Definition: GUIslice.h:133
bool(* GSLC_CB_TICK)(void *pvGui, void *pvElemRef)
Callback function for element tick.
Definition: GUIslice.h:505
bool(* GSLC_CB_PIN_POLL)(void *pvGui, int16_t *pnPinInd, int16_t *pnPinVal)
Callback function for pin polling.
Definition: GUIslice.h:508
gslc_tsImgRef gslc_GetImageFromSD(const char *pFname, gslc_teImgRefFlags eFmt)
Create an image reference to a bitmap file in SD card.
Definition: GUIslice.c:952
void gslc_InitInputMap(gslc_tsGui *pGui, gslc_tsInputMap *asInputMap, uint8_t nInputMapMax)
Definition: GUIslice.c:290
GSLC_CB_PIN_POLL pfuncPinPoll
Callback func ptr for pin polling.
Definition: GUIslice.h:799
gslc_tsImgRef gslc_GetImageFromProg(const unsigned char *pImgBuf, gslc_teImgRefFlags eFmt)
Create an image reference to a bitmap in program memory (PROGMEM)
Definition: GUIslice.c:982
gslc_teFontRefType eFontRefType
Font reference type.
Definition: GUIslice.h:561
uint8_t nFrameRateCnt
Diagnostic frame rate count.
Definition: GUIslice.h:776
No action to perform.
Definition: GUIslice.h:274
void gslc_Update(gslc_tsGui *pGui)
Perform main GUIslice handling functions.
Definition: GUIslice.c:582
Starting Group ID for user assignments.
Definition: GUIslice.h:135
Touch / mouse event.
Definition: GUIslice.h:262
int16_t nType
Element type enumeration.
Definition: GUIslice.h:598
gslc_tsElem gslc_ElemCreate(gslc_tsGui *pGui, int16_t nElemId, int16_t nPageId, int16_t nType, gslc_tsRect rElem, char *pStrBuf, uint8_t nStrBufMax, int16_t nFontId)
Create a new element with default styling.
Definition: GUIslice.c:4420
void gslc_InvalidateRgnPage(gslc_tsGui *pGui, gslc_tsPage *pPage)
Include an entire page (eg.
Definition: GUIslice.c:1436
void gslc_ElemSetTxtMem(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, gslc_teTxtFlags eFlags)
Update the text string location in memory.
Definition: GUIslice.c:3395
Direct event focus away from focused element.
Definition: GUIslice.h:327
gslc_tsRect rBounds
Bounding rect for page elements.
Definition: GUIslice.h:694
uint8_t nFeatures
Element feature vector (appearance/behavior))
Definition: GUIslice.h:596
gslc_tsElem sElemTmp
Temporary element.
Definition: GUIslice.h:750
GPIO pin input asserted (eg. set to 1 / High)
Definition: GUIslice.h:265
gslc_teTouch
Processed event from input raw events and actions.
Definition: GUIslice.h:305
void gslc_Quit(gslc_tsGui *pGui)
Exit the GUIslice environment.
Definition: GUIslice.c:574
gslc_tsElemRef * gslc_ElemCreateBtnImg(gslc_tsGui *pGui, int16_t nElemId, int16_t nPage, gslc_tsRect rElem, gslc_tsImgRef sImgRef, gslc_tsImgRef sImgRefSel, GSLC_CB_TOUCH cbTouch)
Create a graphical Button Element.
Definition: GUIslice.c:2685
void gslc_UnionRect(gslc_tsRect *pRect, gslc_tsRect rAddRect)
Expand a rect to include another rect.
Definition: GUIslice.c:1380
int16_t nVal
The value associated with the input event.
Definition: GUIslice.h:707
ID for Temporary Element.
Definition: GUIslice.h:103
void gslc_ElemDestruct(gslc_tsElem *pElem)
Free up any members associated with an element.
Definition: GUIslice.c:4953
int16_t nElemIndFocused
Element index currently in focus (eg. by keyboard/pin control), GSLC_IND_NONE for none...
Definition: GUIslice.h:670
gslc_teEventSubType
Event sub-types.
Definition: GUIslice.h:363
gslc_teFontRefMode eFontRefMode
Font reference mode.
Definition: GUIslice.h:562
int gslc_ElemGetGroup(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
Get the group ID for an element.
Definition: GUIslice.c:3272
char * pStrBuf
Ptr to text string buffer to overlay.
Definition: GUIslice.h:625
gslc_tsRect gslc_ElemGetRect(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef)
Get the rectangular region for an element.
Definition: GUIslice.c:3298
void gslc_ElemSetRoundEn(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bRoundEn)
Set the rounded frame/fill state for an Element.
Definition: GUIslice.c:3220
void gslc_ElemSetTouchFunc(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, GSLC_CB_TOUCH funcCb)
Update the touch function callback for an element.
Definition: GUIslice.c:3628
Define point coordinates.
Definition: GUIslice.h:528
bool gslc_FontSet(gslc_tsGui *pGui, int16_t nFontId, gslc_teFontRefType eFontRefType, const void *pvFontRef, uint16_t nFontSz)
Load a font into the local font cache and store as font ID (nFontId)
Definition: GUIslice.c:1866
void gslc_SetPageCur(gslc_tsGui *pGui, int16_t nPageId)
Select a page for the current layer in the page stack.
Definition: GUIslice.c:2095
uint8_t gslc_GetElemRefFlag(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, uint8_t nFlagMask)
Get the flags associated with an element reference.
Definition: GUIslice.c:2491
Button E (short press)
Definition: GUIslice.h:294
bool gslc_SetClipRect(gslc_tsGui *pGui, gslc_tsRect *pRect)
Set the clipping rectangle for further drawing.
Definition: GUIslice.c:4779
GUI structure.
Definition: GUIslice.h:716
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)
Definition: GUIslice.c:3326
bool gslc_GuiRotate(gslc_tsGui *pGui, uint8_t nRotation)
Dynamically change rotation, automatically adapt touchscreen axes swap/flip.
Definition: GUIslice.c:4857
Button Up (short press)
Definition: GUIslice.h:296
gslc_teFontId
Font ID enumerations.
Definition: GUIslice.h:146
Mask for updating text memory type.
Definition: GUIslice.h:474
Element Struct.
Definition: GUIslice.h:593
int16_t nTouchCalXMax
Calibration X maximum reading.
Definition: GUIslice.h:734
Perform redraw.
Definition: GUIslice.h:356
Color structure. Defines RGB triplet.
Definition: GUIslice.h:534
Element is read-only / const Stored in FLASH (external to element array) Access via PROGMEM...
Definition: GUIslice.h:411
void gslc_SetPageBase(gslc_tsGui *pGui, int16_t nPageId)
Assigns a page for the base layer in the page stack.
Definition: GUIslice.c:2090
uint8_t nFrameRateStart
Diagnostic frame rate timestamp.
Definition: GUIslice.h:777
Font reference structure.
Definition: GUIslice.h:559
gslc_tsRect gslc_GetClipRect(gslc_tsGui *pGui)
Get the current the clipping rectangle.
Definition: GUIslice.c:4773
Font reference is a filename (full path)
Definition: GUIslice.h:384
void * pXData
Ptr to extended data structure.
Definition: GUIslice.h:639
No Group ID has been assigned.
Definition: GUIslice.h:137
uint8_t nFlipY
Adafruit GFX Touch Flip x axis.
Definition: GUIslice.h:731
gslc_tsColor colElemFill
Color for background fill.
Definition: GUIslice.h:603
Button C (long press)
Definition: GUIslice.h:291
uint8_t nInputMode
Input mode: 0=navigate, 1=edit.
Definition: GUIslice.h:806
Image format is BMP (24-bit)
Definition: GUIslice.h:445
Mask for Source flags.
Definition: GUIslice.h:451
Button Down (short press)
Definition: GUIslice.h:297
Touch event (up)
Definition: GUIslice.h:319
void gslc_ElemSetClickEn(gslc_tsGui *pGui, gslc_tsElemRef *pElemRef, bool bClickEn)
Update the click enable for an element.
Definition: GUIslice.c:3615
Background element type.
Definition: GUIslice.h:167
No Page ID has been assigned.
Definition: GUIslice.h:120
void gslc_DrawFillQuad(gslc_tsGui *pGui, gslc_tsPt *psPt, gslc_tsColor nCol)
Draw a filled quadrilateral.
Definition: GUIslice.c:1728
Mask for updating text encoding.
Definition: GUIslice.h:476
Internal debug action.
Definition: GUIslice.h:280
Adjust value (absolute) of focused element.
Definition: GUIslice.h:279
Starting Element ID for user assignments.
Definition: GUIslice.h:100
void gslc_DrawFillCircle(gslc_tsGui *pGui, int16_t nMidX, int16_t nMidY, uint16_t nRadius, gslc_tsColor nCol)
Draw a filled circle.
Definition: GUIslice.c:1535
char * gslc_GetVer(gslc_tsGui *pGui)
Get the GUIslice version number.
Definition: GUIslice.c:99
GSLC_CB_DRAW pfuncXDraw
Callback func ptr for custom drawing.
Definition: GUIslice.h:644
bool bRedrawPartialEn
Driver supports partial page redraw.
Definition: GUIslice.h:766
int16_t nTouchCalYMin
Calibration Y minimum reading.
Definition: GUIslice.h:735
gslc_tsImgRef gslc_GetImageFromRam(unsigned char *pImgBuf, gslc_teImgRefFlags eFmt)
Create an image reference to a bitmap in SRAM.
Definition: GUIslice.c:971
Event based on specific element index (keyboard/GPIO action)
Definition: GUIslice.h:311
bool(* GSLC_CB_EVENT)(void *pvGui, gslc_tsEvent sEvent)
Callback function for element drawing.
Definition: GUIslice.h:496
Full redraw of element requested.
Definition: GUIslice.h:419
Image is stored in RAM.
Definition: GUIslice.h:441
void gslc_PolarToXY(uint16_t nRad, int16_t n64Ang, int16_t *nDX, int16_t *nDY)
Convert polar coordinate to cartesian.
Definition: GUIslice.c:1102
gslc_tsColor colElemFrame
Color for frame.
Definition: GUIslice.h:602
void gslc_GuiDestruct(gslc_tsGui *pGui)
Free up any surfaces associated with the GUI, pages, collections and elements.
Definition: GUIslice.c:5018
void gslc_CollectTouch(gslc_tsGui *pGui, gslc_tsCollect *pCollect, gslc_tsEventTouch *pEventTouch)
Handle touch events within the element collection.
Definition: GUIslice.c:3855
Mask for Format flags.
Definition: GUIslice.h:452
Overlay page (eg. popups)
Definition: GUIslice.h:127
void gslc_PageRedrawSet(gslc_tsGui *pGui, bool bRedraw)
Update the need-redraw status for the current page.
Definition: GUIslice.c:2137
bool(* GSLC_CB_DRAW)(void *pvGui, void *pvElemRef, gslc_teRedrawType eRedraw)
Callback function for element drawing.
Definition: GUIslice.h:499
int16_t nId
Font ID specified by user.
Definition: GUIslice.h:560
Font mode 3.
Definition: GUIslice.h:399
gslc_teTouch eTouch
Touch state.
Definition: GUIslice.h:553
void gslc_DrawFillRoundRect(gslc_tsGui *pGui, gslc_tsRect rRect, int16_t nRadius, gslc_tsColor nCol)
Draw a filled rounded rectangle.
Definition: GUIslice.c:1329
Element is read-only / const Stored in FLASH (external to element array) Access directly.
Definition: GUIslice.h:414
struct gslc_tsColor gslc_tsColor
Color structure. Defines RGB triplet.
int8_t eTxtAlign
Alignment of overlay text.
Definition: GUIslice.h:633
Page structure.
Definition: GUIslice.h:684