@@ -34,80 +34,80 @@ struct AnsiWidget {
3434 ~AnsiWidget ();
3535
3636 void addImage (ImageDisplay &image);
37- void addInput (FormInput *input) { _back->_inputs .add (input); }
37+ void addInput (FormInput *input) const { _back->_inputs .add (input); }
3838 void clearScreen ();
3939 bool construct ();
4040 void drawArc (int xc, int yc, double r, double start, double end, double aspect);
4141 void drawEllipse (int xc, int yc, int rx, int ry, int fill);
4242 void drawImage (ImageDisplay &image);
43- void drawOverlay (bool vscroll) { _back->drawOverlay (vscroll); }
43+ void drawOverlay (bool vscroll) const { _back->drawOverlay (vscroll); }
4444 void drawLine (int x1, int y1, int x2, int y2);
4545 void drawRect (int x1, int y1, int x2, int y2);
46- void drawRectFilled (int x1, int y1, int x2, int y2);
47- void flush (bool force, bool vscroll=false , int maxPending = MAX_PENDING);
48- void flushNow () { if (_front) _front->drawBase (false ); }
49- int getBackgroundColor () { return _back->_bg ; }
50- int getCharHeight () { return _back->_charHeight ; }
51- int getCharWidth () { return _back->_charWidth ; }
52- int getColor () { return _back->_fg ; }
46+ void drawRectFilled (int x1, int y1, int x2, int y2) const ;
47+ void flush (bool force, bool vscroll=false , int maxPending = MAX_PENDING) const ;
48+ void flushNow () const { if (_front) _front->drawBase (false ); }
49+ int getBackgroundColor () const { return _back->_bg ; }
50+ int getCharHeight () const { return _back->_charHeight ; }
51+ int getCharWidth () const { return _back->_charWidth ; }
52+ int getColor () const { return _back->_fg ; }
5353 int getFontSize () const { return _fontSize; }
54- FormInput *getNextField (FormInput *field) { return _back->getNextField (field); }
55- int getPixel (int x, int y) { return _back->getPixel (x, y); }
56- int getStatusHeight () { return _back->_height - _back->_statusOffset ; }
57- int getScreenId (bool back);
58- int getScreenWidth () { return _back->_width ; }
59- void getScroll (int &x, int &y) { _back->getScroll (x, y); }
54+ FormInput *getNextField (FormInput *field) const { return _back->getNextField (field); }
55+ int getPixel (int x, int y) const { return _back->getPixel (x, y); }
56+ int getStatusHeight () const { return _back->_height - _back->_statusOffset ; }
57+ int getScreenId (bool back) const ;
58+ int getScreenWidth () const { return _back->_width ; }
59+ void getScroll (int &x, int &y) const { _back->getScroll (x, y); }
6060 int getHeight () const { return _height; }
6161 int getWidth () const { return _width; }
62- int getX () { return _back->_curX ; }
63- int getY () { return _back->_curY ; }
62+ int getX () const { return _back->_curX ; }
63+ int getY () const { return _back->_curY ; }
6464 int getMenuIndex () const { return _back->getIndex (_activeButton); }
6565 bool hasActiveButton () const { return _activeButton != nullptr ; }
6666 bool hasHover () const { return _hoverInput != nullptr ; }
6767 bool hasMenu () const { return _back == _screens[MENU_SCREEN]; }
6868 void handleMenu (bool up);
6969 void insetMenuScreen (int x, int y, int w, int h);
7070 void insetTextScreen (int x, int y, int w, int h);
71- bool overLabel (int x, int y) { return _back->overLabel (x, y); };
72- bool overMenu (int x, int y) { return _back->overMenu (x, y); };
71+ bool overLabel (int x, int y) const { return _back->overLabel (x, y); };
72+ bool overMenu (int x, int y) const { return _back->overMenu (x, y); };
7373 bool pointerTouchEvent (MAEvent &event);
7474 bool pointerMoveEvent (MAEvent &event);
75- void pointerReleaseEvent (MAEvent &event);
75+ void pointerReleaseEvent (const MAEvent &event);
7676 void print (const char *str);
7777 void redraw ();
7878 void removeHover ();
79- void removeImage (int imageId) { _back->removeImage (imageId); }
80- bool removeInput (FormInput *input) { return _back->removeInput (input); }
79+ void removeImage (int imageId) const { _back->removeImage (imageId); }
80+ bool removeInput (FormInput *input) const { return _back->removeInput (input); }
8181 void removeInputs ();
82- void resetScroll () { _back->resetScroll (); }
82+ void resetScroll () const { _back->resetScroll (); }
8383 void reset ();
84- void resetFont () { _back->reset (_fontSize); _back->updateFont (); }
84+ void resetFont () const { _back->reset (_fontSize); _back->updateFont (); }
8585 void resize (int width, int height);
8686 bool scroll (bool up, bool page);
8787 void selectBackScreen (int screenId);
8888 void selectFrontScreen (int screenId);
8989 int selectScreen (int screenId, bool forceFlush=true );
9090 void setColor (long color);
91- void setDirty () { _back->setDirty (); }
91+ void setDirty () const { _back->setDirty (); }
9292 void setAutoflush (bool autoflush) { _autoflush = autoflush; }
9393 void setFont (int size, bool bold, bool italic);
9494 void setFontSize (int fontSize);
95- void setPixel (int x, int y, int c);
96- void setScroll (int x, int y) { _back->setScroll (x, y); }
97- void setStatus (const char *label);
98- void setTextColor (long fg, long bg);
95+ void setPixel (int x, int y, int c) const ;
96+ void setScroll (int x, int y) const { _back->setScroll (x, y); }
97+ void setStatus (const char *label) const ;
98+ void setTextColor (long fg, long bg) const ;
9999 void setXY (int x, int y);
100- int textHeight () { return _back->_charHeight ; }
101- void updateInputs (var_p_t form, bool setv) { _back->updateInputs (form, setv); }
100+ int textHeight () const { return _back->_charHeight ; }
101+ void updateInputs (var_p_t form, bool setv) const { _back->updateInputs (form, setv); }
102102
103103private:
104104 Screen *createScreen (int screenId);
105- bool doEscape (const char *&p, int textHeight);
105+ bool doEscape (const char *&p, int textHeight) const ;
106106 void doSwipe (int start, bool moveDown, int distance, int maxScroll);
107- void drawActiveButton ();
108- bool drawHoverLink (MAEvent &event);
107+ void drawActiveButton () const ;
108+ bool drawHoverLink (const MAEvent &event);
109109 void handleEscape (const char *&p, int textHeight);
110- bool setActiveButton (MAEvent &event, Screen *screen);
110+ bool setActiveButton (const MAEvent &event, Screen *screen);
111111
112112 Screen *_screens[MAX_SCREENS]{};
113113 Screen *_back; // screen being painted/written
0 commit comments