Potato Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
Widget.hpp
Go to the documentation of this file.
1
2
#pragma once
3
4
#include <vector>
5
6
#include "
Core/Event/Tickable.hpp
"
7
#include "
Game/UI/UIElement.hpp
"
8
9
class
WidgetElement
;
10
14
class
Widget
:
public
Tickable,
public
UIElement
15
{
16
public
:
24
Widget
(std::string UID);
25
virtual
~Widget
();
26
28
std::string
GetUID
()
const
;
29
36
template
<
typename
ElemType>
37
ElemType*
AddElement
(std::string name);
38
40
const
std::unordered_map<std::string, WidgetElement*>&
GetAllElements
()
const
;
42
WidgetElement
*
GetElement
(std::string name);
43
44
private
:
45
46
std::unordered_map<std::string, WidgetElement*> Elements;
47
48
private
:
49
const
std::string UID;
50
51
};
52
53
template
<
typename
ElemType>
54
ElemType*
Widget::AddElement
(std::string name) {
55
ElemType* elem =
new
ElemType();
56
Elements[name] = elem;
57
58
return
elem;
59
}
Tickable.hpp
UIElement.hpp
UIElement
Wrapper for elements that can be rendered on screen.
Definition
UIElement.hpp:12
Widget::GetAllElements
const std::unordered_map< std::string, WidgetElement * > & GetAllElements() const
Gets map of all elements.
Definition
Widget.cpp:18
Widget::GetUID
std::string GetUID() const
Gets unique ID of widget.
Definition
Widget.cpp:14
Widget::Widget
Widget(std::string UID)
Constructs widget.
Definition
Widget.cpp:7
Widget::AddElement
ElemType * AddElement(std::string name)
Creates and adds WidgetElement to widget screen.
Definition
Widget.hpp:54
Widget::GetElement
WidgetElement * GetElement(std::string name)
Gets specific element by name.
Definition
Widget.cpp:21
WidgetElement
Wrapper for specialized sub-element that can be rendered by a Widget.
Definition
WidgetElement.hpp:11
Game
UI
Widgets
Widget.hpp
Generated by
1.17.0