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 
5 use glib;
6 use glib::object::IsA;
7 use glib::translate::*;
8 use glib::GString;
9 use gtk_sys;
10 use std::fmt;
11 use StateFlags;
12 use Widget;
13 
14 glib_wrapper! {
15     #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
16     pub struct WidgetPath(Shared<gtk_sys::GtkWidgetPath>);
17 
18     match fn {
19         ref => |ptr| gtk_sys::gtk_widget_path_ref(ptr),
20         unref => |ptr| gtk_sys::gtk_widget_path_unref(ptr),
21         get_type => || gtk_sys::gtk_widget_path_get_type(),
22     }
23 }
24 
25 impl WidgetPath {
new() -> WidgetPath26     pub fn new() -> WidgetPath {
27         assert_initialized_main_thread!();
28         unsafe { from_glib_full(gtk_sys::gtk_widget_path_new()) }
29     }
30 
append_for_widget<P: IsA<Widget>>(&self, widget: &P) -> i3231     pub fn append_for_widget<P: IsA<Widget>>(&self, widget: &P) -> i32 {
32         unsafe {
33             gtk_sys::gtk_widget_path_append_for_widget(
34                 self.to_glib_none().0,
35                 widget.as_ref().to_glib_none().0,
36             )
37         }
38     }
39 
append_type(&self, type_: glib::types::Type) -> i3240     pub fn append_type(&self, type_: glib::types::Type) -> i32 {
41         unsafe { gtk_sys::gtk_widget_path_append_type(self.to_glib_none().0, type_.to_glib()) }
42     }
43 
append_with_siblings(&self, siblings: &WidgetPath, sibling_index: u32) -> i3244     pub fn append_with_siblings(&self, siblings: &WidgetPath, sibling_index: u32) -> i32 {
45         unsafe {
46             gtk_sys::gtk_widget_path_append_with_siblings(
47                 self.to_glib_none().0,
48                 siblings.to_glib_none().0,
49                 sibling_index,
50             )
51         }
52     }
53 
copy(&self) -> Option<WidgetPath>54     pub fn copy(&self) -> Option<WidgetPath> {
55         unsafe { from_glib_full(gtk_sys::gtk_widget_path_copy(self.to_glib_none().0)) }
56     }
57 
get_object_type(&self) -> glib::types::Type58     pub fn get_object_type(&self) -> glib::types::Type {
59         unsafe {
60             from_glib(gtk_sys::gtk_widget_path_get_object_type(
61                 self.to_glib_none().0,
62             ))
63         }
64     }
65 
has_parent(&self, type_: glib::types::Type) -> bool66     pub fn has_parent(&self, type_: glib::types::Type) -> bool {
67         unsafe {
68             from_glib(gtk_sys::gtk_widget_path_has_parent(
69                 self.to_glib_none().0,
70                 type_.to_glib(),
71             ))
72         }
73     }
74 
is_type(&self, type_: glib::types::Type) -> bool75     pub fn is_type(&self, type_: glib::types::Type) -> bool {
76         unsafe {
77             from_glib(gtk_sys::gtk_widget_path_is_type(
78                 self.to_glib_none().0,
79                 type_.to_glib(),
80             ))
81         }
82     }
83 
iter_add_class(&self, pos: i32, name: &str)84     pub fn iter_add_class(&self, pos: i32, name: &str) {
85         unsafe {
86             gtk_sys::gtk_widget_path_iter_add_class(
87                 self.to_glib_none().0,
88                 pos,
89                 name.to_glib_none().0,
90             );
91         }
92     }
93 
iter_clear_classes(&self, pos: i32)94     pub fn iter_clear_classes(&self, pos: i32) {
95         unsafe {
96             gtk_sys::gtk_widget_path_iter_clear_classes(self.to_glib_none().0, pos);
97         }
98     }
99 
iter_get_name(&self, pos: i32) -> Option<GString>100     pub fn iter_get_name(&self, pos: i32) -> Option<GString> {
101         unsafe {
102             from_glib_none(gtk_sys::gtk_widget_path_iter_get_name(
103                 self.to_glib_none().0,
104                 pos,
105             ))
106         }
107     }
108 
109     #[cfg(any(feature = "v3_20", feature = "dox"))]
iter_get_object_name(&self, pos: i32) -> Option<GString>110     pub fn iter_get_object_name(&self, pos: i32) -> Option<GString> {
111         unsafe {
112             from_glib_none(gtk_sys::gtk_widget_path_iter_get_object_name(
113                 self.to_glib_none().0,
114                 pos,
115             ))
116         }
117     }
118 
iter_get_object_type(&self, pos: i32) -> glib::types::Type119     pub fn iter_get_object_type(&self, pos: i32) -> glib::types::Type {
120         unsafe {
121             from_glib(gtk_sys::gtk_widget_path_iter_get_object_type(
122                 self.to_glib_none().0,
123                 pos,
124             ))
125         }
126     }
127 
iter_get_sibling_index(&self, pos: i32) -> u32128     pub fn iter_get_sibling_index(&self, pos: i32) -> u32 {
129         unsafe { gtk_sys::gtk_widget_path_iter_get_sibling_index(self.to_glib_none().0, pos) }
130     }
131 
iter_get_siblings(&self, pos: i32) -> Option<WidgetPath>132     pub fn iter_get_siblings(&self, pos: i32) -> Option<WidgetPath> {
133         unsafe {
134             from_glib_none(gtk_sys::gtk_widget_path_iter_get_siblings(
135                 self.to_glib_none().0,
136                 pos,
137             ))
138         }
139     }
140 
iter_get_state(&self, pos: i32) -> StateFlags141     pub fn iter_get_state(&self, pos: i32) -> StateFlags {
142         unsafe {
143             from_glib(gtk_sys::gtk_widget_path_iter_get_state(
144                 self.to_glib_none().0,
145                 pos,
146             ))
147         }
148     }
149 
iter_has_class(&self, pos: i32, name: &str) -> bool150     pub fn iter_has_class(&self, pos: i32, name: &str) -> bool {
151         unsafe {
152             from_glib(gtk_sys::gtk_widget_path_iter_has_class(
153                 self.to_glib_none().0,
154                 pos,
155                 name.to_glib_none().0,
156             ))
157         }
158     }
159 
iter_has_name(&self, pos: i32, name: &str) -> bool160     pub fn iter_has_name(&self, pos: i32, name: &str) -> bool {
161         unsafe {
162             from_glib(gtk_sys::gtk_widget_path_iter_has_name(
163                 self.to_glib_none().0,
164                 pos,
165                 name.to_glib_none().0,
166             ))
167         }
168     }
169 
iter_has_qclass(&self, pos: i32, qname: glib::Quark) -> bool170     pub fn iter_has_qclass(&self, pos: i32, qname: glib::Quark) -> bool {
171         unsafe {
172             from_glib(gtk_sys::gtk_widget_path_iter_has_qclass(
173                 self.to_glib_none().0,
174                 pos,
175                 qname.to_glib(),
176             ))
177         }
178     }
179 
iter_has_qname(&self, pos: i32, qname: glib::Quark) -> bool180     pub fn iter_has_qname(&self, pos: i32, qname: glib::Quark) -> bool {
181         unsafe {
182             from_glib(gtk_sys::gtk_widget_path_iter_has_qname(
183                 self.to_glib_none().0,
184                 pos,
185                 qname.to_glib(),
186             ))
187         }
188     }
189 
iter_list_classes(&self, pos: i32) -> Vec<GString>190     pub fn iter_list_classes(&self, pos: i32) -> Vec<GString> {
191         unsafe {
192             FromGlibPtrContainer::from_glib_container(gtk_sys::gtk_widget_path_iter_list_classes(
193                 self.to_glib_none().0,
194                 pos,
195             ))
196         }
197     }
198 
iter_remove_class(&self, pos: i32, name: &str)199     pub fn iter_remove_class(&self, pos: i32, name: &str) {
200         unsafe {
201             gtk_sys::gtk_widget_path_iter_remove_class(
202                 self.to_glib_none().0,
203                 pos,
204                 name.to_glib_none().0,
205             );
206         }
207     }
208 
iter_set_name(&self, pos: i32, name: &str)209     pub fn iter_set_name(&self, pos: i32, name: &str) {
210         unsafe {
211             gtk_sys::gtk_widget_path_iter_set_name(
212                 self.to_glib_none().0,
213                 pos,
214                 name.to_glib_none().0,
215             );
216         }
217     }
218 
219     #[cfg(any(feature = "v3_20", feature = "dox"))]
iter_set_object_name(&self, pos: i32, name: Option<&str>)220     pub fn iter_set_object_name(&self, pos: i32, name: Option<&str>) {
221         unsafe {
222             gtk_sys::gtk_widget_path_iter_set_object_name(
223                 self.to_glib_none().0,
224                 pos,
225                 name.to_glib_none().0,
226             );
227         }
228     }
229 
iter_set_object_type(&self, pos: i32, type_: glib::types::Type)230     pub fn iter_set_object_type(&self, pos: i32, type_: glib::types::Type) {
231         unsafe {
232             gtk_sys::gtk_widget_path_iter_set_object_type(
233                 self.to_glib_none().0,
234                 pos,
235                 type_.to_glib(),
236             );
237         }
238     }
239 
iter_set_state(&self, pos: i32, state: StateFlags)240     pub fn iter_set_state(&self, pos: i32, state: StateFlags) {
241         unsafe {
242             gtk_sys::gtk_widget_path_iter_set_state(self.to_glib_none().0, pos, state.to_glib());
243         }
244     }
245 
length(&self) -> i32246     pub fn length(&self) -> i32 {
247         unsafe { gtk_sys::gtk_widget_path_length(self.to_glib_none().0) }
248     }
249 
prepend_type(&self, type_: glib::types::Type)250     pub fn prepend_type(&self, type_: glib::types::Type) {
251         unsafe {
252             gtk_sys::gtk_widget_path_prepend_type(self.to_glib_none().0, type_.to_glib());
253         }
254     }
255 
to_string(&self) -> GString256     fn to_string(&self) -> GString {
257         unsafe { from_glib_full(gtk_sys::gtk_widget_path_to_string(self.to_glib_none().0)) }
258     }
259 }
260 
261 impl Default for WidgetPath {
default() -> Self262     fn default() -> Self {
263         Self::new()
264     }
265 }
266 
267 impl fmt::Display for WidgetPath {
268     #[inline]
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result269     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
270         write!(f, "{}", self.to_string())
271     }
272 }
273