diff --git a/examples/menu/src/main.rs b/examples/menu/src/main.rs index dbd8de0..ab668cb 100644 --- a/examples/menu/src/main.rs +++ b/examples/menu/src/main.rs @@ -14,9 +14,7 @@ use cosmic::iced_core::{Length, Size}; use cosmic::widget::menu::action::MenuAction; use cosmic::widget::menu::key_bind::KeyBind; use cosmic::widget::menu::key_bind::Modifier; -use cosmic::widget::menu::menu_tree::{menu_items, menu_root, MenuItem}; -use cosmic::widget::menu::{ItemHeight, ItemWidth, MenuBar, MenuTree}; -use cosmic::widget::segmented_button::Entity; +use cosmic::widget::menu::{self, ItemHeight, ItemWidth}; use cosmic::{executor, Element}; /// Runs application with these settings @@ -67,7 +65,7 @@ pub enum Action { impl MenuAction for Action { type Message = Message; - fn message(&self, _entity_opt: Option) -> Self::Message { + fn message(&self) -> Self::Message { match self { Action::WindowClose => Message::WindowClose, Action::ToggleHideContent => Message::ToggleHideContent, @@ -156,23 +154,23 @@ impl cosmic::Application for App { } pub fn menu_bar<'a>(config: &Config, key_binds: &HashMap) -> Element<'a, Message> { - MenuBar::new(vec![MenuTree::with_children( - menu_root("File"), - menu_items( + menu::bar(vec![menu::Tree::with_children( + menu::root("File"), + menu::items( key_binds, vec![ - MenuItem::Button("New window", Action::WindowNew), - MenuItem::Divider, - MenuItem::Folder( + menu::Item::Button("New window", Action::WindowNew), + menu::Item::Divider, + menu::Item::Folder( "View", - vec![MenuItem::CheckBox( + vec![menu::Item::CheckBox( "Hide content", config.hide_content, Action::ToggleHideContent, )], ), - MenuItem::Divider, - MenuItem::Button("Quit", Action::WindowClose), + menu::Item::Divider, + menu::Item::Button("Quit", Action::WindowClose), ], ), )]) diff --git a/examples/open-dialog/src/main.rs b/examples/open-dialog/src/main.rs index 63bb3a1..8cc01b8 100644 --- a/examples/open-dialog/src/main.rs +++ b/examples/open-dialog/src/main.rs @@ -168,7 +168,7 @@ impl cosmic::Application for App { Err(why) => Message::OpenError(Arc::new(why)), } }) - .map(cosmic::app::Message::App); + .map(Into::into); } // Displays an error in the application's warning bar. diff --git a/src/theme/style/button.rs b/src/theme/style/button.rs index 0509d62..e79496c 100644 --- a/src/theme/style/button.rs +++ b/src/theme/style/button.rs @@ -120,8 +120,8 @@ pub fn appearance( } Button::MenuRoot => { appearance.background = None; - appearance.icon_color = Some(cosmic.accent.base.into()); - appearance.text_color = Some(cosmic.accent.base.into()); + appearance.icon_color = None; + appearance.text_color = None; } Button::MenuItem => { let (background, _, _) = color(&cosmic.background.component); diff --git a/src/theme/style/menu_bar.rs b/src/theme/style/menu_bar.rs index 1b17c52..18b983f 100644 --- a/src/theme/style/menu_bar.rs +++ b/src/theme/style/menu_bar.rs @@ -19,7 +19,7 @@ pub struct Appearance { pub border_color: Color, /// The expand value of the menus' background pub background_expand: [u16; 4], - /// The highlighted path [`Color`] of the the menu bar and its menus. + // /// The highlighted path [`Color`] of the the menu bar and its menus. pub path: Color, } diff --git a/src/widget/button/widget.rs b/src/widget/button/widget.rs index 7444b21..9c07900 100644 --- a/src/widget/button/widget.rs +++ b/src/widget/button/widget.rs @@ -375,7 +375,13 @@ impl<'a, Message: 'a + Clone> Widget }; let mut icon_color = styling.icon_color.unwrap_or(renderer_style.icon_color); - let mut text_color = styling.text_color.unwrap_or(renderer_style.text_color); + + // Menu roots should share the accent color that icons get in the header. + let mut text_color = if matches!(self.style, crate::theme::Button::MenuRoot) { + icon_color + } else { + styling.text_color.unwrap_or(renderer_style.text_color) + }; if let Some(alpha) = headerbar_alpha { icon_color.a = alpha; diff --git a/src/widget/menu/action.rs b/src/widget/menu/action.rs index 25ac538..1b70209 100644 --- a/src/widget/menu/action.rs +++ b/src/widget/menu/action.rs @@ -1,5 +1,3 @@ -use crate::widget::segmented_button::Entity; - /// `MenuAction` is a trait that represents an action in a menu. /// /// It is used to define the behavior of menu items when they are activated. diff --git a/src/widget/menu/menu_bar.rs b/src/widget/menu/menu_bar.rs index c885913..c191ac0 100644 --- a/src/widget/menu/menu_bar.rs +++ b/src/widget/menu/menu_bar.rs @@ -390,8 +390,8 @@ where }, shadow: Default::default(), }; - let path_color = styling.path; - renderer.fill_quad(path_quad, path_color); + + renderer.fill_quad(path_quad, styling.path); } } diff --git a/src/widget/menu/menu_inner.rs b/src/widget/menu/menu_inner.rs index 74c4460..e0d2275 100644 --- a/src/widget/menu/menu_inner.rs +++ b/src/widget/menu/menu_inner.rs @@ -709,8 +709,8 @@ where }, shadow: Shadow::default(), }; - let path_color = styling.path; - r.fill_quad(path_quad, path_color); + + r.fill_quad(path_quad, styling.path); } // draw item