From e4d9d8c8b87398d088cb3be4b720d07676e158ad Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Fri, 17 Jan 2025 04:19:53 +0300 Subject: [PATCH] When CUIRadioButton was changed, don't forget to send RADIOBUTTON_SET event (#943) --- src/xrUICore/Buttons/UIRadioButton.cpp | 13 +++++++++++++ src/xrUICore/Buttons/UIRadioButton.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/xrUICore/Buttons/UIRadioButton.cpp b/src/xrUICore/Buttons/UIRadioButton.cpp index 3811a4842a3..4d81f8186b5 100644 --- a/src/xrUICore/Buttons/UIRadioButton.cpp +++ b/src/xrUICore/Buttons/UIRadioButton.cpp @@ -23,6 +23,19 @@ bool CUIRadioButton::InitTexture(pcstr /*texture*/, bool /*fatal = true*/) return true; } +void CUIRadioButton::SendMessage(CUIWindow* pWnd, s16 msg, void* pData) +{ + if (!IsEnabled()) + return; + + inherited::SendMessage(pWnd, msg, pData); + + if (msg == TAB_CHANGED && this == pWnd) + { + GetMessageTarget()->SendMessage(this, RADIOBUTTON_SET, nullptr); + } +} + bool CUIRadioButton::OnMouseDown(int mouse_btn) { const bool result = inherited::OnMouseDown(mouse_btn); diff --git a/src/xrUICore/Buttons/UIRadioButton.h b/src/xrUICore/Buttons/UIRadioButton.h index 319209830d0..f666e68d893 100644 --- a/src/xrUICore/Buttons/UIRadioButton.h +++ b/src/xrUICore/Buttons/UIRadioButton.h @@ -8,6 +8,7 @@ class CUIRadioButton final : public CUITabButton public: virtual void InitButton(Fvector2 pos, Fvector2 size); virtual bool InitTexture(pcstr texture, bool fatal = true); + void SendMessage(CUIWindow* pWnd, s16 msg, void* pData = nullptr) override; bool OnMouseDown(int mouse_btn) override; pcstr GetDebugType() override { return "CUIRadioButton"; } };