Fix compile errors

C++20
uramer 3 years ago
parent f07f05ddd3
commit 67641dcdb7

@ -2,7 +2,7 @@
#include <components/lua_ui/element.hpp>
#include <components/lua_ui/layers.hpp>
#include <components/lua_ui/content.hpp>
#include <components/lua_ui/scriptsettings.hpp>
#include <components/lua_ui/registerscriptsettings.hpp>
#include "context.hpp"
#include "actions.hpp"

@ -165,7 +165,8 @@ add_component_dir (queries
)
add_component_dir (lua_ui
properties widget element util layers content scriptsettings
registerscriptsettings scriptsettings
properties widget element util layers content
adapter text textedit window image container
)

@ -14,16 +14,16 @@ namespace LuaUi
LuaAdapter::LuaAdapter()
: mElement(nullptr)
, mContent(nullptr)
, mContainer(nullptr)
{
mContent = MyGUI::Gui::getInstancePtr()->createWidget<LuaContainer>(
mContainer = MyGUI::Gui::getInstancePtr()->createWidget<LuaContainer>(
"", MyGUI::IntCoord(), MyGUI::Align::Default, "", "");
mContent->initialize(luaState, mContent);
mContent->onCoordChange([this](WidgetExtension* ext, MyGUI::IntCoord coord)
mContainer->initialize(luaState, mContainer);
mContainer->onCoordChange([this](WidgetExtension* ext, MyGUI::IntCoord coord)
{
setSize(coord.size());
});
mContent->widget()->attachToWidget(this);
mContainer->widget()->attachToWidget(this);
}
void LuaAdapter::attach(const std::shared_ptr<Element>& element)
@ -31,7 +31,7 @@ namespace LuaUi
detachElement();
mElement = element;
attachElement();
setSize(mContent->widget()->getSize());
setSize(mContainer->widget()->getSize());
// workaround for MyGUI bug
// parent visibility doesn't affect added children
@ -48,7 +48,7 @@ namespace LuaUi
void LuaAdapter::attachElement()
{
if (mElement.get())
mElement->attachToWidget(mContent);
mElement->attachToWidget(mContainer);
}
void LuaAdapter::detachElement()

@ -1,6 +1,8 @@
#ifndef OPENMW_LUAUI_ADAPTER
#define OPENMW_LUAUI_ADAPTER
#include <memory>
#include <MyGUI_Widget.h>
namespace LuaUi
@ -16,11 +18,11 @@ namespace LuaUi
void attach(const std::shared_ptr<Element>& element);
void detach();
bool empty() { return mElement.get() == nullptr; }
private:
LuaContainer* mContent;
std::shared_ptr<Element> mElement;
LuaContainer* mContainer;
void attachElement();
void detachElement();
};

@ -0,0 +1,13 @@
#ifndef OPENMW_LUAUI_REGISTERSCRIPTSETTINGS
#define OPENMW_LUAUI_REGISTERSCRIPTSETTINGS
#include <sol/sol.hpp>
namespace LuaUi
{
// implemented in scriptsettings.cpp
void registerSettingsPage(const sol::table& options);
void clearSettings();
}
#endif // !OPENMW_LUAUI_REGISTERSCRIPTSETTINGS

@ -3,6 +3,7 @@
#include <map>
#include <sol/sol.hpp>
#include "registerscriptsettings.hpp"
#include "element.hpp"
#include "adapter.hpp"

@ -3,6 +3,7 @@
#include <string>
#include <string_view>
#include <memory>
#include <MyGUI_Widget.h>
@ -18,8 +19,6 @@ namespace LuaUi
};
size_t scriptSettingsPageCount();
ScriptSettingsPage scriptSettingsPageAt(size_t index);
void registerSettingsPage(const sol::table& options);
void clearSettings();
void attachPageAt(size_t index, LuaAdapter* adapter);
}

@ -11,7 +11,7 @@
#include "container.hpp"
#include "element.hpp"
#include "scriptsettings.hpp"
#include "registerscriptsettings.hpp"
namespace LuaUi
{

@ -17,8 +17,8 @@ namespace LuaUi
, mLua(nullptr)
, mWidget(nullptr)
, mSlot(this)
, mParent(nullptr)
, mLayout(sol::nil)
, mParent(nullptr)
{}
void WidgetExtension::initialize(lua_State* lua, MyGUI::Widget* self)

Loading…
Cancel
Save