mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-07-18 00:06:59 +02:00
27 lines
778 B
Rust
27 lines
778 B
Rust
use crate::*;
|
|
|
|
impl_debug!(MenuItem |self, w| { write!(w, "{}", &self.0) });
|
|
impl_default!(MenuItem: Self("".into(), Arc::new(Box::new(|_|Ok(())))));
|
|
impl PartialEq for MenuItem { fn eq (&self, other: &Self) -> bool { self.0 == other.0 } }
|
|
impl AsRef<Arc<[MenuItem]>> for MenuItems { fn as_ref (&self) -> &Arc<[MenuItem]> { &self.0 } }
|
|
|
|
/// List of menu items.
|
|
///
|
|
/// ```
|
|
/// let items: tek::MenuItems = Default::default();
|
|
/// ```
|
|
#[derive(Debug, Clone, Default, PartialEq)] pub struct MenuItems(
|
|
pub Arc<[MenuItem]>
|
|
);
|
|
|
|
/// An item of a menu.
|
|
///
|
|
/// ```
|
|
/// let item: tek::MenuItem = Default::default();
|
|
/// ```
|
|
#[derive(Clone)] pub struct MenuItem(
|
|
/// Label
|
|
pub Arc<str>,
|
|
/// Callback
|
|
pub Arc<Box<dyn Fn(&mut App)->Usually<()> + Send + Sync>>
|
|
);
|