44//
55// This program is distributed under the terms of the GPL v2.0 or later
66// Download the GNU Public License (GPL) from www.gnu.org
7- //
7+ //
88
99#ifndef ANSIWIDGET_H
1010#define ANSIWIDGET_H
@@ -37,7 +37,7 @@ struct Widget : public Shape {
3737 virtual void clicked (IButtonListener *listener, int x, int y) = 0;
3838 virtual bool overlaps (MAPoint2d pt, int scrollX, int scrollY, bool &redraw);
3939 void drawButton (const char *caption, int x, int y, int w, int h, bool pressed);
40- void drawLink (const char *caption, int x, int y);
40+ void drawLink (const char *caption, int x, int y, int sw, int chw );
4141 int getBackground (int buttonColor);
4242
4343 bool _pressed;
@@ -60,16 +60,18 @@ struct TextButton : public Button {
6060 TextButton (Screen *screen, const char *action, const char *label,
6161 int x, int y, int w, int h) :
6262 Button (screen, action, label, x, y, w, h) {}
63- void draw (int x, int y) { drawLink (_label.c_str (), x, y); }
63+ void draw (int x, int y, int bw, int cw) {
64+ drawLink (_label.c_str (), x, y, bw, cw);
65+ }
6466};
6567
6668// internal block button
6769struct BlockButton : public Button {
6870 BlockButton (Screen *screen, const char *action, const char *label,
6971 int x, int y, int w, int h) :
7072 Button (screen, action, label, x, y, w, h) {}
71- void draw (int x, int y) {
72- drawButton (_label.c_str (), x, y, _width, _height, _pressed);
73+ void draw (int x, int y, int bw, int cw ) {
74+ drawButton (_label.c_str (), x, y, _width, _height, _pressed);
7375 }
7476};
7577
@@ -105,8 +107,8 @@ struct FormButton : public FormWidget {
105107 virtual ~FormButton () {}
106108
107109 const char *getText () const { return _caption.c_str (); }
108- void draw (int x, int y) {
109- drawButton (_caption.c_str (), x, y, _width, _height, _pressed);
110+ void draw (int x, int y, int sw, int chw ) {
111+ drawButton (_caption.c_str (), x, y, _width, _height, _pressed);
110112 }
111113 void clicked (IButtonListener *listener, int x, int y);
112114 void setText (const char *text) { _caption = text; }
@@ -120,7 +122,7 @@ struct FormLabel : public FormWidget {
120122 virtual ~FormLabel () {}
121123
122124 const char *getText () const { return _caption.c_str (); }
123- void draw (int x, int y) {
125+ void draw (int x, int y, int sw, int chw ) {
124126 drawButton (_caption.c_str (), x, y, _width, _height, false );
125127 }
126128 void setText (const char *text) { _caption = text; }
@@ -134,19 +136,21 @@ struct FormLink : public FormWidget {
134136 virtual ~FormLink () {}
135137
136138 const char *getText () const { return _link.c_str (); }
137- void draw (int x, int y) { drawLink (_link.c_str (), x, y); }
139+ void draw (int x, int y, int sw, int chw) {
140+ drawLink (_link.c_str (), x, y, sw, chw);
141+ }
138142
139143private:
140144 String _link;
141145};
142146
143147struct FormLineInput : public FormWidget {
144- FormLineInput (Screen *screen, char *buffer, int maxSize,
148+ FormLineInput (Screen *screen, char *buffer, int maxSize,
145149 int x, int y, int w, int h);
146150 virtual ~FormLineInput () {}
147151
148152 void close ();
149- void draw (int x, int y);
153+ void draw (int x, int y, int sw, int chw );
150154 bool edit (int key);
151155 const char *getText () const { return _buffer; }
152156 void setText (const char *text) {}
@@ -158,7 +162,7 @@ struct FormLineInput : public FormWidget {
158162};
159163
160164struct FormList : public FormWidget {
161- FormList (Screen *screen, IFormWidgetListModel *model,
165+ FormList (Screen *screen, IFormWidgetListModel *model,
162166 int x, int y, int w, int h);
163167 virtual ~FormList () {}
164168
@@ -173,7 +177,7 @@ struct FormList : public FormWidget {
173177};
174178
175179struct FormDropList : public FormList {
176- FormDropList (Screen *screen, IFormWidgetListModel *model,
180+ FormDropList (Screen *screen, IFormWidgetListModel *model,
177181 int x, int y, int w, int h);
178182 void clicked (IButtonListener *listener, int x, int y);
179183 void draw (int dx, int dy);
@@ -189,7 +193,7 @@ struct FormDropList : public FormList {
189193};
190194
191195struct FormListBox : public FormList {
192- FormListBox (Screen *screen, IFormWidgetListModel *model,
196+ FormListBox (Screen *screen, IFormWidgetListModel *model,
193197 int x, int y, int w, int h);
194198 void clicked (IButtonListener *listener, int x, int y);
195199 void draw (int dx, int dy);
@@ -264,7 +268,7 @@ struct AnsiWidget {
264268
265269 Screen *_screens[MAX_SCREENS];
266270 Screen *_back; // screen being painted/written
267- Screen *_front; // screen to display
271+ Screen *_front; // screen to display
268272 Screen *_focus; // screen with the active button
269273 int _width; // device screen width
270274 int _height; // device screen height
0 commit comments