feat!(segmented_button): Add context menu support and integrations

This commit is contained in:
Michael Aaron Murphy 2024-04-09 16:54:50 +02:00 committed by Michael Murphy
parent d54af65a2a
commit 59a913c15d
13 changed files with 612 additions and 118 deletions

View file

@ -48,6 +48,8 @@ pub enum Message {
Minimize,
/// Activates a navigation element from the nav bar.
NavBar(nav_bar::Id),
/// Activates a context menu for an item from the nav bar.
NavBarContext(nav_bar::Id),
/// Set scaling factor
ScaleFactor(f32),
/// Notification of system theme changes.
@ -367,7 +369,6 @@ impl<T: Application> Cosmic<T> {
Message::ContextDrawer(show) => {
self.app.core_mut().window.show_context = show;
return self.app.on_context_drawer();
}
Message::Drag => return command::drag(Some(self.app.main_window_id())),
@ -381,6 +382,11 @@ impl<T: Application> Cosmic<T> {
return self.app.on_nav_select(key);
}
Message::NavBarContext(key) => {
self.app.core_mut().nav_bar_set_context(key);
return self.app.on_nav_context(key);
}
Message::ToggleNavBar => {
self.app.core_mut().nav_bar_toggle();
}