-
-
Notifications
You must be signed in to change notification settings - Fork 192
Output
This page describes output objects, see output initialization for more details.
#color tables
each color table line is in the format:
{{disabled normal,disabled selected},{enabled normal,enabled selected, enabled editing}}
lines are:
bgColor - normal background colors
fgColor - normal foreground color
valColor - values color
unitColor - numeric field unit color
cursorColor - cursor color
titleColor - menu title color
Menu output devices use a list of panels with at least one defined panel. A panel describes an output area within the output device, it can be a single panel occupying all the device or part of it, leaving some shared space, or it may be a list of several panels.
Multiple panels allow preview of sub-menus or field option values if the output device has the usePreview style. If there are more available panels then previous menus can be used to fill the navigation history on the free panels (left). The current menu panel is between the history and the preview.
struct panel {
idx_t x,y,w,h;
inline idx_t maxX() const {return x+w;}
inline idx_t maxY() const {return y+h;}
};
public data members:
const panel panels* an array of panel structures.
navNode** nodes some RAM space for dynamic navigation data, basically what node is at what panel. This is statically allocated and delivered here for usage. MENU_OUTPUTS Macro automates this construction.
const idx_t sz number of panels
idx_t cur=0 current panel
panelsList(const panel panels[],navNode* nodes[],idx_t sz)
where:
panels array of panel structures
nodes array of navNode pointers (ram) with size equals the number of panels
sz number of panels
void reset(idx_t from=0) clear all panels references to menu nodes
const panel operator[](idx_t i) const get a panel by index
idx_t maxX() const get max X of all panels
idx_t maxY() const get max Y of all panels
#class outputsList
Specifies a set of output devices to construct a root navigation object.
The menu system supports simultaneous output to a list of devices, allowing technical or debug alternatives.
Most of the function members need not be called by the user, unless of course the user wishes to use the output driver to display messages or clear the screen.
Because some devices require multiple pass drawing, messages are better handled by alert, see navRoot object.
For headless menu (no output devices) we can use a zero length list for device output.
example:
outputsList out(NULL,0);
int cnt=1 number of output devices
menuOut const outs** array of output device drivers
outputsList(menuOut* const outA[],int n);
where:
outA array of output devices
n number of output devices
menuOut& operator[](idx_t i) get output device by index
void printMenu(navNode& nav) const print specified navNode on all devices
void clearLine(idx_t ln,idx_t panelNr=0,colorDefs color=bgColor,bool selected=false,status stat=enabledStatus) const clear a line
void clearChanged(navNode& nav) const signal navNode as drawn
void clear() clear all devices
void setCursor(idx_t x,idx_t y) set cursor position
void setColor(colorDefs c,bool selected=false,status s=enabledStatus) set current color
void drawCursor(idx_t ln,bool selected,status stat,idx_t panelNr=0) draw cursor
void doNav(navCmd cmd,class navNode &nav) apply navigation command on all devices (experimental)
result idle(idleFunc f,idleEvent e) apply idle on all devices
#class menuOut:public Print
This class serves as a base for menu output devices. It is derived from system's Print class, that makes it handy for printing out information on the device.
describes the output device attributes and or capabilities. Styles are binary masks and can be combined.
- none use default
- redraw device uses multiple pass redraw (ex: U8Glib 1)
- minimalRedraw device can do partial screen updates. LCD's and TFT usually can, Serial can't.
- drawNumIndex draw numeric index accelerators on this device. If true options from 1 to 9 are printed with the respective [index] at left.
- usePreview use menu or options preview on next panel, if available.
- expandEnums the last element of the enum, just for size control.
Enumerates drawing parts for use in wrapping clients, as the web interface used by ESP8266. The driver or format function will be called on start and end of each part, parts are wrapped starting with a fmtPanel at root.
parts:
fmtPanel,fmtTitle,fmtBody,fmtOp,fmtIdx,fmtCursor,fmtOpBody,fmtPreview,fmtPrompt,fmtField,fmtToggle,fmtSelect,fmtChoose,fmtUnit
idx_t tops* ram workspace for scroll position for panel/node on this device
panelsList& panels the list of panels
idx_t lastSel=-1 internal control of last selection (might be removed)
menuOut(idx_t *topsList,panelsList &pan,styles os=minimalRedraw)
where:
topsList RAM area for dynamic navigation data with size equal to the number of panels
pan a list of panels
os output device styles (enum styles)