Changeset View
Changeset View
Standalone View
Standalone View
source/gui/CGUI.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 259 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
// janwas 2006-03-03: spoke with Ykkrosh about EventName case. | // janwas 2006-03-03: spoke with Ykkrosh about EventName case. | ||||
// when registering, case is converted to lower - this avoids surprise | // when registering, case is converted to lower - this avoids surprise | ||||
// if someone were to get the case wrong and then not notice their | // if someone were to get the case wrong and then not notice their | ||||
// handler is never called. however, until now, the other end | // handler is never called. however, until now, the other end | ||||
// (sending events here) wasn't converting to lower case, | // (sending events here) wasn't converting to lower case, | ||||
// leading to a similar problem. | // leading to a similar problem. | ||||
// now fixed; case is irrelevant since all are converted to lower. | // now fixed; case is irrelevant since all are converted to lower. | ||||
GUI<CStr>::RecurseObject(0, m_BaseObject, | |||||
&IGUIObject::ScriptEvent, EventName.LowerCase()); | GUI<CStr>::RecurseObject(0, m_BaseObject, &IGUIObject::ScriptEvent, EventName.LowerCase()); | ||||
} | |||||
void CGUI::SendEventToAll(const CStr& EventName, JS::HandleValue argument) | |||||
{ | |||||
GUI<CStr>::RecurseObject(0, m_BaseObject, &IGUIObject::ScriptEvent, EventName.LowerCase(), argument); | |||||
} | } | ||||
CGUI::CGUI(const shared_ptr<ScriptRuntime>& runtime) | CGUI::CGUI(const shared_ptr<ScriptRuntime>& runtime) | ||||
: m_MouseButtons(0), m_FocusedObject(NULL), m_InternalNameNumber(0) | : m_MouseButtons(0), m_FocusedObject(NULL), m_InternalNameNumber(0) | ||||
{ | { | ||||
m_ScriptInterface.reset(new ScriptInterface("Engine", "GUIPage", runtime)); | m_ScriptInterface.reset(new ScriptInterface("Engine", "GUIPage", runtime)); | ||||
GuiScriptingInit(*m_ScriptInterface); | GuiScriptingInit(*m_ScriptInterface); | ||||
m_ScriptInterface->LoadGlobalScripts(); | m_ScriptInterface->LoadGlobalScripts(); | ||||
▲ Show 20 Lines • Show All 1,459 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator