mirror of
https://github.com/OpenMW/openmw.git
synced 2025-10-15 23:16:39 +00:00
Fix compile errors
This commit is contained in:
parent
f07f05ddd3
commit
67641dcdb7
9 changed files with 31 additions and 15 deletions
|
@ -2,7 +2,7 @@
|
||||||
#include <components/lua_ui/element.hpp>
|
#include <components/lua_ui/element.hpp>
|
||||||
#include <components/lua_ui/layers.hpp>
|
#include <components/lua_ui/layers.hpp>
|
||||||
#include <components/lua_ui/content.hpp>
|
#include <components/lua_ui/content.hpp>
|
||||||
#include <components/lua_ui/scriptsettings.hpp>
|
#include <components/lua_ui/registerscriptsettings.hpp>
|
||||||
|
|
||||||
#include "context.hpp"
|
#include "context.hpp"
|
||||||
#include "actions.hpp"
|
#include "actions.hpp"
|
||||||
|
|
|
@ -165,7 +165,8 @@ add_component_dir (queries
|
||||||
)
|
)
|
||||||
|
|
||||||
add_component_dir (lua_ui
|
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
|
adapter text textedit window image container
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -14,16 +14,16 @@ namespace LuaUi
|
||||||
|
|
||||||
LuaAdapter::LuaAdapter()
|
LuaAdapter::LuaAdapter()
|
||||||
: mElement(nullptr)
|
: mElement(nullptr)
|
||||||
, mContent(nullptr)
|
, mContainer(nullptr)
|
||||||
{
|
{
|
||||||
mContent = MyGUI::Gui::getInstancePtr()->createWidget<LuaContainer>(
|
mContainer = MyGUI::Gui::getInstancePtr()->createWidget<LuaContainer>(
|
||||||
"", MyGUI::IntCoord(), MyGUI::Align::Default, "", "");
|
"", MyGUI::IntCoord(), MyGUI::Align::Default, "", "");
|
||||||
mContent->initialize(luaState, mContent);
|
mContainer->initialize(luaState, mContainer);
|
||||||
mContent->onCoordChange([this](WidgetExtension* ext, MyGUI::IntCoord coord)
|
mContainer->onCoordChange([this](WidgetExtension* ext, MyGUI::IntCoord coord)
|
||||||
{
|
{
|
||||||
setSize(coord.size());
|
setSize(coord.size());
|
||||||
});
|
});
|
||||||
mContent->widget()->attachToWidget(this);
|
mContainer->widget()->attachToWidget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaAdapter::attach(const std::shared_ptr<Element>& element)
|
void LuaAdapter::attach(const std::shared_ptr<Element>& element)
|
||||||
|
@ -31,7 +31,7 @@ namespace LuaUi
|
||||||
detachElement();
|
detachElement();
|
||||||
mElement = element;
|
mElement = element;
|
||||||
attachElement();
|
attachElement();
|
||||||
setSize(mContent->widget()->getSize());
|
setSize(mContainer->widget()->getSize());
|
||||||
|
|
||||||
// workaround for MyGUI bug
|
// workaround for MyGUI bug
|
||||||
// parent visibility doesn't affect added children
|
// parent visibility doesn't affect added children
|
||||||
|
@ -48,7 +48,7 @@ namespace LuaUi
|
||||||
void LuaAdapter::attachElement()
|
void LuaAdapter::attachElement()
|
||||||
{
|
{
|
||||||
if (mElement.get())
|
if (mElement.get())
|
||||||
mElement->attachToWidget(mContent);
|
mElement->attachToWidget(mContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaAdapter::detachElement()
|
void LuaAdapter::detachElement()
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef OPENMW_LUAUI_ADAPTER
|
#ifndef OPENMW_LUAUI_ADAPTER
|
||||||
#define OPENMW_LUAUI_ADAPTER
|
#define OPENMW_LUAUI_ADAPTER
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <MyGUI_Widget.h>
|
#include <MyGUI_Widget.h>
|
||||||
|
|
||||||
namespace LuaUi
|
namespace LuaUi
|
||||||
|
@ -16,11 +18,11 @@ namespace LuaUi
|
||||||
|
|
||||||
void attach(const std::shared_ptr<Element>& element);
|
void attach(const std::shared_ptr<Element>& element);
|
||||||
void detach();
|
void detach();
|
||||||
bool empty() { return mElement.get() == nullptr; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LuaContainer* mContent;
|
|
||||||
std::shared_ptr<Element> mElement;
|
std::shared_ptr<Element> mElement;
|
||||||
|
LuaContainer* mContainer;
|
||||||
|
|
||||||
void attachElement();
|
void attachElement();
|
||||||
void detachElement();
|
void detachElement();
|
||||||
};
|
};
|
||||||
|
|
13
components/lua_ui/registerscriptsettings.hpp
Normal file
13
components/lua_ui/registerscriptsettings.hpp
Normal file
|
@ -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 <map>
|
||||||
#include <sol/sol.hpp>
|
#include <sol/sol.hpp>
|
||||||
|
|
||||||
|
#include "registerscriptsettings.hpp"
|
||||||
#include "element.hpp"
|
#include "element.hpp"
|
||||||
#include "adapter.hpp"
|
#include "adapter.hpp"
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <MyGUI_Widget.h>
|
#include <MyGUI_Widget.h>
|
||||||
|
|
||||||
|
@ -18,8 +19,6 @@ namespace LuaUi
|
||||||
};
|
};
|
||||||
size_t scriptSettingsPageCount();
|
size_t scriptSettingsPageCount();
|
||||||
ScriptSettingsPage scriptSettingsPageAt(size_t index);
|
ScriptSettingsPage scriptSettingsPageAt(size_t index);
|
||||||
void registerSettingsPage(const sol::table& options);
|
|
||||||
void clearSettings();
|
|
||||||
void attachPageAt(size_t index, LuaAdapter* adapter);
|
void attachPageAt(size_t index, LuaAdapter* adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "container.hpp"
|
#include "container.hpp"
|
||||||
|
|
||||||
#include "element.hpp"
|
#include "element.hpp"
|
||||||
#include "scriptsettings.hpp"
|
#include "registerscriptsettings.hpp"
|
||||||
|
|
||||||
namespace LuaUi
|
namespace LuaUi
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,8 +17,8 @@ namespace LuaUi
|
||||||
, mLua(nullptr)
|
, mLua(nullptr)
|
||||||
, mWidget(nullptr)
|
, mWidget(nullptr)
|
||||||
, mSlot(this)
|
, mSlot(this)
|
||||||
, mParent(nullptr)
|
|
||||||
, mLayout(sol::nil)
|
, mLayout(sol::nil)
|
||||||
|
, mParent(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void WidgetExtension::initialize(lua_State* lua, MyGUI::Widget* self)
|
void WidgetExtension::initialize(lua_State* lua, MyGUI::Widget* self)
|
||||||
|
|
Loading…
Reference in a new issue