From 9bb15b7511da3746914773969556a04585e216f4 Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Tue, 26 Aug 2025 13:01:49 -0500 Subject: [PATCH] Convert BigRedButton ctor into just a Bundle The BigRedButton isn't doing anything that requires the `Commands`, so it'll be turned back into just a Bundle. --- src/widgets/mod.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/widgets/mod.rs b/src/widgets/mod.rs index 367090a..6b0a74a 100644 --- a/src/widgets/mod.rs +++ b/src/widgets/mod.rs @@ -91,9 +91,12 @@ fn machine_ui_base(commands: &mut Commands, header: impl Into, theme: &U pub struct BigRedButton; impl BigRedButton { - // TODO: Hook up action handling (callback? Observer? Some other weird component?) - fn spawn_big_red_button(commands: &mut ChildSpawnerCommands, text: impl Into) { - let mut builder = commands.spawn(( + /// Default bundle for a Big Red Button. Remember to attach on-press observers! + /// + /// I haven't figure out what will receive the on-press events, so I'm moving + /// the problem. It will not be the button's job to hook up the event notice. + fn bundle(text: impl Into) -> impl Bundle { + ( Button, BigRedButton, Node { @@ -117,7 +120,7 @@ impl BigRedButton { TextColor(WHITE.into()), TextShadow::default(), ], - )); + ); } /// Re-color the button when a pointer passes over it