iced_core::overlay

Trait 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 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§

Source

fn layout(&mut self, renderer: &Renderer, bounds: Size) -> Node

Returns the layout Node of the Overlay.

This Node is used by the runtime to compute the Layout of the user interface.

Source

fn draw( &self, renderer: &mut Renderer, theme: &Theme, style: &Style, layout: Layout<'_>, cursor: Cursor, )

Draws the Overlay using the associated Renderer.

Provided Methods§

Source

fn operate( &mut self, _layout: Layout<'_>, _renderer: &Renderer, _operation: &mut dyn Operation, )

Applies a widget::Operation to the Overlay.

Source

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 the Overlay
  • the current cursor position
  • a mutable Message list, allowing the Overlay to produce new messages based on user interaction.
  • the Renderer
  • a Clipboard, if available

By default, it does nothing.

Source

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.

Source

fn is_over( &self, layout: Layout<'_>, _renderer: &Renderer, cursor_position: Point, ) -> bool

Returns true if the cursor is over the Overlay.

By default, it returns true if the bounds of the layout contain the cursor_position.

Source

fn overlay<'a>( &'a mut self, _layout: Layout<'_>, _renderer: &Renderer, ) -> Option<Element<'a, Message, Theme, Renderer>>

Returns the nested overlay of the Overlay, if there is any.

Implementors§

Source§

impl<'a, Message, Theme, Renderer> Overlay<Message, Theme, Renderer> for Group<'a, Message, Theme, Renderer>
where Renderer: Renderer,