Skip to main content

gtk/
entry_completion.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::EntryCompletion;
4use crate::Widget;
5use crate::{Entry, ffi};
6use glib::object::Cast;
7use glib::object::IsA;
8use glib::translate::*;
9
10pub trait EntryCompletionExtManual: IsA<EntryCompletion> + 'static {
11    /// Gets the entry `self` has been attached to.
12    ///
13    /// # Returns
14    ///
15    /// The entry `self` has been attached to
16    #[doc(alias = "gtk_entry_completion_get_entry")]
17    #[doc(alias = "get_entry")]
18    fn entry(&self) -> Option<Entry> {
19        unsafe {
20            Option::<Widget>::from_glib_none(ffi::gtk_entry_completion_get_entry(
21                self.as_ref().to_glib_none().0,
22            ))
23            .map(|widget| {
24                widget
25                    .downcast()
26                    .expect("Non-Entry widget received from get_entry method")
27            })
28        }
29    }
30}
31
32impl<O: IsA<EntryCompletion>> EntryCompletionExtManual for O {}