mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Dispose Lua UI elements correctly
This commit is contained in:
parent
c07fb75bf7
commit
cc528d2e08
12 changed files with 59 additions and 49 deletions
39
components/lua_ui/util.cpp
Normal file
39
components/lua_ui/util.cpp
Normal file
|
@ -0,0 +1,39 @@
|
|||
#include "util.hpp"
|
||||
|
||||
#include <MyGUI_FactoryManager.h>
|
||||
|
||||
#include "widget.hpp"
|
||||
#include "text.hpp"
|
||||
#include "textedit.hpp"
|
||||
#include "window.hpp"
|
||||
|
||||
#include "element.hpp"
|
||||
|
||||
namespace LuaUi
|
||||
{
|
||||
|
||||
void registerAllWidgets()
|
||||
{
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<LuaWidget>("Widget");
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<LuaText>("Widget");
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<LuaTextEdit>("Widget");
|
||||
MyGUI::FactoryManager::getInstance().registerFactory<LuaWindow>("Widget");
|
||||
}
|
||||
|
||||
const std::unordered_map<std::string, std::string>& widgetTypeToName()
|
||||
{
|
||||
static std::unordered_map<std::string, std::string> types{
|
||||
{ "LuaWidget", "Widget" },
|
||||
{ "LuaText", "Text" },
|
||||
{ "LuaTextEdit", "TextEdit" },
|
||||
{ "LuaWindow", "Window" },
|
||||
};
|
||||
return types;
|
||||
}
|
||||
|
||||
void clearUserInterface()
|
||||
{
|
||||
while (!Element::sAllElements.empty())
|
||||
Element::sAllElements.begin()->second->destroy();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue