atk/auto/
action.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use atk_sys;
6use glib::object::IsA;
7use glib::translate::*;
8use glib::GString;
9use std::fmt;
10
11glib_wrapper! {
12    pub struct Action(Interface<atk_sys::AtkAction>);
13
14    match fn {
15        get_type => || atk_sys::atk_action_get_type(),
16    }
17}
18
19pub const NONE_ACTION: Option<&Action> = None;
20
21pub trait AtkActionExt: 'static {
22    fn do_action(&self, i: i32) -> bool;
23
24    fn get_description(&self, i: i32) -> Option<GString>;
25
26    fn get_keybinding(&self, i: i32) -> Option<GString>;
27
28    fn get_localized_name(&self, i: i32) -> Option<GString>;
29
30    fn get_n_actions(&self) -> i32;
31
32    fn get_name(&self, i: i32) -> Option<GString>;
33
34    fn set_description(&self, i: i32, desc: &str) -> bool;
35}
36
37impl<O: IsA<Action>> AtkActionExt for O {
38    fn do_action(&self, i: i32) -> bool {
39        unsafe {
40            from_glib(atk_sys::atk_action_do_action(
41                self.as_ref().to_glib_none().0,
42                i,
43            ))
44        }
45    }
46
47    fn get_description(&self, i: i32) -> Option<GString> {
48        unsafe {
49            from_glib_none(atk_sys::atk_action_get_description(
50                self.as_ref().to_glib_none().0,
51                i,
52            ))
53        }
54    }
55
56    fn get_keybinding(&self, i: i32) -> Option<GString> {
57        unsafe {
58            from_glib_none(atk_sys::atk_action_get_keybinding(
59                self.as_ref().to_glib_none().0,
60                i,
61            ))
62        }
63    }
64
65    fn get_localized_name(&self, i: i32) -> Option<GString> {
66        unsafe {
67            from_glib_none(atk_sys::atk_action_get_localized_name(
68                self.as_ref().to_glib_none().0,
69                i,
70            ))
71        }
72    }
73
74    fn get_n_actions(&self) -> i32 {
75        unsafe { atk_sys::atk_action_get_n_actions(self.as_ref().to_glib_none().0) }
76    }
77
78    fn get_name(&self, i: i32) -> Option<GString> {
79        unsafe {
80            from_glib_none(atk_sys::atk_action_get_name(
81                self.as_ref().to_glib_none().0,
82                i,
83            ))
84        }
85    }
86
87    fn set_description(&self, i: i32, desc: &str) -> bool {
88        unsafe {
89            from_glib(atk_sys::atk_action_set_description(
90                self.as_ref().to_glib_none().0,
91                i,
92                desc.to_glib_none().0,
93            ))
94        }
95    }
96}
97
98impl fmt::Display for Action {
99    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
100        write!(f, "Action")
101    }
102}