// // FILE: [sd_card_formatter_GSLC.h] // Created by GUIslice Builder version: [0.15.b004] // // GUIslice Builder Generated GUI Framework File // // For the latest guides, updates and support view: // https://github.com/ImpulseAdventure/GUIslice // // #ifndef _GUISLICE_GEN_H #define _GUISLICE_GEN_H // ------------------------------------------------ // Headers to include // ------------------------------------------------ #include "src/guislice/GUIslice.h" #include "src/guislice/GUIslice_drv.h" // Include any extended elements // // Include extended elements #include "src/guislice/XProgress.h" #include "src/guislice/XTextbox.h" // // ------------------------------------------------ // Headers and Defines for fonts // Note that font files are located within the Adafruit-GFX library folder: // ------------------------------------------------ // #if defined(DRV_DISP_TFT_ESPI) #error Project tab->Target Platform should be tft_espi #endif #include #include "src/guislice/NotoMono10pt7b.h" #include "src/guislice/NotoMono12pt7b.h" #include "src/guislice/NotoMono16pt7b.h" #include "src/guislice/NotoMono8pt7b.h" // // ------------------------------------------------ // Defines for resources // ------------------------------------------------ // // // ------------------------------------------------ // Enumerations for pages, elements, fonts, images // ------------------------------------------------ // enum {E_PG_BASE,E_PG_MAIN,E_SD_CARD,E_PG_SD_CONFIRM}; enum {E_ELEM_BATT_LEVEL,E_ELEM_BOX1,E_ELEM_BTN_SD_FMT,E_ELEM_SD_NO ,E_ELEM_SD_YES,E_ELEM_STATUS,E_ELEM_TEXT14,E_ELEM_TEXT15 ,E_ELEM_TX_SD_INFO,E_STATUS_LINE}; // Must use separate enum for fonts with MAX_FONT at end to use gslc_FontSet. enum {E_AO_NOTOMONO10PT7B,E_AO_NOTOMONO12PT7B,E_AO_NOTOMONO16PT7B ,E_AO_NOTOMONO8PT7B,MAX_FONT}; // // ------------------------------------------------ // Instantiate the GUI // ------------------------------------------------ // ------------------------------------------------ // Define the maximum number of elements and pages // ------------------------------------------------ // #define MAX_PAGE 4 #define MAX_ELEM_PG_BASE 3 // # Elems total on page #define MAX_ELEM_PG_BASE_RAM MAX_ELEM_PG_BASE // # Elems in RAM #define MAX_ELEM_PG_MAIN 0 // # Elems total on page #define MAX_ELEM_PG_MAIN_RAM MAX_ELEM_PG_MAIN // # Elems in RAM #define MAX_ELEM_SD_CARD 2 // # Elems total on page #define MAX_ELEM_SD_CARD_RAM MAX_ELEM_SD_CARD // # Elems in RAM #define MAX_ELEM_PG_SD_CONFIRM 5 // # Elems total on page #define MAX_ELEM_PG_SD_CONFIRM_RAM MAX_ELEM_PG_SD_CONFIRM // # Elems in RAM // // ------------------------------------------------ // Create element storage // ------------------------------------------------ gslc_tsGui m_gui; gslc_tsDriver m_drv; gslc_tsFont m_asFont[MAX_FONT]; gslc_tsPage m_asPage[MAX_PAGE]; // gslc_tsElem m_asBasePage1Elem[MAX_ELEM_PG_BASE_RAM]; gslc_tsElemRef m_asBasePage1ElemRef[MAX_ELEM_PG_BASE]; gslc_tsElem m_asPage1Elem[MAX_ELEM_PG_MAIN_RAM]; gslc_tsElemRef m_asPage1ElemRef[MAX_ELEM_PG_MAIN]; gslc_tsElem m_asPage3Elem[MAX_ELEM_SD_CARD_RAM]; gslc_tsElemRef m_asPage3ElemRef[MAX_ELEM_SD_CARD]; gslc_tsElem m_asPopup1Elem[MAX_ELEM_PG_SD_CONFIRM_RAM]; gslc_tsElemRef m_asPopup1ElemRef[MAX_ELEM_PG_SD_CONFIRM]; gslc_tsXProgress m_sXBarGauge2; gslc_tsXTextbox m_sTextbox2; char m_acTextboxBuf2[224]; // NRows=8 NCols=28 #define MAX_STR 100 // // ------------------------------------------------ // Program Globals // ------------------------------------------------ // Element References for direct access // extern gslc_tsElemRef* m_pElemBatteryLevel; extern gslc_tsElemRef* m_pElemBtSDNo; extern gslc_tsElemRef* m_pElemBtSDYes; extern gslc_tsElemRef* m_pElemSDInfo; extern gslc_tsElemRef* m_pElemStatusText; extern gslc_tsElemRef* m_pTextSliderSDInfo; // // Define debug message function static int16_t DebugOut(char ch); // ------------------------------------------------ // Callback Methods // ------------------------------------------------ bool CbBtnCommon(void* pvGui,void *pvElemRef,gslc_teTouch eTouch,int16_t nX,int16_t nY); bool CbCheckbox(void* pvGui, void* pvElemRef, int16_t nSelId, bool bState); bool CbDrawScanner(void* pvGui,void* pvElemRef,gslc_teRedrawType eRedraw); bool CbKeypad(void* pvGui, void *pvElemRef, int16_t nState, void* pvData); bool CbListbox(void* pvGui, void* pvElemRef, int16_t nSelId); bool CbSlidePos(void* pvGui,void* pvElemRef,int16_t nPos); bool CbSpinner(void* pvGui, void *pvElemRef, int16_t nState, void* pvData); bool CbTickScanner(void* pvGui,void* pvScope); // ------------------------------------------------ // Create page elements // ------------------------------------------------ void InitGUIslice_gen() { gslc_tsElemRef* pElemRef = NULL; if (!gslc_Init(&m_gui,&m_drv,m_asPage,MAX_PAGE,m_asFont,MAX_FONT)) { return; } // ------------------------------------------------ // Load Fonts // ------------------------------------------------ // if (!gslc_FontSet(&m_gui,E_AO_NOTOMONO10PT7B,GSLC_FONTREF_PTR,&NotoMono10pt7b,1)) { return; } if (!gslc_FontSet(&m_gui,E_AO_NOTOMONO12PT7B,GSLC_FONTREF_PTR,&NotoMono12pt7b,1)) { return; } if (!gslc_FontSet(&m_gui,E_AO_NOTOMONO16PT7B,GSLC_FONTREF_PTR,&NotoMono16pt7b,1)) { return; } if (!gslc_FontSet(&m_gui,E_AO_NOTOMONO8PT7B,GSLC_FONTREF_PTR,&NotoMono8pt7b,1)) { return; } // // gslc_PageAdd(&m_gui,E_PG_BASE,m_asBasePage1Elem,MAX_ELEM_PG_BASE_RAM,m_asBasePage1ElemRef,MAX_ELEM_PG_BASE); gslc_PageAdd(&m_gui,E_PG_MAIN,m_asPage1Elem,MAX_ELEM_PG_MAIN_RAM,m_asPage1ElemRef,MAX_ELEM_PG_MAIN); gslc_PageAdd(&m_gui,E_SD_CARD,m_asPage3Elem,MAX_ELEM_SD_CARD_RAM,m_asPage3ElemRef,MAX_ELEM_SD_CARD); gslc_PageAdd(&m_gui,E_PG_SD_CONFIRM,m_asPopup1Elem,MAX_ELEM_PG_SD_CONFIRM_RAM,m_asPopup1ElemRef,MAX_ELEM_PG_SD_CONFIRM); // Now mark E_PG_BASE as a "base" page which means that it's elements // are always visible. This is useful for common page elements. gslc_SetPageBase(&m_gui, E_PG_BASE); // NOTE: The current page defaults to the first page added. Here we explicitly // ensure that the main page is the correct page no matter the add order. gslc_SetPageCur(&m_gui,E_PG_MAIN); // Set Background to a flat color gslc_SetBkgndColor(&m_gui,GSLC_COL_BLACK); // ----------------------------------- // PAGE: E_PG_BASE // Create progress bar E_ELEM_BATT_LEVEL pElemRef = gslc_ElemXProgressCreate(&m_gui,E_ELEM_BATT_LEVEL,E_PG_BASE,&m_sXBarGauge2, (gslc_tsRect){263,5,50,15},0,100,0,GSLC_COL_GREEN,false); m_pElemBatteryLevel = pElemRef; // Create E_ELEM_STATUS text label pElemRef = gslc_ElemCreateTxt(&m_gui,E_ELEM_STATUS,E_PG_BASE,(gslc_tsRect){2,2,250,21}, (char*)"SD Card Formatter",0,E_AO_NOTOMONO8PT7B); gslc_ElemSetTxtCol(&m_gui,pElemRef,GSLC_COL_GREEN); m_pElemStatusText = pElemRef; // Create E_STATUS_LINE line pElemRef = gslc_ElemCreateLine(&m_gui,E_STATUS_LINE,E_PG_BASE,0,25,320,25); gslc_ElemSetCol(&m_gui,pElemRef,GSLC_COL_BLACK,GSLC_COL_GRAY_DK1,GSLC_COL_GRAY_DK1); // ----------------------------------- // PAGE: E_PG_MAIN // ----------------------------------- // PAGE: E_SD_CARD // Create textbox pElemRef = gslc_ElemXTextboxCreate(&m_gui,E_ELEM_TX_SD_INFO,E_SD_CARD,&m_sTextbox2, (gslc_tsRect){3,30,313,150},E_AO_NOTOMONO8PT7B, (char*)&m_acTextboxBuf2,8,28); gslc_ElemXTextboxWrapSet(&m_gui,pElemRef,true); gslc_ElemSetTxtCol(&m_gui,pElemRef,GSLC_COL_GRAY_LT3); gslc_ElemSetCol(&m_gui,pElemRef,GSLC_COL_GRAY,GSLC_COL_BLACK,GSLC_COL_BLACK); m_pElemSDInfo = pElemRef; // create E_ELEM_BTN_SD_FMT button with text label pElemRef = gslc_ElemCreateBtnTxt(&m_gui,E_ELEM_BTN_SD_FMT,E_SD_CARD, (gslc_tsRect){110,190,100,40},(char*)"FORMAT?",0,E_AO_NOTOMONO8PT7B,&CbBtnCommon); gslc_ElemSetCol(&m_gui,pElemRef,GSLC_COL_RED_DK1,GSLC_COL_GRAY,GSLC_COL_RED_DK1); // ----------------------------------- // PAGE: E_PG_SD_CONFIRM // Create E_ELEM_BOX1 box pElemRef = gslc_ElemCreateBox(&m_gui,E_ELEM_BOX1,E_PG_SD_CONFIRM,(gslc_tsRect){0,0,320,240}); gslc_ElemSetCol(&m_gui,pElemRef,GSLC_COL_BLACK,GSLC_COL_BLACK,GSLC_COL_BLACK); // Create E_ELEM_TEXT14 text label pElemRef = gslc_ElemCreateTxt(&m_gui,E_ELEM_TEXT14,E_PG_SD_CONFIRM,(gslc_tsRect){0,30,320,42}, (char*)"Format SD Card?",0,E_AO_NOTOMONO16PT7B); gslc_ElemSetTxtAlign(&m_gui,pElemRef,GSLC_ALIGN_MID_MID); gslc_ElemSetTxtCol(&m_gui,pElemRef,GSLC_COL_RED_LT1); // Create E_ELEM_TEXT15 text label pElemRef = gslc_ElemCreateTxt(&m_gui,E_ELEM_TEXT15,E_PG_SD_CONFIRM,(gslc_tsRect){0,90,320,32}, (char*)"This will ERASE it!",0,E_AO_NOTOMONO12PT7B); gslc_ElemSetTxtAlign(&m_gui,pElemRef,GSLC_ALIGN_MID_MID); gslc_ElemSetTxtCol(&m_gui,pElemRef,GSLC_COL_RED_LT4); // create E_ELEM_SD_NO button with text label pElemRef = gslc_ElemCreateBtnTxt(&m_gui,E_ELEM_SD_NO,E_PG_SD_CONFIRM, (gslc_tsRect){50,160,80,40},(char*)"No",0,E_AO_NOTOMONO10PT7B,&CbBtnCommon); gslc_ElemSetCol(&m_gui,pElemRef,GSLC_COL_BLUE_LT2,GSLC_COL_GRAY,GSLC_COL_BLUE_LT2); m_pElemBtSDNo = pElemRef; // create E_ELEM_SD_YES button with text label pElemRef = gslc_ElemCreateBtnTxt(&m_gui,E_ELEM_SD_YES,E_PG_SD_CONFIRM, (gslc_tsRect){170,160,80,40},(char*)"Yes",0,E_AO_NOTOMONO10PT7B,&CbBtnCommon); gslc_ElemSetCol(&m_gui,pElemRef,GSLC_COL_RED_LT1,GSLC_COL_GRAY,GSLC_COL_RED_LT1); m_pElemBtSDYes = pElemRef; // // // } #endif // end _GUISLICE_GEN_H