From f1ceb95cd92b475b692e4321d1dbab86c25cd68b Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Wed, 9 Jun 2021 16:11:32 -0400 Subject: [PATCH] lvgui: Rework Toolbar a bit --- boot/lib/lvgui/lvgui/toolbar.rb | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/boot/lib/lvgui/lvgui/toolbar.rb b/boot/lib/lvgui/lvgui/toolbar.rb index 02c3f170..526d67a4 100644 --- a/boot/lib/lvgui/lvgui/toolbar.rb +++ b/boot/lib/lvgui/lvgui/toolbar.rb @@ -2,12 +2,23 @@ class LVGUI::Toolbar < LVGUI::Widget def initialize(parent) super(LVGL::LVContainer.new(parent)) - set_height(0) - set_fit2(LVGL::FIT::FILL, LVGL::FIT::TIGHT) + # Defaults "hidden" + set_height(0) + + # And mostly transparent set_style(LVGL::CONT_STYLE::MAIN, LVGL::LVStyle::STYLE_TRANSP.dup) style = get_style(LVGL::CONT_STYLE::MAIN) - style.body_padding_top = 0 + style.body_border_width = 0 + style.body_padding_top = LVGUI.row_padding() - LVGUI.pixel_scale(10) style.body_padding_bottom = 0 + style.body_padding_left = LVGUI.col_padding() + style.body_padding_right = LVGUI.col_padding() + + # Fills the width, fits content + set_fit2(LVGL::FIT::FLOOD, LVGL::FIT::TIGHT) + + # Layout... + set_layout(LVGL::LAYOUT::PRETTY) end end