Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/gui/ObjectTypes/CList.cpp
Show All 17 Lines | |||||
#include "precompiled.h" | #include "precompiled.h" | ||||
#include "CList.h" | #include "CList.h" | ||||
#include "gui/CGUI.h" | #include "gui/CGUI.h" | ||||
#include "gui/CGUIScrollBarVertical.h" | #include "gui/CGUIScrollBarVertical.h" | ||||
#include "gui/SettingTypes/CGUIColor.h" | #include "gui/SettingTypes/CGUIColor.h" | ||||
#include "gui/SettingTypes/CGUIList.h" | #include "gui/SettingTypes/CGUIList.h" | ||||
#include "gui/Scripting/JSInterface_GUIProxy.h" | |||||
#include "lib/external_libraries/libsdl.h" | #include "lib/external_libraries/libsdl.h" | ||||
#include "lib/timer.h" | #include "lib/timer.h" | ||||
const CStr CList::EventNameSelectionChange = "SelectionChange"; | const CStr CList::EventNameSelectionChange = "SelectionChange"; | ||||
const CStr CList::EventNameHoverChange = "HoverChange"; | const CStr CList::EventNameHoverChange = "HoverChange"; | ||||
const CStr CList::EventNameMouseLeftClickItem = "MouseLeftClickItem"; | const CStr CList::EventNameMouseLeftClickItem = "MouseLeftClickItem"; | ||||
const CStr CList::EventNameMouseLeftDoubleClickItem = "MouseLeftDoubleClickItem"; | const CStr CList::EventNameMouseLeftDoubleClickItem = "MouseLeftDoubleClickItem"; | ||||
▲ Show 20 Lines • Show All 368 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
// Do not send a settings-changed message | // Do not send a settings-changed message | ||||
m_List.m_Items.push_back(str); | m_List.m_Items.push_back(str); | ||||
m_ListData.m_Items.push_back(data); | m_ListData.m_Items.push_back(data); | ||||
SetupText(true); | SetupText(true); | ||||
} | } | ||||
void CList::AddItem(const CGUIString& strAndData) | |||||
{ | |||||
AddItem(strAndData, strAndData); | |||||
} | |||||
bool CList::HandleAdditionalChildren(const XMBElement& child, CXeromyces* pFile) | bool CList::HandleAdditionalChildren(const XMBElement& child, CXeromyces* pFile) | ||||
{ | { | ||||
int elmt_item = pFile->GetElementID("item"); | int elmt_item = pFile->GetElementID("item"); | ||||
if (child.GetNodeName() == elmt_item) | if (child.GetNodeName() == elmt_item) | ||||
{ | { | ||||
CGUIString vlist; | CGUIString vlist; | ||||
vlist.SetValue(child.GetText().FromUTF8()); | vlist.SetValue(child.GetText().FromUTF8()); | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | int CList::GetHoveredItem() | ||||
for (size_t i = 0; i < m_List.m_Items.size(); ++i) | for (size_t i = 0; i < m_List.m_Items.size(); ++i) | ||||
if (mouse.Y >= rect.top + m_ItemsYPositions[i] && | if (mouse.Y >= rect.top + m_ItemsYPositions[i] && | ||||
mouse.Y < rect.top + m_ItemsYPositions[i + 1]) | mouse.Y < rect.top + m_ItemsYPositions[i + 1]) | ||||
return i; | return i; | ||||
return -1; | return -1; | ||||
} | } | ||||
void CList::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); | |||||
} | |||||
Wildfire Games · Phabricator