aboutsummaryrefslogtreecommitdiffstats
path: root/source/widget.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/widget.hpp')
-rw-r--r--source/widget.hpp35
1 files changed, 32 insertions, 3 deletions
diff --git a/source/widget.hpp b/source/widget.hpp
index afa9441..32e7009 100644
--- a/source/widget.hpp
+++ b/source/widget.hpp
@@ -1,8 +1,29 @@
+/**
+ * @file widget.hpp
+ * @brief Defines widgets that may be put on the display.
+ *
+ * Copyright (C) 2019 Clyne Sullivan
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
#ifndef WIDGET_HPP_
#define WIDGET_HPP_
class Adafruit_GFX;
+#include <bluefruit.h>
#include <cstring>
class Widget {
@@ -16,7 +37,8 @@ public:
return height;
}
- virtual void render(Adafruit_GFX& display, unsigned int ypos) = 0;
+ virtual void render(Adafruit_GFX& display, int ypos) = 0;
+ virtual bool onPress(void) = 0;
protected:
inline void setHeight(unsigned int _height) {
@@ -32,7 +54,10 @@ public:
constexpr TimeWidget(void)
: Widget(30), prevTicks(0) {}
- void render(Adafruit_GFX& display, unsigned int ypos) final;
+ void render(Adafruit_GFX& display, int ypos) final;
+ bool onPress(void) final {
+ return false;
+ }
};
class NotificationWidget : public Widget {
@@ -49,6 +74,10 @@ public:
setHeight(16 * (i / 12 + 1));
}
- void render(Adafruit_GFX& display, unsigned int ypos) final;
+ void render(Adafruit_GFX& display, int ypos) final;
+ bool onPress(void) final {
+ return true;
+ }
};
+
#endif // WIDGET_HPP_