Skip to main content

sourceview5/auto/
hover_context.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5
6use crate::{Buffer, View, ffi};
7use glib::translate::*;
8
9glib::wrapper! {
10    #[doc(alias = "GtkSourceHoverContext")]
11    pub struct HoverContext(Object<ffi::GtkSourceHoverContext, ffi::GtkSourceHoverContextClass>);
12
13    match fn {
14        type_ => || ffi::gtk_source_hover_context_get_type(),
15    }
16}
17
18impl HoverContext {
19    #[doc(alias = "gtk_source_hover_context_get_bounds")]
20    #[doc(alias = "get_bounds")]
21    pub fn bounds(&self) -> Option<(gtk::TextIter, gtk::TextIter)> {
22        unsafe {
23            let mut begin = gtk::TextIter::uninitialized();
24            let mut end = gtk::TextIter::uninitialized();
25            let ret = from_glib(ffi::gtk_source_hover_context_get_bounds(
26                self.to_glib_none().0,
27                begin.to_glib_none_mut().0,
28                end.to_glib_none_mut().0,
29            ));
30            if ret { Some((begin, end)) } else { None }
31        }
32    }
33
34    #[doc(alias = "gtk_source_hover_context_get_buffer")]
35    #[doc(alias = "get_buffer")]
36    pub fn buffer(&self) -> Buffer {
37        unsafe {
38            from_glib_none(ffi::gtk_source_hover_context_get_buffer(
39                self.to_glib_none().0,
40            ))
41        }
42    }
43
44    #[doc(alias = "gtk_source_hover_context_get_view")]
45    #[doc(alias = "get_view")]
46    pub fn view(&self) -> View {
47        unsafe {
48            from_glib_none(ffi::gtk_source_hover_context_get_view(
49                self.to_glib_none().0,
50            ))
51        }
52    }
53}