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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::IconSize;
use crate::Widget;
use glib::object::IsA;
use glib::translate::*;
use std::fmt;

glib::wrapper! {
    #[doc(alias = "GtkTooltip")]
    pub struct Tooltip(Object<ffi::GtkTooltip>);

    match fn {
        type_ => || ffi::gtk_tooltip_get_type(),
    }
}

impl Tooltip {
    #[doc(alias = "gtk_tooltip_set_custom")]
    pub fn set_custom(&self, custom_widget: Option<&impl IsA<Widget>>) {
        unsafe {
            ffi::gtk_tooltip_set_custom(
                self.to_glib_none().0,
                custom_widget.map(|p| p.as_ref()).to_glib_none().0,
            );
        }
    }

    #[doc(alias = "gtk_tooltip_set_icon")]
    pub fn set_icon(&self, pixbuf: Option<&gdk_pixbuf::Pixbuf>) {
        unsafe {
            ffi::gtk_tooltip_set_icon(self.to_glib_none().0, pixbuf.to_glib_none().0);
        }
    }

    #[doc(alias = "gtk_tooltip_set_icon_from_gicon")]
    pub fn set_icon_from_gicon(&self, gicon: Option<&impl IsA<gio::Icon>>, size: IconSize) {
        unsafe {
            ffi::gtk_tooltip_set_icon_from_gicon(
                self.to_glib_none().0,
                gicon.map(|p| p.as_ref()).to_glib_none().0,
                size.into_glib(),
            );
        }
    }

    #[doc(alias = "gtk_tooltip_set_icon_from_icon_name")]
    pub fn set_icon_from_icon_name(&self, icon_name: Option<&str>, size: IconSize) {
        unsafe {
            ffi::gtk_tooltip_set_icon_from_icon_name(
                self.to_glib_none().0,
                icon_name.to_glib_none().0,
                size.into_glib(),
            );
        }
    }

    #[doc(alias = "gtk_tooltip_set_markup")]
    pub fn set_markup(&self, markup: Option<&str>) {
        unsafe {
            ffi::gtk_tooltip_set_markup(self.to_glib_none().0, markup.to_glib_none().0);
        }
    }

    #[doc(alias = "gtk_tooltip_set_text")]
    pub fn set_text(&self, text: Option<&str>) {
        unsafe {
            ffi::gtk_tooltip_set_text(self.to_glib_none().0, text.to_glib_none().0);
        }
    }

    #[doc(alias = "gtk_tooltip_set_tip_area")]
    pub fn set_tip_area(&self, rect: &gdk::Rectangle) {
        unsafe {
            ffi::gtk_tooltip_set_tip_area(self.to_glib_none().0, rect.to_glib_none().0);
        }
    }

    #[doc(alias = "gtk_tooltip_trigger_tooltip_query")]
    pub fn trigger_tooltip_query(display: &gdk::Display) {
        assert_initialized_main_thread!();
        unsafe {
            ffi::gtk_tooltip_trigger_tooltip_query(display.to_glib_none().0);
        }
    }
}

impl fmt::Display for Tooltip {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.write_str("Tooltip")
    }
}