feat(widget): add dropdown widget as pick_list replacement

The Dropdown widget is based on the PickList widget from iced.
This commit is contained in:
Michael Aaron Murphy 2023-10-23 16:57:37 +02:00 committed by Michael Murphy
parent dbd6c978ba
commit ca7c17ce21
9 changed files with 1121 additions and 15 deletions

View file

@ -0,0 +1,38 @@
// 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.
use iced_core::{Background, BorderRadius, Color};
/// 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
pub border_radius: BorderRadius,
/// 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,
}
/// 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;
}