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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT

use crate::Buffer;
use crate::View;
use glib::translate::*;
use std::fmt;

glib::wrapper! {
    pub struct HoverContext(Object<ffi::GtkSourceHoverContext, ffi::GtkSourceHoverContextClass>);

    match fn {
        get_type => || ffi::gtk_source_hover_context_get_type(),
    }
}

impl HoverContext {
    #[doc(alias = "gtk_source_hover_context_get_bounds")]
    pub fn get_bounds(&self, begin: &mut gtk::TextIter, end: &mut gtk::TextIter) -> bool {
        unsafe {
            from_glib(ffi::gtk_source_hover_context_get_bounds(
                self.to_glib_none().0,
                begin.to_glib_none_mut().0,
                end.to_glib_none_mut().0,
            ))
        }
    }

    /// A convenience function to get the buffer.
    ///
    /// # Returns
    ///
    /// The `Buffer` for the view
    #[doc(alias = "gtk_source_hover_context_get_buffer")]
    pub fn get_buffer(&self) -> Option<Buffer> {
        unsafe {
            from_glib_none(ffi::gtk_source_hover_context_get_buffer(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "gtk_source_hover_context_get_iter")]
    pub fn get_iter(&self, iter: &mut gtk::TextIter) -> bool {
        unsafe {
            from_glib(ffi::gtk_source_hover_context_get_iter(
                self.to_glib_none().0,
                iter.to_glib_none_mut().0,
            ))
        }
    }

    ///
    /// # Returns
    ///
    /// the `View` that owns the context
    #[doc(alias = "gtk_source_hover_context_get_view")]
    pub fn get_view(&self) -> Option<View> {
        unsafe {
            from_glib_none(ffi::gtk_source_hover_context_get_view(
                self.to_glib_none().0,
            ))
        }
    }
}

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