graphdisplay now with confirm and back
This commit is contained in:
@ -9,6 +9,8 @@
|
|||||||
#include "widgets/label.h"
|
#include "widgets/label.h"
|
||||||
#include "widgets/graph.h"
|
#include "widgets/graph.h"
|
||||||
#include "tftinstance.h"
|
#include "tftinstance.h"
|
||||||
|
#include "confirminterface.h"
|
||||||
|
#include "backinterface.h"
|
||||||
|
|
||||||
namespace espgui {
|
namespace espgui {
|
||||||
template<size_t COUNT>
|
template<size_t COUNT>
|
||||||
@ -41,7 +43,9 @@ public:
|
|||||||
template<size_t COUNT>
|
template<size_t COUNT>
|
||||||
class GraphDisplay :
|
class GraphDisplay :
|
||||||
public DisplayWithTitle,
|
public DisplayWithTitle,
|
||||||
public virtual GraphAccessorInterface<COUNT>
|
public virtual GraphAccessorInterface<COUNT>,
|
||||||
|
public virtual ConfirmInterface,
|
||||||
|
public virtual BackInterface
|
||||||
{
|
{
|
||||||
using Base = DisplayWithTitle;
|
using Base = DisplayWithTitle;
|
||||||
|
|
||||||
@ -49,6 +53,8 @@ public:
|
|||||||
void initScreen() override;
|
void initScreen() override;
|
||||||
void redraw() override;
|
void redraw() override;
|
||||||
|
|
||||||
|
void buttonPressed(Button button) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr int screenHeight = 320, topMargin = 40, bottomMargin = 10, labelOffset = -5;
|
static constexpr int screenHeight = 320, topMargin = 40, bottomMargin = 10, labelOffset = -5;
|
||||||
static constexpr int graphHeight = screenHeight-topMargin-bottomMargin;
|
static constexpr int graphHeight = screenHeight-topMargin-bottomMargin;
|
||||||
@ -71,4 +77,17 @@ void GraphDisplay<COUNT>::redraw()
|
|||||||
|
|
||||||
m_graph.redraw(static_cast<const GraphAccessorInterface<COUNT> &>(*this).getBuffers());
|
m_graph.redraw(static_cast<const GraphAccessorInterface<COUNT> &>(*this).getBuffers());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<size_t COUNT>
|
||||||
|
void GraphDisplay<COUNT>::buttonPressed(Button button)
|
||||||
|
{
|
||||||
|
Base::buttonPressed(button);
|
||||||
|
|
||||||
|
switch (button)
|
||||||
|
{
|
||||||
|
case Button::Left: back(); break;
|
||||||
|
case Button::Right: confirm(); break;
|
||||||
|
default:;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user