1use glib::{prelude::*, translate::*};
6use std::fmt;
7
8glib::wrapper! {
9 #[doc(alias = "AtkAction")]
10 pub struct Action(Interface<ffi::AtkAction, ffi::AtkActionIface>);
11
12 match fn {
13 type_ => || ffi::atk_action_get_type(),
14 }
15}
16
17impl Action {
18 pub const NONE: Option<&'static Action> = None;
19}
20
21mod sealed {
22 pub trait Sealed {}
23 impl<T: super::IsA<super::Action>> Sealed for T {}
24}
25
26pub trait AtkActionExt: IsA<Action> + sealed::Sealed + 'static {
27 #[doc(alias = "atk_action_do_action")]
28 fn do_action(&self, i: i32) -> bool {
29 unsafe { from_glib(ffi::atk_action_do_action(self.as_ref().to_glib_none().0, i)) }
30 }
31
32 #[doc(alias = "atk_action_get_description")]
33 #[doc(alias = "get_description")]
34 fn description(&self, i: i32) -> Option<glib::GString> {
35 unsafe {
36 from_glib_none(ffi::atk_action_get_description(
37 self.as_ref().to_glib_none().0,
38 i,
39 ))
40 }
41 }
42
43 #[doc(alias = "atk_action_get_keybinding")]
44 #[doc(alias = "get_keybinding")]
45 fn keybinding(&self, i: i32) -> Option<glib::GString> {
46 unsafe {
47 from_glib_none(ffi::atk_action_get_keybinding(
48 self.as_ref().to_glib_none().0,
49 i,
50 ))
51 }
52 }
53
54 #[doc(alias = "atk_action_get_localized_name")]
55 #[doc(alias = "get_localized_name")]
56 fn localized_name(&self, i: i32) -> Option<glib::GString> {
57 unsafe {
58 from_glib_none(ffi::atk_action_get_localized_name(
59 self.as_ref().to_glib_none().0,
60 i,
61 ))
62 }
63 }
64
65 #[doc(alias = "atk_action_get_n_actions")]
66 #[doc(alias = "get_n_actions")]
67 fn n_actions(&self) -> i32 {
68 unsafe { ffi::atk_action_get_n_actions(self.as_ref().to_glib_none().0) }
69 }
70
71 #[doc(alias = "atk_action_get_name")]
72 #[doc(alias = "get_name")]
73 fn name(&self, i: i32) -> Option<glib::GString> {
74 unsafe { from_glib_none(ffi::atk_action_get_name(self.as_ref().to_glib_none().0, i)) }
75 }
76
77 #[doc(alias = "atk_action_set_description")]
78 fn set_description(&self, i: i32, desc: &str) -> bool {
79 unsafe {
80 from_glib(ffi::atk_action_set_description(
81 self.as_ref().to_glib_none().0,
82 i,
83 desc.to_glib_none().0,
84 ))
85 }
86 }
87}
88
89impl<O: IsA<Action>> AtkActionExt for O {}
90
91impl fmt::Display for Action {
92 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
93 f.write_str("Action")
94 }
95}