~aleteoryx/muditaos

38bc935af90b14d26db229d2de0a568dd4dbd9f6 — Przemyslaw Brudny 4 years ago d45c23d
[EGD-7237] Layout NavBar refactor

Layout NavBar refactor.
27 files changed, 192 insertions(+), 137 deletions(-)

M module-apps/application-alarm-clock/widgets/AlarmClockStyle.hpp
M module-apps/application-alarm-clock/windows/AlarmClockMainWindow.cpp
M module-apps/application-calendar/include/application-calendar/widgets/CalendarStyle.hpp
M module-apps/application-calendar/windows/CalendarMainWindow.cpp
M module-apps/application-call/windows/CallWindow.cpp
M module-apps/application-calllog/data/CallLogStyle.hpp
M module-apps/application-calllog/windows/CallLogMainWindow.cpp
M module-apps/application-meditation/data/Style.hpp
M module-apps/application-messages/data/MessagesStyle.hpp
M module-apps/application-messages/windows/MessagesMainWindow.cpp
M module-apps/application-music-player/data/MusicPlayerStyle.hpp
M module-apps/application-notes/windows/NoteMainWindow.cpp
M module-apps/application-phonebook/data/PhonebookStyle.hpp
M module-apps/application-phonebook/windows/PhonebookMainWindow.cpp
M module-apps/application-settings/widgets/SettingsStyle.hpp
M module-apps/application-settings/widgets/advanced/ColorTestListStyle.hpp
M module-apps/application-settings/windows/apps/SoundSelectWindow.cpp
M module-apps/application-settings/windows/display-keypad/QuotesMainWindow.cpp
M module-apps/application-settings/windows/network/ApnSettingsWindow.cpp
M module-apps/apps-common/popups/PowerOffWindow.cpp
M module-apps/apps-common/widgets/DateAndTimeStyle.hpp
M module-apps/apps-common/windows/AppWindow.cpp
M module-gui/gui/widgets/Label.cpp
M module-gui/gui/widgets/Label.hpp
M module-gui/gui/widgets/NavBar.cpp
M module-gui/gui/widgets/NavBar.hpp
M module-gui/gui/widgets/Style.hpp
M module-apps/application-alarm-clock/widgets/AlarmClockStyle.hpp => module-apps/application-alarm-clock/widgets/AlarmClockStyle.hpp +1 -1
@@ 15,7 15,7 @@ namespace style::alarmClock
        inline constexpr auto listView_x = style::window::default_left_margin;
        inline constexpr auto listView_y = style::window::default_vertical_pos;
        inline constexpr auto listView_w = style::listview::body_width_with_scroll;
        inline constexpr auto listView_h = style::window_height - listView_y - style::footer::height;
        inline constexpr auto listView_h = style::window_height - listView_y - style::nav_bar::height;

        namespace name
        {

M module-apps/application-alarm-clock/windows/AlarmClockMainWindow.cpp => module-apps/application-alarm-clock/windows/AlarmClockMainWindow.cpp +1 -1
@@ 59,7 59,7 @@ namespace app::alarmClock
                          0,
                          style::window::default_vertical_pos,
                          style::window_width,
                          style::window_height - ::style::window::default_vertical_pos - ::style::footer::height,
                          style::window_height - ::style::window::default_vertical_pos - ::style::nav_bar::height,
                          "empty_list_add_W_G",
                          utils::translate("app_alarm_clock_no_alarms_information"));
        emptyListIcon->setVisible(false);

