Plutonium framework API  0.3
Simple UI framework for libnx and SDL2
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
16 #include <vector>
17 
18 namespace pu::ui
19 {
20  class Container
21  {
22  public:
23  Container(i32 X, i32 Y, i32 Width, i32 Height);
25 
26  template<typename Elem>
27  void Add(std::shared_ptr<Elem> Elm)
28  {
29  static_assert(std::is_base_of<elm::Element, Elem>::value, "Elements must inherit from pu::ui::elm::Element!");
30 
31  elms.push_back(std::dynamic_pointer_cast<elm::Element>(Elm));
32  }
33 
34  elm::Element::Ref &At(i32 Index);
35  bool Has(elm::Element::Ref &Elm);
36  void Clear();
37  i32 GetCount();
38  void SetX(i32 X);
39  i32 GetX();
40  void SetY(i32 Y);
41  i32 GetY();
42  void SetWidth(i32 Width);
43  i32 GetWidth();
44  void SetHeight(i32 Height);
45  i32 GetHeight();
46  void PreRender();
47  protected:
48  i32 x;
49  i32 y;
50  i32 w;
51  i32 h;
52  std::vector<elm::Element::Ref> elms;
53  };
54 }
void SetHeight(i32 Height)
bool Has(elm::Element::Ref &Elm)
void SetY(i32 Y)
i32 y
Definition: ui_Container.hpp:49
i32 h
Definition: ui_Container.hpp:51
elm::Element::Ref & At(i32 Index)
void SetWidth(i32 Width)
std::vector< elm::Element::Ref > elms
Definition: ui_Container.hpp:52
Container(i32 X, i32 Y, i32 Width, i32 Height)
s32 i32
Definition: pu_Macros.hpp:17
i32 w
Definition: ui_Container.hpp:50
#define PU_SMART_CTOR(type)
Definition: pu_Macros.hpp:8
i32 x
Definition: ui_Container.hpp:48
Definition: ui_Container.hpp:20
void SetX(i32 X)
void Add(std::shared_ptr< Elem > Elm)
Definition: ui_Container.hpp:27