Introduce mouse_interaction method to Widget trait

This commit is contained in:
Héctor Ramón Jiménez 2021-10-18 16:43:18 +07:00
parent 7a876c8b29
commit be97a5d502
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
10 changed files with 152 additions and 21 deletions

View file

@ -80,6 +80,7 @@ pub use tooltip::Tooltip;
use crate::event::{self, Event};
use crate::layout;
use crate::mouse;
use crate::overlay;
use crate::renderer;
use crate::{Clipboard, Hasher, Layout, Length, Point, Rectangle};
@ -175,6 +176,18 @@ where
event::Status::Ignored
}
/// Returns the current [`mouse::Interaction`] of the [`Widget`].
///
/// By default, it returns [`mouse::Interaction::Idle`].
fn mouse_interaction(
&self,
_layout: Layout<'_>,
_viewport: &Rectangle,
_cursor_position: Point,
) -> mouse::Interaction {
mouse::Interaction::Idle
}
/// Returns the overlay of the [`Widget`], if there is any.
fn overlay(
&mut self,