[Table] Fixes
This commit is contained in:
+3
-3
@@ -30,7 +30,7 @@ void Table::Header::paint(BitmapBuffer * dc)
|
|||||||
if (cell) {
|
if (cell) {
|
||||||
cell->paint(dc, x, 0, TABLE_HEADER_FONT);
|
cell->paint(dc, x, 0, TABLE_HEADER_FONT);
|
||||||
}
|
}
|
||||||
x += columnsWidth[i];
|
x += static_cast<Table *>(parent)->columnsWidth[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ void Table::Body::checkEvents()
|
|||||||
coord_t x = 10;
|
coord_t x = 10;
|
||||||
for (unsigned i = 0; i < line->cells.size(); i++) {
|
for (unsigned i = 0; i < line->cells.size(); i++) {
|
||||||
auto cell = line->cells[i];
|
auto cell = line->cells[i];
|
||||||
auto width = columnsWidth[i];
|
auto width = static_cast<Table *>(parent)->columnsWidth[i];
|
||||||
if (cell && cell->needsInvalidate()) {
|
if (cell && cell->needsInvalidate()) {
|
||||||
invalidate({x, y, width, TABLE_LINE_HEIGHT - 2});
|
invalidate({x, y, width, TABLE_LINE_HEIGHT - 2});
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ void Table::Body::paint(BitmapBuffer * dc)
|
|||||||
if (cell) {
|
if (cell) {
|
||||||
cell->paint(dc, x, y, line->flags | (highlight ? MENU_HIGHLIGHT_COLOR : DEFAULT_COLOR));
|
cell->paint(dc, x, y, line->flags | (highlight ? MENU_HIGHLIGHT_COLOR : DEFAULT_COLOR));
|
||||||
}
|
}
|
||||||
x += columnsWidth[i];
|
x += static_cast<Table *>(parent)->columnsWidth[i];
|
||||||
}
|
}
|
||||||
y += TABLE_LINE_HEIGHT;
|
y += TABLE_LINE_HEIGHT;
|
||||||
index += 1;
|
index += 1;
|
||||||
|
|||||||
+3
-9
@@ -126,8 +126,7 @@ class Table: public FormField {
|
|||||||
public:
|
public:
|
||||||
Header(Table * parent, const rect_t & rect, uint8_t columnsCount):
|
Header(Table * parent, const rect_t & rect, uint8_t columnsCount):
|
||||||
Window(parent, rect, OPAQUE),
|
Window(parent, rect, OPAQUE),
|
||||||
Line(columnsCount),
|
Line(columnsCount)
|
||||||
columnsWidth(parent->columnsWidth)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,9 +138,6 @@ class Table: public FormField {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void paint(BitmapBuffer * dc) override;
|
void paint(BitmapBuffer * dc) override;
|
||||||
|
|
||||||
protected:
|
|
||||||
std::vector<coord_t> & columnsWidth;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Body: public Window {
|
class Body: public Window {
|
||||||
@@ -149,8 +145,7 @@ class Table: public FormField {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
Body(Table * parent, const rect_t & rect, WindowFlags windowFlags):
|
Body(Table * parent, const rect_t & rect, WindowFlags windowFlags):
|
||||||
Window(parent, rect, windowFlags),
|
Window(parent, rect, windowFlags)
|
||||||
columnsWidth(parent->columnsWidth)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +220,6 @@ class Table: public FormField {
|
|||||||
void checkEvents() override;
|
void checkEvents() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<coord_t> & columnsWidth;
|
|
||||||
std::vector<Line *> lines;
|
std::vector<Line *> lines;
|
||||||
int selection = -1;
|
int selection = -1;
|
||||||
};
|
};
|
||||||
@@ -270,7 +264,7 @@ class Table: public FormField {
|
|||||||
restWidth -= columnWidth;
|
restWidth -= columnWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (restColumn) {
|
if (restColumn >= 0) {
|
||||||
columnsWidth[restColumn] = restWidth;
|
columnsWidth[restColumn] = restWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user