1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 03:39:14 +00:00
OpenMW/components/lua_ui/util.cpp

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

59 lines
1.9 KiB
C++
Raw Normal View History

2022-01-18 08:12:56 +00:00
#include "util.hpp"
2021-11-18 15:19:54 +00:00
#include <MyGUI_FactoryManager.h>
#include "adapter.hpp"
#include "container.hpp"
#include "flex.hpp"
2021-11-18 15:19:54 +00:00
#include "image.hpp"
#include "text.hpp"
#include "textedit.hpp"
#include "widget.hpp"
#include "window.hpp"
2022-01-18 08:12:56 +00:00
#include "element.hpp"
2022-01-29 22:43:08 +00:00
#include "registerscriptsettings.hpp"
2022-01-18 08:12:56 +00:00
2021-11-18 15:19:54 +00:00
namespace LuaUi
{
void registerAllWidgets()
{
MyGUI::FactoryManager::getInstance().registerFactory<LuaAdapter>("Widget");
2021-11-18 15:19:54 +00:00
MyGUI::FactoryManager::getInstance().registerFactory<LuaWidget>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<LuaText>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<LuaTextEdit>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<LuaWindow>("Widget");
2022-01-28 09:31:45 +00:00
MyGUI::FactoryManager::getInstance().registerFactory<LuaImage>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<LuaTileRect>("BasisSkin");
MyGUI::FactoryManager::getInstance().registerFactory<LuaContainer>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<LuaFlex>("Widget");
2021-11-18 15:19:54 +00:00
}
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" },
2022-01-28 09:31:45 +00:00
{ "LuaImage", "Image" },
{ "LuaFlex", "Flex" },
2022-05-14 10:27:30 +00:00
{ "LuaContainer", "Container" },
2021-11-18 15:19:54 +00:00
};
return types;
}
2022-01-18 08:12:56 +00:00
2024-01-07 22:29:20 +00:00
void clearGameInterface()
2022-01-18 08:12:56 +00:00
{
2024-01-07 22:29:20 +00:00
while (!Element::sGameElements.empty())
Element::erase(Element::sGameElements.begin()->second.get());
2024-01-07 22:29:20 +00:00
}
void clearMenuInterface()
{
while (!Element::sMenuElements.empty())
Element::erase(Element::sMenuElements.begin()->second.get());
2022-01-18 08:12:56 +00:00
}
2021-11-18 15:19:54 +00:00
}