refactor: popups for nav bar / segmented buttons
This commit is contained in:
parent
f5fc392ba4
commit
cde1989e78
13 changed files with 544 additions and 57 deletions
|
|
@ -389,10 +389,23 @@ where
|
|||
let mut nav =
|
||||
crate::widget::nav_bar(nav_model, |id| crate::Action::Cosmic(Action::NavBar(id)))
|
||||
.on_context(|id| crate::Action::Cosmic(Action::NavBarContext(id)))
|
||||
.context_menu(self.nav_context_menu(self.core().nav_bar_context()))
|
||||
.into_container()
|
||||
.width(iced::Length::Shrink)
|
||||
.height(iced::Length::Fill);
|
||||
.context_menu(self.nav_context_menu());
|
||||
#[cfg(all(
|
||||
feature = "multi-window",
|
||||
feature = "wayland",
|
||||
target_os = "linux",
|
||||
feature = "winit",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
{
|
||||
nav = nav
|
||||
.window_id_maybe(self.core().main_window_id())
|
||||
.on_surface_action(|m| crate::Action::Cosmic(crate::app::Action::Surface(m)))
|
||||
}
|
||||
let mut nav = nav
|
||||
.into_container()
|
||||
.width(iced::Length::Shrink)
|
||||
.height(iced::Length::Fill);
|
||||
|
||||
if !self.core().is_condensed() {
|
||||
nav = nav.max_width(280);
|
||||
|
|
@ -402,10 +415,7 @@ where
|
|||
}
|
||||
|
||||
/// Shows a context menu for the active nav bar item.
|
||||
fn nav_context_menu(
|
||||
&self,
|
||||
id: nav_bar::Id,
|
||||
) -> Option<Vec<menu::Tree<crate::Action<Self::Message>>>> {
|
||||
fn nav_context_menu(&self) -> Option<Vec<menu::Tree<crate::Action<Self::Message>>>> {
|
||||
None
|
||||
}
|
||||
|
||||
|
|
@ -635,10 +645,8 @@ impl<App: Application> ApplicationExt for App {
|
|||
let mut widgets = Vec::with_capacity(3);
|
||||
|
||||
// Insert nav bar onto the left side of the window.
|
||||
let has_nav = if let Some(nav) = self
|
||||
.nav_bar()
|
||||
.map(|nav| id_container(nav, iced_core::id::Id::new("COSMIC_nav_bar")))
|
||||
{
|
||||
let has_nav = if let Some(nav) = self.nav_bar() {
|
||||
let nav = id_container(nav, iced_core::id::Id::new("COSMIC_nav_bar"));
|
||||
widgets.push(
|
||||
container(nav)
|
||||
.padding([
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue