gtk4/
entry.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::translate::*;
4
5use crate::{prelude::*, Entry};
6
7mod sealed {
8    pub trait Sealed {}
9    impl<T: super::IsA<super::Entry>> Sealed for T {}
10}
11
12// rustdoc-stripper-ignore-next
13/// Trait containing manually implemented methods of [`Entry`](crate::Entry).
14pub trait EntryExtManual: sealed::Sealed + IsA<Entry> + 'static {
15    /// Retrieves the character displayed in place of the actual text
16    /// in “password mode”.
17    ///
18    /// # Returns
19    ///
20    /// the current invisible char, or 0, if the entry does not
21    ///   show invisible text at all.
22    #[doc(alias = "gtk_entry_get_invisible_char")]
23    #[doc(alias = "get_invisible_char")]
24    fn invisible_char(&self) -> Option<char> {
25        let ret =
26            unsafe { crate::ffi::gtk_entry_get_invisible_char(self.as_ref().to_glib_none().0) };
27        if ret == 0 {
28            return None;
29        }
30        Some(TryFrom::try_from(ret).expect("conversion from an invalid Unicode value attempted"))
31    }
32}
33
34impl<O: IsA<Entry>> EntryExtManual for O {}