pub struct MenuBar { /* private fields */ }
Expand description
Horizontal menu bar where you can add MenuButton
s.
The menu bar goes well in a crate::TopBottomPanel::top
,
but can also be placed in a crate::Window
.
In the latter case you may want to wrap it in Frame
.
§Example:
egui::MenuBar::new().ui(ui, |ui| {
ui.menu_button("File", |ui| {
if ui.button("Quit").clicked() {
ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close);
}
});
});
Implementations§
Source§impl MenuBar
impl MenuBar
pub fn new() -> Self
Sourcepub fn style(self, style: impl Into<StyleModifier>) -> Self
pub fn style(self, style: impl Into<StyleModifier>) -> Self
Set the style for buttons in the menu bar.
Doesn’t affect the style of submenus, use MenuConfig::style
for that.
Default is menu_style
.
Sourcepub fn config(self, config: MenuConfig) -> Self
pub fn config(self, config: MenuConfig) -> Self
Set the config for submenus.
Note: The config will only be passed when using MenuButton
, not via Popup::menu
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MenuBar
impl !RefUnwindSafe for MenuBar
impl Send for MenuBar
impl Sync for MenuBar
impl Unpin for MenuBar
impl !UnwindSafe for MenuBar
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more