|
|
@ -43,13 +43,13 @@ namespace LuaUi
|
|
|
|
return type;
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void destroyWidget(LuaUi::WidgetExtension* ext)
|
|
|
|
void destroyWidget(WidgetExtension* ext)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ext->deinitialize();
|
|
|
|
ext->deinitialize();
|
|
|
|
MyGUI::Gui::getInstancePtr()->destroyWidget(ext->widget());
|
|
|
|
MyGUI::Gui::getInstancePtr()->destroyWidget(ext->widget());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void destroyChild(LuaUi::WidgetExtension* ext)
|
|
|
|
void destroyChild(WidgetExtension* ext)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!ext->isRoot())
|
|
|
|
if (!ext->isRoot())
|
|
|
|
destroyWidget(ext);
|
|
|
|
destroyWidget(ext);
|
|
|
@ -57,7 +57,7 @@ namespace LuaUi
|
|
|
|
ext->widget()->detachFromWidget();
|
|
|
|
ext->widget()->detachFromWidget();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void detachElements(LuaUi::WidgetExtension* ext)
|
|
|
|
void detachElements(WidgetExtension* ext)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (auto* child : ext->children())
|
|
|
|
for (auto* child : ext->children())
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -75,19 +75,20 @@ namespace LuaUi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void destroyRoot(LuaUi::WidgetExtension* ext)
|
|
|
|
void destroyRoot(WidgetExtension* ext)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
detachElements(ext);
|
|
|
|
detachElements(ext);
|
|
|
|
destroyWidget(ext);
|
|
|
|
destroyWidget(ext);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void updateRootCoord(LuaUi::WidgetExtension* ext)
|
|
|
|
void updateRootCoord(WidgetExtension* ext)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LuaUi::WidgetExtension* root = ext;
|
|
|
|
WidgetExtension* root = ext;
|
|
|
|
while (root->getParent())
|
|
|
|
while (root->getParent())
|
|
|
|
root = root->getParent();
|
|
|
|
root = root->getParent();
|
|
|
|
root->updateCoord();
|
|
|
|
root->updateCoord();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
WidgetExtension* pluckElementRoot(const sol::object& child)
|
|
|
|
WidgetExtension* pluckElementRoot(const sol::object& child)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::shared_ptr<Element> element = child.as<std::shared_ptr<Element>>();
|
|
|
|
std::shared_ptr<Element> element = child.as<std::shared_ptr<Element>>();
|
|
|
@ -158,7 +159,6 @@ namespace LuaUi
|
|
|
|
result[i] = pluckElementRoot(child);
|
|
|
|
result[i] = pluckElementRoot(child);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
result[i] = createWidget(child.as<sol::table>(), depth);
|
|
|
|
result[i] = createWidget(child.as<sol::table>(), depth);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -172,7 +172,7 @@ namespace LuaUi
|
|
|
|
ext->setTemplateChildren(updateContent(ext->templateChildren(), content, depth));
|
|
|
|
ext->setTemplateChildren(updateContent(ext->templateChildren(), content, depth));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void setEventCallbacks(LuaUi::WidgetExtension* ext, const sol::object& eventsObj)
|
|
|
|
void setEventCallbacks(WidgetExtension* ext, const sol::object& eventsObj)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ext->clearCallbacks();
|
|
|
|
ext->clearCallbacks();
|
|
|
|
if (eventsObj == sol::nil)
|
|
|
|
if (eventsObj == sol::nil)
|
|
|
|