~aleteoryx/muditaos

ref: 3b08e4c358c58c836b9aaa2c8d41e5c300e18f9d muditaos/module-apps/windows/OptionsWindowOption.cpp -rw-r--r-- 1.3 KiB
3b08e4c3 — Mateusz Grzywacz [EGD-4932] new battery icons + battery in TopBar rework 5 years 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-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "OptionsWindowOption.hpp"
#include <Label.hpp>
#include <Image.hpp>
#include <cassert>

namespace style::option
{
    const gui::Position arrow_position_x = 408;
    const gui::Position arrow_position_y = 24;
} // namespace style::option

namespace gui::option
{
    auto Simple::build() const -> Item *
    {
        auto *label = new gui::Label(nullptr,
                                     style::window::default_left_margin,
                                     0,
                                     style::window_width - 2 * style::window::default_left_margin,
                                     style::window::label::big_h,
                                     text);
        style::window::decorateOption(label);
        label->activatedCallback = activatedCallback;
        if (arrow == Arrow::Enabled) {
            new gui::Image(
                label, style::option::arrow_position_x, style::option::arrow_position_y, 0, 0, "right_label_arrow");
        }
        return label;
    }

} // namespace gui::option

namespace gui
{
    [[nodiscard]] auto Option::build() const -> Item *
    {
        assert(option);
        return option->build();
    }
} // namespace gui