Merge pull request #920 from clarkmoody/feature/pane-grid-title-bar-overlay

Pane Grid Title Bar Overlay
This commit is contained in:
Héctor Ramón 2021-06-22 12:02:07 +02:00 committed by GitHub
commit 94ee2566c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 9 deletions

View File

@ -193,18 +193,17 @@ where
&mut self, &mut self,
layout: Layout<'_>, layout: Layout<'_>,
) -> Option<overlay::Element<'_, Message, Renderer>> { ) -> 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 mut children = layout.children();
let title_bar_layout = children.next()?;
// Overlays only allowed in the pane body, for now at least. match title_bar.overlay(title_bar_layout) {
let _title_bar_layout = children.next(); Some(overlay) => Some(overlay),
None => self.body.overlay(children.next()?),
children.next()? }
} else { } else {
layout self.body.overlay(layout)
}; }
self.body.overlay(body_layout)
} }
} }

View File

@ -1,6 +1,7 @@
use crate::container; use crate::container;
use crate::event::{self, Event}; use crate::event::{self, Event};
use crate::layout; use crate::layout;
use crate::overlay;
use crate::pane_grid; use crate::pane_grid;
use crate::{ use crate::{
Clipboard, Element, Hasher, Layout, Padding, Point, Rectangle, Size, Clipboard, Element, Hasher, Layout, Padding, Point, Rectangle, Size,
@ -242,4 +243,11 @@ where
control_status.merge(title_status) control_status.merge(title_status)
} }
pub(crate) fn overlay(
&mut self,
layout: Layout<'_>,
) -> Option<overlay::Element<'_, Message, Renderer>> {
self.content.overlay(layout)
}
} }