Trait cosmic::iced_widget::renderer::graphics::core::overlay::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§

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 an crate::widget::Operation to the Overlay.

source

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 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, 'b, Message, Renderer> Overlay<Message, Theme, Renderer> for Overlay<'a, 'b, Message, Renderer>
where Message: Clone, Renderer: Renderer,

source§

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