From 30c9dd3b4529f22d5e786b5c2f9d6bd76eed0dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 25 Oct 2026 13:44:44 +0100 Subject: [PATCH] UI: Let clickable views be highlighted without the focus SetHighlighted outlines the view, following its round corners, to point it out without giving it the focus, which would turn on keyboard navigation. Co-Authored-By: Claude Opus 5.5 (1M context) --- Common/UI/View.cpp | 3 +++ Common/UI/View.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/Common/UI/View.cpp b/Common/UI/View.cpp index b14d87b7eb..28b01f8631 100644 --- a/Common/UI/View.cpp +++ b/Common/UI/View.cpp @@ -217,6 +217,9 @@ void Clickable::DrawBG(UIContext &dc, const Style &style) { } else { dc.FillRoundRect(style.background, bounds_, dc.GetTheme().choiceRoundRadius, roundCorners_); } + if (highlighted_) { + dc.Draw()->DrawRoundRect(bounds_, dc.GetTheme().choiceRoundRadius, 0xFFFFFFFF, RoundRectStyle::OutlineThin, roundCorners_); + } } void Clickable::ClickInternal() { diff --git a/Common/UI/View.h b/Common/UI/View.h index 768bd38414..0eef740735 100644 --- a/Common/UI/View.h +++ b/Common/UI/View.h @@ -565,6 +565,9 @@ public: void FocusChanged(FocusFlags focusFlags) override; + // Outlines it, to point it out without the keyboard focus (which would turn on keyboard navigation). + void SetHighlighted(bool highlighted) { highlighted_ = highlighted; } + Event OnClick; protected: @@ -579,6 +582,7 @@ protected: int downCountDown_ = 0; bool dragging_ = false; bool down_ = false; + bool highlighted_ = false; }; // TODO: Very similar to Choice, should probably merge them.