Changeset View
Changeset View
Standalone View
Standalone View
source/gui/ObjectTypes/CText.cpp
Show First 20 Lines • Show All 252 Lines • ▼ Show 20 Lines | bool CText::MouseOverIcon() | ||||
return false; | return false; | ||||
} | } | ||||
void CText::CreateJSObject() | void CText::CreateJSObject() | ||||
{ | { | ||||
ScriptRequest rq(m_pGUI.GetScriptInterface()); | ScriptRequest rq(m_pGUI.GetScriptInterface()); | ||||
// TODO SM60: actually use this when we can use GetProxyPrivate | |||||
JS::RootedValue priv(rq.cx); | JS::RootedValue priv(rq.cx); | ||||
//priv.get().setPrivate(this); -> need to use a virtual func. | priv.get().setPrivate(this); | ||||
js::ProxyOptions options; | js::ProxyOptions options; | ||||
options.setClass(&JSI_GUIProxy<IGUIObject>::ClassDefinition()); | options.setClass(&JSI_GUIProxy<IGUIObject>::ClassDefinition()); | ||||
m_JSObject.init(rq.cx, js::NewProxyObject(rq.cx, &JSI_GUIProxy<CText>::Singleton(), priv, nullptr, options)); | m_JSObject.init(rq.cx, js::NewProxyObject(rq.cx, &JSI_GUIProxy<CText>::Singleton(), priv, nullptr, options)); | ||||
// TODO: remove this when we can use GetProxyPrivate | |||||
JS_SetPrivate(m_JSObject.get(), this); | |||||
} | } | ||||
bool CText::getTextSize(ScriptInterface& scriptInterface, JS::MutableHandleValue ret) | bool CText::getTextSize(ScriptInterface& scriptInterface, JS::MutableHandleValue ret) | ||||
{ | { | ||||
ScriptRequest rq(scriptInterface); | ScriptRequest rq(scriptInterface); | ||||
UpdateText(); | UpdateText(); | ||||
ScriptInterface::ToJSVal(rq, ret, m_GeneratedTexts[0].GetSize()); | ScriptInterface::ToJSVal(rq, ret, m_GeneratedTexts[0].GetSize()); | ||||
return true; | return true; | ||||
} | } |
Wildfire Games · Phabricator