From b6bc6b9e47605ede9bffe50445d1afe3acf0ab49 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 13 Jul 2023 10:58:06 +1000 Subject: Ui polish and fleshing out --- src/ui/include/widget_top_bar.hpp | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'src/ui/include/widget_top_bar.hpp') 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 #include #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 -- cgit v1.2.3