~aleteoryx/muditaos

ref: 97760f7765e0cdf678e0b4e976cd36f731879a36 muditaos/module-apps/locks/windows/LockWindow.hpp -rw-r--r-- 1.7 KiB
97760f77 — Kuba Kleczkowski [EGD-6567] Add GSM time update handling 4 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
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include "AppWindow.hpp"
#include "RichTextParser.hpp"
#include "Text.hpp"

namespace locks
{
    class Lock;
}

namespace gui
{
    class LockWindow : public AppWindow
    {
      public:
        enum class TextType
        {
            Title,
            Primary,
            Secondary
        };

        enum class Token
        {
            Sim,
            Attempts,
            Mins,
            CmeCode,
            PinType
        };

        LockWindow(app::Application *app, std::string name) : AppWindow(app, std::move(name))
        {}
        void build();
        void buildInfoTexts();
        void buildPinLabels(const std::function<Rect *()> &itemBuilder,
                            unsigned int pinSize,
                            unsigned int offsetX,
                            unsigned int offsetY,
                            unsigned int boxWidth);
        virtual void restore() noexcept;
        void setBottomBarWidgetsActive(bool left, bool center, bool right);
        void setText(const std::string &value,
                     TextType type,
                     text::RichTextParser::TokenMap tokens = text::RichTextParser::TokenMap{});
        void setTitleBar(bool isVisible);

        std::unique_ptr<locks::Lock> lock = nullptr;
        gui::HBox *pinLabelsBox          = nullptr;
        gui::Text *primaryText           = nullptr;
        gui::Text *secondaryText         = nullptr;

      protected:
        virtual void buildBottomBar();
        virtual void buildTitleBar() = 0;
    };
} // namespace gui