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
16
17namespace 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) {}
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
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}
Definition: elm_Element.hpp:37
Definition: elm_Rectangle.hpp:20
Color GetColor()
Definition: elm_Rectangle.hpp:74
void SetBorderRadius(const i32 border_radius)
Definition: elm_Rectangle.hpp:69
void SetX(const i32 x)
Definition: elm_Rectangle.hpp:37
void SetY(const i32 y)
Definition: elm_Rectangle.hpp:45
i32 GetY() override
Definition: elm_Rectangle.hpp:41
i32 GetBorderRadius()
Definition: elm_Rectangle.hpp:65
i32 GetX() override
Definition: elm_Rectangle.hpp:33
void SetWidth(const i32 width)
Definition: elm_Rectangle.hpp:53
i32 GetWidth() override
Definition: elm_Rectangle.hpp:49
void OnInput(const u64 keys_down, const u64 keys_up, const u64 keys_held, const TouchPoint touch_pos) override
Definition: elm_Rectangle.hpp:83
void SetColor(const Color clr)
Definition: elm_Rectangle.hpp:78
void SetHeight(const i32 height)
Definition: elm_Rectangle.hpp:61
void OnRender(render::Renderer::Ref &drawer, const i32 x, const i32 y) override
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
i32 GetHeight() override
Definition: elm_Rectangle.hpp:57
Definition: elm_Button.hpp:18
s32 i32
Definition: pu_Include.hpp:28
#define PU_SMART_CTOR(type)
Definition: pu_Include.hpp:19
Definition: ui_Types.hpp:44
Definition: ui_Types.hpp:62