Possibility to have a different font style for all table lines
This commit is contained in:
+1
-1
@@ -41,7 +41,7 @@ void Table::Body::paint(BitmapBuffer * dc)
|
||||
dc->drawSolidFilledRect(0, y, width(), TABLE_LINE_HEIGHT - 2, index == selection ? 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(), TABLE_BODY_FONT | (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 | (index == selection ? MENU_HIGHLIGHT_COLOR : DEFAULT_COLOR));
|
||||
x += columnsWidth[i];
|
||||
}
|
||||
y += TABLE_LINE_HEIGHT;
|
||||
|
||||
+12
-1
@@ -35,6 +35,7 @@ class Table: public Window {
|
||||
std::vector<std::string> values;
|
||||
std::function<void()> onPress;
|
||||
std::function<void()> onSelect;
|
||||
LcdFlags flags = TABLE_BODY_FONT;
|
||||
};
|
||||
|
||||
class Header: public Window {
|
||||
@@ -88,6 +89,11 @@ class Table: public Window {
|
||||
setInnerHeight(lines.size() * TABLE_LINE_HEIGHT - 2);
|
||||
}
|
||||
|
||||
void setLineFlags(uint8_t index, LcdFlags flags)
|
||||
{
|
||||
lines[index].flags = flags;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
lines.clear();
|
||||
@@ -175,6 +181,11 @@ class Table: public Window {
|
||||
body.select(index, scroll);
|
||||
}
|
||||
|
||||
void setLineFlags(uint8_t index, LcdFlags flags)
|
||||
{
|
||||
body.setLineFlags(index, flags);
|
||||
}
|
||||
|
||||
void setHeader(const char * const values[])
|
||||
{
|
||||
header.setHeight(TABLE_HEADER_HEIGHT);
|
||||
@@ -204,7 +215,7 @@ class Table: public Window {
|
||||
clearSelection();
|
||||
}
|
||||
|
||||
int size()
|
||||
uint8_t size()
|
||||
{
|
||||
return body.lines.size();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user