Trait cosmic::iced_runtime::core::Overlay
source · 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 on_event(
&mut self,
_event: Event,
_layout: Layout<'_>,
_cursor: Cursor,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
_shell: &mut Shell<'_, Message>,
) -> Status { ... }
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 an crate::widget::Operation
to the Overlay
.
sourcefn on_event(
&mut self,
_event: Event,
_layout: Layout<'_>,
_cursor: Cursor,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
_shell: &mut Shell<'_, Message>,
) -> Status
fn on_event( &mut self, _event: Event, _layout: Layout<'_>, _cursor: Cursor, _renderer: &Renderer, _clipboard: &mut dyn Clipboard, _shell: &mut Shell<'_, Message>, ) -> Status
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
.