https://github.com/libsdl-org/Maelstrom/commit/1c09a16ca201618e62919b8bb7f64fa8ea793cfe
From 1c09a16ca201618e62919b8bb7f64fa8ea793cfe Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 5 Jan 2013 17:17:10 -0800
Subject: [PATCH] Hide the dropdown if it's disabled
---
screenlib/UIElementDropdown.cpp | 9 +++++++++
screenlib/UIElementDropdown.h | 1 +
2 files changed, 10 insertions(+)
diff --git a/screenlib/UIElementDropdown.cpp b/screenlib/UIElementDropdown.cpp
index 3b158a5a..81d5973f 100644
--- a/screenlib/UIElementDropdown.cpp
+++ b/screenlib/UIElementDropdown.cpp
@@ -71,6 +71,15 @@ UIElementDropdown::Action(UIBaseElement *sender, const char *action)
UIElementButton::Action(sender, action);
}
+void
+UIElementDropdown::UpdateDisabledState()
+{
+ // Hide the dropdown when we are disabled
+ HideElements();
+
+ UIElementButton::UpdateDisabledState();
+}
+
void
UIElementDropdown::OnClick()
{
diff --git a/screenlib/UIElementDropdown.h b/screenlib/UIElementDropdown.h
index 850b4b8b..cb083777 100644
--- a/screenlib/UIElementDropdown.h
+++ b/screenlib/UIElementDropdown.h
@@ -36,6 +36,7 @@ DECLARE_TYPESAFE_CLASS(UIElementButton)
override bool HandleEvent(const SDL_Event &event);
override void Action(UIBaseElement *sender, const char *action);
+ override void UpdateDisabledState();
override void OnClick();
void ShowElements();