diff options
Diffstat (limited to 'source/widget.cpp')
-rw-r--r-- | source/widget.cpp | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/source/widget.cpp b/source/widget.cpp index 358de01..b67c4d0 100644 --- a/source/widget.cpp +++ b/source/widget.cpp @@ -21,20 +21,66 @@ #include "rtc.hpp" #include "widget.hpp" +PressAction TimeWidget::onPress(void) +{ + if (getHeight() == 30) + setHeight(SHARP_HEIGHT); + else + setHeight(30); + + return PressAction::Fullscreen; +} + void TimeWidget::render(Adafruit_GFX& display, int ypos) { if (auto t = RTC::ticks(); t != prevTicks) { prevTicks = t; display.setTextSize(3); display.setCursor(0, ypos + 4); - display.printf("%2d:%02d:%02d", t / 3600, (t % 3600) / - 60, t % 60); + display.printf("%2d:%02d:%02d", t / 3600, (t % 3600) / 60, + t % 60); } } +void TimeWidget::renderFullscreen(Adafruit_GFX& display, int ypos) +{ + if (auto t = RTC::ticks(); t != prevTicks) { + prevTicks = t; + display.setTextSize(4); + display.setCursor(12, SHARP_HEIGHT / 3); + display.printf("%2d:%02d", t / 3600, (t % 3600) / 60); + } + +} + void NotificationWidget::render(Adafruit_GFX& display, int ypos) { display.setTextSize(2); display.setCursor(0, ypos); display.printf("%-36s", message); } + +void NoteWidget::render(Adafruit_GFX& display, int ypos) +{ + display.setTextSize(2); + display.setCursor(0, ypos); + display.printf("NOTE:\n%9s...", text); +} + +void NoteWidget::renderFullscreen(Adafruit_GFX& display, int ypos) +{ + display.setTextSize(2); + display.setCursor(0, ypos); + display.print(text); +} + +PressAction NoteWidget::onPress(void) +{ + if (getHeight() == 24) + setHeight(SHARP_HEIGHT); + else + setHeight(24); + + return PressAction::Fullscreen; +} + |