1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-05 15:55:45 +00:00
OpenMW/components/lua_ui/element.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
937 B
C++
Raw Normal View History

2021-11-18 15:19:54 +00:00
#ifndef OPENMW_LUAUI_ELEMENT
#define OPENMW_LUAUI_ELEMENT
#include "widget.hpp"
namespace LuaUi
{
struct Element
{
2022-01-18 08:12:56 +00:00
static std::shared_ptr<Element> make(sol::table layout);
2021-11-18 15:19:54 +00:00
template <class Callback>
static void forEach(Callback callback)
{
for (auto& [e, _] : sAllElements)
callback(e);
}
WidgetExtension* mRoot;
WidgetExtension* mAttachedTo;
2021-11-18 15:19:54 +00:00
sol::table mLayout;
std::string mLayer;
2021-11-18 15:19:54 +00:00
bool mUpdate;
bool mDestroy;
void create();
void update();
void destroy();
2022-01-18 08:12:56 +00:00
friend void clearUserInterface();
void attachToWidget(WidgetExtension* w);
void detachFromWidget();
2022-01-18 08:12:56 +00:00
private:
Element(sol::table layout);
static std::map<Element*, std::shared_ptr<Element>> sAllElements;
void updateAttachment();
2021-11-18 15:19:54 +00:00
};
}
#endif // !OPENMW_LUAUI_ELEMENT