Introduce Shell type in iced_native
Widgets now can invalidate the current layout of the application on demand.
This commit is contained in:
parent
f7792d89d6
commit
bbd9355450
26 changed files with 218 additions and 130 deletions
|
|
@ -10,7 +10,7 @@ use crate::text;
|
|||
use crate::widget::{Row, Text};
|
||||
use crate::{
|
||||
Alignment, Clipboard, Element, Event, Hasher, Layout, Length, Point,
|
||||
Rectangle, Widget,
|
||||
Rectangle, Shell, Widget,
|
||||
};
|
||||
|
||||
pub use iced_style::toggler::{Style, StyleSheet};
|
||||
|
|
@ -173,14 +173,14 @@ where
|
|||
cursor_position: Point,
|
||||
_renderer: &Renderer,
|
||||
_clipboard: &mut dyn Clipboard,
|
||||
messages: &mut Vec<Message>,
|
||||
shell: &mut Shell<'_, Message>,
|
||||
) -> event::Status {
|
||||
match event {
|
||||
Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) => {
|
||||
let mouse_over = layout.bounds().contains(cursor_position);
|
||||
|
||||
if mouse_over {
|
||||
messages.push((self.on_toggle)(!self.is_active));
|
||||
shell.publish((self.on_toggle)(!self.is_active));
|
||||
|
||||
event::Status::Captured
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue