~aleteoryx/muditaos

ref: 4d2eeeb97d2dcf8587d6ec433fd550687cb87968 muditaos/module-apps/widgets/ModesBox.hpp -rw-r--r-- 3.1 KiB
4d2eeeb9 — Mateusz Grzegorzek [EGD-5932] Add the rest of queries to Quotes agent 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <BoxLayout.hpp>
#include <Label.hpp>
#include <module-gui/gui/widgets/Image.hpp>

namespace style::window::modes
{
    constexpr inline auto invision_diff = 26;

    constexpr inline auto left_offset   = style::window_width / 4;
    constexpr inline auto top_offset    = 182;
    constexpr inline auto bottom_offset = 257;
    constexpr inline auto height        = style::window_height - top_offset - bottom_offset;
    constexpr inline auto width         = style::window_width - left_offset;

    namespace connected
    {
        constexpr inline auto title_key = "home_modes_connected";
        constexpr inline auto width     = 129;
        constexpr inline auto height    = 33;

        namespace margin
        {
            constexpr inline auto left  = 296 - style::window::modes::left_offset + invision_diff;
            constexpr inline auto right = 20;
        } // namespace margin
    }     // namespace connected

    namespace notdisturb
    {
        constexpr inline auto title_key = "home_modes_notdisturb";
        constexpr inline auto width     = 297 + invision_diff;
        constexpr inline auto height    = 51;

        namespace margin
        {
            constexpr inline auto top    = 20;
            constexpr inline auto left   = 128 - style::window::modes::left_offset;
            constexpr inline auto bottom = 20;
            constexpr inline auto right  = 0;
        } // namespace margin
    }     // namespace notdisturb

    namespace offline
    {
        constexpr inline auto title_key = "home_modes_offline";
        constexpr inline auto width     = 88;
        constexpr inline auto height    = 33;

        namespace margin
        {
            constexpr inline auto left  = 337 - style::window::modes::left_offset + invision_diff;
            constexpr inline auto right = 10;
        } // namespace margin
    }     // namespace offline

    namespace image
    {
        namespace margin
        {
            constexpr inline auto left = 7;
        }
        constexpr inline auto width  = 10;
        constexpr inline auto height = 20;
    } // namespace image

} // namespace style::window::modes

namespace gui
{
    class ModeRow : public HBox
    {
        Label *label = nullptr;
        Image *img   = nullptr;

      public:
        ModeRow(Item *parent = nullptr, uint32_t x = 0, uint32_t y = 0, uint32_t width = 0, uint32_t height = 0);

        void addText(const std::string &text,
                     const std::string &fontSize,
                     const Margins &margin,
                     uint32_t width,
                     uint32_t height);

        void addImage(const std::string &imageName);
    };

    class ModesBox : public VBox
    {
        ModeRow *connected  = nullptr;
        ModeRow *notDisturb = nullptr;
        ModeRow *offline    = nullptr;

        void addConnected();

        void addNotDisturb();

        void addOffline();

      public:
        ModesBox(Item *parent = nullptr, uint32_t x = 0, uint32_t y = 0);
    };
} // namespace gui