1 // This file was generated by gir (https://github.com/gtk-rs/gir) 2 // from 3 // from gir-files (https://github.com/gtk-rs/gir-files.git) 4 // DO NOT EDIT 5 6 use glib::object::Cast; 7 use glib::object::IsA; 8 use glib::object::ObjectType as ObjectType_; 9 use glib::signal::connect_raw; 10 use glib::signal::SignalHandlerId; 11 use glib::translate::*; 12 use glib::StaticType; 13 use glib::ToValue; 14 use std::boxed::Box as Box_; 15 use std::fmt; 16 use std::mem::transmute; 17 18 glib::wrapper! { 19 #[doc(alias = "HdyAvatar")] 20 pub struct Avatar(Object<ffi::HdyAvatar, ffi::HdyAvatarClass>) @extends gtk::DrawingArea, gtk::Widget, @implements gtk::Buildable; 21 22 match fn { 23 type_ => || ffi::hdy_avatar_get_type(), 24 } 25 } 26 27 impl Avatar { 28 #[doc(alias = "hdy_avatar_new")] new(size: i32, text: Option<&str>, show_initials: bool) -> Avatar29 pub fn new(size: i32, text: Option<&str>, show_initials: bool) -> Avatar { 30 assert_initialized_main_thread!(); 31 unsafe { 32 gtk::Widget::from_glib_none(ffi::hdy_avatar_new( 33 size, 34 text.to_glib_none().0, 35 show_initials.into_glib(), 36 )) 37 .unsafe_cast() 38 } 39 } 40 41 // rustdoc-stripper-ignore-next 42 /// Creates a new builder-pattern struct instance to construct [`Avatar`] objects. 43 /// 44 /// This method returns an instance of [`AvatarBuilder`] which can be used to create [`Avatar`] objects. builder() -> AvatarBuilder45 pub fn builder() -> AvatarBuilder { 46 AvatarBuilder::default() 47 } 48 49 #[cfg(any(feature = "v1_2", feature = "dox"))] 50 #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] 51 #[doc(alias = "hdy_avatar_draw_to_pixbuf")] draw_to_pixbuf(&self, size: i32, scale_factor: i32) -> Option<gdk_pixbuf::Pixbuf>52 pub fn draw_to_pixbuf(&self, size: i32, scale_factor: i32) -> Option<gdk_pixbuf::Pixbuf> { 53 unsafe { 54 from_glib_full(ffi::hdy_avatar_draw_to_pixbuf( 55 self.to_glib_none().0, 56 size, 57 scale_factor, 58 )) 59 } 60 } 61 62 #[doc(alias = "hdy_avatar_get_icon_name")] 63 #[doc(alias = "get_icon_name")] icon_name(&self) -> Option<glib::GString>64 pub fn icon_name(&self) -> Option<glib::GString> { 65 unsafe { from_glib_none(ffi::hdy_avatar_get_icon_name(self.to_glib_none().0)) } 66 } 67 68 #[cfg(any(feature = "v1_2", feature = "dox"))] 69 #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] 70 #[doc(alias = "hdy_avatar_get_loadable_icon")] 71 #[doc(alias = "get_loadable_icon")] loadable_icon(&self) -> Option<gio::LoadableIcon>72 pub fn loadable_icon(&self) -> Option<gio::LoadableIcon> { 73 unsafe { from_glib_none(ffi::hdy_avatar_get_loadable_icon(self.to_glib_none().0)) } 74 } 75 76 #[doc(alias = "hdy_avatar_get_show_initials")] 77 #[doc(alias = "get_show_initials")] shows_initials(&self) -> bool78 pub fn shows_initials(&self) -> bool { 79 unsafe { from_glib(ffi::hdy_avatar_get_show_initials(self.to_glib_none().0)) } 80 } 81 82 #[doc(alias = "hdy_avatar_get_size")] 83 #[doc(alias = "get_size")] size(&self) -> i3284 pub fn size(&self) -> i32 { 85 unsafe { ffi::hdy_avatar_get_size(self.to_glib_none().0) } 86 } 87 88 #[doc(alias = "hdy_avatar_get_text")] 89 #[doc(alias = "get_text")] text(&self) -> Option<glib::GString>90 pub fn text(&self) -> Option<glib::GString> { 91 unsafe { from_glib_none(ffi::hdy_avatar_get_text(self.to_glib_none().0)) } 92 } 93 94 #[doc(alias = "hdy_avatar_set_icon_name")] set_icon_name(&self, icon_name: Option<&str>)95 pub fn set_icon_name(&self, icon_name: Option<&str>) { 96 unsafe { 97 ffi::hdy_avatar_set_icon_name(self.to_glib_none().0, icon_name.to_glib_none().0); 98 } 99 } 100 101 #[cfg_attr(feature = "v1_2", deprecated = "Since 1.2")] 102 #[doc(alias = "hdy_avatar_set_image_load_func")] set_image_load_func( &self, load_image: Option<Box_<dyn Fn(i32) -> Option<gdk_pixbuf::Pixbuf> + 'static>>, )103 pub fn set_image_load_func( 104 &self, 105 load_image: Option<Box_<dyn Fn(i32) -> Option<gdk_pixbuf::Pixbuf> + 'static>>, 106 ) { 107 let load_image_data: Box_< 108 Option<Box_<dyn Fn(i32) -> Option<gdk_pixbuf::Pixbuf> + 'static>>, 109 > = Box_::new(load_image); 110 unsafe extern "C" fn load_image_func( 111 size: libc::c_int, 112 user_data: glib::ffi::gpointer, 113 ) -> *mut gdk_pixbuf::ffi::GdkPixbuf { 114 let callback: &Option<Box_<dyn Fn(i32) -> Option<gdk_pixbuf::Pixbuf> + 'static>> = 115 &*(user_data as *mut _); 116 let res = if let Some(ref callback) = *callback { 117 callback(size) 118 } else { 119 panic!("cannot get closure...") 120 }; 121 res.to_glib_full() 122 } 123 let load_image = if load_image_data.is_some() { 124 Some(load_image_func as _) 125 } else { 126 None 127 }; 128 unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) { 129 let _callback: Box_<Option<Box_<dyn Fn(i32) -> Option<gdk_pixbuf::Pixbuf> + 'static>>> = 130 Box_::from_raw(data as *mut _); 131 } 132 let destroy_call3 = Some(destroy_func as _); 133 let super_callback0: Box_< 134 Option<Box_<dyn Fn(i32) -> Option<gdk_pixbuf::Pixbuf> + 'static>>, 135 > = load_image_data; 136 unsafe { 137 ffi::hdy_avatar_set_image_load_func( 138 self.to_glib_none().0, 139 load_image, 140 Box_::into_raw(super_callback0) as *mut _, 141 destroy_call3, 142 ); 143 } 144 } 145 146 #[cfg(any(feature = "v1_2", feature = "dox"))] 147 #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] 148 #[doc(alias = "hdy_avatar_set_loadable_icon")] set_loadable_icon<P: IsA<gio::LoadableIcon>>(&self, icon: Option<&P>)149 pub fn set_loadable_icon<P: IsA<gio::LoadableIcon>>(&self, icon: Option<&P>) { 150 unsafe { 151 ffi::hdy_avatar_set_loadable_icon( 152 self.to_glib_none().0, 153 icon.map(|p| p.as_ref()).to_glib_none().0, 154 ); 155 } 156 } 157 158 #[doc(alias = "hdy_avatar_set_show_initials")] set_show_initials(&self, show_initials: bool)159 pub fn set_show_initials(&self, show_initials: bool) { 160 unsafe { 161 ffi::hdy_avatar_set_show_initials(self.to_glib_none().0, show_initials.into_glib()); 162 } 163 } 164 165 #[doc(alias = "hdy_avatar_set_size")] set_size(&self, size: i32)166 pub fn set_size(&self, size: i32) { 167 unsafe { 168 ffi::hdy_avatar_set_size(self.to_glib_none().0, size); 169 } 170 } 171 172 #[doc(alias = "hdy_avatar_set_text")] set_text(&self, text: Option<&str>)173 pub fn set_text(&self, text: Option<&str>) { 174 unsafe { 175 ffi::hdy_avatar_set_text(self.to_glib_none().0, text.to_glib_none().0); 176 } 177 } 178 179 #[doc(alias = "icon-name")] connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId180 pub fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 181 unsafe extern "C" fn notify_icon_name_trampoline<F: Fn(&Avatar) + 'static>( 182 this: *mut ffi::HdyAvatar, 183 _param_spec: glib::ffi::gpointer, 184 f: glib::ffi::gpointer, 185 ) { 186 let f: &F = &*(f as *const F); 187 f(&from_glib_borrow(this)) 188 } 189 unsafe { 190 let f: Box_<F> = Box_::new(f); 191 connect_raw( 192 self.as_ptr() as *mut _, 193 b"notify::icon-name\0".as_ptr() as *const _, 194 Some(transmute::<_, unsafe extern "C" fn()>( 195 notify_icon_name_trampoline::<F> as *const (), 196 )), 197 Box_::into_raw(f), 198 ) 199 } 200 } 201 202 #[cfg(any(feature = "v1_2", feature = "dox"))] 203 #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] 204 #[doc(alias = "loadable-icon")] connect_loadable_icon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId205 pub fn connect_loadable_icon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 206 unsafe extern "C" fn notify_loadable_icon_trampoline<F: Fn(&Avatar) + 'static>( 207 this: *mut ffi::HdyAvatar, 208 _param_spec: glib::ffi::gpointer, 209 f: glib::ffi::gpointer, 210 ) { 211 let f: &F = &*(f as *const F); 212 f(&from_glib_borrow(this)) 213 } 214 unsafe { 215 let f: Box_<F> = Box_::new(f); 216 connect_raw( 217 self.as_ptr() as *mut _, 218 b"notify::loadable-icon\0".as_ptr() as *const _, 219 Some(transmute::<_, unsafe extern "C" fn()>( 220 notify_loadable_icon_trampoline::<F> as *const (), 221 )), 222 Box_::into_raw(f), 223 ) 224 } 225 } 226 227 #[doc(alias = "show-initials")] connect_show_initials_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId228 pub fn connect_show_initials_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 229 unsafe extern "C" fn notify_show_initials_trampoline<F: Fn(&Avatar) + 'static>( 230 this: *mut ffi::HdyAvatar, 231 _param_spec: glib::ffi::gpointer, 232 f: glib::ffi::gpointer, 233 ) { 234 let f: &F = &*(f as *const F); 235 f(&from_glib_borrow(this)) 236 } 237 unsafe { 238 let f: Box_<F> = Box_::new(f); 239 connect_raw( 240 self.as_ptr() as *mut _, 241 b"notify::show-initials\0".as_ptr() as *const _, 242 Some(transmute::<_, unsafe extern "C" fn()>( 243 notify_show_initials_trampoline::<F> as *const (), 244 )), 245 Box_::into_raw(f), 246 ) 247 } 248 } 249 250 #[doc(alias = "size")] connect_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId251 pub fn connect_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 252 unsafe extern "C" fn notify_size_trampoline<F: Fn(&Avatar) + 'static>( 253 this: *mut ffi::HdyAvatar, 254 _param_spec: glib::ffi::gpointer, 255 f: glib::ffi::gpointer, 256 ) { 257 let f: &F = &*(f as *const F); 258 f(&from_glib_borrow(this)) 259 } 260 unsafe { 261 let f: Box_<F> = Box_::new(f); 262 connect_raw( 263 self.as_ptr() as *mut _, 264 b"notify::size\0".as_ptr() as *const _, 265 Some(transmute::<_, unsafe extern "C" fn()>( 266 notify_size_trampoline::<F> as *const (), 267 )), 268 Box_::into_raw(f), 269 ) 270 } 271 } 272 273 #[doc(alias = "text")] connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId274 pub fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 275 unsafe extern "C" fn notify_text_trampoline<F: Fn(&Avatar) + 'static>( 276 this: *mut ffi::HdyAvatar, 277 _param_spec: glib::ffi::gpointer, 278 f: glib::ffi::gpointer, 279 ) { 280 let f: &F = &*(f as *const F); 281 f(&from_glib_borrow(this)) 282 } 283 unsafe { 284 let f: Box_<F> = Box_::new(f); 285 connect_raw( 286 self.as_ptr() as *mut _, 287 b"notify::text\0".as_ptr() as *const _, 288 Some(transmute::<_, unsafe extern "C" fn()>( 289 notify_text_trampoline::<F> as *const (), 290 )), 291 Box_::into_raw(f), 292 ) 293 } 294 } 295 } 296 297 #[derive(Clone, Default)] 298 // rustdoc-stripper-ignore-next 299 /// A [builder-pattern] type to construct [`Avatar`] objects. 300 /// 301 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 302 pub struct AvatarBuilder { 303 icon_name: Option<String>, 304 #[cfg(any(feature = "v1_2", feature = "dox"))] 305 #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] 306 loadable_icon: Option<gio::LoadableIcon>, 307 show_initials: Option<bool>, 308 size: Option<i32>, 309 text: Option<String>, 310 app_paintable: Option<bool>, 311 can_default: Option<bool>, 312 can_focus: Option<bool>, 313 double_buffered: Option<bool>, 314 events: Option<gdk::EventMask>, 315 expand: Option<bool>, 316 focus_on_click: Option<bool>, 317 halign: Option<gtk::Align>, 318 has_default: Option<bool>, 319 has_focus: Option<bool>, 320 has_tooltip: Option<bool>, 321 height_request: Option<i32>, 322 hexpand: Option<bool>, 323 hexpand_set: Option<bool>, 324 is_focus: Option<bool>, 325 margin: Option<i32>, 326 margin_bottom: Option<i32>, 327 margin_end: Option<i32>, 328 margin_left: Option<i32>, 329 margin_right: Option<i32>, 330 margin_start: Option<i32>, 331 margin_top: Option<i32>, 332 name: Option<String>, 333 no_show_all: Option<bool>, 334 opacity: Option<f64>, 335 parent: Option<gtk::Container>, 336 receives_default: Option<bool>, 337 sensitive: Option<bool>, 338 //style: /*Unknown type*/, 339 tooltip_markup: Option<String>, 340 tooltip_text: Option<String>, 341 valign: Option<gtk::Align>, 342 vexpand: Option<bool>, 343 vexpand_set: Option<bool>, 344 visible: Option<bool>, 345 width_request: Option<i32>, 346 } 347 348 impl AvatarBuilder { 349 // rustdoc-stripper-ignore-next 350 /// Create a new [`AvatarBuilder`]. new() -> Self351 pub fn new() -> Self { 352 Self::default() 353 } 354 355 // rustdoc-stripper-ignore-next 356 /// Build the [`Avatar`]. build(self) -> Avatar357 pub fn build(self) -> Avatar { 358 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 359 if let Some(ref icon_name) = self.icon_name { 360 properties.push(("icon-name", icon_name)); 361 } 362 #[cfg(any(feature = "v1_2", feature = "dox"))] 363 if let Some(ref loadable_icon) = self.loadable_icon { 364 properties.push(("loadable-icon", loadable_icon)); 365 } 366 if let Some(ref show_initials) = self.show_initials { 367 properties.push(("show-initials", show_initials)); 368 } 369 if let Some(ref size) = self.size { 370 properties.push(("size", size)); 371 } 372 if let Some(ref text) = self.text { 373 properties.push(("text", text)); 374 } 375 if let Some(ref app_paintable) = self.app_paintable { 376 properties.push(("app-paintable", app_paintable)); 377 } 378 if let Some(ref can_default) = self.can_default { 379 properties.push(("can-default", can_default)); 380 } 381 if let Some(ref can_focus) = self.can_focus { 382 properties.push(("can-focus", can_focus)); 383 } 384 if let Some(ref double_buffered) = self.double_buffered { 385 properties.push(("double-buffered", double_buffered)); 386 } 387 if let Some(ref events) = self.events { 388 properties.push(("events", events)); 389 } 390 if let Some(ref expand) = self.expand { 391 properties.push(("expand", expand)); 392 } 393 if let Some(ref focus_on_click) = self.focus_on_click { 394 properties.push(("focus-on-click", focus_on_click)); 395 } 396 if let Some(ref halign) = self.halign { 397 properties.push(("halign", halign)); 398 } 399 if let Some(ref has_default) = self.has_default { 400 properties.push(("has-default", has_default)); 401 } 402 if let Some(ref has_focus) = self.has_focus { 403 properties.push(("has-focus", has_focus)); 404 } 405 if let Some(ref has_tooltip) = self.has_tooltip { 406 properties.push(("has-tooltip", has_tooltip)); 407 } 408 if let Some(ref height_request) = self.height_request { 409 properties.push(("height-request", height_request)); 410 } 411 if let Some(ref hexpand) = self.hexpand { 412 properties.push(("hexpand", hexpand)); 413 } 414 if let Some(ref hexpand_set) = self.hexpand_set { 415 properties.push(("hexpand-set", hexpand_set)); 416 } 417 if let Some(ref is_focus) = self.is_focus { 418 properties.push(("is-focus", is_focus)); 419 } 420 if let Some(ref margin) = self.margin { 421 properties.push(("margin", margin)); 422 } 423 if let Some(ref margin_bottom) = self.margin_bottom { 424 properties.push(("margin-bottom", margin_bottom)); 425 } 426 if let Some(ref margin_end) = self.margin_end { 427 properties.push(("margin-end", margin_end)); 428 } 429 if let Some(ref margin_left) = self.margin_left { 430 properties.push(("margin-left", margin_left)); 431 } 432 if let Some(ref margin_right) = self.margin_right { 433 properties.push(("margin-right", margin_right)); 434 } 435 if let Some(ref margin_start) = self.margin_start { 436 properties.push(("margin-start", margin_start)); 437 } 438 if let Some(ref margin_top) = self.margin_top { 439 properties.push(("margin-top", margin_top)); 440 } 441 if let Some(ref name) = self.name { 442 properties.push(("name", name)); 443 } 444 if let Some(ref no_show_all) = self.no_show_all { 445 properties.push(("no-show-all", no_show_all)); 446 } 447 if let Some(ref opacity) = self.opacity { 448 properties.push(("opacity", opacity)); 449 } 450 if let Some(ref parent) = self.parent { 451 properties.push(("parent", parent)); 452 } 453 if let Some(ref receives_default) = self.receives_default { 454 properties.push(("receives-default", receives_default)); 455 } 456 if let Some(ref sensitive) = self.sensitive { 457 properties.push(("sensitive", sensitive)); 458 } 459 if let Some(ref tooltip_markup) = self.tooltip_markup { 460 properties.push(("tooltip-markup", tooltip_markup)); 461 } 462 if let Some(ref tooltip_text) = self.tooltip_text { 463 properties.push(("tooltip-text", tooltip_text)); 464 } 465 if let Some(ref valign) = self.valign { 466 properties.push(("valign", valign)); 467 } 468 if let Some(ref vexpand) = self.vexpand { 469 properties.push(("vexpand", vexpand)); 470 } 471 if let Some(ref vexpand_set) = self.vexpand_set { 472 properties.push(("vexpand-set", vexpand_set)); 473 } 474 if let Some(ref visible) = self.visible { 475 properties.push(("visible", visible)); 476 } 477 if let Some(ref width_request) = self.width_request { 478 properties.push(("width-request", width_request)); 479 } 480 glib::Object::new::<Avatar>(&properties).expect("Failed to create an instance of Avatar") 481 } 482 icon_name(mut self, icon_name: &str) -> Self483 pub fn icon_name(mut self, icon_name: &str) -> Self { 484 self.icon_name = Some(icon_name.to_string()); 485 self 486 } 487 488 #[cfg(any(feature = "v1_2", feature = "dox"))] 489 #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] loadable_icon<P: IsA<gio::LoadableIcon>>(mut self, loadable_icon: &P) -> Self490 pub fn loadable_icon<P: IsA<gio::LoadableIcon>>(mut self, loadable_icon: &P) -> Self { 491 self.loadable_icon = Some(loadable_icon.clone().upcast()); 492 self 493 } 494 show_initials(mut self, show_initials: bool) -> Self495 pub fn show_initials(mut self, show_initials: bool) -> Self { 496 self.show_initials = Some(show_initials); 497 self 498 } 499 size(mut self, size: i32) -> Self500 pub fn size(mut self, size: i32) -> Self { 501 self.size = Some(size); 502 self 503 } 504 text(mut self, text: &str) -> Self505 pub fn text(mut self, text: &str) -> Self { 506 self.text = Some(text.to_string()); 507 self 508 } 509 app_paintable(mut self, app_paintable: bool) -> Self510 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 511 self.app_paintable = Some(app_paintable); 512 self 513 } 514 can_default(mut self, can_default: bool) -> Self515 pub fn can_default(mut self, can_default: bool) -> Self { 516 self.can_default = Some(can_default); 517 self 518 } 519 can_focus(mut self, can_focus: bool) -> Self520 pub fn can_focus(mut self, can_focus: bool) -> Self { 521 self.can_focus = Some(can_focus); 522 self 523 } 524 double_buffered(mut self, double_buffered: bool) -> Self525 pub fn double_buffered(mut self, double_buffered: bool) -> Self { 526 self.double_buffered = Some(double_buffered); 527 self 528 } 529 events(mut self, events: gdk::EventMask) -> Self530 pub fn events(mut self, events: gdk::EventMask) -> Self { 531 self.events = Some(events); 532 self 533 } 534 expand(mut self, expand: bool) -> Self535 pub fn expand(mut self, expand: bool) -> Self { 536 self.expand = Some(expand); 537 self 538 } 539 focus_on_click(mut self, focus_on_click: bool) -> Self540 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 541 self.focus_on_click = Some(focus_on_click); 542 self 543 } 544 halign(mut self, halign: gtk::Align) -> Self545 pub fn halign(mut self, halign: gtk::Align) -> Self { 546 self.halign = Some(halign); 547 self 548 } 549 has_default(mut self, has_default: bool) -> Self550 pub fn has_default(mut self, has_default: bool) -> Self { 551 self.has_default = Some(has_default); 552 self 553 } 554 has_focus(mut self, has_focus: bool) -> Self555 pub fn has_focus(mut self, has_focus: bool) -> Self { 556 self.has_focus = Some(has_focus); 557 self 558 } 559 has_tooltip(mut self, has_tooltip: bool) -> Self560 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 561 self.has_tooltip = Some(has_tooltip); 562 self 563 } 564 height_request(mut self, height_request: i32) -> Self565 pub fn height_request(mut self, height_request: i32) -> Self { 566 self.height_request = Some(height_request); 567 self 568 } 569 hexpand(mut self, hexpand: bool) -> Self570 pub fn hexpand(mut self, hexpand: bool) -> Self { 571 self.hexpand = Some(hexpand); 572 self 573 } 574 hexpand_set(mut self, hexpand_set: bool) -> Self575 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 576 self.hexpand_set = Some(hexpand_set); 577 self 578 } 579 is_focus(mut self, is_focus: bool) -> Self580 pub fn is_focus(mut self, is_focus: bool) -> Self { 581 self.is_focus = Some(is_focus); 582 self 583 } 584 margin(mut self, margin: i32) -> Self585 pub fn margin(mut self, margin: i32) -> Self { 586 self.margin = Some(margin); 587 self 588 } 589 margin_bottom(mut self, margin_bottom: i32) -> Self590 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 591 self.margin_bottom = Some(margin_bottom); 592 self 593 } 594 margin_end(mut self, margin_end: i32) -> Self595 pub fn margin_end(mut self, margin_end: i32) -> Self { 596 self.margin_end = Some(margin_end); 597 self 598 } 599 margin_left(mut self, margin_left: i32) -> Self600 pub fn margin_left(mut self, margin_left: i32) -> Self { 601 self.margin_left = Some(margin_left); 602 self 603 } 604 margin_right(mut self, margin_right: i32) -> Self605 pub fn margin_right(mut self, margin_right: i32) -> Self { 606 self.margin_right = Some(margin_right); 607 self 608 } 609 margin_start(mut self, margin_start: i32) -> Self610 pub fn margin_start(mut self, margin_start: i32) -> Self { 611 self.margin_start = Some(margin_start); 612 self 613 } 614 margin_top(mut self, margin_top: i32) -> Self615 pub fn margin_top(mut self, margin_top: i32) -> Self { 616 self.margin_top = Some(margin_top); 617 self 618 } 619 name(mut self, name: &str) -> Self620 pub fn name(mut self, name: &str) -> Self { 621 self.name = Some(name.to_string()); 622 self 623 } 624 no_show_all(mut self, no_show_all: bool) -> Self625 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 626 self.no_show_all = Some(no_show_all); 627 self 628 } 629 opacity(mut self, opacity: f64) -> Self630 pub fn opacity(mut self, opacity: f64) -> Self { 631 self.opacity = Some(opacity); 632 self 633 } 634 parent<P: IsA<gtk::Container>>(mut self, parent: &P) -> Self635 pub fn parent<P: IsA<gtk::Container>>(mut self, parent: &P) -> Self { 636 self.parent = Some(parent.clone().upcast()); 637 self 638 } 639 receives_default(mut self, receives_default: bool) -> Self640 pub fn receives_default(mut self, receives_default: bool) -> Self { 641 self.receives_default = Some(receives_default); 642 self 643 } 644 sensitive(mut self, sensitive: bool) -> Self645 pub fn sensitive(mut self, sensitive: bool) -> Self { 646 self.sensitive = Some(sensitive); 647 self 648 } 649 tooltip_markup(mut self, tooltip_markup: &str) -> Self650 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 651 self.tooltip_markup = Some(tooltip_markup.to_string()); 652 self 653 } 654 tooltip_text(mut self, tooltip_text: &str) -> Self655 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 656 self.tooltip_text = Some(tooltip_text.to_string()); 657 self 658 } 659 valign(mut self, valign: gtk::Align) -> Self660 pub fn valign(mut self, valign: gtk::Align) -> Self { 661 self.valign = Some(valign); 662 self 663 } 664 vexpand(mut self, vexpand: bool) -> Self665 pub fn vexpand(mut self, vexpand: bool) -> Self { 666 self.vexpand = Some(vexpand); 667 self 668 } 669 vexpand_set(mut self, vexpand_set: bool) -> Self670 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 671 self.vexpand_set = Some(vexpand_set); 672 self 673 } 674 visible(mut self, visible: bool) -> Self675 pub fn visible(mut self, visible: bool) -> Self { 676 self.visible = Some(visible); 677 self 678 } 679 width_request(mut self, width_request: i32) -> Self680 pub fn width_request(mut self, width_request: i32) -> Self { 681 self.width_request = Some(width_request); 682 self 683 } 684 } 685 686 impl fmt::Display for Avatar { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result687 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 688 f.write_str("Avatar") 689 } 690 } 691