2023-10-23 16:57:37 +02:00
|
|
|
// Copyright 2023 System76 <info@system76.com>
|
|
|
|
|
// Copyright 2019 Héctor Ramón, Iced contributors
|
|
|
|
|
// SPDX-License-Identifier: MPL-2.0 AND MIT
|
|
|
|
|
|
|
|
|
|
//! Change the appearance of menus.
|
2024-01-30 22:14:00 -05:00
|
|
|
use iced_core::{border::Radius, Background, Color};
|
2023-10-23 16:57:37 +02:00
|
|
|
|
|
|
|
|
/// The appearance of a menu.
|
|
|
|
|
#[derive(Debug, Clone, Copy)]
|
|
|
|
|
pub struct Appearance {
|
|
|
|
|
/// Menu text color
|
|
|
|
|
pub text_color: Color,
|
|
|
|
|
/// Menu background
|
|
|
|
|
pub background: Background,
|
|
|
|
|
/// Menu border width
|
|
|
|
|
pub border_width: f32,
|
|
|
|
|
/// Menu border radius
|
2024-01-30 22:14:00 -05:00
|
|
|
pub border_radius: Radius,
|
2023-10-23 16:57:37 +02:00
|
|
|
/// Menu border color
|
|
|
|
|
pub border_color: Color,
|
|
|
|
|
/// Text color when hovered
|
|
|
|
|
pub hovered_text_color: Color,
|
|
|
|
|
/// Background when hovered
|
|
|
|
|
pub hovered_background: Background,
|
|
|
|
|
/// Text color when selected
|
|
|
|
|
pub selected_text_color: Color,
|
|
|
|
|
/// Background when selected
|
|
|
|
|
pub selected_background: Background,
|
2023-11-20 17:04:37 +01:00
|
|
|
/// Description text color
|
|
|
|
|
pub description_color: Color,
|
2023-10-23 16:57:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// The style sheet of a menu.
|
|
|
|
|
pub trait StyleSheet {
|
|
|
|
|
/// The supported style of the [`StyleSheet`].
|
|
|
|
|
type Style: Default + Clone;
|
|
|
|
|
|
|
|
|
|
/// Produces the [`Appearance`] of a menu.
|
|
|
|
|
fn appearance(&self, style: &Self::Style) -> Appearance;
|
|
|
|
|
}
|