~aleteoryx/muditaos

ref: 2cff347326ffc377a227b3a28faa009be8a6a1e0 muditaos/module-gui/gui/widgets/Rect.hpp -rw-r--r-- 2.1 KiB
2cff3473 — Marcin Smoczyński [EGD-4002] audio: remove phone call recording (#794) 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
#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
        RectangleEdgeFlags edges{RectangleEdgeFlags::GUI_RECT_ALL_EDGES};
        /// mark which edge should be flat. This will disable roundness on both sides of the edge.
        RectangleFlatFlags flatEdges = {RectangleFlatFlags::GUI_RECT_FLAT_NO_FLAT};
        /// mark if given corners should be painted (only for rounded corners)
        RectangleCornerFlags corners = {RectangleCornerFlags::GUI_RECT_ALL_CORNERS};
        /// mark if we japs should be painted. small protrusions indicating a speech bubble
        RectangleYapFlags yaps = {RectangleYapFlags::GUI_RECT_YAP_NO_YAPS};
        /// yap size in horizontal width.
        unsigned short yapSize = {style::window::messages::yaps_size_default};

      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(RectangleEdgeFlags edges);
        void setCorners(RectangleCornerFlags corners);
        void setFlat(RectangleFlatFlags flats);
        virtual void setYaps(RectangleYapFlags yaps);
        virtual void setYapSize(unsigned short value);
        void setFilled(bool val);
        std::list<DrawCommand *> buildDrawList() override;
    };

} /* namespace gui */