diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-07-13 10:58:06 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-07-13 10:58:06 +1000 |
| commit | b6bc6b9e47605ede9bffe50445d1afe3acf0ab49 (patch) | |
| tree | 05c9281c2763919b6a6780191f6ecc54547063ae /src/ui/screen.cpp | |
| parent | 2dc700b12f26109d987ad22f530e39d165025656 (diff) | |
| download | tangara-fw-b6bc6b9e47605ede9bffe50445d1afe3acf0ab49.tar.gz | |
Ui polish and fleshing out
Diffstat (limited to 'src/ui/screen.cpp')
| -rw-r--r-- | src/ui/screen.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/ui/screen.cpp b/src/ui/screen.cpp new file mode 100644 index 00000000..7ea5e3ce --- /dev/null +++ b/src/ui/screen.cpp @@ -0,0 +1,32 @@ +/* + * Copyright 2023 jacqueline <me@jacqueline.id.au> + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#include "screen.hpp" + +#include <memory> + +#include "widget_top_bar.hpp" + +namespace ui { + +auto Screen::UpdateTopBar(const widgets::TopBar::State& state) -> void { + if (top_bar_) { + top_bar_->Update(state); + } +} + +auto Screen::CreateTopBar(lv_obj_t* parent, + const widgets::TopBar::Configuration& config) + -> widgets::TopBar* { + assert(top_bar_ == nullptr); + top_bar_ = std::make_unique<widgets::TopBar>(parent, config); + if (top_bar_->button()) { + lv_group_add_obj(group_, top_bar_->button()); + } + return top_bar_.get(); +} + +} // namespace ui |
