Changeset View
Changeset View
Standalone View
Standalone View
source/gui/scripting/JSInterface_GUIManager.cpp
/* Copyright (C) 2018 Wildfire Games. | /* Copyright (C) 2019 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | bool JSI_GUIManager::TemplateExists(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::string& templateName) | ||||
return g_GUI->TemplateExists(templateName); | return g_GUI->TemplateExists(templateName); | ||||
} | } | ||||
CParamNode JSI_GUIManager::GetTemplate(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::string& templateName) | CParamNode JSI_GUIManager::GetTemplate(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::string& templateName) | ||||
{ | { | ||||
return g_GUI->GetTemplate(templateName); | return g_GUI->GetTemplate(templateName); | ||||
} | } | ||||
bool JSI_GUIManager::AddIcon(ScriptInterface::CxPrivate* pCxPrivate, const std::string& name, const std::string& sprite, const std::string& size, bool replaceExisting) | |||||
{ | |||||
CGUI* guiPage = static_cast<CGUI*>(pCxPrivate->pCBData); | |||||
return guiPage->AddIcon(name, sprite, size, replaceExisting); | |||||
vladislavbelov: Missing include, error on MSVC:
```
error C2027: use of undefined type 'CGUI'… | |||||
} | |||||
void JSI_GUIManager::RegisterScriptFunctions(const ScriptInterface& scriptInterface) | void JSI_GUIManager::RegisterScriptFunctions(const ScriptInterface& scriptInterface) | ||||
{ | { | ||||
scriptInterface.RegisterFunction<void, std::wstring, JS::HandleValue, &PushGuiPage>("PushGuiPage"); | scriptInterface.RegisterFunction<void, std::wstring, JS::HandleValue, &PushGuiPage>("PushGuiPage"); | ||||
scriptInterface.RegisterFunction<void, std::wstring, JS::HandleValue, &SwitchGuiPage>("SwitchGuiPage"); | scriptInterface.RegisterFunction<void, std::wstring, JS::HandleValue, &SwitchGuiPage>("SwitchGuiPage"); | ||||
scriptInterface.RegisterFunction<void, &PopGuiPage>("PopGuiPage"); | scriptInterface.RegisterFunction<void, &PopGuiPage>("PopGuiPage"); | ||||
scriptInterface.RegisterFunction<void, JS::HandleValue, &PopGuiPageCB>("PopGuiPageCB"); | scriptInterface.RegisterFunction<void, JS::HandleValue, &PopGuiPageCB>("PopGuiPageCB"); | ||||
scriptInterface.RegisterFunction<JS::Value, std::string, &GetGUIObjectByName>("GetGUIObjectByName"); | scriptInterface.RegisterFunction<JS::Value, std::string, &GetGUIObjectByName>("GetGUIObjectByName"); | ||||
scriptInterface.RegisterFunction<std::wstring, std::wstring, &SetCursor>("SetCursor"); | scriptInterface.RegisterFunction<std::wstring, std::wstring, &SetCursor>("SetCursor"); | ||||
scriptInterface.RegisterFunction<void, &ResetCursor>("ResetCursor"); | scriptInterface.RegisterFunction<void, &ResetCursor>("ResetCursor"); | ||||
scriptInterface.RegisterFunction<bool, std::string, &TemplateExists>("TemplateExists"); | scriptInterface.RegisterFunction<bool, std::string, &TemplateExists>("TemplateExists"); | ||||
scriptInterface.RegisterFunction<CParamNode, std::string, &GetTemplate>("GetTemplate"); | scriptInterface.RegisterFunction<CParamNode, std::string, &GetTemplate>("GetTemplate"); | ||||
scriptInterface.RegisterFunction<bool, std::string, std::string, std::string, bool, &AddIcon>("AddIcon"); | |||||
} | } |
Wildfire Games · Phabricator
Missing include, error on MSVC: