gtk4/
shortcut_trigger.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::{ffi, prelude::*, ShortcutTrigger};
6
7mod sealed {
8    pub trait Sealed {}
9    impl<T: super::IsA<super::ShortcutTrigger>> Sealed for T {}
10}
11
12// rustdoc-stripper-ignore-next
13/// Trait containing manually implemented methods of
14/// [`ShortcutTrigger`](crate::ShortcutTrigger).
15pub trait ShortcutTriggerExtManual: sealed::Sealed + IsA<ShortcutTrigger> {
16    #[doc(alias = "gtk_shortcut_trigger_compare")]
17    fn compare(&self, trigger2: &impl IsA<ShortcutTrigger>) -> std::cmp::Ordering {
18        unsafe {
19            from_glib(ffi::gtk_shortcut_trigger_compare(
20                ToGlibPtr::<*mut ffi::GtkShortcutTrigger>::to_glib_none(self.as_ref()).0
21                    as glib::ffi::gconstpointer,
22                ToGlibPtr::<*mut ffi::GtkShortcutTrigger>::to_glib_none(trigger2.as_ref()).0
23                    as glib::ffi::gconstpointer,
24            ))
25        }
26    }
27
28    #[doc(alias = "gtk_shortcut_trigger_equal")]
29    fn equal(&self, trigger2: &impl IsA<ShortcutTrigger>) -> bool {
30        unsafe {
31            from_glib(ffi::gtk_shortcut_trigger_equal(
32                ToGlibPtr::<*mut ffi::GtkShortcutTrigger>::to_glib_none(self.as_ref()).0
33                    as glib::ffi::gconstpointer,
34                ToGlibPtr::<*mut ffi::GtkShortcutTrigger>::to_glib_none(trigger2.as_ref()).0
35                    as glib::ffi::gconstpointer,
36            ))
37        }
38    }
39
40    #[doc(alias = "gtk_shortcut_trigger_hash")]
41    fn hash(&self) -> u32 {
42        unsafe {
43            ffi::gtk_shortcut_trigger_hash(
44                ToGlibPtr::<*mut ffi::GtkShortcutTrigger>::to_glib_none(self.as_ref()).0
45                    as glib::ffi::gconstpointer,
46            )
47        }
48    }
49}
50
51impl<O: IsA<ShortcutTrigger>> ShortcutTriggerExtManual for O {}