summaryrefslogtreecommitdiffstats
path: root/graphics/src/widget/tooltip.rs
blob: b5b0c558946789b3489c693b510aa23b5056a738 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Decorate content and apply alignment.
use crate::defaults::Defaults;
use crate::{Backend, Renderer};
use iced_native::{Element, Layout, Point, Rectangle};

/// An element decorating some content.
///
/// This is an alias of an `iced_native` tooltip with a default
/// `Renderer`.
pub type Tooltip<'a, Message, Backend> =
    iced_native::Tooltip<'a, Message, Renderer<Backend>>;

impl<B> iced_native::tooltip::Renderer for Renderer<B>
where
    B: Backend,
{
    type Style = ();

    fn draw<Message>(
        &mut self,
        defaults: &Defaults,
        cursor_position: Point,
        content: &Element<'_, Message, Self>,
        content_layout: Layout<'_>,
        viewport: &Rectangle,
    ) -> Self::Output {
        let (content, mouse_interaction) = content.draw(
            self,
            &defaults,
            content_layout,
            cursor_position,
            viewport,
        );

        (content, mouse_interaction)
    }
}