git.lucas.co / cce-ui
GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git

commit95ba909a9d50c4e58fb78b9cacd1f53d2cd5e077
parent45f2efb639
authorLucas Galante <lsgalante12@gmail.com>
date2026-09-29 22:07
feat: a toggle's hover can be set by its host

As a slider's can, for a host that paints one as a stamp over several
rows.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

 src/widget/input/checkbox.rs | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/widget/input/checkbox.rs b/src/widget/input/checkbox.rs
index 8fdc1f3..49de12e 100644
--- a/src/widget/input/checkbox.rs
+++ b/src/widget/input/checkbox.rs
@@ -296,6 +296,13 @@ impl Toggle {
         self.slide_t = if v { 1.0 } else { 0.0 };
     }
 
+    /// Set the hover directly, for a host that paints one toggle as a
+    /// STAMP over several rows and does its own hit-testing — the
+    /// designer's dialog — as `Checkbox::set_hovered` is there for.
+    pub fn set_hovered(&mut self, hovered: bool) {
+        self.hovered = hovered;
+    }
+
     pub fn toggled(&self) -> bool {
         self.toggled
     }