diff --git a/radio/src/thirdparty/libopenui/src/table.cpp b/radio/src/thirdparty/libopenui/src/table.cpp index 3fc1b7e39..e0b1424fe 100644 --- a/radio/src/thirdparty/libopenui/src/table.cpp +++ b/radio/src/thirdparty/libopenui/src/table.cpp @@ -38,10 +38,11 @@ void Table::Body::paint(BitmapBuffer * dc) coord_t x; int index = 0; for (auto & line: lines) { - dc->drawSolidFilledRect(0, y, width(), TABLE_LINE_HEIGHT - 2, index == selection ? MENU_HIGHLIGHT_BGCOLOR : TABLE_BGCOLOR); + bool highlight = hasFocus() && index == selection; + dc->drawSolidFilledRect(0, y, width(), TABLE_LINE_HEIGHT - 2, highlight ? MENU_HIGHLIGHT_BGCOLOR : TABLE_BGCOLOR); x = 10; for (unsigned i = 0; i < line.values.size(); i++) { - dc->drawText(x, y + (TABLE_LINE_HEIGHT - getFontHeight(TABLE_BODY_FONT)) / 2 + 3, line.values[i].c_str(), line.flags | (index == selection ? MENU_HIGHLIGHT_COLOR : DEFAULT_COLOR)); + dc->drawText(x, y + (TABLE_LINE_HEIGHT - getFontHeight(TABLE_BODY_FONT)) / 2 + 3, line.values[i].c_str(), line.flags | (highlight ? MENU_HIGHLIGHT_COLOR : DEFAULT_COLOR)); x += columnsWidth[i]; } y += TABLE_LINE_HEIGHT; @@ -54,6 +55,7 @@ bool Table::Body::onTouchEnd(coord_t x, coord_t y) { unsigned index = y / TABLE_LINE_HEIGHT; if (index < lines.size()) { + setFocus(SET_FOCUS_DEFAULT); auto onPress = lines[index].onPress; if (onPress) onPress(); diff --git a/radio/src/thirdparty/libopenui/src/table.h b/radio/src/thirdparty/libopenui/src/table.h index 1791b3216..bba715aed 100644 --- a/radio/src/thirdparty/libopenui/src/table.h +++ b/radio/src/thirdparty/libopenui/src/table.h @@ -20,12 +20,12 @@ #ifndef _TABLE_H_ #define _TABLE_H_ -#include "window.h" +#include "form.h" #include #include #include "libopenui_config.h" -class Table: public Window { +class Table: public FormField { class Line { public: explicit Line(uint8_t columnsCount): @@ -135,7 +135,7 @@ class Table: public Window { public: Table(Window * parent, const rect_t & rect, uint8_t columnsCount, WindowFlags windowFlags = OPAQUE): - Window(parent, rect), + FormField(parent, rect), columnsCount(columnsCount), columnsWidth(columnsCount, width() / columnsCount), header(this, {0, 0, width(), 0}, columnsCount), @@ -218,7 +218,7 @@ class Table: public Window { clearSelection(); } - uint8_t size() + uint8_t size() const { return body.lines.size(); }