M module-apps/application-calendar/include/application-calendar/widgets/CalendarStyle.hpp => module-apps/application-calendar/include/application-calendar/widgets/CalendarStyle.hpp +1 -1
@@ 17,7 17,7 @@ namespace style::window::calendar
    inline constexpr auto listView_x = style::window::default_left_margin;
    inline constexpr auto listView_y = style::window::default_vertical_pos;
    inline constexpr auto listView_w = style::listview::body_width_with_scroll;
    inline constexpr auto listView_h = style::window_height - listView_y - style::footer::height;
    inline constexpr auto listView_h = style::window_height - listView_y - style::nav_bar::height;

    namespace item
    {

M module-apps/application-calendar/windows/CalendarMainWindow.cpp => module-apps/application-calendar/windows/CalendarMainWindow.cpp +1 -1
@@ 44,7 44,7 @@ namespace gui

        offsetFromTop = style::window::default_vertical_pos + style::window::calendar::month_year_height;
        monthWidth    = style::window::default_body_width;
        monthHeight   = style::window_height - style::window::default_vertical_pos - style::footer::height;
        monthHeight   = style::window_height - style::window::default_vertical_pos - style::nav_bar::height;
        dayWidth      = style::window::calendar::day_cell_width;
        dayHeight     = style::window::calendar::day_cell_height;


M module-apps/application-call/windows/CallWindow.cpp => module-apps/application-call/windows/CallWindow.cpp +2 -2
@@ 79,7 79,7 @@ namespace gui
        speakerIcon                       = new SpeakerIcon(this, speakerIcon::x, speakerIcon::y);
        speakerIcon->focusChangedCallback = [=](gui::Item &item) {
            LOG_DEBUG("speakerIcon get/lost focus");
            navBar->setText(nav_bar::Side::Center, utils::translate(style::strings::common::Switch), false);
            navBar->setText(nav_bar::Side::Center, utils::translate(style::strings::common::Switch), item.focus);
            return true;
        };
        speakerIcon->activatedCallback = [=](gui::Item &item) {


@@ 107,7 107,7 @@ namespace gui
        microphoneIcon                       = new MicrophoneIcon(this, microphoneIcon::x, microphoneIcon::y);
        microphoneIcon->focusChangedCallback = [=](gui::Item &item) {
            LOG_DEBUG("microphoneIcon get/lost focus");
            navBar->setText(nav_bar::Side::Center, utils::translate(style::strings::common::Switch), false);
            navBar->setText(nav_bar::Side::Center, utils::translate(style::strings::common::Switch), item.focus);
            return true;
        };
        microphoneIcon->activatedCallback = [=](gui::Item &item) {

M module-apps/application-calllog/data/CallLogStyle.hpp => module-apps/application-calllog/data/CallLogStyle.hpp +2 -2
@@ 14,7 14,7 @@ namespace callLogStyle
    // DETAILS WINDOW
    namespace detailsWindow
    {
        constexpr inline auto x = style::window::navBar::leftMargin;
        constexpr inline auto x = style::nav_bar::left_margin;
        constexpr inline auto y = style::window::default_vertical_pos;
        constexpr inline auto w = style::window_width - 2 * x;
        constexpr inline auto h = style::window::default_body_height;


@@ 45,7 45,7 @@ namespace callLogStyle
        constexpr inline uint32_t x = style::window::default_left_margin;
        constexpr inline uint32_t y = style::window::default_vertical_pos;
        constexpr inline uint32_t w = style::listview::body_width_with_scroll;
        constexpr inline uint32_t h = style::window_height - y - style::footer::height;
        constexpr inline uint32_t h = style::window_height - y - style::nav_bar::height;
    } // namespace mainWindow

} // namespace callLogStyle

M module-apps/application-calllog/windows/CallLogMainWindow.cpp => module-apps/application-calllog/windows/CallLogMainWindow.cpp +1 -1
@@ 64,7 64,7 @@ namespace gui
                          0,
                          ::style::window::default_vertical_pos,
                          ::style::window_width,
                          ::style::window_height - ::style::window::default_vertical_pos - ::style::footer::height,
                          ::style::window_height - ::style::window::default_vertical_pos - ::style::nav_bar::height,
                          "info_icon_W_G",
                          utils::translate("app_calllog_no_calls"));
        emptyListIcon->setVisible(false);

M module-apps/application-meditation/data/Style.hpp => module-apps/application-meditation/data/Style.hpp +1 -1
@@ 107,7 107,7 @@ namespace style::meditation
            constexpr auto X      = style::window::default_left_margin;
            constexpr auto Y      = style::window::default_vertical_pos;
            constexpr auto Width  = style::listview::body_width_with_scroll;
            constexpr auto Height = style::window_height - Y - style::footer::height;
            constexpr auto Height = style::window_height - Y - style::nav_bar::height;
        } // namespace window

    } // namespace listView

M module-apps/application-messages/data/MessagesStyle.hpp => module-apps/application-messages/data/MessagesStyle.hpp +2 -2
@@ 18,7 18,7 @@ namespace style
            inline constexpr uint32_t ListPositionY = style::window::default_vertical_pos - 1;
            // Bottom margin need to be added to fit all elements.
            inline constexpr uint32_t listHeight =
                style::window_height - ListPositionY - style::footer::height + style::margins::small;
                style::window_height - ListPositionY - style::nav_bar::height + style::margins::small;
            inline constexpr uint32_t listWidth = style::listview::body_width_with_scroll;
        } // namespace threads



@@ 111,7 111,7 @@ namespace style
            {
                inline constexpr uint32_t x = style::window::default_left_margin;
                inline constexpr uint32_t y = style::window::default_vertical_pos;
                inline constexpr uint32_t h = style::window_height - y - style::footer::height;
                inline constexpr uint32_t h = style::window_height - y - style::nav_bar::height;
                inline constexpr uint32_t w = style::listview::body_width_with_scroll;

            } // namespace list

M module-apps/application-messages/windows/MessagesMainWindow.cpp => module-apps/application-messages/windows/MessagesMainWindow.cpp +1 -1
@@ 73,7 73,7 @@ namespace gui
                                 0,
                                 style::window::default_vertical_pos,
                                 style::window_width,
                                 style::window_height - style::window::default_vertical_pos - style::footer::height,
                                 style::window_height - style::window::default_vertical_pos - style::nav_bar::height,
                                 "empty_list_add_W_G",
                                 utils::translate("app_messages_no_messages"));
        emptyListIcon->setVisible(false);

M module-apps/application-music-player/data/MusicPlayerStyle.hpp => module-apps/application-music-player/data/MusicPlayerStyle.hpp +1 -1
@@ 87,7 87,7 @@ namespace musicPlayerStyle
        constexpr uint32_t y = style::window::default_vertical_pos - 1;
        constexpr uint32_t w = style::listview::body_width_with_scroll;
        // Bottom margin need to be added to fit all elements.
        constexpr uint32_t h = style::window_height - y - style::footer::height + style::margins::small;
        constexpr uint32_t h = style::window_height - y - style::nav_bar::height + style::margins::small;
    } // namespace allSongsWindow

    namespace songItem

M module-apps/application-notes/windows/NoteMainWindow.cpp => module-apps/application-notes/windows/NoteMainWindow.cpp +1 -1
@@ 75,7 75,7 @@ namespace app::notes
                          0,
                          ::style::window::default_vertical_pos,
                          ::style::window_width,
                          ::style::window_height - ::style::window::default_vertical_pos - ::style::footer::height,
                          ::style::window_height - ::style::window::default_vertical_pos - ::style::nav_bar::height,
                          "empty_list_add_W_G",
                          utils::translate("app_notes_no_notes"));
        emptyListIcon->setVisible(false);

M module-apps/application-phonebook/data/PhonebookStyle.hpp => module-apps/application-phonebook/data/PhonebookStyle.hpp +6 -6
@@ 18,7 18,7 @@ namespace phonebookStyle
            inline constexpr uint32_t x = style::window::default_left_margin;
            inline constexpr uint32_t y = style::window::default_vertical_pos;
            inline constexpr uint32_t w = style::listview::body_width_with_scroll;
            inline constexpr uint32_t h = style::window_height - y - style::footer::height;
            inline constexpr uint32_t h = style::window_height - y - style::nav_bar::height;
        } // namespace contactsList
    }     // namespace mainWindow



@@ 29,7 29,7 @@ namespace phonebookStyle
            inline constexpr uint32_t x = style::window::default_left_margin;
            inline constexpr uint32_t y = style::window::default_vertical_pos;
            inline constexpr uint32_t w = style::listview::body_width_with_scroll;
            inline constexpr uint32_t h = style::window_height - y - style::footer::height;
            inline constexpr uint32_t h = style::window_height - y - style::nav_bar::height;
        } // namespace newContactsList
    }     // namespace newContactWindow



@@ 40,14 40,14 @@ namespace phonebookStyle
            inline constexpr uint32_t x = style::window::default_left_margin;
            inline constexpr uint32_t y = style::window::default_vertical_pos + 74;
            inline constexpr uint32_t w = style::listview::body_width_with_scroll;
            inline constexpr uint32_t h = style::window_height - y - style::footer::height;
            inline constexpr uint32_t h = style::window_height - y - style::nav_bar::height;
        } // namespace contactDetailsList
        namespace contactDetailsListNoFlags
        {
            inline constexpr uint32_t x = style::window::default_left_margin;
            inline constexpr uint32_t y = style::window::default_vertical_pos;
            inline constexpr uint32_t w = style::listview::body_width_with_scroll;
            inline constexpr uint32_t h = style::window_height - y - style::footer::height;
            inline constexpr uint32_t h = style::window_height - y - style::nav_bar::height;
        } // namespace contactDetailsListNoFlags

    } // namespace contactDetailsWindow


