@@ -22,6 +22,9 @@ FormList *activeList = NULL;
2222FormInput *focusInput = NULL ;
2323FormEditInput *focusEdit = NULL ;
2424
25+ #define LINE_Y (_height - 2 )
26+ #define LINE_W (_width - 2 )
27+
2528FormEditInput *get_focus_edit () {
2629 return focusEdit;
2730}
@@ -117,7 +120,9 @@ FormInput::~FormInput() {
117120
118121void FormInput::construct (var_p_t form, var_p_t field, int id) {
119122 _exit = (map_get_bool (field, FORM_INPUT_IS_EXIT));
120- _noFocus = (map_get_bool (field, FORM_INPUT_NO_FOCUS));
123+ if (!_noFocus) {
124+ _noFocus = (map_get_bool (field, FORM_INPUT_NO_FOCUS));
125+ }
121126 _id = id;
122127
123128 var_p_t v_id = map_get (field, FORM_INPUT_ID);
@@ -219,8 +224,8 @@ void FormInput::drawButton(const char *caption, int dx, int dy,
219224void FormInput::drawHover (int dx, int dy, bool selected) {
220225 MAHandle currentHandle = maSetDrawTarget (HANDLE_SCREEN);
221226 maSetColor (selected ? _fg : _bg);
222- int y = _y + dy + _height - 2 ;
223- maLine (dx + _x + 2 , y, dx + _x + _width - 2 , y);
227+ int y = _y + dy + LINE_Y ;
228+ maLine (dx + _x + 2 , y, dx + _x + LINE_W , y);
224229 maUpdateScreen ();
225230 maSetDrawTarget (currentHandle);
226231}
@@ -414,25 +419,28 @@ FormLink::FormLink(const char *link, int x, int y, int w, int h) :
414419 _link(link) {
415420}
416421
422+ void FormLink::draw (int x, int y, int w, int h, int chw) {
423+ drawLink (_link.c_str (), x, y, w, chw);
424+ if (_pressed) {
425+ maSetColor (_pressed ? _fg : _bg);
426+ maLine (x, y + LINE_Y, x + LINE_W, y + LINE_Y);
427+ }
428+ }
429+
417430//
418431// FormTab
419432//
420433FormTab::FormTab (const char *link, int x, int y, int w, int h) :
421434 FormLink(link, x, y, w, h) {
435+ _noFocus = true ;
422436}
423437
424438void FormTab::draw (int x, int y, int w, int h, int chw) {
425439 int x_begin = chw;
426440 int x_end = x + MIN (w, _width);
427441
428- maSetColor (_fg);
429- drawText (_link, x + x_begin, y, w, chw);
430- setTextColor ();
442+ drawLink (_link.c_str (), x + x_begin, y, w, chw);
431443 maLine (x_end, y + 4 , x_end, y + _height - 4 );
432-
433- x_end -= x_begin;
434- maSetColor (_pressed ? _fg : _bg);
435- maLine (x + x_begin, y + _height - 2 , x_end, y + _height - 2 );
436444}
437445
438446int FormTab::padding (bool vert) const {
@@ -1188,9 +1196,9 @@ void MenuButton::draw(int x, int y, int w, int h, int chw) {
11881196 maDrawText (x + 4 , textY, _label.c_str (), len);
11891197 if (!_pressed && _index > 0 && _index % 2 == 0 ) {
11901198 maSetColor (0x3b3a36 );
1191- maLine (x + 2 , y, x + _width - 2 , y);
1199+ maLine (x + 2 , y, x + LINE_W , y);
11921200 maSetColor (0x46453f );
1193- maLine (x + 2 , y - 1 , x + _width - 2 , y - 1 );
1201+ maLine (x + 2 , y - 1 , x + LINE_W , y - 1 );
11941202 }
11951203 }
11961204}
0 commit comments