Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/gui/scripting/JSInterface_GUIManager.cpp
Show All 13 Lines | |||||
* You should have received a copy of the GNU General Public License | * You should have received a copy of the GNU General Public License | ||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | ||||
*/ | */ | ||||
#include "precompiled.h" | #include "precompiled.h" | ||||
#include "JSInterface_GUIManager.h" | #include "JSInterface_GUIManager.h" | ||||
#include "gui/CGUI.h" | |||||
#include "gui/GUIManager.h" | #include "gui/GUIManager.h" | ||||
#include "gui/IGUIObject.h" | #include "gui/IGUIObject.h" | ||||
#include "ps/GameSetup/Config.h" | #include "ps/GameSetup/Config.h" | ||||
#include "scriptinterface/ScriptInterface.h" | #include "scriptinterface/ScriptInterface.h" | ||||
// Note that the initData argument may only contain clonable data. | // Note that the initData argument may only contain clonable data. | ||||
// Functions aren't supported for example! | // Functions aren't supported for example! | ||||
void JSI_GUIManager::PushGuiPage(ScriptInterface::CxPrivate* pCxPrivate, const std::wstring& name, JS::HandleValue initData) | void JSI_GUIManager::PushGuiPage(ScriptInterface::CxPrivate* pCxPrivate, const std::wstring& name, JS::HandleValue initData) | ||||
Show All 11 Lines | void JSI_GUIManager::PopGuiPage(ScriptInterface::CxPrivate* UNUSED(pCxPrivate)) | ||||
g_GUI->PopPage(); | g_GUI->PopPage(); | ||||
} | } | ||||
void JSI_GUIManager::PopGuiPageCB(ScriptInterface::CxPrivate* pCxPrivate, JS::HandleValue args) | void JSI_GUIManager::PopGuiPageCB(ScriptInterface::CxPrivate* pCxPrivate, JS::HandleValue args) | ||||
{ | { | ||||
g_GUI->PopPageCB(pCxPrivate->pScriptInterface->WriteStructuredClone(args)); | g_GUI->PopPageCB(pCxPrivate->pScriptInterface->WriteStructuredClone(args)); | ||||
} | } | ||||
JS::Value JSI_GUIManager::GetGUIObjectByName(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::string& name) | JS::Value JSI_GUIManager::GetGUIObjectByName(ScriptInterface::CxPrivate* pCxPrivate, const std::string& name) | ||||
{ | { | ||||
IGUIObject* guiObj = g_GUI->FindObjectByName(name); | CGUI* guiPage = static_cast<CGUI*>(pCxPrivate->pCBData); | ||||
IGUIObject* guiObj = guiPage->FindObjectByName(name); | |||||
if (!guiObj) | if (!guiObj) | ||||
return JS::UndefinedValue(); | return JS::UndefinedValue(); | ||||
return JS::ObjectValue(*guiObj->GetJSObject()); | return JS::ObjectValue(*guiObj->GetJSObject()); | ||||
} | } | ||||
std::wstring JSI_GUIManager::SetCursor(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& name) | std::wstring JSI_GUIManager::SetCursor(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& name) | ||||
{ | { | ||||
Show All 32 Lines |
Wildfire Games · Phabricator