@@ 59,7 59,7 @@ namespace phonebookStyle
            inline constexpr uint32_t x = style::window::default_left_margin;
            inline constexpr uint32_t y = style::window::default_vertical_pos;
            inline constexpr uint32_t w = style::listview::body_width_with_scroll;
            inline constexpr uint32_t h = style::window_height - y - style::footer::height;
            inline constexpr uint32_t h = style::window_height - y - style::nav_bar::height;
        } // namespace searchResultList
    }     // namespace searchResultsWindow



@@ 70,7 70,7 @@ namespace phonebookStyle
            inline constexpr uint32_t x = style::window::default_left_margin;
            inline constexpr uint32_t y = style::window::default_vertical_pos;
            inline constexpr uint32_t w = style::listview::body_width_with_scroll;
            inline constexpr uint32_t h = style::window_height - y - style::footer::height;
            inline constexpr uint32_t h = style::window_height - y - style::nav_bar::height;
        } // namespace contactsListIce
    }     // namespace iceContactsWindow


M module-apps/application-phonebook/windows/PhonebookMainWindow.cpp => module-apps/application-phonebook/windows/PhonebookMainWindow.cpp +1 -1
@@ 53,7 53,7 @@ namespace gui
                          0,
                          ::style::window::default_vertical_pos,
                          ::style::window_width,
                          ::style::window_height - ::style::window::default_vertical_pos - ::style::footer::height,
                          ::style::window_height - ::style::window::default_vertical_pos - ::style::nav_bar::height,
                          "empty_list_add_W_G",
                          utils::translate("app_phonebook_no_contacts"));
        emptyListIcon->setVisible(false);

M module-apps/application-settings/widgets/SettingsStyle.hpp => module-apps/application-settings/widgets/SettingsStyle.hpp +2 -2
@@ 47,7 47,7 @@ namespace style
                inline constexpr uint32_t x = style::window::default_left_margin;
                inline constexpr uint32_t y = style::window::default_vertical_pos;
                inline constexpr uint32_t w = style::listview::body_width_with_scroll;
                inline constexpr uint32_t h = style::window_height - y - style::footer::height;
                inline constexpr uint32_t h = style::window_height - y - style::nav_bar::height;
            } // namespace newApn

            namespace bluetooth


@@ 115,7 115,7 @@ namespace style
            inline constexpr auto X      = style::window::default_left_margin;
            inline constexpr auto Y      = style::window::default_vertical_pos;
            inline constexpr auto Width  = style::listview::body_width_with_scroll;
            inline constexpr auto Height = style::window_height - Y - style::footer::height;
            inline constexpr auto Height = style::window_height - Y - style::nav_bar::height;
        } // namespace list

    } // namespace quotes::categories

M module-apps/application-settings/widgets/advanced/ColorTestListStyle.hpp => module-apps/application-settings/widgets/advanced/ColorTestListStyle.hpp +1 -1
@@ 12,7 12,7 @@ namespace style::colorTest
        inline constexpr auto x      = style::window::default_left_margin;
        inline constexpr auto y      = style::window::default_vertical_pos;
        inline constexpr auto width  = style::listview::body_width_with_scroll;
        inline constexpr auto height = style::window_height - y - style::footer::height;
        inline constexpr auto height = style::window_height - y - style::nav_bar::height;
    } // namespace listview

    namespace item

M module-apps/application-settings/windows/apps/SoundSelectWindow.cpp => module-apps/application-settings/windows/apps/SoundSelectWindow.cpp +1 -1
@@ 36,7 36,7 @@ namespace gui
                                        style::window::default_vertical_pos - 1,
                                        style::listview::body_width_with_scroll,
                                        style::window_height - style::window::default_vertical_pos + 1 -
                                            style::footer::height + style::margins::small,
                                            style::nav_bar::height + style::margins::small,
                                        mSoundsModel,
                                        listview::ScrollBarType::Proportional);


M module-apps/application-settings/windows/display-keypad/QuotesMainWindow.cpp => module-apps/application-settings/windows/display-keypad/QuotesMainWindow.cpp +1 -1
@@ 16,7 16,7 @@ namespace style::quotes
        constexpr auto X      = style::window::default_left_margin;
        constexpr auto Y      = style::window::default_vertical_pos;
        constexpr auto Width  = style::listview::body_width_with_scroll;
        constexpr auto Height = style::window_height - Y - style::footer::height;
        constexpr auto Height = style::window_height - Y - style::nav_bar::height;
    } // namespace list
} // namespace style::quotes


M module-apps/application-settings/windows/network/ApnSettingsWindow.cpp => module-apps/application-settings/windows/network/ApnSettingsWindow.cpp +1 -1
@@ 28,7 28,7 @@ namespace gui
                                 0,
                                 style::window::default_vertical_pos,
                                 style::window_width,
                                 style::window_height - style::window::default_vertical_pos - style::footer::height,
                                 style::window_height - style::window::default_vertical_pos - style::nav_bar::height,
                                 "empty_list_add_W_G",
                                 utils::translate("app_settings_apn_settings_no_apns"));
        emptyListIcon->setVisible(false);

M module-apps/apps-common/popups/PowerOffWindow.cpp => module-apps/apps-common/popups/PowerOffWindow.cpp +0 -3
@@ 28,9 28,6 @@ namespace gui
        metadata.icon  = "turn_off_W_G";
        auto msg       = std::make_unique<DialogMetadataMessage>(std::move(metadata));
        DialogYesNo::onBeforeShow(mode, msg.get());

        navBar->setActive(nav_bar::Side::Center, false);
        navBar->setActive(nav_bar::Side::Right, false);
    }

} /* namespace gui */

M module-apps/apps-common/widgets/DateAndTimeStyle.hpp => module-apps/apps-common/widgets/DateAndTimeStyle.hpp +1 -1
@@ 15,5 15,5 @@ namespace style::window::date_and_time
    inline constexpr auto listView_x       = style::window::default_left_margin;
    inline constexpr auto listView_y       = style::window::default_vertical_pos;
    inline constexpr auto listView_w       = style::listview::body_width_with_scroll;
    inline constexpr auto listView_h       = style::window_height - listView_y - style::footer::height;
    inline constexpr auto listView_h       = style::window_height - listView_y - style::nav_bar::height;
} // namespace style::window::date_and_time

M module-apps/apps-common/windows/AppWindow.cpp => module-apps/apps-common/windows/AppWindow.cpp +5 -1
@@ 51,7 51,11 @@ namespace gui
                                         style::header::width,
                                         style::header::height);

        navBar = new gui::nav_bar::NavBar(this, 0, style::window_height - 51, style::window_width, 50);
        navBar = new gui::nav_bar::NavBar(this,
                                          style::nav_bar::default_horizontal_pos,
                                          style::nav_bar::default_vertical_pos,
                                          style::nav_bar::width,
                                          style::nav_bar::height);
        navBar->setActive(nav_bar::Side::Left, false);
        navBar->setActive(nav_bar::Side::Center, false);
        navBar->setActive(nav_bar::Side::Right, false);

M module-gui/gui/widgets/Label.cpp => module-gui/gui/widgets/Label.cpp +3 -2
@@ 271,12 271,13 @@ namespace gui
        textColor = color;
    }

    uint32_t Label::getTextNeedSpace() const noexcept
    uint32_t Label::getTextNeedSpace(const UTF8 &_text) const noexcept
    {
        if (font == nullptr) {
            return 0;
        }
        return font->getPixelWidth(text);

        return _text.empty() ? font->getPixelWidth(text) : font->getPixelWidth(_text);
    }

    uint32_t Label::getTextHeight() const noexcept

M module-gui/gui/widgets/Label.hpp => module-gui/gui/widgets/Label.hpp +1 -1
@@ 126,7 126,7 @@ namespace gui
        RawFont *getFont() const noexcept;
        // virtual methods
        void buildDrawListImplementation(std::list<Command> &commands) override;
        uint32_t getTextNeedSpace() const noexcept;
        uint32_t getTextNeedSpace(const UTF8 &text = "") const noexcept;
        /// line: height
        uint32_t getTextHeight() const noexcept;
        uint32_t getTextWidth() const noexcept;

M module-gui/gui/widgets/NavBar.cpp => module-gui/gui/widgets/NavBar.cpp +123 -71
@@ 10,74 10,62 @@

