diff --git a/src/graphdisplay.h b/src/graphdisplay.h index f911f80..7b5b977 100644 --- a/src/graphdisplay.h +++ b/src/graphdisplay.h @@ -9,6 +9,8 @@ #include "widgets/label.h" #include "widgets/graph.h" #include "tftinstance.h" +#include "confirminterface.h" +#include "backinterface.h" namespace espgui { template @@ -41,7 +43,9 @@ public: template class GraphDisplay : public DisplayWithTitle, - public virtual GraphAccessorInterface + public virtual GraphAccessorInterface, + public virtual ConfirmInterface, + public virtual BackInterface { using Base = DisplayWithTitle; @@ -49,6 +53,8 @@ public: void initScreen() override; void redraw() override; + void buttonPressed(Button button) override; + private: static constexpr int screenHeight = 320, topMargin = 40, bottomMargin = 10, labelOffset = -5; static constexpr int graphHeight = screenHeight-topMargin-bottomMargin; @@ -71,4 +77,17 @@ void GraphDisplay::redraw() m_graph.redraw(static_cast &>(*this).getBuffers()); } + +template +void GraphDisplay::buttonPressed(Button button) +{ + Base::buttonPressed(button); + + switch (button) + { + case Button::Left: back(); break; + case Button::Right: confirm(); break; + default:; + } +} }