From fb57fbe93790e7e5f71beb3c9bd889ae17bcceb3 Mon Sep 17 00:00:00 2001 From: FluxxCode Date: Thu, 1 Feb 2024 21:50:01 +0100 Subject: [PATCH] Update ui.rs --- src/ui.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ui.rs b/src/ui.rs index ec4ef758..173533ab 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -1,3 +1,5 @@ +/// Adds a dynamically sized button to the UI that can be enabled or disabled. +/// Returns true if the button is clicked. Otherwise None is returned. pub fn button_enabled_disabled(ui: &mut egui::Ui, text: &str, enabled: bool) -> bool { if !enabled { let button = egui::Button::new(text) @@ -12,6 +14,8 @@ pub fn button_enabled_disabled(ui: &mut egui::Ui, text: &str, enabled: bool) -> ui.add(egui::Button::new(text)).clicked() } +/// Adds a fixed sized button to the UI that can be enabled or disabled. +/// Returns true if the button is clicked. Otherwise None is returned. pub fn button_sized_enabled_disabled( ui: &mut egui::Ui, size: egui::Vec2, @@ -31,6 +35,7 @@ pub fn button_sized_enabled_disabled( ui.add_sized(size, egui::Button::new(text)).clicked() } +/// Returns the fill color of disabled buttons #[inline] fn get_disabled_fill_color(ui: &egui::Ui) -> egui::Color32 { let c = ui.style().visuals.widgets.noninteractive.bg_fill;