namespace gui::nav_bar
{
    NavBar::NavBar()
    NavBar::NavBar(Item *parent, uint32_t x, uint32_t y, uint32_t w, uint32_t h)
        : HThreeBox<HBox, HBox, HBox>(parent, x, y, w, h)
    {
        setEdges(RectangleEdge::None);

        Padding margins{style::window::navBar::leftMargin, 0, style::window::navBar::rightMargin, 0};
        left   = prepareLabel(Side::Left);
        center = prepareLabel(Side::Center);
        right  = prepareLabel(Side::Right);
        firstBox = new HBox(this);
        firstBox->setMinimumHeight(h);
        firstBox->setAlignment(Alignment(Alignment::Horizontal::Left, gui::Alignment::Vertical::Center));
        firstBox->setMargins({style::nav_bar::left_margin, 0, 0, 0});
        firstBox->setEdges(RectangleEdge::None);

        left->setPadding(margins);
        center->setPadding(margins);
        right->setPadding(margins);
        centerBox = new HBox(this);
        centerBox->setEdges(RectangleEdge::None);
        centerBox->setAlignment(Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Center));
        centerBox->setMaximumSize(w, h);

        addWidget(left);
        addWidget(center);
        addWidget(right);
        lastBox = new HBox(this);
        lastBox->setMinimumHeight(h);
        lastBox->setAlignment(Alignment(Alignment::Horizontal::Right, gui::Alignment::Vertical::Center));
        lastBox->setMargins({0, 0, style::nav_bar::right_margin, 0});
        lastBox->setEdges(RectangleEdge::None);

        setFillColor(ColorFullWhite);
        setBorderColor(ColorNoColor);
        setFilled(true);
        setSize(style::window::navBar::w, style::window::navBar::h);
    }
    NavBar::NavBar(Item *parent, uint32_t x, uint32_t y, uint32_t w, uint32_t h) : Rect{parent, x, y, w, h}
    {

        Padding margins{style::window::navBar::leftMargin, 0, style::window::navBar::rightMargin, 0};
        left   = prepareLabel(Side::Left);
        center = prepareLabel(Side::Center);
        right  = prepareLabel(Side::Right);
        createLabels();

        left->setPadding(margins);
        center->setPadding(margins);
        right->setPadding(margins);

        addWidget(left);
        addWidget(center);
        addWidget(right);

        setFillColor(ColorFullWhite);
        setBorderColor(ColorNoColor);
        setFilled(true);
        setSize(style::window::navBar::w, style::window::navBar::h);
        updateDrawArea();
        resizeItems();
    }
    NavBar::~NavBar()
    {}

    gui::Label *NavBar::prepareLabel(nav_bar::Side side)
    void NavBar::createLabels()
    {
        Label *label = new Label(this, 0, 0, 0, 0);
        label->setBorderColor(Color{15, 15});
        switch (side) {
        case Side::Left:
            label->setAlignment(gui::Alignment(gui::Alignment::Horizontal::Left, gui::Alignment::Vertical::Center));
            label->setFont(style::footer::font::medium);
            break;
        case Side::Center:
            label->setAlignment(gui::Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Center));
            label->setFont(style::footer::font::bold);
            break;
        case Side::Right:
            label->setAlignment(gui::Alignment(gui::Alignment::Horizontal::Right, gui::Alignment::Vertical::Center));
            label->setFont(style::footer::font::medium);
            break;
        };

        label->setFilled(false);

        return label;
        left = new Label(firstBox);
        left->setAlignment(Alignment(Alignment::Horizontal::Left, gui::Alignment::Vertical::Bottom));
        left->setPadding({0, 0, 0, style::nav_bar::bottom_padding});
        left->setMinimumHeight(widgetArea.h);
        left->setFont(style::nav_bar::font::medium);
        left->setEllipsis(Ellipsis::Right);
        left->setVisible(true);
        left->setEdges(RectangleEdge::None);

        center = new Label(centerBox);
        center->setAlignment(Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Center));
        center->setPadding({0, 0, 0, style::nav_bar::bottom_padding});
        center->setMinimumHeight(widgetArea.h);
        center->setMaximumWidth(widgetArea.w);
        center->setFont(style::nav_bar::font::bold);
        center->setEllipsis(Ellipsis::Right);
        center->setVisible(true);
        center->setEdges(RectangleEdge::None);

        right = new Label(lastBox);
        right->setAlignment(Alignment(Alignment::Horizontal::Right, gui::Alignment::Vertical::Center));
        right->setPadding({0, 0, 0, style::nav_bar::bottom_padding});
        right->setMinimumHeight(widgetArea.h);
        right->setFont(style::nav_bar::font::medium);
        right->setEllipsis(Ellipsis::Right);
        right->setVisible(true);
        right->setEdges(RectangleEdge::None);
    }

    Label *NavBar::getSide(nav_bar::Side side)


