diff --git a/binaries/data/mods/_test.gui/gui/regainFocus/pushWithPopOnInit.js b/binaries/data/mods/_test.gui/gui/regainFocus/pushWithPopOnInit.js
index 14f188ba39..3152923203 100644
--- a/binaries/data/mods/_test.gui/gui/regainFocus/pushWithPopOnInit.js
+++ b/binaries/data/mods/_test.gui/gui/regainFocus/pushWithPopOnInit.js
@@ -1,4 +1,4 @@
function init()
{
- return Engine.PushGuiPage("regainFocus/page_emptyPage.xml");
+ return Engine.OpenChildPage("regainFocus/page_emptyPage.xml");
}
diff --git a/binaries/data/mods/_test.gui/gui/sequential/sequential.js b/binaries/data/mods/_test.gui/gui/sequential/sequential.js
index e87c9984bf..08f919ebb8 100644
--- a/binaries/data/mods/_test.gui/gui/sequential/sequential.js
+++ b/binaries/data/mods/_test.gui/gui/sequential/sequential.js
@@ -1,5 +1,5 @@
async function init()
{
- await Engine.PushGuiPage("regainFocus/page_emptyPage.xml");
- await Engine.PushGuiPage("regainFocus/page_emptyPage.xml");
+ await Engine.OpenChildPage("regainFocus/page_emptyPage.xml");
+ await Engine.OpenChildPage("regainFocus/page_emptyPage.xml");
}
diff --git a/binaries/data/mods/mod/gui/common/functions_msgbox.js b/binaries/data/mods/mod/gui/common/functions_msgbox.js
index 46cb5512ed..308d6e9493 100644
--- a/binaries/data/mods/mod/gui/common/functions_msgbox.js
+++ b/binaries/data/mods/mod/gui/common/functions_msgbox.js
@@ -1,6 +1,6 @@
function messageBox(width, height, message, title, buttonCaptions)
{
- return Engine.PushGuiPage(
+ return Engine.OpenChildPage(
"page_msgbox.xml",
{
"width": width,
@@ -13,7 +13,7 @@ function messageBox(width, height, message, title, buttonCaptions)
function timedConfirmation(width, height, message, timeParameter, timeout, title, buttonCaptions)
{
- return Engine.PushGuiPage(
+ return Engine.OpenChildPage(
"page_timedconfirmation.xml",
{
"width": width,
diff --git a/binaries/data/mods/mod/gui/common/terms.js b/binaries/data/mods/mod/gui/common/terms.js
index b05ad037f4..e69a8c1bf9 100644
--- a/binaries/data/mods/mod/gui/common/terms.js
+++ b/binaries/data/mods/mod/gui/common/terms.js
@@ -7,7 +7,7 @@ function initTerms(terms)
async function openTerms(page)
{
- const data = await Engine.PushGuiPage(
+ const data = await Engine.OpenChildPage(
"page_termsdialog.xml",
{
"file": g_Terms[page].file,
diff --git a/binaries/data/mods/mod/gui/modmod/modmod.js b/binaries/data/mods/mod/gui/modmod/modmod.js
index b8eaf635e2..3bd1faa93e 100644
--- a/binaries/data/mods/mod/gui/modmod/modmod.js
+++ b/binaries/data/mods/mod/gui/modmod/modmod.js
@@ -84,7 +84,7 @@ function init(data, hotloadData)
initMods();
initGUIButtons(data);
if (g_HasIncompatibleMods)
- Engine.PushGuiPage("page_incompatible_mods.xml", {});
+ Engine.OpenChildPage("page_incompatible_mods.xml", {});
}
function initMods()
diff --git a/binaries/data/mods/mod/gui/modmod/modmod.xml b/binaries/data/mods/mod/gui/modmod/modmod.xml
index 5b5e0a9be8..62a42e5fd3 100644
--- a/binaries/data/mods/mod/gui/modmod/modmod.xml
+++ b/binaries/data/mods/mod/gui/modmod/modmod.xml
@@ -200,7 +200,7 @@
diff --git a/source/gui/GUIManager.cpp b/source/gui/GUIManager.cpp
index ed531ce571..3eb2a0fe39 100644
--- a/source/gui/GUIManager.cpp
+++ b/source/gui/GUIManager.cpp
@@ -113,10 +113,10 @@ void CGUIManager::SwitchPage(const CStrW& pageName, const ScriptInterface* srcSc
m_PageStack.clear();
}
- PushPage(pageName, initDataClone);
+ OpenChildPage(pageName, initDataClone);
}
-JS::Value CGUIManager::PushPage(const CStrW& pageName, Script::StructuredClone initData)
+JS::Value CGUIManager::OpenChildPage(const CStrW& pageName, Script::StructuredClone initData)
{
// Store the callback handler in the current GUI page before opening the new one
JS::RootedValue promise{m_ScriptInterface.GetGeneralJSContext(), [&]
@@ -130,8 +130,8 @@ JS::Value CGUIManager::PushPage(const CStrW& pageName, Script::StructuredClone i
return m_PageStack.back().ReplacePromise(*currentPage.GetScriptInterface());
}()};
- // Push the page prior to loading its contents, because that may push
- // another GUI page on init which should be pushed on top of this new page.
+ // Emplace the page prior to loading its contents, because that may open
+ // another GUI page on init which should be emplaced on top of this new page.
m_PageStack.emplace_back(pageName, initData);
m_PageStack.back().LoadPage(m_ScriptContext);
diff --git a/source/gui/GUIManager.h b/source/gui/GUIManager.h
index 7fc063e7e1..140b62a3c4 100644
--- a/source/gui/GUIManager.h
+++ b/source/gui/GUIManager.h
@@ -71,7 +71,7 @@ public:
* user inputs.
* The returned promise will be fulfilled once the pushed page is closed.
*/
- JS::Value PushPage(const CStrW& pageName, Script::StructuredClone initData);
+ JS::Value OpenChildPage(const CStrW& pageName, Script::StructuredClone initData);
/**
* Called when a file has been modified, to hotload changes.
diff --git a/source/gui/Scripting/JSInterface_GUIManager.cpp b/source/gui/Scripting/JSInterface_GUIManager.cpp
index e2907f9c47..3e92698905 100644
--- a/source/gui/Scripting/JSInterface_GUIManager.cpp
+++ b/source/gui/Scripting/JSInterface_GUIManager.cpp
@@ -33,9 +33,9 @@ namespace JSI_GUIManager
// Note that the initData argument may only contain clonable data.
// Functions aren't supported for example!
// It returns a promise.
-JS::Value PushGuiPage(const ScriptRequest& rq, const std::wstring& name, JS::HandleValue initData)
+JS::Value OpenChildPage(const ScriptRequest& rq, const std::wstring& name, JS::HandleValue initData)
{
- return g_GUI->PushPage(name, Script::WriteStructuredClone(rq, initData));
+ return g_GUI->OpenChildPage(name, Script::WriteStructuredClone(rq, initData));
}
void SwitchGuiPage(const ScriptInterface& scriptInterface, const std::wstring& name, JS::HandleValue initData)
@@ -66,7 +66,7 @@ CParamNode GetTemplate(const std::string& templateName)
void RegisterScriptFunctions(const ScriptRequest& rq)
{
- ScriptFunction::Register<&PushGuiPage>(rq, "PushGuiPage");
+ ScriptFunction::Register<&OpenChildPage>(rq, "OpenChildPage");
ScriptFunction::Register<&SwitchGuiPage>(rq, "SwitchGuiPage");
ScriptFunction::Register<&SetCursor>(rq, "SetCursor");
ScriptFunction::Register<&ResetCursor>(rq, "ResetCursor");
diff --git a/source/gui/tests/test_GuiManager.h b/source/gui/tests/test_GuiManager.h
index 1ea3fa205b..b46da35147 100644
--- a/source/gui/tests/test_GuiManager.h
+++ b/source/gui/tests/test_GuiManager.h
@@ -83,7 +83,7 @@ public:
Script::CreateObject(rq, &val);
Script::StructuredClone data = Script::WriteStructuredClone(rq, JS::NullHandleValue);
- g_GUI->PushPage(L"event/page_event.xml", data);
+ g_GUI->OpenChildPage(L"event/page_event.xml", data);
const ScriptInterface& pageScriptInterface = *(g_GUI->GetActiveGUI()->GetScriptInterface());
ScriptRequest prq(pageScriptInterface);
@@ -146,7 +146,7 @@ public:
Script::CreateObject(rq, &val);
Script::StructuredClone data = Script::WriteStructuredClone(rq, JS::NullHandleValue);
- g_GUI->PushPage(L"hotkey/page_hotkey.xml", data);
+ g_GUI->OpenChildPage(L"hotkey/page_hotkey.xml", data);
// Press 'a'.
SDL_Event_ hotkeyNotification;
@@ -228,11 +228,11 @@ public:
Script::WriteStructuredClone(rq, JS::UndefinedHandleValue)};
TS_ASSERT_EQUALS(g_GUI->GetPageCount(), 0);
- g_GUI->PushPage(L"regainFocus/page_emptyPage.xml", undefined);
+ g_GUI->OpenChildPage(L"regainFocus/page_emptyPage.xml", undefined);
TS_ASSERT_EQUALS(g_GUI->GetPageCount(), 1);
// This page instantly pushes an empty page with a callback that pops another page again.
- g_GUI->PushPage(L"regainFocus/page_pushWithPopOnInit.xml", undefined);
+ g_GUI->OpenChildPage(L"regainFocus/page_pushWithPopOnInit.xml", undefined);
TS_ASSERT_EQUALS(g_GUI->GetPageCount(), 3);
// Pop the empty page and execute the continuation.
@@ -254,7 +254,7 @@ public:
const Script::StructuredClone undefined{
Script::WriteStructuredClone(rq, JS::UndefinedHandleValue)};
- g_GUI->PushPage(L"regainFocus/page_emptyPage.xml", undefined);
+ g_GUI->OpenChildPage(L"regainFocus/page_emptyPage.xml", undefined);
for (const auto& [reject, result] : testSteps)
@@ -263,7 +263,7 @@ public:
const Script::StructuredClone clonedValue{Script::WriteStructuredClone(rq, value)};
const JS::RootedValue promise{rq.cx,
- g_GUI->PushPage(L"resolveReject/page_resolveReject.xml", clonedValue)};
+ g_GUI->OpenChildPage(L"resolveReject/page_resolveReject.xml", clonedValue)};
// Check whether promises are settled in the page stack and flush the stack.
g_GUI->TickObjects();
@@ -277,7 +277,7 @@ public:
const ScriptRequest rq{g_GUI->GetScriptInterface()};
const Script::StructuredClone undefined{
Script::WriteStructuredClone(rq, JS::UndefinedHandleValue)};
- g_GUI->PushPage(L"sequential/page_sequential.xml", undefined);
+ g_GUI->OpenChildPage(L"sequential/page_sequential.xml", undefined);
TS_ASSERT_EQUALS(g_GUI->GetPageCount(), 2);
CloseTopmostPage();
TS_ASSERT_EQUALS(g_GUI->GetPageCount(), 2);