Skip to content

Commit

Permalink
Add back MenuChild::kind
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaust committed Dec 16, 2024
1 parent 84f05a2 commit d12cba1
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/platform_impl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,52 @@ impl dyn IsMenuItem + '_ {
}
}

/// Internal utilities
impl MenuChild {
#[cfg(not(target_os = "linux"))]
fn kind(&self, c: Rc<RefCell<MenuChild>>) -> 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 {
Expand Down

0 comments on commit d12cba1

Please sign in to comment.