#pragma once #include #include "GwApi.h" #include #include #define MAX_PAGE_NUMBER 4 typedef std::vector ValueList; typedef struct{ String pageName; //the values will always contain the user defined values first ValueList values; } PageData; typedef struct{ GwApi::Status status; GwLog *logger=NULL; GwConfigHandler *config=NULL; } CommonData; //a base class that all pages must inherit from class Page{ public: virtual void displayPage(CommonData &commonData, PageData &pageData)=0; virtual void displayNew(CommonData &commonData, PageData &pageData){} //return -1 if handled by the page virtual int handleKey(int key){return key;} }; typedef std::function PageFunction; typedef std::vector StringList; /** * a class that describes a page * it contains the name (type) * the number of expected user defined boat Values * and a list of boatValue names that are fixed * for each page you define a variable of this type * and add this to registerAllPages in the obp60task */ class PageDescription{ public: String pageName; int userParam=0; StringList fixedParam; PageFunction creator; bool header=true; PageDescription(String name, PageFunction creator,int userParam,StringList fixedParam,bool header=true){ this->pageName=name; this->userParam=userParam; this->fixedParam=fixedParam; this->creator=creator; this->header=header; } PageDescription(String name, PageFunction creator,int userParam,bool header=true){ this->pageName=name; this->userParam=userParam; this->creator=creator; this->header=header; } };