iced-yoda/style/src/radio.rs

30 lines
1,013 B
Rust
Raw Normal View History

2022-11-10 01:10:28 +01:00
//! Change the appearance of radio buttons.
2020-01-07 02:25:57 +01:00
use iced_core::{Background, Color};
/// The appearance of a radio button.
#[derive(Debug, Clone, Copy)]
2022-05-27 01:26:57 +02:00
pub struct Appearance {
2022-11-10 01:10:28 +01:00
/// The [`Background`] of the radio button.
2020-01-07 02:25:57 +01:00
pub background: Background,
2022-11-10 01:10:28 +01:00
/// The [`Color`] of the dot of the radio button.
2020-01-07 02:25:57 +01:00
pub dot_color: Color,
2022-11-10 01:10:28 +01:00
/// The border width of the radio button.
pub border_width: f32,
2022-11-10 01:10:28 +01:00
/// The border [`Color`] of the radio button.
2020-01-07 02:25:57 +01:00
pub border_color: Color,
2022-11-10 01:10:28 +01:00
/// The text [`Color`] of the radio button.
pub text_color: Option<Color>,
2020-01-07 02:25:57 +01:00
}
/// A set of rules that dictate the style of a radio button.
pub trait StyleSheet {
2022-11-10 01:10:28 +01:00
/// The supported style of the [`StyleSheet`].
type Style: Default;
2020-01-07 02:25:57 +01:00
2022-11-10 01:10:28 +01:00
/// Produces the active [`Appearance`] of a radio button.
fn active(&self, style: &Self::Style, is_selected: bool) -> Appearance;
2022-11-10 01:10:28 +01:00
/// Produces the hovered [`Appearance`] of a radio button.
fn hovered(&self, style: &Self::Style, is_selected: bool) -> Appearance;
2020-01-07 02:25:57 +01:00
}