Table updates
This commit is contained in:
+13
-4
@@ -72,12 +72,14 @@ class Table: public Window {
|
|||||||
void paint(BitmapBuffer * dc) override;
|
void paint(BitmapBuffer * dc) override;
|
||||||
|
|
||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
bool onTouchEnd(coord_t x, coord_t y)
|
bool onTouchEnd(coord_t x, coord_t y) override
|
||||||
{
|
{
|
||||||
unsigned index = y / TABLE_LINE_HEIGHT;
|
unsigned index = y / TABLE_LINE_HEIGHT;
|
||||||
auto onPress = lines[index].onPress;
|
if (index < lines.size()) {
|
||||||
if (onPress)
|
auto onPress = lines[index].onPress;
|
||||||
onPress();
|
if (onPress)
|
||||||
|
onPress();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -112,6 +114,12 @@ class Table: public Window {
|
|||||||
return body.selection;
|
return body.selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clearSelection()
|
||||||
|
{
|
||||||
|
body.selection = -1;
|
||||||
|
body.invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
void setSelection(int index, bool scroll = false)
|
void setSelection(int index, bool scroll = false)
|
||||||
{
|
{
|
||||||
body.selection = index;
|
body.selection = index;
|
||||||
@@ -143,6 +151,7 @@ class Table: public Window {
|
|||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
body.clear();
|
body.clear();
|
||||||
|
clearSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
Reference in New Issue
Block a user