pub trait Overlay<Message, Theme, Renderer>where
Renderer: Renderer,{
// Required methods
fn layout(&mut self, renderer: &Renderer, bounds: Size) -> Node;
fn draw(
&self,
renderer: &mut Renderer,
theme: &Theme,
style: &Style,
layout: Layout<'_>,
cursor: Cursor,
);
// Provided methods
fn operate(
&mut self,
_layout: Layout<'_>,
_renderer: &Renderer,
_operation: &mut dyn Operation,
) { ... }
fn update(
&mut self,
_event: Event,
_layout: Layout<'_>,
_cursor: Cursor,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
_shell: &mut Shell<'_, Message>,
) { ... }
fn mouse_interaction(
&self,
_layout: Layout<'_>,
_cursor: Cursor,
_viewport: &Rectangle,
_renderer: &Renderer,
) -> Interaction { ... }
fn is_over(
&self,
layout: Layout<'_>,
_renderer: &Renderer,
cursor_position: Point,
) -> bool { ... }
fn overlay<'a>(
&'a mut self,
_layout: Layout<'_>,
_renderer: &Renderer,
) -> Option<Element<'a, Message, Theme, Renderer>> { ... }
}
Expand description
An interactive component that can be displayed on top of other widgets.
Required Methods§
Provided Methods§
Sourcefn operate(
&mut self,
_layout: Layout<'_>,
_renderer: &Renderer,
_operation: &mut dyn Operation,
)
fn operate( &mut self, _layout: Layout<'_>, _renderer: &Renderer, _operation: &mut dyn Operation, )
Applies a widget::Operation
to the Overlay
.
Sourcefn update(
&mut self,
_event: Event,
_layout: Layout<'_>,
_cursor: Cursor,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
_shell: &mut Shell<'_, Message>,
)
fn update( &mut self, _event: Event, _layout: Layout<'_>, _cursor: Cursor, _renderer: &Renderer, _clipboard: &mut dyn Clipboard, _shell: &mut Shell<'_, Message>, )
Processes a runtime Event
.
It receives:
- an
Event
describing user interaction - the computed
Layout
of theOverlay
- the current cursor position
- a mutable
Message
list, allowing theOverlay
to produce new messages based on user interaction. - the
Renderer
- a
Clipboard
, if available
By default, it does nothing.
Sourcefn mouse_interaction(
&self,
_layout: Layout<'_>,
_cursor: Cursor,
_viewport: &Rectangle,
_renderer: &Renderer,
) -> Interaction
fn mouse_interaction( &self, _layout: Layout<'_>, _cursor: Cursor, _viewport: &Rectangle, _renderer: &Renderer, ) -> Interaction
Returns the current mouse::Interaction
of the Overlay
.
By default, it returns mouse::Interaction::Idle
.