~aleteoryx/muditaos

ref: 1f157e411df916e18c974c2176e3ff7c5e54e7a0 muditaos/module-gui/gui/widgets/Rect.hpp -rw-r--r-- 2.2 KiB
1f157e41 — Bartosz [MOS-59] Fix weird behaviour of indicators on popups 2 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
// 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 <list>
#include <cstdint>
#include "Item.hpp"
#include "../core/Color.hpp"
#include "Style.hpp"

namespace gui
{

    class Rect : public Item
    {
      public:
        /// color used for drawing border
        Color borderColor = Color(0, 0);
        /// color for filling rectangle
        Color fillColor = Color(15, 15);
        /// number of pixels used to draw border of rectangle without focus
        uint8_t penWidth = style::window::default_border_rect_no_focus;
        /// number of pixels used to draw border of rectangle when it has focus
        uint8_t penFocusWidth = style::window::default_border_focus_w;
        /// mark if rectangle should be filled with fill color.
        bool filled = false;
        /// mark how to draw borders
        RectangleEdge edges{RectangleEdge::All};
        /// mark which edge should be flat. This will disable roundness on both sides of the edge.
        RectangleFlatEdge flatEdges = {RectangleFlatEdge::None};
        /// mark if given corners should be painted (only for rounded corners)
        RectangleRoundedCorner corners = {RectangleRoundedCorner::All};
        /// mark if we japs should be painted. small protrusions indicating a speech bubble
        RectangleYap yaps = {RectangleYap::None};
        /// yap size in horizontal width.
        unsigned short yapSize = style::window::default_rect_yaps;

      public:
        Rect();
        Rect(Item *parent, const uint32_t &x, const uint32_t &y, const uint32_t &w, const uint32_t &h);

        void setFillColor(const Color &color);
        void setBorderColor(const Color &color);
        void setPenWidth(uint8_t width);
        void setPenFocusWidth(uint8_t width);
        void setEdges(RectangleEdge edges);
        void setCorners(RectangleRoundedCorner corners);
        void setFlat(RectangleFlatEdge flats);
        virtual void setYaps(RectangleYap yaps);
        virtual void setYapSize(unsigned short value);
        void setFilled(bool val);
        void buildDrawListImplementation(std::list<Command> &commands) override;

        void accept(GuiVisitor &visitor) override;
    };

} /* namespace gui */