Plutonium framework API 0.3.0 UI framework libraries for libnx

elm_Rectangle.hpp
Go to the documentation of this file.
1
2/*
3
4 Plutonium library
5
6 @file Rectangle.hpp
7 @brief A Rectangle is an Element which simply draws a filled rectangle.
8 @author XorTroll
9
10 @copyright Plutonium project - an easy-to-use UI framework for Nintendo Switch homebrew
11
12*/
13
14#pragma once
15#include <pu/ui/elm/elm_Element.hpp>
16
17 namespace pu::ui::elm {
18
19 class Rectangle : public Element
20 {
21 private:
22 i32 x;
23 i32 y;
24 i32 w;
25 i32 h;
26 Color clr;
27 i32 border_radius;
28
29 public:
30 Rectangle(const i32 x, const i32 y, const i32 width, const i32 height, const Color clr, const i32 border_radius = 0) : Element(), x(x), y(y), w(width), h(height), clr(clr), border_radius(border_radius) {}
31 PU_SMART_CTOR(Rectangle)
32
33 inline i32 GetX() override {
34 return this->x;
35 }
36
37 inline void SetX(const i32 x) {
38 this->x = x;
39 }
40
41 inline i32 GetY() override {
42 return this->y;
43 }
44
45 inline void SetY(const i32 y) {
46 this->y = y;
47 }
48
49 inline i32 GetWidth() override {
50 return this->w;
51 }
52
53 inline void SetWidth(const i32 width) {
54 this->w = width;
55 }
56
57 inline i32 GetHeight() override {
58 return this->h;
59 }
60
61 inline void SetHeight(const i32 height) {
62 this->h = height;
63 }
64
65 inline i32 GetBorderRadius() {
66 return this->border_radius;
67 }
68
69 inline void SetBorderRadius(const i32 border_radius) {
70 this->border_radius = border_radius;
71 }
72
73
74 inline Color GetColor() {
75 return this->clr;
76 }
77
78 inline void SetColor(const Color clr) {
79 this->clr = clr;
80 }
81
82 void OnRender(render::Renderer::Ref &drawer, const i32 x, const i32 y) override;
83 void OnInput(const u64 keys_down, const u64 keys_up, const u64 keys_held, const TouchPoint touch_pos) override {}
84 };
85
86}
pu::ui::elm::Element
Definition: elm_Element.hpp:37
pu::ui::elm::Rectangle
Definition: elm_Rectangle.hpp:20
pu::ui::elm::Rectangle::GetColor
Color GetColor()
Definition: elm_Rectangle.hpp:74
pu::ui::elm::Rectangle::SetBorderRadius
void SetBorderRadius(const i32 border_radius)
Definition: elm_Rectangle.hpp:69
pu::ui::elm::Rectangle::SetX
void SetX(const i32 x)
Definition: elm_Rectangle.hpp:37
pu::ui::elm::Rectangle::SetY
void SetY(const i32 y)
Definition: elm_Rectangle.hpp:45
pu::ui::elm::Rectangle::GetY
i32 GetY() override
Definition: elm_Rectangle.hpp:41
pu::ui::elm::Rectangle::GetBorderRadius
i32 GetBorderRadius()
Definition: elm_Rectangle.hpp:65
pu::ui::elm::Rectangle::GetX
i32 GetX() override
Definition: elm_Rectangle.hpp:33
pu::ui::elm::Rectangle::SetWidth
void SetWidth(const i32 width)
Definition: elm_Rectangle.hpp:53
pu::ui::elm::Rectangle::GetWidth
i32 GetWidth() override
Definition: elm_Rectangle.hpp:49
pu::ui::elm::Rectangle::OnInput
void OnInput(const u64 keys_down, const u64 keys_up, const u64 keys_held, const TouchPoint touch_pos) override
Definition: elm_Rectangle.hpp:83
pu::ui::elm::Rectangle::SetColor
void SetColor(const Color clr)
Definition: elm_Rectangle.hpp:78
pu::ui::elm::Rectangle::SetHeight
void SetHeight(const i32 height)
Definition: elm_Rectangle.hpp:61
pu::ui::elm::Rectangle::OnRender
void OnRender(render::Renderer::Ref &drawer, const i32 x, const i32 y) override
pu::ui::elm::Rectangle::Rectangle
Rectangle(const i32 x, const i32 y, const i32 width, const i32 height, const Color clr, const i32 border_radius=0)
Definition: elm_Rectangle.hpp:30
pu::ui::elm::Rectangle::GetHeight
i32 GetHeight() override
Definition: elm_Rectangle.hpp:57
elm_Element.hpp
pu::ui::elm
Definition: elm_Button.hpp:18
pu::i32
s32 i32
Definition: pu_Include.hpp:28
PU_SMART_CTOR
#define PU_SMART_CTOR(type)
Definition: pu_Include.hpp:19
pu::ui::Color
Definition: ui_Types.hpp:44
pu::ui::TouchPoint
Definition: ui_Types.hpp:62