### Overview Add a button widget that responds to mouse clicks and displays text or an icon. ### Current State _No response_ ### Scope **Goals:** - Text button with label - Click detection - Visual states (normal, hover, pressed, disabled) - Callback on click **Non-Goals:** - Icon buttons - Toggle buttons - Styling ### Proposed API ```rust pub enum ButtonState { Normal, Hovered, Pressed, Disabled, } pub struct Button { label: String, state: ButtonState, on_click: Option<Box<dyn Fn()>>, } impl Button { pub fn new(label: &str) -> Self; pub fn on_click(self, callback: impl Fn() + 'static) -> Self; pub fn set_enabled(&mut self, enabled: bool); pub fn state(&self) -> ButtonState; } impl Widget for Button { fn render(&self, ctx: &mut UiRenderContext) -> Vec<RenderCommand>; fn hit_test(&self, x: f32, y: f32) -> bool; // Mouse event handling internally updates state } ``` ### Acceptance Criteria - [ ] Button displays label text - [ ] Hover state when mouse over - [ ] Pressed state when mouse down - [ ] Click callback fires on mouse up inside - [ ] Disabled state ignores i ### Affected Crates lambda-rs ### Notes - State transitions: Normal <-> Hovered <-> Pressed - Click fires only if release is inside button
Activity