Plutonium framework API 0.3.0
UI framework libraries for libnx
Loading...
Searching...
No Matches
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
17namespace pu::ui::elm {
18
19 class Rectangle : public Element {
20 private:
21 i32 x;
22 i32 y;
23 i32 w;
24 i32 h;
25 Color clr;
26 i32 border_radius;
27
28 public:
29 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
32 inline i32 GetX() override {
33 return this->x;
34 }
35
36 inline void SetX(const i32 x) {
37 this->x = x;
38 }
39
40 inline i32 GetY() override {
41 return this->y;
42 }
43
44 inline void SetY(const i32 y) {
45 this->y = y;
46 }
47
48 inline i32 GetWidth() override {
49 return this->w;
50 }
51
52 inline void SetWidth(const i32 width) {
53 this->w = width;
54 }
55
56 inline i32 GetHeight() override {
57 return this->h;
58 }
59
60 inline void SetHeight(const i32 height) {
61 this->h = height;
62 }
63
64 PU_CLASS_POD_GETSET(BorderRadius, border_radius, i32)
65 PU_CLASS_POD_GETSET(Color, clr, Color)
66
67 void OnRender(render::Renderer::Ref &drawer, const i32 x, const i32 y) override;
68 void OnInput(const u64 keys_down, const u64 keys_up, const u64 keys_held, const TouchPoint touch_pos) override {}
69 };
70
71}
Definition elm_Element.hpp:37
Element()
Definition elm_Element.hpp:45
Definition elm_Rectangle.hpp:19
void SetX(const i32 x)
Definition elm_Rectangle.hpp:36
void SetY(const i32 y)
Definition elm_Rectangle.hpp:44
i32 GetY() override
Definition elm_Rectangle.hpp:40
i32 GetX() override
Definition elm_Rectangle.hpp:32
void SetWidth(const i32 width)
Definition elm_Rectangle.hpp:52
i32 GetWidth() override
Definition elm_Rectangle.hpp:48
void OnInput(const u64 keys_down, const u64 keys_up, const u64 keys_held, const TouchPoint touch_pos) override
Definition elm_Rectangle.hpp:68
void SetHeight(const i32 height)
Definition elm_Rectangle.hpp:60
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:29
i32 GetHeight() override
Definition elm_Rectangle.hpp:56
Definition render_Renderer.hpp:127
Definition render_Renderer.hpp:20
Definition elm_Button.hpp:18
#define PU_SMART_CTOR(type)
Definition pu_Include.hpp:20
#define PU_CLASS_POD_GETSET(fn_name, var_name, type)
Definition pu_Include.hpp:37
Definition ui_Types.hpp:44
Definition ui_Types.hpp:67