~aleteoryx/muditaos

ref: d5de12f7cea071555de4058ebf62b160a86a36af muditaos/module-apps/windows/OptionSetting.cpp -rw-r--r-- 1.4 KiB
d5de12f7 — Radosław Wicik [EGD-3852] clean include in service (#928) 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
44
45
46
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "OptionSetting.hpp"
#include "OptionsStyle.hpp"

namespace gui
{
    auto OptionSettings::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;
        std::string img;
        switch (rIcon) {
        case RightIcon::Enabled:
            img = "right_label_arrow";
            break;
        case RightIcon::Border:
            img = "right_label_arrow_border";
            break;
        case RightIcon::On:
            img = "btn_on";
            break;
        case RightIcon::Off:
            img = "btn_off";
            break;
        case RightIcon::Bt:
            img = "bt";
            break;
        default:
            break;
        }

        if (!img.empty()) {
            new gui::Image(label, style::option::arrow_position_x, style::option::arrow_positon_y, 0, 0, img);
        }
        label->focusChangedCallback = focusCb;
        return label;
    }
} // namespace gui