Introduce Shell type in iced_native

Widgets now can invalidate the current layout of the application on demand.
This commit is contained in:
Héctor Ramón Jiménez 2021-11-29 16:22:01 +07:00
parent f7792d89d6
commit bbd9355450
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
26 changed files with 218 additions and 130 deletions

View file

@ -5,7 +5,9 @@ use crate::overlay;
use crate::renderer;
use crate::widget::container;
use crate::widget::pane_grid::TitleBar;
use crate::{Clipboard, Element, Hasher, Layout, Point, Rectangle, Size};
use crate::{
Clipboard, Element, Hasher, Layout, Point, Rectangle, Shell, Size,
};
/// The content of a [`Pane`].
///
@ -160,7 +162,7 @@ where
cursor_position: Point,
renderer: &Renderer,
clipboard: &mut dyn Clipboard,
messages: &mut Vec<Message>,
shell: &mut Shell<'_, Message>,
is_picked: bool,
) -> event::Status {
let mut event_status = event::Status::Ignored;
@ -174,7 +176,7 @@ where
cursor_position,
renderer,
clipboard,
messages,
shell,
);
children.next().unwrap()
@ -191,7 +193,7 @@ where
cursor_position,
renderer,
clipboard,
messages,
shell,
)
};

View file

@ -5,7 +5,7 @@ use crate::overlay;
use crate::renderer;
use crate::widget::container;
use crate::{
Clipboard, Element, Hasher, Layout, Padding, Point, Rectangle, Size,
Clipboard, Element, Hasher, Layout, Padding, Point, Rectangle, Shell, Size,
};
/// The title bar of a [`Pane`].
@ -218,7 +218,7 @@ where
cursor_position: Point,
renderer: &Renderer,
clipboard: &mut dyn Clipboard,
messages: &mut Vec<Message>,
shell: &mut Shell<'_, Message>,
) -> event::Status {
let mut children = layout.children();
let padded = children.next().unwrap();
@ -235,7 +235,7 @@ where
cursor_position,
renderer,
clipboard,
messages,
shell,
)
} else {
event::Status::Ignored
@ -247,7 +247,7 @@ where
cursor_position,
renderer,
clipboard,
messages,
shell,
);
control_status.merge(title_status)