refactor(menu): add menu::bar as shorthand for MenuBar::new
This commit is contained in:
parent
709ab268a0
commit
b3bce0740e
2 changed files with 10 additions and 3 deletions
|
|
@ -59,10 +59,11 @@ pub use action::MenuAction as Action;
|
|||
|
||||
mod flex;
|
||||
pub mod key_bind;
|
||||
pub use key_bind::KeyBind;
|
||||
|
||||
mod menu_bar;
|
||||
pub use menu_bar::MenuBar;
|
||||
pub(crate) use menu_bar::MenuBarState;
|
||||
pub use menu_bar::{menu_bar as bar, MenuBar};
|
||||
|
||||
mod menu_inner;
|
||||
mod menu_tree;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,13 @@ use iced_widget::core::{
|
|||
Alignment, Clipboard, Element, Layout, Length, Padding, Rectangle, Shell, Widget,
|
||||
};
|
||||
|
||||
/// A `MenuBar` collects `MenuTree`s and handles all the layout, event processing, and drawing.
|
||||
pub fn menu_bar<Message, Renderer: iced_core::Renderer>(
|
||||
menu_roots: Vec<MenuTree<Message, Renderer>>,
|
||||
) -> MenuBar<Message, Renderer> {
|
||||
MenuBar::new(menu_roots)
|
||||
}
|
||||
|
||||
pub(crate) struct MenuBarState {
|
||||
pub(crate) pressed: bool,
|
||||
pub(crate) view_cursor: Cursor,
|
||||
|
|
@ -56,8 +63,7 @@ impl Default for MenuBarState {
|
|||
}
|
||||
}
|
||||
|
||||
/// A `MenuBar` collects `MenuTree`s and handles
|
||||
/// all the layout, event processing and drawing
|
||||
/// A `MenuBar` collects `MenuTree`s and handles all the layout, event processing, and drawing.
|
||||
#[allow(missing_debug_implementations)]
|
||||
pub struct MenuBar<'a, Message, Renderer = crate::Renderer>
|
||||
where
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue