This is an old version of the documentation. View the latest version here.
Control Surface  1.0.0
MIDI Control Surface library for Arduino
SelectorDisplay.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Banks/Bank.hpp>
5 #include <Selectors/Selector.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 {
23  display.setCursor(x, y);
24  display.print(selector.get() * multiplier + offset);
25  }
26 
27  private:
29  int16_t offset, multiplier, x, y;
30  uint8_t size;
31  uint16_t color;
32 };
33 
37 class BankDisplay : public DisplayElement {
38  public:
40  PixelLocation loc, uint8_t size, uint16_t color)
42  y(loc.y), size(size), color(color) {}
43 
44  void draw() override {
47  display.setCursor(x, y);
48  display.print(bank.getOffset() + offset);
49  }
50 
51  private:
53  int16_t offset, x, y;
54  uint8_t size;
55  uint16_t color;
56 };
57 
OutputBank
A class for changing the address of BankableMIDIOutputs.
Definition: Bank.hpp:20
SelectorDisplay
A class for displaying the setting of a Selector object.
Definition: SelectorDisplay.hpp:12
BankDisplay::bank
OutputBank & bank
Definition: SelectorDisplay.hpp:52
SelectorBase::get
setting_t get() const
Get the current selection/setting.
Definition: Selector.hpp:47
BankDisplay::size
uint8_t size
Definition: SelectorDisplay.hpp:54
DisplayElement
An interface for elements that draw to a display.
Definition: DisplayElement.hpp:11
BankDisplay::y
int16_t y
Definition: SelectorDisplay.hpp:53
BankDisplay::offset
int16_t offset
Definition: SelectorDisplay.hpp:53
DisplayInterface
An interface for displays.
Definition: DisplayInterface.hpp:14
SelectorBase
Base class for all Selectors exposing the get method, so it can be used by display elements etc,...
Definition: Selector.hpp:40
SelectorDisplay::size
uint8_t size
Definition: SelectorDisplay.hpp:30
OutputBank::getOffset
uint8_t getOffset() const
Get the offset (number of banks times the index of the selected bank)
Definition: Bank.hpp:61
BankDisplay
A class for displaying the setting of a Bank object.
Definition: SelectorDisplay.hpp:37
PixelLocation
A simple struct representing a pixel with integer coordinates.
Definition: Def.hpp:74
SelectorDisplay::multiplier
int16_t multiplier
Definition: SelectorDisplay.hpp:29
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: NamespaceSettings.hpp:9
DisplayElement.hpp
DisplayInterface::setCursor
virtual void setCursor(int16_t x, int16_t y)=0
Set the cursor position.
DisplayInterface::setTextSize
virtual void setTextSize(uint8_t size)=0
Set the text size.
BankDisplay::draw
void draw() override
Draw this DisplayElement to the display buffer.
Definition: SelectorDisplay.hpp:44
Selector.hpp
SelectorDisplay::x
int16_t x
Definition: SelectorDisplay.hpp:29
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: NamespaceSettings.hpp:10
DisplayElement::display
DisplayInterface & display
Definition: DisplayElement.hpp:44
SelectorDisplay::draw
void draw() override
Draw this DisplayElement to the display buffer.
Definition: SelectorDisplay.hpp:20
Bank.hpp
BankDisplay::color
uint16_t color
Definition: SelectorDisplay.hpp:55
SelectorDisplay::SelectorDisplay
SelectorDisplay(DisplayInterface &display, SelectorBase &selector, int16_t offset, int16_t multiplier, PixelLocation loc, uint8_t size, uint16_t color)
Definition: SelectorDisplay.hpp:14
SelectorDisplay::offset
int16_t offset
Definition: SelectorDisplay.hpp:29
SelectorDisplay::color
uint16_t color
Definition: SelectorDisplay.hpp:31
BankDisplay::x
int16_t x
Definition: SelectorDisplay.hpp:53
BankDisplay::BankDisplay
BankDisplay(DisplayInterface &display, OutputBank &bank, int16_t offset, PixelLocation loc, uint8_t size, uint16_t color)
Definition: SelectorDisplay.hpp:39
SelectorDisplay::y
int16_t y
Definition: SelectorDisplay.hpp:29
SelectorDisplay::selector
SelectorBase & selector
Definition: SelectorDisplay.hpp:28
DisplayInterface::setTextColor
virtual void setTextColor(uint16_t color)=0
Set the text color.