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
73
74
use crate::ShortcutTrigger;
use gdk::keys::Key;
use glib::object::Cast;
use glib::translate::*;
use std::fmt;
glib::wrapper! {
pub struct KeyvalTrigger(Object<ffi::GtkKeyvalTrigger, ffi::GtkKeyvalTriggerClass>) @extends ShortcutTrigger;
match fn {
type_ => || ffi::gtk_keyval_trigger_get_type(),
}
}
impl KeyvalTrigger {
#[doc(alias = "gtk_keyval_trigger_new")]
pub fn new(keyval: Key, modifiers: gdk::ModifierType) -> Self {
assert_initialized_main_thread!();
unsafe {
ShortcutTrigger::from_glib_full(ffi::gtk_keyval_trigger_new(
keyval.into_glib(),
modifiers.into_glib(),
))
.unsafe_cast()
}
}
#[doc(alias = "gtk_keyval_trigger_get_keyval")]
#[doc(alias = "get_keyval")]
pub fn keyval(&self) -> Key {
unsafe { ffi::gtk_keyval_trigger_get_keyval(self.to_glib_none().0).into() }
}
#[doc(alias = "gtk_keyval_trigger_get_modifiers")]
#[doc(alias = "get_modifiers")]
pub fn modifiers(&self) -> gdk::ModifierType {
unsafe { from_glib(ffi::gtk_keyval_trigger_get_modifiers(self.to_glib_none().0)) }
}
}
impl fmt::Display for KeyvalTrigger {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("KeyvalTrigger")
}
}