2022-11-10 01:10:28 +01:00
|
|
|
//! Change the appearance of menus.
|
2020-06-11 20:41:11 +02:00
|
|
|
use iced_core::{Background, Color};
|
|
|
|
|
|
|
|
|
|
/// The appearance of a menu.
|
|
|
|
|
#[derive(Debug, Clone, Copy)]
|
2022-06-07 04:51:44 +02:00
|
|
|
pub struct Appearance {
|
2022-11-10 01:10:28 +01:00
|
|
|
/// The text [`Color`] of the menu.
|
2020-06-11 20:41:11 +02:00
|
|
|
pub text_color: Color,
|
2022-11-10 01:10:28 +01:00
|
|
|
/// The [`Background`] of the menu.
|
2020-06-11 20:41:11 +02:00
|
|
|
pub background: Background,
|
2022-11-10 01:10:28 +01:00
|
|
|
/// The border width of the menu.
|
2020-11-23 00:31:50 +01:00
|
|
|
pub border_width: f32,
|
2022-11-10 01:10:28 +01:00
|
|
|
/// The border radius of the menu.
|
2022-08-02 16:03:29 -07:00
|
|
|
pub border_radius: f32,
|
2022-11-10 01:10:28 +01:00
|
|
|
/// The border [`Color`] of the menu.
|
2020-06-11 20:41:11 +02:00
|
|
|
pub border_color: Color,
|
2022-11-10 01:10:28 +01:00
|
|
|
/// The text [`Color`] of a selected option in the menu.
|
2020-06-11 20:41:11 +02:00
|
|
|
pub selected_text_color: Color,
|
2022-11-10 01:10:28 +01:00
|
|
|
/// The background [`Color`] of a selected option in the menu.
|
2020-06-11 20:41:11 +02:00
|
|
|
pub selected_background: Background,
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-10 01:10:28 +01:00
|
|
|
/// The style sheet of a menu.
|
2022-06-07 04:51:44 +02:00
|
|
|
pub trait StyleSheet {
|
2022-11-10 01:10:28 +01:00
|
|
|
/// The supported style of the [`StyleSheet`].
|
2022-11-09 04:05:31 +01:00
|
|
|
type Style: Default + Clone;
|
2022-06-07 04:51:44 +02:00
|
|
|
|
2022-11-10 01:10:28 +01:00
|
|
|
/// Produces the [`Appearance`] of a menu.
|
2022-11-09 04:05:31 +01:00
|
|
|
fn appearance(&self, style: &Self::Style) -> Appearance;
|
2020-06-11 20:41:11 +02:00
|
|
|
}
|