Simple GUI Library
shape.h
Go to the documentation of this file.
1/**
2 * @author Nikita Mochalov (github.com/tralf-strues)
3 * @file shape.h
4 * @date 2021-11-05
5 *
6 * @copyright Copyright (c) 2021
7 */
8
9#pragma once
10
11#include "../component.h"
12#include "../../paint/background.h"
13#include "../../paint/border.h"
14
15namespace Sgl
16{
17 class Shape : public Component
18 {
19 public:
20 Shape(Sml::Color fillColor = Sml::COLOR_TRANSPARENT);
21 Shape(const Background* background);
22 virtual ~Shape() override = default;
23
24 virtual void layout() override final;
25 virtual bool isResizable() const override final;
26
27 // const std::vector<const Fill*>& getFills() const;
28 // void addFill(const Fill* fill);
29
30 // void setFill(const Fill* fill);
31
32 Sml::Color getFillColor() const;
33 void setFillColor(Sml::Color color);
34
35 const Background* getBackground() const;
36 void setBackground(const Background* background);
37
38 const Border* getBorder() const;
39 void setBorder(const Border* border);
40
41 virtual int32_t computeMinWidth(int32_t height = -1) const override final;
42 virtual int32_t computeMinHeight(int32_t width = -1) const override final;
43
44 virtual int32_t computeMaxWidth(int32_t height = -1) const override final;
45 virtual int32_t computeMaxHeight(int32_t width = -1) const override final;
46
47 protected:
48 Sml::Color m_FillColor = Sml::COLOR_TRANSPARENT;
49 const Background* m_Background = nullptr;
50 const Border* m_Border = nullptr;
51 // std::vector<const Fill*> m_Fills;
52 // TODO: border, etc.
53 };
54}