Skip to content

Commit

Permalink
Allow overlay from pane grid title bar
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkmoody committed Jun 17, 2021
1 parent e68da22 commit 27b42ca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
16 changes: 8 additions & 8 deletions native/src/widget/pane_grid/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,18 @@ where
&mut self,
layout: Layout<'_>,
) -> Option<overlay::Element<'_, Message, Renderer>> {
let body_layout = if self.title_bar.is_some() {
if let Some(title_bar) = self.title_bar.as_mut() {
let mut children = layout.children();
let title_bar_layout = children.next().unwrap();

// Overlays only allowed in the pane body, for now at least.
let _title_bar_layout = children.next();
if let Some(overlay) = title_bar.overlay(title_bar_layout) {
return Some(overlay);
}

children.next()?
self.body.overlay(children.next()?)
} else {
layout
};

self.body.overlay(body_layout)
self.body.overlay(layout)
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions native/src/widget/pane_grid/title_bar.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::container;
use crate::event::{self, Event};
use crate::layout;
use crate::overlay;
use crate::pane_grid;
use crate::{
Clipboard, Element, Hasher, Layout, Padding, Point, Rectangle, Size,
Expand Down Expand Up @@ -242,4 +243,11 @@ where

control_status.merge(title_status)
}

pub(crate) fn overlay(
&mut self,
layout: Layout<'_>,
) -> Option<overlay::Element<'_, Message, Renderer>> {
self.content.overlay(layout)
}
}

0 comments on commit 27b42ca

Please sign in to comment.