Simple GUI Library
rectangle.h
Go to the documentation of this file.
1/**
2 * @author Nikita Mochalov (github.com/tralf-strues)
3 * @file rectangle.h
4 * @date 2021-12-07
5 *
6 * @copyright Copyright (c) 2021
7 */
8
9#pragma once
10
11#include "sml/math/rectangle.h"
12#include "shape.h"
13
14namespace Sgl
15{
16 class Rectangle : public Shape
17 {
18 public:
19 Rectangle(Sml::Color fillColor = Sml::COLOR_TRANSPARENT);
20 Rectangle(const Background* background);
21
22 int32_t getWidth() const;
23 void setWidth(int32_t width);
24
25 int32_t getHeight() const;
26 void setHeight(int32_t height);
27
28 virtual void render(const Sml::Rectangle<int32_t>& targetRegion) override;
29
30 virtual int32_t computePrefWidth(int32_t height = -1) const override final;
31 virtual int32_t computePrefHeight(int32_t width = -1) const override final;
32
33 private:
34 int32_t m_Width = 0;
35 int32_t m_Height = 0;
36 };
37};