From c099226cd271db97e995237f6a08c2f5c157de0e Mon Sep 17 00:00:00 2001 From: fallenoak Date: Mon, 2 Feb 2026 22:29:26 -0600 Subject: [PATCH] feat(ui): add CSimpleFrame::GetAttribute --- src/ui/simple/CSimpleFrame.cpp | 12 ++++++++++++ src/ui/simple/CSimpleFrame.hpp | 1 + 2 files changed, 13 insertions(+) diff --git a/src/ui/simple/CSimpleFrame.cpp b/src/ui/simple/CSimpleFrame.cpp index 1257cd1..2588bcf 100644 --- a/src/ui/simple/CSimpleFrame.cpp +++ b/src/ui/simple/CSimpleFrame.cpp @@ -522,6 +522,18 @@ void CSimpleFrame::PreLoadXML(XMLNode* node, CStatus* status) { } } +bool CSimpleFrame::GetAttribute(const char* name, int32_t& luaRef) { + auto attr = this->m_attributes.Ptr(name); + + if (!attr || attr->luaRef == -1) { + return false; + } + + luaRef = attr->luaRef; + + return true; +} + int32_t CSimpleFrame::GetBoundsRect(CRect& bounds) { if (this->IsResizePending()) { this->Resize(1); diff --git a/src/ui/simple/CSimpleFrame.hpp b/src/ui/simple/CSimpleFrame.hpp index 39e8d19..d014462 100644 --- a/src/ui/simple/CSimpleFrame.hpp +++ b/src/ui/simple/CSimpleFrame.hpp @@ -132,6 +132,7 @@ class CSimpleFrame : public CScriptRegion { void DisableEvent(CSimpleEventType eventType); void EnableDrawLayer(uint32_t drawlayer); void EnableEvent(CSimpleEventType eventType, int32_t priority); + bool GetAttribute(const char* name, int32_t& luaRef); int32_t GetHitRect(CRect& rect); void Hide(); void LoadXML_Attributes(const XMLNode* node, CStatus* status);