~aleteoryx/muditaos

muditaos/module-apps/application-phonebook/widgets/ContactFlagsWidget.hpp -rw-r--r-- 1.7 KiB
a405cad6Aleteoryx trim readme 7 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/blob/master/LICENSE.md

#pragma once

#include <Image.hpp>
#include <Label.hpp>
#include <Rect.hpp>

namespace gui
{

    class VBox;
    class HBox;
    class ContactFlagIconWidget;

    class ContactFlagsWidget : public Rect
    {
      public:
        ContactFlagsWidget(Item *parent = nullptr);
        ~ContactFlagsWidget() override = default;
        void setFavourites(bool isEnabled);
        void setSpeedDial(bool isEnabled, unsigned char position = 0);
        void setICE(bool isEnabled);
        void setBlocked(bool isBlocked);

        bool getFavourites()
        {
            return favourites;
        }
        bool getSpeedDial()
        {
            return speedDial;
        }
        bool getICE()
        {
            return ice;
        }
        bool getBlocked()
        {
            return blocked;
        }

      private:
        void initGUIIcons();
        void buildWidget();
        void repositionIcons();
        void hideIfNoFlags();
        bool favourites                       = false;
        bool speedDial                        = false;
        unsigned char speedDialPos            = 0;
        bool ice                              = false;
        bool blocked                          = false;
        HBox *mainBox                         = nullptr;
        ContactFlagIconWidget *favouritesIcon = nullptr;
        ContactFlagIconWidget *speedDialIcon  = nullptr;
        ContactFlagIconWidget *iceIcon        = nullptr;
        ContactFlagIconWidget *blockedIcon    = nullptr;
        static const unsigned char iconsCount;
    };

} // namespace gui