pub struct MouseArea<'a, Message> {Show 23 fields
id: Id,
content: Element<'a, Message>,
on_auto_scroll: Option<Box<dyn OnAutoScroll<'a, Message>>>,
on_drag: Option<Box<dyn OnDrag<'a, Message>>>,
on_double_click: Option<Box<dyn OnMouseButton<'a, Message>>>,
on_press: Option<Box<dyn OnMouseButton<'a, Message>>>,
on_drag_end: Option<Box<dyn OnMouseButton<'a, Message>>>,
on_release: Option<Box<dyn OnMouseButton<'a, Message>>>,
on_resize: Option<Box<dyn OnResize<'a, Message>>>,
on_right_press: Option<Box<dyn OnMouseButton<'a, Message>>>,
on_right_press_no_capture: bool,
on_right_press_window_position: bool,
on_right_release: Option<Box<dyn OnMouseButton<'a, Message>>>,
on_middle_press: Option<Box<dyn OnMouseButton<'a, Message>>>,
on_middle_release: Option<Box<dyn OnMouseButton<'a, Message>>>,
on_back_press: Option<Box<dyn OnMouseButton<'a, Message>>>,
on_back_release: Option<Box<dyn OnMouseButton<'a, Message>>>,
on_forward_press: Option<Box<dyn OnMouseButton<'a, Message>>>,
on_forward_release: Option<Box<dyn OnMouseButton<'a, Message>>>,
on_scroll: Option<Box<dyn OnScroll<'a, Message>>>,
on_enter: Option<Box<dyn OnEnterExit<'a, Message>>>,
on_exit: Option<Box<dyn OnEnterExit<'a, Message>>>,
show_drag_rect: bool,
}Expand description
Emit messages on mouse events.
Fields§
§id: Id§content: Element<'a, Message>§on_auto_scroll: Option<Box<dyn OnAutoScroll<'a, Message>>>§on_drag: Option<Box<dyn OnDrag<'a, Message>>>§on_double_click: Option<Box<dyn OnMouseButton<'a, Message>>>§on_press: Option<Box<dyn OnMouseButton<'a, Message>>>§on_drag_end: Option<Box<dyn OnMouseButton<'a, Message>>>§on_release: Option<Box<dyn OnMouseButton<'a, Message>>>§on_resize: Option<Box<dyn OnResize<'a, Message>>>§on_right_press: Option<Box<dyn OnMouseButton<'a, Message>>>§on_right_press_no_capture: bool§on_right_press_window_position: bool§on_right_release: Option<Box<dyn OnMouseButton<'a, Message>>>§on_middle_press: Option<Box<dyn OnMouseButton<'a, Message>>>§on_middle_release: Option<Box<dyn OnMouseButton<'a, Message>>>§on_back_press: Option<Box<dyn OnMouseButton<'a, Message>>>§on_back_release: Option<Box<dyn OnMouseButton<'a, Message>>>§on_forward_press: Option<Box<dyn OnMouseButton<'a, Message>>>§on_forward_release: Option<Box<dyn OnMouseButton<'a, Message>>>§on_scroll: Option<Box<dyn OnScroll<'a, Message>>>§on_enter: Option<Box<dyn OnEnterExit<'a, Message>>>§on_exit: Option<Box<dyn OnEnterExit<'a, Message>>>§show_drag_rect: boolImplementations§
Source§impl<'a, Message> MouseArea<'a, Message>
impl<'a, Message> MouseArea<'a, Message>
Sourcepub fn on_auto_scroll(self, message: impl OnAutoScroll<'a, Message>) -> Self
pub fn on_auto_scroll(self, message: impl OnAutoScroll<'a, Message>) -> Self
The message to emit when auto scroll changes.
Sourcepub fn on_drag(self, message: impl OnDrag<'a, Message>) -> Self
pub fn on_drag(self, message: impl OnDrag<'a, Message>) -> Self
The message to emit when a drag is initiated.
Sourcepub fn on_drag_end(self, message: impl OnMouseButton<'a, Message>) -> Self
pub fn on_drag_end(self, message: impl OnMouseButton<'a, Message>) -> Self
The message to emit when a drag ends.
Sourcepub fn on_double_click(self, message: impl OnMouseButton<'a, Message>) -> Self
pub fn on_double_click(self, message: impl OnMouseButton<'a, Message>) -> Self
The message to emit on a double click.
Sourcepub fn on_press(self, message: impl OnMouseButton<'a, Message>) -> Self
pub fn on_press(self, message: impl OnMouseButton<'a, Message>) -> Self
The message to emit on a left button press.
Sourcepub fn on_release(self, message: impl OnMouseButton<'a, Message>) -> Self
pub fn on_release(self, message: impl OnMouseButton<'a, Message>) -> Self
The message to emit on a left button release.
Sourcepub fn on_resize(self, message: impl OnResize<'a, Message>) -> Self
pub fn on_resize(self, message: impl OnResize<'a, Message>) -> Self
The message to emit on resizing.
Sourcepub fn on_right_press(self, message: impl OnMouseButton<'a, Message>) -> Self
pub fn on_right_press(self, message: impl OnMouseButton<'a, Message>) -> Self
The message to emit on a right button press.
Sourcepub fn on_right_press_no_capture(self) -> Self
pub fn on_right_press_no_capture(self) -> Self
on_right_press will not capture input
Sourcepub fn wayland_on_right_press_window_position(self) -> Self
pub fn wayland_on_right_press_window_position(self) -> Self
Only on wayland, on_right_press will provide window position instead of widget relative
Sourcepub fn on_right_press_window_position(self) -> Self
pub fn on_right_press_window_position(self) -> Self
on_right_press will provide window position instead of widget relative
Sourcepub fn on_right_release(self, message: impl OnMouseButton<'a, Message>) -> Self
pub fn on_right_release(self, message: impl OnMouseButton<'a, Message>) -> Self
The message to emit on a right button release.
Sourcepub fn on_middle_press(self, message: impl OnMouseButton<'a, Message>) -> Self
pub fn on_middle_press(self, message: impl OnMouseButton<'a, Message>) -> Self
The message to emit on a middle button press.
Sourcepub fn on_middle_release(self, message: impl OnMouseButton<'a, Message>) -> Self
pub fn on_middle_release(self, message: impl OnMouseButton<'a, Message>) -> Self
The message to emit on a middle button release.
Sourcepub fn on_back_press(self, message: impl OnMouseButton<'a, Message>) -> Self
pub fn on_back_press(self, message: impl OnMouseButton<'a, Message>) -> Self
The message to emit on a back button press.
Sourcepub fn on_back_release(self, message: impl OnMouseButton<'a, Message>) -> Self
pub fn on_back_release(self, message: impl OnMouseButton<'a, Message>) -> Self
The message to emit on a back button release.
Sourcepub fn on_forward_press(self, message: impl OnMouseButton<'a, Message>) -> Self
pub fn on_forward_press(self, message: impl OnMouseButton<'a, Message>) -> Self
The message to emit on a forward button press.
Sourcepub fn on_forward_release(
self,
message: impl OnMouseButton<'a, Message>,
) -> Self
pub fn on_forward_release( self, message: impl OnMouseButton<'a, Message>, ) -> Self
The message to emit on a forward button release.
Sourcepub fn on_scroll(self, message: impl OnScroll<'a, Message>) -> Self
pub fn on_scroll(self, message: impl OnScroll<'a, Message>) -> Self
The message to emit on a scroll.
Sourcepub fn on_enter(self, message: impl OnEnterExit<'a, Message>) -> Self
pub fn on_enter(self, message: impl OnEnterExit<'a, Message>) -> Self
The message to emit when a mouse enters the area.
Sourcepub fn on_exit(self, message: impl OnEnterExit<'a, Message>) -> Self
pub fn on_exit(self, message: impl OnEnterExit<'a, Message>) -> Self
The message to emit when a mouse exits the area.
pub const fn show_drag_rect(self, show_drag_rect: bool) -> Self
Trait Implementations§
Source§impl<'a, Message> From<MouseArea<'a, Message>> for Element<'a, Message>where
Message: 'a + Clone,
Renderer: 'a + Renderer,
Theme: 'a,
impl<'a, Message> From<MouseArea<'a, Message>> for Element<'a, Message>where
Message: 'a + Clone,
Renderer: 'a + Renderer,
Theme: 'a,
Source§impl<Message> Widget<Message, Theme, Renderer> for MouseArea<'_, Message>where
Message: Clone,
impl<Message> Widget<Message, Theme, Renderer> for MouseArea<'_, Message>where
Message: Clone,
Source§fn operate(
&mut self,
tree: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn Operation,
)
fn operate( &mut self, tree: &mut Tree, layout: Layout<'_>, renderer: &Renderer, operation: &mut dyn Operation, )
Operation] to the [Widget].Source§fn update(
&mut self,
tree: &mut Tree,
event: &Event,
layout: Layout<'_>,
cursor: Cursor,
renderer: &Renderer,
clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>,
viewport: &Rectangle,
)
fn update( &mut self, tree: &mut Tree, event: &Event, layout: Layout<'_>, cursor: Cursor, renderer: &Renderer, clipboard: &mut dyn Clipboard, shell: &mut Shell<'_, Message>, viewport: &Rectangle, )
Event]. Read moreSource§fn mouse_interaction(
&self,
tree: &Tree,
layout: Layout<'_>,
cursor: Cursor,
viewport: &Rectangle,
renderer: &Renderer,
) -> Interaction
fn mouse_interaction( &self, tree: &Tree, layout: Layout<'_>, cursor: Cursor, viewport: &Rectangle, renderer: &Renderer, ) -> Interaction
Source§fn draw(
&self,
tree: &Tree,
renderer: &mut Renderer,
theme: &Theme,
renderer_style: &Style,
layout: Layout<'_>,
cursor: Cursor,
viewport: &Rectangle,
)
fn draw( &self, tree: &Tree, renderer: &mut Renderer, theme: &Theme, renderer_style: &Style, layout: Layout<'_>, cursor: Cursor, viewport: &Rectangle, )
Widget] using the associated Renderer.Source§fn overlay<'b>(
&'b mut self,
tree: &'b mut Tree,
layout: Layout<'b>,
renderer: &Renderer,
viewport: &Rectangle,
translation: Vector,
) -> Option<Element<'b, Message, Theme, Renderer>>
fn overlay<'b>( &'b mut self, tree: &'b mut Tree, layout: Layout<'b>, renderer: &Renderer, viewport: &Rectangle, translation: Vector, ) -> Option<Element<'b, Message, Theme, Renderer>>
Widget], if there is any.Source§fn drag_destinations(
&self,
state: &Tree,
layout: Layout<'_>,
renderer: &Renderer,
dnd_rectangles: &mut DndDestinationRectangles,
)
fn drag_destinations( &self, state: &Tree, layout: Layout<'_>, renderer: &Renderer, dnd_rectangles: &mut DndDestinationRectangles, )
Auto Trait Implementations§
impl<'a, Message> Freeze for MouseArea<'a, Message>
impl<'a, Message> !RefUnwindSafe for MouseArea<'a, Message>
impl<'a, Message> !Send for MouseArea<'a, Message>
impl<'a, Message> !Sync for MouseArea<'a, Message>
impl<'a, Message> Unpin for MouseArea<'a, Message>
impl<'a, Message> !UnwindSafe for MouseArea<'a, Message>
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
§impl<T> Also for T
impl<T> Also for T
§impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
§impl<F, T> ConvertInto<T> for Fwhere
T: ConvertFrom<F>,
impl<F, T> ConvertInto<T> for Fwhere
T: ConvertFrom<F>,
§fn convert_into(self) -> T
fn convert_into(self) -> T
Self to a value of type T.§impl<F, T> ConvertTryFrom<F> for Twhere
F: ConvertInto<T>,
impl<F, T> ConvertTryFrom<F> for Twhere
F: ConvertInto<T>,
§type Error = Infallible
type Error = Infallible
§fn convert_try_from(value: F) -> Result<T, Infallible>
fn convert_try_from(value: F) -> Result<T, Infallible>
F to a value of type Self.§impl<F, T> ConvertTryInto<T> for Fwhere
T: ConvertTryFrom<F>,
impl<F, T> ConvertTryInto<T> for Fwhere
T: ConvertTryFrom<F>,
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<'a, Message, T> IntoListItem<'a, Message> for Twhere
T: Into<Element<'a, Message, Theme, Renderer>>,
impl<'a, Message, T> IntoListItem<'a, Message> for Twhere
T: Into<Element<'a, Message, Theme, Renderer>>,
fn into_list_item(self) -> ListItem<'a, Message>
Source§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more