Make Widget::on_event return an event::Status

This commit is contained in:
Héctor Ramón Jiménez 2020-11-12 00:09:52 +01:00
parent 1db11ba69a
commit 3f968b8c87
20 changed files with 136 additions and 70 deletions

View file

@ -4,9 +4,11 @@
//!
//! [`Slider`]: struct.Slider.html
//! [`State`]: struct.State.html
use crate::event::{self, Event};
use crate::layout;
use crate::mouse;
use crate::{
layout, mouse, Clipboard, Element, Event, Hasher, Layout, Length, Point,
Rectangle, Size, Widget,
Clipboard, Element, Hasher, Layout, Length, Point, Rectangle, Size, Widget,
};
use std::{hash::Hash, ops::RangeInclusive};
@ -202,7 +204,7 @@ where
messages: &mut Vec<Message>,
_renderer: &Renderer,
_clipboard: Option<&dyn Clipboard>,
) {
) -> event::Status {
let mut change = || {
let bounds = layout.bounds();
if cursor_position.x <= bounds.x {
@ -251,6 +253,8 @@ where
},
_ => {}
}
event::Status::Ignored
}
fn draw(