@@ -34,80 +34,80 @@ struct AnsiWidget {
34
34
~AnsiWidget ();
35
35
36
36
void addImage (ImageDisplay &image);
37
- void addInput (FormInput *input) { _back->_inputs .add (input); }
37
+ void addInput (FormInput *input) const { _back->_inputs .add (input); }
38
38
void clearScreen ();
39
39
bool construct ();
40
40
void drawArc (int xc, int yc, double r, double start, double end, double aspect);
41
41
void drawEllipse (int xc, int yc, int rx, int ry, int fill);
42
42
void drawImage (ImageDisplay &image);
43
- void drawOverlay (bool vscroll) { _back->drawOverlay (vscroll); }
43
+ void drawOverlay (bool vscroll) const { _back->drawOverlay (vscroll); }
44
44
void drawLine (int x1, int y1, int x2, int y2);
45
45
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 ; }
53
53
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); }
60
60
int getHeight () const { return _height; }
61
61
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 ; }
64
64
int getMenuIndex () const { return _back->getIndex (_activeButton); }
65
65
bool hasActiveButton () const { return _activeButton != nullptr ; }
66
66
bool hasHover () const { return _hoverInput != nullptr ; }
67
67
bool hasMenu () const { return _back == _screens[MENU_SCREEN]; }
68
68
void handleMenu (bool up);
69
69
void insetMenuScreen (int x, int y, int w, int h);
70
70
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); };
73
73
bool pointerTouchEvent (MAEvent &event);
74
74
bool pointerMoveEvent (MAEvent &event);
75
- void pointerReleaseEvent (MAEvent &event);
75
+ void pointerReleaseEvent (const MAEvent &event);
76
76
void print (const char *str);
77
77
void redraw ();
78
78
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); }
81
81
void removeInputs ();
82
- void resetScroll () { _back->resetScroll (); }
82
+ void resetScroll () const { _back->resetScroll (); }
83
83
void reset ();
84
- void resetFont () { _back->reset (_fontSize); _back->updateFont (); }
84
+ void resetFont () const { _back->reset (_fontSize); _back->updateFont (); }
85
85
void resize (int width, int height);
86
86
bool scroll (bool up, bool page);
87
87
void selectBackScreen (int screenId);
88
88
void selectFrontScreen (int screenId);
89
89
int selectScreen (int screenId, bool forceFlush=true );
90
90
void setColor (long color);
91
- void setDirty () { _back->setDirty (); }
91
+ void setDirty () const { _back->setDirty (); }
92
92
void setAutoflush (bool autoflush) { _autoflush = autoflush; }
93
93
void setFont (int size, bool bold, bool italic);
94
94
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 ;
99
99
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); }
102
102
103
103
private:
104
104
Screen *createScreen (int screenId);
105
- bool doEscape (const char *&p, int textHeight);
105
+ bool doEscape (const char *&p, int textHeight) const ;
106
106
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);
109
109
void handleEscape (const char *&p, int textHeight);
110
- bool setActiveButton (MAEvent &event, Screen *screen);
110
+ bool setActiveButton (const MAEvent &event, Screen *screen);
111
111
112
112
Screen *_screens[MAX_SCREENS]{};
113
113
Screen *_back; // screen being painted/written
0 commit comments