Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/gui/ObjectTypes/CText.cpp
Show All 16 Lines | |||||
#include "precompiled.h" | #include "precompiled.h" | ||||
#include "CText.h" | #include "CText.h" | ||||
#include "gui/CGUI.h" | #include "gui/CGUI.h" | ||||
#include "gui/CGUIScrollBarVertical.h" | #include "gui/CGUIScrollBarVertical.h" | ||||
#include "gui/CGUIText.h" | #include "gui/CGUIText.h" | ||||
#include "gui/Scripting/JSInterface_GUIProxy.h" | |||||
#include "scriptinterface/ScriptInterface.h" | #include "scriptinterface/ScriptInterface.h" | ||||
CText::CText(CGUI& pGUI) | CText::CText(CGUI& pGUI) | ||||
: IGUIObject(pGUI), | : IGUIObject(pGUI), | ||||
IGUIScrollBarOwner(*static_cast<IGUIObject*>(this)), | IGUIScrollBarOwner(*static_cast<IGUIObject*>(this)), | ||||
IGUITextOwner(*static_cast<IGUIObject*>(this)), | IGUITextOwner(*static_cast<IGUIObject*>(this)), | ||||
m_BufferZone(), | m_BufferZone(), | ||||
m_Caption(), | m_Caption(), | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
void CText::UpdateCachedSize() | void CText::UpdateCachedSize() | ||||
{ | { | ||||
IGUIObject::UpdateCachedSize(); | IGUIObject::UpdateCachedSize(); | ||||
IGUITextOwner::UpdateCachedSize(); | IGUITextOwner::UpdateCachedSize(); | ||||
} | } | ||||
CSize2D CText::GetTextSize() | |||||
{ | |||||
UpdateText(); | |||||
return m_GeneratedTexts[0].GetSize(); | |||||
} | |||||
void CText::HandleMessage(SGUIMessage& Message) | void CText::HandleMessage(SGUIMessage& Message) | ||||
{ | { | ||||
IGUIObject::HandleMessage(Message); | IGUIObject::HandleMessage(Message); | ||||
IGUIScrollBarOwner::HandleMessage(Message); | IGUIScrollBarOwner::HandleMessage(Message); | ||||
//IGUITextOwner::HandleMessage(Message); <== placed it after the switch instead! | //IGUITextOwner::HandleMessage(Message); <== placed it after the switch instead! | ||||
switch (Message.type) | switch (Message.type) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | for (const CGUIText::SSpriteCall& spritecall : guitext.GetSpriteCalls()) | ||||
SetSettingFromString("_icon_tooltip", spritecall.m_Tooltip, true); | SetSettingFromString("_icon_tooltip", spritecall.m_Tooltip, true); | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
void CText::CreateJSObject() | |||||
{ | |||||
ScriptRequest rq(m_pGUI.GetScriptInterface()); | |||||
using ProxyHandler = JSI_GUIProxy<std::remove_pointer_t<decltype(this)>>; | |||||
ProxyHandler::CreateJSObject(rq, this, GetGUI().GetProxyData(&ProxyHandler::Singleton()), m_JSObject); | |||||
} | |||||
void CText::getTextSize(ScriptInterface& scriptInterface, JS::MutableHandleValue ret) | |||||
{ | |||||
ScriptRequest rq(scriptInterface); | |||||
UpdateText(); | |||||
ScriptInterface::ToJSVal(rq, ret, m_GeneratedTexts[0].GetSize()); | |||||
} |
Wildfire Games · Phabricator