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
|
|
|
|
2022-01-28 20:35:05 +00:00
|
|
|
WidgetExtension* mRoot;
|
2022-01-29 22:06:43 +00:00
|
|
|
WidgetExtension* mAttachedTo;
|
2021-11-18 15:19:54 +00:00
|
|
|
sol::table mLayout;
|
2022-01-28 20:35:05 +00:00
|
|
|
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();
|
|
|
|
|
2022-01-29 22:06:43 +00:00
|
|
|
void attachToWidget(WidgetExtension* w);
|
|
|
|
void detachFromWidget();
|
2022-01-28 20:35:05 +00:00
|
|
|
|
2022-01-18 08:12:56 +00:00
|
|
|
private:
|
|
|
|
Element(sol::table layout);
|
|
|
|
static std::map<Element*, std::shared_ptr<Element>> sAllElements;
|
2022-01-28 20:35:05 +00:00
|
|
|
void updateAttachment();
|
2021-11-18 15:19:54 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // !OPENMW_LUAUI_ELEMENT
|