Toast Engine
Loading...
Searching...
No Matches
panel.hpp
Go to the documentation of this file.
1
8
9#pragma once
10#include <memory>
11#include <toast/ui/assets.hpp>
12#include <toast/world/node.hpp>
13
14// NOLINTNEXTLINE(readability-identifier-naming)
15namespace Rml {
16class Context;
17class ElementDocument;
18}
19
20namespace ui {
21class UIBinds;
22class UIBindStore;
23}
24
25namespace toast {
26
27class TOAST_API [[ToastNode, Icon("Window"), Color("Blue")]] Panel : public Node {
28public:
29 Panel();
30 ~Panel() override;
31
32 [[nodiscard]]
33 auto rmlContext() -> Rml::Context* {
34 return m_context;
35 }
36
37 [[nodiscard]]
38 auto rmlDocument() -> Rml::ElementDocument* {
39 return m_document;
40 }
41
42 [[nodiscard]]
43 auto colorScheme() const -> const assets::Handle<assets::ColorScheme>& {
44 return m_color_scheme;
45 }
46
47 void reloadDocument();
48
49private:
50 void onReflectedFieldChanged(std::string_view field_name) override;
51 void updateInspectorMessages() override;
52 void init();
53 void begin();
54 void destroy();
55 void onEnable();
56 void onDisable();
57
59 void setup();
60 void loadDocument();
61 void unloadDocument();
62
63 [[Reflect]]
65
66 [[Reflect]]
68
69 [[Reflect]]
70 std::vector<assets::Handle<assets::Font>> m_fonts;
71
72 [[Reflect, Group("Data"), Name("Table")]]
73 std::vector<assets::Handle<assets::Localization>> m_localizations;
74
75 [[Reflect, Group("Data"), Name("Image table")]]
76 std::vector<assets::Handle<assets::ImageLocalization>> m_image_localizations;
77
78 Rml::Context* m_context = nullptr;
79 Rml::ElementDocument* m_document = nullptr;
80 std::unique_ptr<ui::UIBindStore> m_bind_store;
81 std::unique_ptr<ui::UIBinds> m_binds;
82};
83
84}
Type-safe smart pointer for assets.
Definition core_types.hpp:149
Definition reflect.hpp:244
Persistent values shared by Lua and the active RmlUi data model.
Definition ui_binds.hpp:33
Definition ui_binds.hpp:52
Base object type for the scene graph.
Aggregate header for the UI asset types.