cosmic/widget/button/
mod.rspub use crate::theme::Button as ButtonClass;
pub mod link;
use derive_setters::Setters;
#[doc(inline)]
pub use link::link;
#[doc(inline)]
pub use link::Button as LinkButton;
mod icon;
#[doc(inline)]
pub use icon::icon;
#[doc(inline)]
pub use icon::Button as IconButton;
mod image;
#[doc(inline)]
pub use image::image;
#[doc(inline)]
pub use image::Button as ImageButton;
mod style;
#[doc(inline)]
pub use style::{Catalog, Style};
mod text;
#[doc(inline)]
pub use text::Button as TextButton;
#[doc(inline)]
pub use text::{destructive, standard, suggested, text};
mod widget;
#[doc(inline)]
pub use widget::{draw, focus, layout, mouse_interaction, Button};
use iced_core::font::Weight;
use iced_core::widget::Id;
use iced_core::{Length, Padding};
use std::borrow::Cow;
pub fn custom<'a, Message>(content: impl Into<crate::Element<'a, Message>>) -> Button<'a, Message> {
Button::new(content)
}
pub fn custom_image_button<'a, Message>(
content: impl Into<crate::Element<'a, Message>>,
on_remove: Option<Message>,
) -> Button<'a, Message> {
Button::new_image(content, on_remove)
}
#[must_use]
#[derive(Setters)]
pub struct Builder<'a, Message, Variant> {
id: Id,
#[setters(into)]
label: Cow<'a, str>,
#[setters(into)]
tooltip: Cow<'a, str>,
#[setters(strip_option)]
on_press: Option<Message>,
#[setters(into)]
width: Length,
#[setters(into)]
height: Length,
#[setters(into)]
padding: Padding,
spacing: u16,
icon_size: u16,
line_height: u16,
font_size: u16,
font_weight: Weight,
class: ButtonClass,
#[setters(skip)]
variant: Variant,
}
impl<'a, Message, Variant> Builder<'a, Message, Variant> {
pub fn on_press_maybe(mut self, on_press: Option<Message>) -> Self {
self.on_press = on_press;
self
}
}