Control Surface master
MIDI Control Surface library for Arduino
SelectorDisplay.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Banks/Bank.hpp>
6
8
13 public:
15 int16_t offset, int16_t multiplier, PixelLocation loc,
16 uint8_t size, uint16_t color)
18 multiplier(multiplier), x(loc.x), y(loc.y), size(size), color(color) {
19 }
20 void draw() override {
24 setting_t selection = selector.get();
25 display.print(selection * multiplier + offset);
26 previous = selection;
27 }
28
29 bool getDirty() const override { return previous != selector.get(); }
30
31 private:
34 int16_t offset, multiplier, x, y;
35 uint8_t size;
36 uint16_t color;
37};
38
43 public:
45 PixelLocation loc, uint8_t size, uint16_t color)
47 y(loc.y), size(size), color(color) {}
48
49 void draw() override {
53 uint8_t bankoffset = bank.getOffset();
54 display.print(bankoffset + offset);
55 previous = bankoffset;
56 }
57
58 bool getDirty() const override { return previous != bank.getOffset(); }
59
60 private:
62 uint8_t previous = 0xFF;
63 int16_t offset, x, y;
64 uint8_t size;
65 uint16_t color;
66};
67
constexpr setting_t NO_SETTING
A special setting that indicates an unused or invalid setting.
Definition: Def.hpp:53
uint8_t setting_t
The type used for Selectors.
Definition: Def.hpp:51
A simple struct representing a pixel with integer coordinates.
Definition: Def.hpp:62
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
A class for displaying the setting of a Bank object.
bool getDirty() const override
Check if this DisplayElement has to be re-drawn.
OutputBank & bank
BankDisplay(DisplayInterface &display, OutputBank &bank, int16_t offset, PixelLocation loc, uint8_t size, uint16_t color)
void draw() override
Draw this DisplayElement to the display buffer.
An interface for elements that draw to a display.
DisplayInterface & display
An interface for displays.
virtual void setTextColor(uint16_t color)=0
Set the text color.
virtual void setCursor(int16_t x, int16_t y)=0
Set the cursor position.
virtual void setTextSize(uint8_t size)=0
Set the text size.
A class for changing the address of BankableMIDIOutputs.
Definition: Bank.hpp:16
int8_t getOffset() const
Get the address offset (number of banks times the index of the selected bank after applying the offse...
Definition: Bank.hpp:58
Base class for all Selectors exposing the get method, so it can be used by display elements etc,...
Definition: Selector.hpp:39
setting_t get() const
Get the current selection/setting.
Definition: Selector.hpp:46
A class for displaying the setting of a Selector object.
bool getDirty() const override
Check if this DisplayElement has to be re-drawn.
SelectorDisplay(DisplayInterface &display, SelectorBase &selector, int16_t offset, int16_t multiplier, PixelLocation loc, uint8_t size, uint16_t color)
SelectorBase & selector
void draw() override
Draw this DisplayElement to the display buffer.