summaryrefslogtreecommitdiff
path: root/src/ui/include/widget_top_bar.hpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-07-13 10:58:06 +1000
committerjacqueline <me@jacqueline.id.au>2023-07-13 10:58:06 +1000
commitb6bc6b9e47605ede9bffe50445d1afe3acf0ab49 (patch)
tree05c9281c2763919b6a6780191f6ecc54547063ae /src/ui/include/widget_top_bar.hpp
parent2dc700b12f26109d987ad22f530e39d165025656 (diff)
downloadtangara-fw-b6bc6b9e47605ede9bffe50445d1afe3acf0ab49.tar.gz
Ui polish and fleshing out
Diffstat (limited to 'src/ui/include/widget_top_bar.hpp')
-rw-r--r--src/ui/include/widget_top_bar.hpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/ui/include/widget_top_bar.hpp b/src/ui/include/widget_top_bar.hpp
index 9019807f..adb889fc 100644
--- a/src/ui/include/widget_top_bar.hpp
+++ b/src/ui/include/widget_top_bar.hpp
@@ -6,6 +6,7 @@
#pragma once
+#include <cstdint>
#include <string>
#include "lvgl.h"
@@ -16,13 +17,37 @@ namespace widgets {
class TopBar {
public:
- TopBar(lv_obj_t* parent, lv_group_t* group);
+ struct Configuration {
+ bool show_back_button;
+ std::string title;
+ };
- auto set_title(const std::string&) -> void;
+ enum class PlaybackState {
+ kIdle,
+ kPaused,
+ kPlaying,
+ };
+ struct State {
+ PlaybackState playback_state;
+ uint_fast8_t battery_percent;
+ bool is_charging;
+ };
+
+ explicit TopBar(lv_obj_t* parent, const Configuration& config);
+
+ auto root() -> lv_obj_t* { return container_; }
+ auto button() -> lv_obj_t* { return back_button_; }
+
+ auto Update(const State&) -> void;
+
+ private:
lv_obj_t* container_;
- lv_obj_t* title_;
+
lv_obj_t* back_button_;
+ lv_obj_t* title_;
+ lv_obj_t* playback_;
+ lv_obj_t* battery_;
};
} // namespace widgets