mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Wrap Lua settings widgets into an Adapter widget
This commit is contained in:
parent
db9e734a6a
commit
086a7d9bc5
13 changed files with 168 additions and 44 deletions
|
@ -1,8 +1,10 @@
|
|||
#include "scriptsettings.hpp"
|
||||
|
||||
#include <map>
|
||||
#include <sol/sol.hpp>
|
||||
|
||||
#include "element.hpp"
|
||||
#include "adapter.hpp"
|
||||
|
||||
namespace LuaUi
|
||||
{
|
||||
|
@ -19,7 +21,7 @@ namespace LuaUi
|
|||
if (!element.get())
|
||||
Log(Debug::Warning) << "A script settings page has no UI element assigned";
|
||||
return {
|
||||
name, description, element.get()
|
||||
name, description, element
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -44,13 +46,14 @@ namespace LuaUi
|
|||
allPages.clear();
|
||||
}
|
||||
|
||||
void attachToWidget(size_t index, MyGUI::Widget* widget)
|
||||
void attachPageAt(size_t index, LuaAdapter* adapter)
|
||||
{
|
||||
if (index < allPages.size())
|
||||
{
|
||||
ScriptSettingsPage page = parse(allPages[index]);
|
||||
if (page.mElement)
|
||||
page.mElement->attachToWidget(widget);
|
||||
adapter->detach();
|
||||
if (page.mElement.get())
|
||||
adapter->attach(page.mElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue