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