~aleteoryx/muditaos

muditaos/module-gui/gui/widgets/Style.cpp -rw-r--r-- 1.3 KiB
a405cad6Aleteoryx trim readme 6 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/blob/master/LICENSE.md

#include "Style.hpp"
#include <Label.hpp>

namespace style::window
{

    void decorate(gui::Rect *el)
    {
        if (el == nullptr) {
            return;
        }
        el->setPenWidth(default_border_no_focus_w);
        el->setPenFocusWidth(default_border_focus_w);
        el->setEdges(gui::RectangleEdge::Top | gui::RectangleEdge::Bottom);
        el->setFilled(false);
    }

    void decorate(gui::Label *el)
    {
        if (el == nullptr) {
            return;
        }
        decorate(static_cast<gui::Rect *>(el));
        el->setAlignment(gui::Alignment(gui::Alignment::Horizontal::Left, gui::Alignment::Vertical::Center));
    }

    void decorateOption(gui::Label *el)
    {
        if (el == nullptr) {
            return;
        }
        decorate(el);
        el->setMargins(gui::Margins(style::window::default_left_margin, 0, 0, 0));
        el->setPadding(gui::Padding(style::padding::default_left_text_padding, 0, 0, 0));
        el->setFont(style::window::font::big);
        el->setMinimumHeight(style::window::label::big_h);
        el->setMaximumWidth(style::window::default_body_width);
    }

}; // namespace style::window