Plutonium framework API 0.3.0
UI framework libraries for libnx
Loading...
Searching...
No Matches
ui_Container.hpp
Go to the documentation of this file.
1
2/*
3
4 Plutonium library
5
6 @file ui_Container.hpp
7 @brief A Container is a basic object which contains a bunch of Elements.
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#include <vector>
17#include <bits/stdc++.h>
18
19namespace pu::ui {
20
21 class Container {
22 protected:
28
29 public:
30 Container(const i32 x, const i32 y, const i32 width, const i32 height) : x(x), y(y), w(width), h(height), elems() {}
32
33 inline void Add(elm::Element::Ref elem) {
34 this->elems.push_back(elem);
35 }
36
38 return this->elems;
39 }
40
41 inline bool Has(elm::Element::Ref &elem) {
42 return std::find(this->elems.begin(), this->elems.end(), elem) != this->elems.end();
43 }
44
45 inline void Clear() {
46 this->elems.clear();
47 }
48
49 PU_CLASS_POD_GETSET(X, x, i32)
50 PU_CLASS_POD_GETSET(Y, y, i32)
51 PU_CLASS_POD_GETSET(Width, w, i32)
52 PU_CLASS_POD_GETSET(Height, h, i32)
53
54 void PreRender();
55 };
56
57}
Definition ui_Container.hpp:21
i32 x
Definition ui_Container.hpp:23
std::vector< elm::Element::Ref > elems
Definition ui_Container.hpp:27
i32 w
Definition ui_Container.hpp:25
bool Has(elm::Element::Ref &elem)
Definition ui_Container.hpp:41
void Clear()
Definition ui_Container.hpp:45
std::vector< elm::Element::Ref > & GetElements()
Definition ui_Container.hpp:37
Container(const i32 x, const i32 y, const i32 width, const i32 height)
Definition ui_Container.hpp:30
i32 y
Definition ui_Container.hpp:24
i32 h
Definition ui_Container.hpp:26
void Add(elm::Element::Ref elem)
Definition ui_Container.hpp:33
Definition elm_Element.hpp:37
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