@@ 93,9 81,78 @@ namespace gui::nav_bar
        return nullptr;
    }

    bool NavBar::checkSideOccupied(nav_bar::Side side)
    {
        return getSide(side)->visible && !getSide(side)->getText().empty();
    }

    Length NavBar::outerSideUsedWidth(nav_bar::Side side)
    {
        return getSide(side)->visible ? getSide(side)->getTextNeedSpace() : 0;
    }

    void NavBar::setLeftSideWidth(Length width)
    {
        left->setMinimumWidth(width);
        firstBox->setMinimumWidth(width);
        firstBox->setMaximumWidth(width);
    }

    void NavBar::setRightSideWidth(Length width)
    {
        right->setMinimumWidth(width);
        lastBox->setMinimumWidth(width);
        lastBox->setMaximumWidth(width);
    }

    void NavBar::applyOuterSidesWidth(nav_bar::Side side, const UTF8 &str)
    {
        Length widthToSet = 0U;
        if (side == Side::Left) {
            widthToSet = std::max(outerSideUsedWidth(Side::Right), left->visible ? left->getTextNeedSpace(str) : 0);
        }
        else if (side == Side::Right) {
            widthToSet = std::max(outerSideUsedWidth(Side::Left), right->visible ? right->getTextNeedSpace(str) : 0);
        }
        else {
            widthToSet = std::max(outerSideUsedWidth(Side::Left), outerSideUsedWidth(Side::Right));
        }

        // If other side active set maximum for side to print into
        auto widthReduced = false;
        if ((side == Side::Left && !str.empty() &&
             (checkSideOccupied(Side::Right) || checkSideOccupied(Side::Center))) ||
            (side == Side::Right && !str.empty() &&
             (checkSideOccupied(Side::Left) || checkSideOccupied(Side::Center))) ||
            (side == Side::Center && !str.empty() &&
             (checkSideOccupied(Side::Left) || checkSideOccupied(Side::Right)))) {

            widthReduced = true;
            widthToSet =
                std::min(widthToSet, (widgetArea.w - (style::nav_bar::left_margin + style::nav_bar::right_margin)) / 3);
        }

        if (widthReduced) {
            setLeftSideWidth(widthToSet);
            setRightSideWidth(widthToSet);
        }
        else if (side == Side::Left && !str.empty()) {
            setLeftSideWidth(widthToSet);
            setRightSideWidth(0);
        }
        else if (side == Side::Right && !str.empty()) {
            setRightSideWidth(widthToSet);
            setLeftSideWidth(0);
        }
    }

    void NavBar::setActive(nav_bar::Side side, bool active)
    {
        getSide(side)->setVisible(active);
        auto selectedSide = getSide(side);

        selectedSide->setVisible(active);
        applyOuterSidesWidth(side, selectedSide->getText());
        selectedSide->informContentChanged();
    }

    bool NavBar::isActive(nav_bar::Side side)


@@ 105,8 162,12 @@ namespace gui::nav_bar

    void NavBar::setText(nav_bar::Side side, const UTF8 &str, bool active)
    {
        getSide(side)->setText(str);
        setActive(side, active);
        auto selectedSide = getSide(side);
        selectedSide->setVisible(active);

        applyOuterSidesWidth(side, str);
        selectedSide->setText(str);
        selectedSide->informContentChanged();
    }

    UTF8 NavBar::getText(nav_bar::Side side)


