From 4397653409ec1ea3ff7520a794f712b9b4ef103f Mon Sep 17 00:00:00 2001 From: Daniel Faust Date: Mon, 16 Dec 2024 12:05:31 +0100 Subject: [PATCH] Add back `MenuChild::kind` --- src/platform_impl/mod.rs | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/platform_impl/mod.rs b/src/platform_impl/mod.rs index 5e0c91c..aeb751b 100644 --- a/src/platform_impl/mod.rs +++ b/src/platform_impl/mod.rs @@ -42,6 +42,52 @@ impl dyn IsMenuItem + '_ { } } +/// Internal utilities +impl MenuChild { + #[cfg(not(target_os = "linux"))] + fn kind(&self, c: Rc>) -> MenuItemKind { + use crate::{items::*, MenuItemType}; + + match self.item_type() { + MenuItemType::Submenu => { + let id = c.borrow().id().clone(); + MenuItemKind::Submenu(Submenu { + id: Rc::new(id), + inner: c, + }) + } + MenuItemType::MenuItem => { + let id = c.borrow().id().clone(); + MenuItemKind::MenuItem(MenuItem { + id: Rc::new(id), + inner: c, + }) + } + MenuItemType::Predefined => { + let id = c.borrow().id().clone(); + MenuItemKind::Predefined(PredefinedMenuItem { + id: Rc::new(id), + inner: c, + }) + } + MenuItemType::Check => { + let id = c.borrow().id().clone(); + MenuItemKind::Check(CheckMenuItem { + id: Rc::new(id), + inner: c, + }) + } + MenuItemType::Icon => { + let id = c.borrow().id().clone(); + MenuItemKind::Icon(IconMenuItem { + id: Rc::new(id), + inner: c, + }) + } + } + } +} + #[allow(unused)] impl MenuItemKind { pub(crate) fn as_ref(&self) -> &dyn IsMenuItem {