wip: menus

This commit is contained in:
Ashley Wulber 2025-01-22 16:31:51 -05:00
parent a406859e65
commit 93e3d4fd42
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
25 changed files with 1358 additions and 243 deletions

View file

@ -1,6 +1,8 @@
// From iced_aw, license MIT
//! Change the appearance of menu bars and their menus.
use std::sync::Arc;
use crate::Theme;
use iced_widget::core::Color;
@ -33,19 +35,19 @@ pub trait StyleSheet {
}
/// The style of a menu bar and its menus
#[derive(Default)]
#[derive(Default, Clone)]
#[allow(missing_debug_implementations)]
pub enum MenuBarStyle {
/// The default style.
#[default]
Default,
/// A [`Theme`] that uses a `Custom` palette.
Custom(Box<dyn StyleSheet<Style = Theme>>),
Custom(Arc<dyn StyleSheet<Style = Theme>>),
}
impl From<fn(&Theme) -> Appearance> for MenuBarStyle {
fn from(f: fn(&Theme) -> Appearance) -> Self {
Self::Custom(Box::new(f))
Self::Custom(Arc::new(f))
}
}

View file

@ -32,5 +32,7 @@ mod text_input;
#[doc(inline)]
pub use self::text_input::TextInput;
#[cfg(feature = "wayland")]
pub mod tooltip;
#[cfg(feature = "wayland")]
pub use tooltip::Tooltip;