summaryrefslogtreecommitdiff
path: root/schist_desktop_gui/src/gui/components/button.rs
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2025-08-13 07:50:21 +0000
committerjoeac <me@joeac.net>2025-08-13 07:50:21 +0000
commitee3cd780e21260257b401c3f5cbababd9e27a15a (patch)
treeb0571649a1a1a7644dbc50183cc4c3a29966a963 /schist_desktop_gui/src/gui/components/button.rs
parent49342e8b553d5c92f1c043b3b0ce18bdf1c2cd44 (diff)
task-073
Co-authored-by: Joe Carstairs <jcarstairs@scottlogic.com> Reviewed-on: https://git.joeac.net/joeac/schist/pulls/1 Co-authored-by: Joe Carstairs <me@joeac.net> Co-committed-by: Joe Carstairs <me@joeac.net>
Diffstat (limited to 'schist_desktop_gui/src/gui/components/button.rs')
-rw-r--r--schist_desktop_gui/src/gui/components/button.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/schist_desktop_gui/src/gui/components/button.rs b/schist_desktop_gui/src/gui/components/button.rs
new file mode 100644
index 0000000..bc9e5f9
--- /dev/null
+++ b/schist_desktop_gui/src/gui/components/button.rs
@@ -0,0 +1,24 @@
+use iced::{widget::Button, Element};
+
+pub fn active_button<'a, Content: Into<Element<'a, Message>>, Message>(
+ content: Content,
+) -> Button<'a, Message> {
+ iced::widget::button(content)
+ .style(|theme: &iced::Theme, _status| iced::widget::button::Style {
+ background: Some(iced::Background::Color(
+ theme.extended_palette().primary.base.text,
+ )),
+ text_color: theme.extended_palette().primary.base.color,
+ ..Default::default()
+ })
+ .width(iced::Length::Fill)
+}
+
+pub fn inactive_button<'a, Content: Into<Element<'a, Message>>, Message>(
+ content: Content,
+ on_press: Message,
+) -> Button<'a, Message> {
+ iced::widget::button(content)
+ .on_press(on_press)
+ .width(iced::Length::Fill)
+}