diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-08-25 15:13:25 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-08-25 15:13:25 +1000 |
| commit | 795f26873742eaad7ce53084052d988a0fd542f8 (patch) | |
| tree | 1616ad6149c27b3cd263377741c677d5294a5080 /src/ui/screen.cpp | |
| parent | 3b3bc64d19715c418f407d5231795ca5a2c2fa71 (diff) | |
| download | tangara-fw-795f26873742eaad7ce53084052d988a0fd542f8.tar.gz | |
Add placeholder settings UI
Diffstat (limited to 'src/ui/screen.cpp')
| -rw-r--r-- | src/ui/screen.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/ui/screen.cpp b/src/ui/screen.cpp index 039d2439..c9933042 100644 --- a/src/ui/screen.cpp +++ b/src/ui/screen.cpp @@ -57,4 +57,28 @@ auto Screen::CreateTopBar(lv_obj_t* parent, return top_bar_.get(); } +MenuScreen::MenuScreen(const std::string& title, bool show_back_button) + : Screen() { + lv_group_set_wrap(group_, false); + + lv_obj_set_layout(content_, LV_LAYOUT_FLEX); + lv_obj_set_flex_flow(content_, LV_FLEX_FLOW_COLUMN); + lv_obj_set_flex_align(content_, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, + LV_FLEX_ALIGN_CENTER); + + widgets::TopBar::Configuration config{ + .show_back_button = show_back_button, + .title = title.c_str(), + }; + CreateTopBar(content_, config); + + content_ = lv_obj_create(content_); + lv_obj_set_flex_grow(content_, 1); + lv_obj_set_width(content_, lv_pct(100)); + lv_obj_set_layout(content_, LV_LAYOUT_FLEX); + lv_obj_set_flex_flow(content_, LV_FLEX_FLOW_COLUMN); + lv_obj_set_flex_align(content_, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_START, + LV_FLEX_ALIGN_START); +} + } // namespace ui |