@@ 114,15 175,6 @@ namespace gui::nav_bar
        return getSide(side)->getText();
    }

    bool NavBar::onDimensionChanged(const BoundingBox &oldDim, const BoundingBox &newDim)
    {
        Rect::onDimensionChanged(oldDim, newDim);
        left->setSize(newDim.w, newDim.h);
        center->setSize(newDim.w, newDim.h);
        right->setSize(newDim.w, newDim.h);
        return true;
    }

    void NavBar::store()
    {
        store(Side::Left);

M module-gui/gui/widgets/NavBar.hpp => module-gui/gui/widgets/NavBar.hpp +9 -7
@@ 23,7 23,7 @@ namespace gui::nav_bar
    /// left is left action key, center describes center (enter) key, and right right action key
    /// depending on screen selected elements will be visible
    /// @note when in Text widget it will show input mode if enabled in [ left ] area
    class NavBar : public Rect
    class NavBar : public HThreeBox<HBox, HBox, HBox>
    {
      protected:
        struct Cache


@@ 54,27 54,29 @@ namespace gui::nav_bar
        Label *left   = nullptr;
        Label *center = nullptr;
        Label *right  = nullptr;
        gui::Label *prepareLabel(nav_bar::Side side);
        void createLabels();

        void setLeftSideWidth(Length width);
        void setRightSideWidth(Length width);
        bool checkSideOccupied(nav_bar::Side side);
        Length outerSideUsedWidth(nav_bar::Side side);
        void applyOuterSidesWidth(nav_bar::Side side, const UTF8 &str);
        Label *getSide(nav_bar::Side side);

      public:
        NavBar();
        NavBar(Item *parent, uint32_t x, uint32_t y, uint32_t w, uint32_t h);
        virtual ~NavBar();

        void setActive(nav_bar::Side side, bool active);
        bool isActive(nav_bar::Side side);
        void setText(nav_bar::Side side, const UTF8 &str, bool active = true);
        UTF8 getText(nav_bar::Side side);
        void setFont(Side side, const UTF8 &fontName);

        void store();
        void store(Side side);
        void restore();
        void restore(Side side);

        void setFont(Side side, const UTF8 &fontName);

        bool onDimensionChanged(const BoundingBox &oldDim, const BoundingBox &newDim) override;
        void accept(GuiVisitor &visitor) override;
    };


M module-gui/gui/widgets/Style.hpp => module-gui/gui/widgets/Style.hpp +22 -23
@@ 27,16 27,16 @@ namespace style
        inline constexpr auto default_horizontal_pos  = 20U;
        inline constexpr auto default_vertical_pos    = 0U;
        inline constexpr unsigned status_bar_margin_w = default_horizontal_pos * 2;
        inline constexpr auto height                  = 46U;
        inline constexpr auto width                   = window_width - status_bar_margin_w;
        inline constexpr auto height                  = 46U;
    } // namespace status_bar

    namespace header
    {
        inline constexpr auto default_horizontal_pos = 0U;
        inline constexpr auto default_vertical_pos   = status_bar::height;
        inline constexpr auto height                 = 59U;
        inline constexpr auto width                  = window_width;
        inline constexpr auto height                 = 59U;

        namespace font
        {


@@ 44,16 44,6 @@ namespace style
        } // namespace font
    }     // namespace header

    namespace footer
    {
        inline constexpr auto height = 54U;
        namespace font
        {
            inline constexpr auto bold   = "gt_pressura_bold_24";
            inline constexpr auto medium = "gt_pressura_regular_24";
        }; // namespace font
    };     // namespace footer

    namespace window
    {
        inline constexpr auto default_vertical_pos = header::default_vertical_pos + header::height;


@@ 61,8 51,7 @@ namespace style
        inline constexpr auto default_right_margin = 20U;
        inline constexpr auto default_body_width =
            style::window_width - style::window::default_right_margin - style::window::default_left_margin;
        inline constexpr auto default_body_height =
            style::window_height - style::window::default_vertical_pos - style::footer::height;
        inline constexpr auto default_body_height          = 441U;
        inline constexpr auto default_border_focus_w       = 2U;
        inline constexpr auto default_border_rect_no_focus = 1U;
        inline constexpr auto default_border_no_focus_w    = 0U;


@@ 103,15 92,6 @@ namespace style
        /// minimal label decoration for Option
        void decorateOption(gui::Label *el);

        namespace navBar
        {
            inline constexpr auto leftMargin  = 30U;
            inline constexpr auto rightMargin = 30U;

            inline constexpr auto h = 54U;
            inline constexpr auto w = window_width;
        } // namespace navBar

        namespace progressBar
        {
            inline constexpr auto x     = style::window::default_left_margin;


@@ 122,6 102,25 @@ namespace style
        }; // namespace progressBar
    };     // namespace window

    namespace nav_bar
    {
        inline constexpr auto default_horizontal_pos = 0U;
        inline constexpr auto default_vertical_pos   = window::default_vertical_pos + window::default_body_width;
        inline constexpr auto width                  = window_width;
        inline constexpr auto height                 = 54U;

        inline constexpr auto bottom_padding = 16U;
        inline constexpr auto left_margin    = 30U;
        inline constexpr auto right_margin   = 30U;

        namespace font
        {
            inline constexpr auto bold   = "gt_pressura_bold_24";
            inline constexpr auto medium = "gt_pressura_regular_24";
        }; // namespace font

    } // namespace nav_bar

    namespace settings
    {
        namespace date