# Plutonium framework API: Plutonium/include/pu/ui/ui_Container.hpp Source File

ui_Container.hpp
Go to the documentation of this file.
/*
Plutonium library
@file ui_Container.hpp
@brief A Container is a basic object which contains a bunch of Elements.
@author XorTroll
@copyright Plutonium project - an easy-to-use UI framework for Nintendo Switch homebrew
*/
#pragma once
#include <pu/ui/elm/elm_Element.hpp>
#include <vector>
#include <bits/stdc++.h>
namespace pu::ui {
class Container {
protected:
i32 x;
i32 y;
i32 w;
i32 h;
std::vector<elm::Element::Ref> elems;
public:
Container(const i32 x, const i32 y, const i32 width, const i32 height) : x(x), y(y), w(width), h(height), elems() {}
PU_SMART_CTOR(Container)
inline void Add(elm::Element::Ref elem) {
this->elems.push_back(elem);
}
inline elm::Element::Ref &At(const i32 idx) {
return this->elems.at(idx);
}
inline bool Has(elm::Element::Ref &elem) {
return std::find(this->elems.begin(), this->elems.end(), elem) != this->elems.end();
}
inline void Clear() {
this->elems.clear();
}
inline size_t GetCount() {
return this->elems.size();
}
inline void SetX(const i32 x) {
this->x = x;
}
inline i32 GetX() {
return this->x;
}
inline void SetY(const i32 y) {
this->y = y;
}
inline i32 GetY() {
return this->y;
}
inline void SetWidth(const i32 width) {
this->w = width;
}
inline i32 GetWidth() {
return this->w;
}
inline void SetHeight(const i32 height) {
this->h = height;
}
inline i32 GetHeight() {
return this->h;
}
void PreRender();
};
}
pu::ui::Container
Definition: ui_Container.hpp:21
pu::ui::Container::x
i32 x
Definition: ui_Container.hpp:23
pu::ui::Container::elems
std::vector< elm::Element::Ref > elems
Definition: ui_Container.hpp:27
pu::ui::Container::w
i32 w
Definition: ui_Container.hpp:25
pu::ui::Container::GetCount
size_t GetCount()
Definition: ui_Container.hpp:49
pu::ui::Container::Has
bool Has(elm::Element::Ref &elem)
Definition: ui_Container.hpp:41
pu::ui::Container::Clear
void Clear()
Definition: ui_Container.hpp:45
pu::ui::Container::Container
Container(const i32 x, const i32 y, const i32 width, const i32 height)
Definition: ui_Container.hpp:30
pu::ui::Container::y
i32 y
Definition: ui_Container.hpp:24
pu::ui::Container::At
elm::Element::Ref & At(const i32 idx)
Definition: ui_Container.hpp:37
pu::ui::Container::GetX
i32 GetX()
Definition: ui_Container.hpp:57
pu::ui::Container::SetY
void SetY(const i32 y)
Definition: ui_Container.hpp:61
pu::ui::Container::SetHeight
void SetHeight(const i32 height)
Definition: ui_Container.hpp:77
pu::ui::Container::GetHeight
i32 GetHeight()
Definition: ui_Container.hpp:81
pu::ui::Container::h
i32 h
Definition: ui_Container.hpp:26
pu::ui::Container::PreRender
void PreRender()
pu::ui::Container::SetX
void SetX(const i32 x)
Definition: ui_Container.hpp:53
pu::ui::Container::Add
void Add(elm::Element::Ref elem)
Definition: ui_Container.hpp:33
pu::ui::Container::SetWidth
void SetWidth(const i32 width)
Definition: ui_Container.hpp:69
pu::ui::Container::GetY
i32 GetY()
Definition: ui_Container.hpp:65
pu::ui::Container::GetWidth
i32 GetWidth()
Definition: ui_Container.hpp:73
elm_Element.hpp
pu::ui
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