boot/lib/lvgui: Add BaseUIElements mixin
Where more generic one-off helpers will be added
@@ -25,6 +25,17 @@ module LVGUI
end
end
+ module BaseUIElements
+ def add_main_text(text, alignment: LVGL::LABEL_ALIGN::CENTER)
+ LVGL::LVLabel.new(@container).tap do |label|
+ label.set_long_mode(LVGL::LABEL_LONG::BREAK)
+ label.set_text(text)
+ label.set_align(alignment)
+ label.set_width(@container.get_width_fit)
+ end
+ end
+ end
+
module Window
# Include with +include LVGUI::Window::WithBackButton+ and
# use e.g. +goes_back_to ->() { MainWindow.instance }+
