mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-07-18 00:06:59 +02:00
wip: nomralize
This commit is contained in:
parent
35197fb826
commit
244e2b388e
16 changed files with 1880 additions and 1866 deletions
27
src/menu.rs
Normal file
27
src/menu.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
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>>
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue