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::Actionable; 6 use crate::Align; 7 use crate::Bin; 8 use crate::Buildable; 9 use crate::Button; 10 use crate::ButtonRole; 11 use crate::Container; 12 use crate::PositionType; 13 use crate::ReliefStyle; 14 use crate::ResizeMode; 15 use crate::Widget; 16 use glib::object::Cast; 17 use glib::object::IsA; 18 use glib::object::ObjectType as ObjectType_; 19 use glib::signal::connect_raw; 20 use glib::signal::SignalHandlerId; 21 use glib::translate::*; 22 use glib::StaticType; 23 use glib::ToValue; 24 use std::boxed::Box as Box_; 25 use std::fmt; 26 use std::mem::transmute; 27 28 glib::wrapper! { 29 #[doc(alias = "GtkModelButton")] 30 pub struct ModelButton(Object<ffi::GtkModelButton>) @extends Button, Bin, Container, Widget, @implements Buildable, Actionable; 31 32 match fn { 33 type_ => || ffi::gtk_model_button_get_type(), 34 } 35 } 36 37 impl ModelButton { 38 #[doc(alias = "gtk_model_button_new")] new() -> ModelButton39 pub fn new() -> ModelButton { 40 assert_initialized_main_thread!(); 41 unsafe { Widget::from_glib_none(ffi::gtk_model_button_new()).unsafe_cast() } 42 } 43 44 // rustdoc-stripper-ignore-next 45 /// Creates a new builder-pattern struct instance to construct [`ModelButton`] objects. 46 /// 47 /// This method returns an instance of [`ModelButtonBuilder`] which can be used to create [`ModelButton`] objects. builder() -> ModelButtonBuilder48 pub fn builder() -> ModelButtonBuilder { 49 ModelButtonBuilder::default() 50 } 51 is_active(&self) -> bool52 pub fn is_active(&self) -> bool { 53 unsafe { 54 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 55 glib::gobject_ffi::g_object_get_property( 56 self.as_ptr() as *mut glib::gobject_ffi::GObject, 57 b"active\0".as_ptr() as *const _, 58 value.to_glib_none_mut().0, 59 ); 60 value 61 .get() 62 .expect("Return Value for property `active` getter") 63 } 64 } 65 set_active(&self, active: bool)66 pub fn set_active(&self, active: bool) { 67 unsafe { 68 glib::gobject_ffi::g_object_set_property( 69 self.as_ptr() as *mut glib::gobject_ffi::GObject, 70 b"active\0".as_ptr() as *const _, 71 active.to_value().to_glib_none().0, 72 ); 73 } 74 } 75 is_centered(&self) -> bool76 pub fn is_centered(&self) -> bool { 77 unsafe { 78 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 79 glib::gobject_ffi::g_object_get_property( 80 self.as_ptr() as *mut glib::gobject_ffi::GObject, 81 b"centered\0".as_ptr() as *const _, 82 value.to_glib_none_mut().0, 83 ); 84 value 85 .get() 86 .expect("Return Value for property `centered` getter") 87 } 88 } 89 set_centered(&self, centered: bool)90 pub fn set_centered(&self, centered: bool) { 91 unsafe { 92 glib::gobject_ffi::g_object_set_property( 93 self.as_ptr() as *mut glib::gobject_ffi::GObject, 94 b"centered\0".as_ptr() as *const _, 95 centered.to_value().to_glib_none().0, 96 ); 97 } 98 } 99 icon(&self) -> Option<gio::Icon>100 pub fn icon(&self) -> Option<gio::Icon> { 101 unsafe { 102 let mut value = glib::Value::from_type(<gio::Icon as StaticType>::static_type()); 103 glib::gobject_ffi::g_object_get_property( 104 self.as_ptr() as *mut glib::gobject_ffi::GObject, 105 b"icon\0".as_ptr() as *const _, 106 value.to_glib_none_mut().0, 107 ); 108 value 109 .get() 110 .expect("Return Value for property `icon` getter") 111 } 112 } 113 set_icon<P: IsA<gio::Icon>>(&self, icon: Option<&P>)114 pub fn set_icon<P: IsA<gio::Icon>>(&self, icon: Option<&P>) { 115 unsafe { 116 glib::gobject_ffi::g_object_set_property( 117 self.as_ptr() as *mut glib::gobject_ffi::GObject, 118 b"icon\0".as_ptr() as *const _, 119 icon.to_value().to_glib_none().0, 120 ); 121 } 122 } 123 is_iconic(&self) -> bool124 pub fn is_iconic(&self) -> bool { 125 unsafe { 126 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 127 glib::gobject_ffi::g_object_get_property( 128 self.as_ptr() as *mut glib::gobject_ffi::GObject, 129 b"iconic\0".as_ptr() as *const _, 130 value.to_glib_none_mut().0, 131 ); 132 value 133 .get() 134 .expect("Return Value for property `iconic` getter") 135 } 136 } 137 set_iconic(&self, iconic: bool)138 pub fn set_iconic(&self, iconic: bool) { 139 unsafe { 140 glib::gobject_ffi::g_object_set_property( 141 self.as_ptr() as *mut glib::gobject_ffi::GObject, 142 b"iconic\0".as_ptr() as *const _, 143 iconic.to_value().to_glib_none().0, 144 ); 145 } 146 } 147 is_inverted(&self) -> bool148 pub fn is_inverted(&self) -> bool { 149 unsafe { 150 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 151 glib::gobject_ffi::g_object_get_property( 152 self.as_ptr() as *mut glib::gobject_ffi::GObject, 153 b"inverted\0".as_ptr() as *const _, 154 value.to_glib_none_mut().0, 155 ); 156 value 157 .get() 158 .expect("Return Value for property `inverted` getter") 159 } 160 } 161 set_inverted(&self, inverted: bool)162 pub fn set_inverted(&self, inverted: bool) { 163 unsafe { 164 glib::gobject_ffi::g_object_set_property( 165 self.as_ptr() as *mut glib::gobject_ffi::GObject, 166 b"inverted\0".as_ptr() as *const _, 167 inverted.to_value().to_glib_none().0, 168 ); 169 } 170 } 171 172 #[doc(alias = "menu-name")] menu_name(&self) -> Option<glib::GString>173 pub fn menu_name(&self) -> Option<glib::GString> { 174 unsafe { 175 let mut value = glib::Value::from_type(<glib::GString as StaticType>::static_type()); 176 glib::gobject_ffi::g_object_get_property( 177 self.as_ptr() as *mut glib::gobject_ffi::GObject, 178 b"menu-name\0".as_ptr() as *const _, 179 value.to_glib_none_mut().0, 180 ); 181 value 182 .get() 183 .expect("Return Value for property `menu-name` getter") 184 } 185 } 186 187 #[doc(alias = "menu-name")] set_menu_name(&self, menu_name: Option<&str>)188 pub fn set_menu_name(&self, menu_name: Option<&str>) { 189 unsafe { 190 glib::gobject_ffi::g_object_set_property( 191 self.as_ptr() as *mut glib::gobject_ffi::GObject, 192 b"menu-name\0".as_ptr() as *const _, 193 menu_name.to_value().to_glib_none().0, 194 ); 195 } 196 } 197 role(&self) -> ButtonRole198 pub fn role(&self) -> ButtonRole { 199 unsafe { 200 let mut value = glib::Value::from_type(<ButtonRole as StaticType>::static_type()); 201 glib::gobject_ffi::g_object_get_property( 202 self.as_ptr() as *mut glib::gobject_ffi::GObject, 203 b"role\0".as_ptr() as *const _, 204 value.to_glib_none_mut().0, 205 ); 206 value 207 .get() 208 .expect("Return Value for property `role` getter") 209 } 210 } 211 set_role(&self, role: ButtonRole)212 pub fn set_role(&self, role: ButtonRole) { 213 unsafe { 214 glib::gobject_ffi::g_object_set_property( 215 self.as_ptr() as *mut glib::gobject_ffi::GObject, 216 b"role\0".as_ptr() as *const _, 217 role.to_value().to_glib_none().0, 218 ); 219 } 220 } 221 text(&self) -> Option<glib::GString>222 pub fn text(&self) -> Option<glib::GString> { 223 unsafe { 224 let mut value = glib::Value::from_type(<glib::GString as StaticType>::static_type()); 225 glib::gobject_ffi::g_object_get_property( 226 self.as_ptr() as *mut glib::gobject_ffi::GObject, 227 b"text\0".as_ptr() as *const _, 228 value.to_glib_none_mut().0, 229 ); 230 value 231 .get() 232 .expect("Return Value for property `text` getter") 233 } 234 } 235 set_text(&self, text: Option<&str>)236 pub fn set_text(&self, text: Option<&str>) { 237 unsafe { 238 glib::gobject_ffi::g_object_set_property( 239 self.as_ptr() as *mut glib::gobject_ffi::GObject, 240 b"text\0".as_ptr() as *const _, 241 text.to_value().to_glib_none().0, 242 ); 243 } 244 } 245 246 #[cfg(any(feature = "v3_24", feature = "dox"))] 247 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] 248 #[doc(alias = "use-markup")] uses_markup(&self) -> bool249 pub fn uses_markup(&self) -> bool { 250 unsafe { 251 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 252 glib::gobject_ffi::g_object_get_property( 253 self.as_ptr() as *mut glib::gobject_ffi::GObject, 254 b"use-markup\0".as_ptr() as *const _, 255 value.to_glib_none_mut().0, 256 ); 257 value 258 .get() 259 .expect("Return Value for property `use-markup` getter") 260 } 261 } 262 263 #[cfg(any(feature = "v3_24", feature = "dox"))] 264 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] 265 #[doc(alias = "use-markup")] set_use_markup(&self, use_markup: bool)266 pub fn set_use_markup(&self, use_markup: bool) { 267 unsafe { 268 glib::gobject_ffi::g_object_set_property( 269 self.as_ptr() as *mut glib::gobject_ffi::GObject, 270 b"use-markup\0".as_ptr() as *const _, 271 use_markup.to_value().to_glib_none().0, 272 ); 273 } 274 } 275 276 #[doc(alias = "active")] connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId277 pub fn connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 278 unsafe extern "C" fn notify_active_trampoline<F: Fn(&ModelButton) + 'static>( 279 this: *mut ffi::GtkModelButton, 280 _param_spec: glib::ffi::gpointer, 281 f: glib::ffi::gpointer, 282 ) { 283 let f: &F = &*(f as *const F); 284 f(&from_glib_borrow(this)) 285 } 286 unsafe { 287 let f: Box_<F> = Box_::new(f); 288 connect_raw( 289 self.as_ptr() as *mut _, 290 b"notify::active\0".as_ptr() as *const _, 291 Some(transmute::<_, unsafe extern "C" fn()>( 292 notify_active_trampoline::<F> as *const (), 293 )), 294 Box_::into_raw(f), 295 ) 296 } 297 } 298 299 #[doc(alias = "centered")] connect_centered_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId300 pub fn connect_centered_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 301 unsafe extern "C" fn notify_centered_trampoline<F: Fn(&ModelButton) + 'static>( 302 this: *mut ffi::GtkModelButton, 303 _param_spec: glib::ffi::gpointer, 304 f: glib::ffi::gpointer, 305 ) { 306 let f: &F = &*(f as *const F); 307 f(&from_glib_borrow(this)) 308 } 309 unsafe { 310 let f: Box_<F> = Box_::new(f); 311 connect_raw( 312 self.as_ptr() as *mut _, 313 b"notify::centered\0".as_ptr() as *const _, 314 Some(transmute::<_, unsafe extern "C" fn()>( 315 notify_centered_trampoline::<F> as *const (), 316 )), 317 Box_::into_raw(f), 318 ) 319 } 320 } 321 322 #[doc(alias = "icon")] connect_icon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId323 pub fn connect_icon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 324 unsafe extern "C" fn notify_icon_trampoline<F: Fn(&ModelButton) + 'static>( 325 this: *mut ffi::GtkModelButton, 326 _param_spec: glib::ffi::gpointer, 327 f: glib::ffi::gpointer, 328 ) { 329 let f: &F = &*(f as *const F); 330 f(&from_glib_borrow(this)) 331 } 332 unsafe { 333 let f: Box_<F> = Box_::new(f); 334 connect_raw( 335 self.as_ptr() as *mut _, 336 b"notify::icon\0".as_ptr() as *const _, 337 Some(transmute::<_, unsafe extern "C" fn()>( 338 notify_icon_trampoline::<F> as *const (), 339 )), 340 Box_::into_raw(f), 341 ) 342 } 343 } 344 345 #[doc(alias = "iconic")] connect_iconic_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId346 pub fn connect_iconic_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 347 unsafe extern "C" fn notify_iconic_trampoline<F: Fn(&ModelButton) + 'static>( 348 this: *mut ffi::GtkModelButton, 349 _param_spec: glib::ffi::gpointer, 350 f: glib::ffi::gpointer, 351 ) { 352 let f: &F = &*(f as *const F); 353 f(&from_glib_borrow(this)) 354 } 355 unsafe { 356 let f: Box_<F> = Box_::new(f); 357 connect_raw( 358 self.as_ptr() as *mut _, 359 b"notify::iconic\0".as_ptr() as *const _, 360 Some(transmute::<_, unsafe extern "C" fn()>( 361 notify_iconic_trampoline::<F> as *const (), 362 )), 363 Box_::into_raw(f), 364 ) 365 } 366 } 367 368 #[doc(alias = "inverted")] connect_inverted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId369 pub fn connect_inverted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 370 unsafe extern "C" fn notify_inverted_trampoline<F: Fn(&ModelButton) + 'static>( 371 this: *mut ffi::GtkModelButton, 372 _param_spec: glib::ffi::gpointer, 373 f: glib::ffi::gpointer, 374 ) { 375 let f: &F = &*(f as *const F); 376 f(&from_glib_borrow(this)) 377 } 378 unsafe { 379 let f: Box_<F> = Box_::new(f); 380 connect_raw( 381 self.as_ptr() as *mut _, 382 b"notify::inverted\0".as_ptr() as *const _, 383 Some(transmute::<_, unsafe extern "C" fn()>( 384 notify_inverted_trampoline::<F> as *const (), 385 )), 386 Box_::into_raw(f), 387 ) 388 } 389 } 390 391 #[doc(alias = "menu-name")] connect_menu_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId392 pub fn connect_menu_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 393 unsafe extern "C" fn notify_menu_name_trampoline<F: Fn(&ModelButton) + 'static>( 394 this: *mut ffi::GtkModelButton, 395 _param_spec: glib::ffi::gpointer, 396 f: glib::ffi::gpointer, 397 ) { 398 let f: &F = &*(f as *const F); 399 f(&from_glib_borrow(this)) 400 } 401 unsafe { 402 let f: Box_<F> = Box_::new(f); 403 connect_raw( 404 self.as_ptr() as *mut _, 405 b"notify::menu-name\0".as_ptr() as *const _, 406 Some(transmute::<_, unsafe extern "C" fn()>( 407 notify_menu_name_trampoline::<F> as *const (), 408 )), 409 Box_::into_raw(f), 410 ) 411 } 412 } 413 414 #[doc(alias = "role")] connect_role_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId415 pub fn connect_role_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 416 unsafe extern "C" fn notify_role_trampoline<F: Fn(&ModelButton) + 'static>( 417 this: *mut ffi::GtkModelButton, 418 _param_spec: glib::ffi::gpointer, 419 f: glib::ffi::gpointer, 420 ) { 421 let f: &F = &*(f as *const F); 422 f(&from_glib_borrow(this)) 423 } 424 unsafe { 425 let f: Box_<F> = Box_::new(f); 426 connect_raw( 427 self.as_ptr() as *mut _, 428 b"notify::role\0".as_ptr() as *const _, 429 Some(transmute::<_, unsafe extern "C" fn()>( 430 notify_role_trampoline::<F> as *const (), 431 )), 432 Box_::into_raw(f), 433 ) 434 } 435 } 436 437 #[doc(alias = "text")] connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId438 pub fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 439 unsafe extern "C" fn notify_text_trampoline<F: Fn(&ModelButton) + 'static>( 440 this: *mut ffi::GtkModelButton, 441 _param_spec: glib::ffi::gpointer, 442 f: glib::ffi::gpointer, 443 ) { 444 let f: &F = &*(f as *const F); 445 f(&from_glib_borrow(this)) 446 } 447 unsafe { 448 let f: Box_<F> = Box_::new(f); 449 connect_raw( 450 self.as_ptr() as *mut _, 451 b"notify::text\0".as_ptr() as *const _, 452 Some(transmute::<_, unsafe extern "C" fn()>( 453 notify_text_trampoline::<F> as *const (), 454 )), 455 Box_::into_raw(f), 456 ) 457 } 458 } 459 460 #[cfg(any(feature = "v3_24", feature = "dox"))] 461 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] 462 #[doc(alias = "use-markup")] connect_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId463 pub fn connect_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 464 unsafe extern "C" fn notify_use_markup_trampoline<F: Fn(&ModelButton) + 'static>( 465 this: *mut ffi::GtkModelButton, 466 _param_spec: glib::ffi::gpointer, 467 f: glib::ffi::gpointer, 468 ) { 469 let f: &F = &*(f as *const F); 470 f(&from_glib_borrow(this)) 471 } 472 unsafe { 473 let f: Box_<F> = Box_::new(f); 474 connect_raw( 475 self.as_ptr() as *mut _, 476 b"notify::use-markup\0".as_ptr() as *const _, 477 Some(transmute::<_, unsafe extern "C" fn()>( 478 notify_use_markup_trampoline::<F> as *const (), 479 )), 480 Box_::into_raw(f), 481 ) 482 } 483 } 484 } 485 486 impl Default for ModelButton { default() -> Self487 fn default() -> Self { 488 Self::new() 489 } 490 } 491 492 #[derive(Clone, Default)] 493 // rustdoc-stripper-ignore-next 494 /// A [builder-pattern] type to construct [`ModelButton`] objects. 495 /// 496 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 497 pub struct ModelButtonBuilder { 498 active: Option<bool>, 499 centered: Option<bool>, 500 icon: Option<gio::Icon>, 501 iconic: Option<bool>, 502 inverted: Option<bool>, 503 menu_name: Option<String>, 504 role: Option<ButtonRole>, 505 text: Option<String>, 506 #[cfg(any(feature = "v3_24", feature = "dox"))] 507 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] 508 use_markup: Option<bool>, 509 always_show_image: Option<bool>, 510 image: Option<Widget>, 511 image_position: Option<PositionType>, 512 label: Option<String>, 513 relief: Option<ReliefStyle>, 514 use_underline: Option<bool>, 515 border_width: Option<u32>, 516 child: Option<Widget>, 517 resize_mode: Option<ResizeMode>, 518 app_paintable: Option<bool>, 519 can_default: Option<bool>, 520 can_focus: Option<bool>, 521 events: Option<gdk::EventMask>, 522 expand: Option<bool>, 523 #[cfg(any(feature = "v3_20", feature = "dox"))] 524 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 525 focus_on_click: Option<bool>, 526 halign: Option<Align>, 527 has_default: Option<bool>, 528 has_focus: Option<bool>, 529 has_tooltip: Option<bool>, 530 height_request: Option<i32>, 531 hexpand: Option<bool>, 532 hexpand_set: Option<bool>, 533 is_focus: Option<bool>, 534 margin: Option<i32>, 535 margin_bottom: Option<i32>, 536 margin_end: Option<i32>, 537 margin_start: Option<i32>, 538 margin_top: Option<i32>, 539 name: Option<String>, 540 no_show_all: Option<bool>, 541 opacity: Option<f64>, 542 parent: Option<Container>, 543 receives_default: Option<bool>, 544 sensitive: Option<bool>, 545 tooltip_markup: Option<String>, 546 tooltip_text: Option<String>, 547 valign: Option<Align>, 548 vexpand: Option<bool>, 549 vexpand_set: Option<bool>, 550 visible: Option<bool>, 551 width_request: Option<i32>, 552 action_name: Option<String>, 553 action_target: Option<glib::Variant>, 554 } 555 556 impl ModelButtonBuilder { 557 // rustdoc-stripper-ignore-next 558 /// Create a new [`ModelButtonBuilder`]. new() -> Self559 pub fn new() -> Self { 560 Self::default() 561 } 562 563 // rustdoc-stripper-ignore-next 564 /// Build the [`ModelButton`]. build(self) -> ModelButton565 pub fn build(self) -> ModelButton { 566 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 567 if let Some(ref active) = self.active { 568 properties.push(("active", active)); 569 } 570 if let Some(ref centered) = self.centered { 571 properties.push(("centered", centered)); 572 } 573 if let Some(ref icon) = self.icon { 574 properties.push(("icon", icon)); 575 } 576 if let Some(ref iconic) = self.iconic { 577 properties.push(("iconic", iconic)); 578 } 579 if let Some(ref inverted) = self.inverted { 580 properties.push(("inverted", inverted)); 581 } 582 if let Some(ref menu_name) = self.menu_name { 583 properties.push(("menu-name", menu_name)); 584 } 585 if let Some(ref role) = self.role { 586 properties.push(("role", role)); 587 } 588 if let Some(ref text) = self.text { 589 properties.push(("text", text)); 590 } 591 #[cfg(any(feature = "v3_24", feature = "dox"))] 592 if let Some(ref use_markup) = self.use_markup { 593 properties.push(("use-markup", use_markup)); 594 } 595 if let Some(ref always_show_image) = self.always_show_image { 596 properties.push(("always-show-image", always_show_image)); 597 } 598 if let Some(ref image) = self.image { 599 properties.push(("image", image)); 600 } 601 if let Some(ref image_position) = self.image_position { 602 properties.push(("image-position", image_position)); 603 } 604 if let Some(ref label) = self.label { 605 properties.push(("label", label)); 606 } 607 if let Some(ref relief) = self.relief { 608 properties.push(("relief", relief)); 609 } 610 if let Some(ref use_underline) = self.use_underline { 611 properties.push(("use-underline", use_underline)); 612 } 613 if let Some(ref border_width) = self.border_width { 614 properties.push(("border-width", border_width)); 615 } 616 if let Some(ref child) = self.child { 617 properties.push(("child", child)); 618 } 619 if let Some(ref resize_mode) = self.resize_mode { 620 properties.push(("resize-mode", resize_mode)); 621 } 622 if let Some(ref app_paintable) = self.app_paintable { 623 properties.push(("app-paintable", app_paintable)); 624 } 625 if let Some(ref can_default) = self.can_default { 626 properties.push(("can-default", can_default)); 627 } 628 if let Some(ref can_focus) = self.can_focus { 629 properties.push(("can-focus", can_focus)); 630 } 631 if let Some(ref events) = self.events { 632 properties.push(("events", events)); 633 } 634 if let Some(ref expand) = self.expand { 635 properties.push(("expand", expand)); 636 } 637 #[cfg(any(feature = "v3_20", feature = "dox"))] 638 if let Some(ref focus_on_click) = self.focus_on_click { 639 properties.push(("focus-on-click", focus_on_click)); 640 } 641 if let Some(ref halign) = self.halign { 642 properties.push(("halign", halign)); 643 } 644 if let Some(ref has_default) = self.has_default { 645 properties.push(("has-default", has_default)); 646 } 647 if let Some(ref has_focus) = self.has_focus { 648 properties.push(("has-focus", has_focus)); 649 } 650 if let Some(ref has_tooltip) = self.has_tooltip { 651 properties.push(("has-tooltip", has_tooltip)); 652 } 653 if let Some(ref height_request) = self.height_request { 654 properties.push(("height-request", height_request)); 655 } 656 if let Some(ref hexpand) = self.hexpand { 657 properties.push(("hexpand", hexpand)); 658 } 659 if let Some(ref hexpand_set) = self.hexpand_set { 660 properties.push(("hexpand-set", hexpand_set)); 661 } 662 if let Some(ref is_focus) = self.is_focus { 663 properties.push(("is-focus", is_focus)); 664 } 665 if let Some(ref margin) = self.margin { 666 properties.push(("margin", margin)); 667 } 668 if let Some(ref margin_bottom) = self.margin_bottom { 669 properties.push(("margin-bottom", margin_bottom)); 670 } 671 if let Some(ref margin_end) = self.margin_end { 672 properties.push(("margin-end", margin_end)); 673 } 674 if let Some(ref margin_start) = self.margin_start { 675 properties.push(("margin-start", margin_start)); 676 } 677 if let Some(ref margin_top) = self.margin_top { 678 properties.push(("margin-top", margin_top)); 679 } 680 if let Some(ref name) = self.name { 681 properties.push(("name", name)); 682 } 683 if let Some(ref no_show_all) = self.no_show_all { 684 properties.push(("no-show-all", no_show_all)); 685 } 686 if let Some(ref opacity) = self.opacity { 687 properties.push(("opacity", opacity)); 688 } 689 if let Some(ref parent) = self.parent { 690 properties.push(("parent", parent)); 691 } 692 if let Some(ref receives_default) = self.receives_default { 693 properties.push(("receives-default", receives_default)); 694 } 695 if let Some(ref sensitive) = self.sensitive { 696 properties.push(("sensitive", sensitive)); 697 } 698 if let Some(ref tooltip_markup) = self.tooltip_markup { 699 properties.push(("tooltip-markup", tooltip_markup)); 700 } 701 if let Some(ref tooltip_text) = self.tooltip_text { 702 properties.push(("tooltip-text", tooltip_text)); 703 } 704 if let Some(ref valign) = self.valign { 705 properties.push(("valign", valign)); 706 } 707 if let Some(ref vexpand) = self.vexpand { 708 properties.push(("vexpand", vexpand)); 709 } 710 if let Some(ref vexpand_set) = self.vexpand_set { 711 properties.push(("vexpand-set", vexpand_set)); 712 } 713 if let Some(ref visible) = self.visible { 714 properties.push(("visible", visible)); 715 } 716 if let Some(ref width_request) = self.width_request { 717 properties.push(("width-request", width_request)); 718 } 719 if let Some(ref action_name) = self.action_name { 720 properties.push(("action-name", action_name)); 721 } 722 if let Some(ref action_target) = self.action_target { 723 properties.push(("action-target", action_target)); 724 } 725 glib::Object::new::<ModelButton>(&properties) 726 .expect("Failed to create an instance of ModelButton") 727 } 728 active(mut self, active: bool) -> Self729 pub fn active(mut self, active: bool) -> Self { 730 self.active = Some(active); 731 self 732 } 733 centered(mut self, centered: bool) -> Self734 pub fn centered(mut self, centered: bool) -> Self { 735 self.centered = Some(centered); 736 self 737 } 738 icon<P: IsA<gio::Icon>>(mut self, icon: &P) -> Self739 pub fn icon<P: IsA<gio::Icon>>(mut self, icon: &P) -> Self { 740 self.icon = Some(icon.clone().upcast()); 741 self 742 } 743 iconic(mut self, iconic: bool) -> Self744 pub fn iconic(mut self, iconic: bool) -> Self { 745 self.iconic = Some(iconic); 746 self 747 } 748 inverted(mut self, inverted: bool) -> Self749 pub fn inverted(mut self, inverted: bool) -> Self { 750 self.inverted = Some(inverted); 751 self 752 } 753 menu_name(mut self, menu_name: &str) -> Self754 pub fn menu_name(mut self, menu_name: &str) -> Self { 755 self.menu_name = Some(menu_name.to_string()); 756 self 757 } 758 role(mut self, role: ButtonRole) -> Self759 pub fn role(mut self, role: ButtonRole) -> Self { 760 self.role = Some(role); 761 self 762 } 763 text(mut self, text: &str) -> Self764 pub fn text(mut self, text: &str) -> Self { 765 self.text = Some(text.to_string()); 766 self 767 } 768 769 #[cfg(any(feature = "v3_24", feature = "dox"))] 770 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] use_markup(mut self, use_markup: bool) -> Self771 pub fn use_markup(mut self, use_markup: bool) -> Self { 772 self.use_markup = Some(use_markup); 773 self 774 } 775 always_show_image(mut self, always_show_image: bool) -> Self776 pub fn always_show_image(mut self, always_show_image: bool) -> Self { 777 self.always_show_image = Some(always_show_image); 778 self 779 } 780 image<P: IsA<Widget>>(mut self, image: &P) -> Self781 pub fn image<P: IsA<Widget>>(mut self, image: &P) -> Self { 782 self.image = Some(image.clone().upcast()); 783 self 784 } 785 image_position(mut self, image_position: PositionType) -> Self786 pub fn image_position(mut self, image_position: PositionType) -> Self { 787 self.image_position = Some(image_position); 788 self 789 } 790 label(mut self, label: &str) -> Self791 pub fn label(mut self, label: &str) -> Self { 792 self.label = Some(label.to_string()); 793 self 794 } 795 relief(mut self, relief: ReliefStyle) -> Self796 pub fn relief(mut self, relief: ReliefStyle) -> Self { 797 self.relief = Some(relief); 798 self 799 } 800 use_underline(mut self, use_underline: bool) -> Self801 pub fn use_underline(mut self, use_underline: bool) -> Self { 802 self.use_underline = Some(use_underline); 803 self 804 } 805 border_width(mut self, border_width: u32) -> Self806 pub fn border_width(mut self, border_width: u32) -> Self { 807 self.border_width = Some(border_width); 808 self 809 } 810 child<P: IsA<Widget>>(mut self, child: &P) -> Self811 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 812 self.child = Some(child.clone().upcast()); 813 self 814 } 815 resize_mode(mut self, resize_mode: ResizeMode) -> Self816 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 817 self.resize_mode = Some(resize_mode); 818 self 819 } 820 app_paintable(mut self, app_paintable: bool) -> Self821 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 822 self.app_paintable = Some(app_paintable); 823 self 824 } 825 can_default(mut self, can_default: bool) -> Self826 pub fn can_default(mut self, can_default: bool) -> Self { 827 self.can_default = Some(can_default); 828 self 829 } 830 can_focus(mut self, can_focus: bool) -> Self831 pub fn can_focus(mut self, can_focus: bool) -> Self { 832 self.can_focus = Some(can_focus); 833 self 834 } 835 events(mut self, events: gdk::EventMask) -> Self836 pub fn events(mut self, events: gdk::EventMask) -> Self { 837 self.events = Some(events); 838 self 839 } 840 expand(mut self, expand: bool) -> Self841 pub fn expand(mut self, expand: bool) -> Self { 842 self.expand = Some(expand); 843 self 844 } 845 846 #[cfg(any(feature = "v3_20", feature = "dox"))] 847 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self848 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 849 self.focus_on_click = Some(focus_on_click); 850 self 851 } 852 halign(mut self, halign: Align) -> Self853 pub fn halign(mut self, halign: Align) -> Self { 854 self.halign = Some(halign); 855 self 856 } 857 has_default(mut self, has_default: bool) -> Self858 pub fn has_default(mut self, has_default: bool) -> Self { 859 self.has_default = Some(has_default); 860 self 861 } 862 has_focus(mut self, has_focus: bool) -> Self863 pub fn has_focus(mut self, has_focus: bool) -> Self { 864 self.has_focus = Some(has_focus); 865 self 866 } 867 has_tooltip(mut self, has_tooltip: bool) -> Self868 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 869 self.has_tooltip = Some(has_tooltip); 870 self 871 } 872 height_request(mut self, height_request: i32) -> Self873 pub fn height_request(mut self, height_request: i32) -> Self { 874 self.height_request = Some(height_request); 875 self 876 } 877 hexpand(mut self, hexpand: bool) -> Self878 pub fn hexpand(mut self, hexpand: bool) -> Self { 879 self.hexpand = Some(hexpand); 880 self 881 } 882 hexpand_set(mut self, hexpand_set: bool) -> Self883 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 884 self.hexpand_set = Some(hexpand_set); 885 self 886 } 887 is_focus(mut self, is_focus: bool) -> Self888 pub fn is_focus(mut self, is_focus: bool) -> Self { 889 self.is_focus = Some(is_focus); 890 self 891 } 892 margin(mut self, margin: i32) -> Self893 pub fn margin(mut self, margin: i32) -> Self { 894 self.margin = Some(margin); 895 self 896 } 897 margin_bottom(mut self, margin_bottom: i32) -> Self898 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 899 self.margin_bottom = Some(margin_bottom); 900 self 901 } 902 margin_end(mut self, margin_end: i32) -> Self903 pub fn margin_end(mut self, margin_end: i32) -> Self { 904 self.margin_end = Some(margin_end); 905 self 906 } 907 margin_start(mut self, margin_start: i32) -> Self908 pub fn margin_start(mut self, margin_start: i32) -> Self { 909 self.margin_start = Some(margin_start); 910 self 911 } 912 margin_top(mut self, margin_top: i32) -> Self913 pub fn margin_top(mut self, margin_top: i32) -> Self { 914 self.margin_top = Some(margin_top); 915 self 916 } 917 name(mut self, name: &str) -> Self918 pub fn name(mut self, name: &str) -> Self { 919 self.name = Some(name.to_string()); 920 self 921 } 922 no_show_all(mut self, no_show_all: bool) -> Self923 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 924 self.no_show_all = Some(no_show_all); 925 self 926 } 927 opacity(mut self, opacity: f64) -> Self928 pub fn opacity(mut self, opacity: f64) -> Self { 929 self.opacity = Some(opacity); 930 self 931 } 932 parent<P: IsA<Container>>(mut self, parent: &P) -> Self933 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 934 self.parent = Some(parent.clone().upcast()); 935 self 936 } 937 receives_default(mut self, receives_default: bool) -> Self938 pub fn receives_default(mut self, receives_default: bool) -> Self { 939 self.receives_default = Some(receives_default); 940 self 941 } 942 sensitive(mut self, sensitive: bool) -> Self943 pub fn sensitive(mut self, sensitive: bool) -> Self { 944 self.sensitive = Some(sensitive); 945 self 946 } 947 tooltip_markup(mut self, tooltip_markup: &str) -> Self948 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 949 self.tooltip_markup = Some(tooltip_markup.to_string()); 950 self 951 } 952 tooltip_text(mut self, tooltip_text: &str) -> Self953 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 954 self.tooltip_text = Some(tooltip_text.to_string()); 955 self 956 } 957 valign(mut self, valign: Align) -> Self958 pub fn valign(mut self, valign: Align) -> Self { 959 self.valign = Some(valign); 960 self 961 } 962 vexpand(mut self, vexpand: bool) -> Self963 pub fn vexpand(mut self, vexpand: bool) -> Self { 964 self.vexpand = Some(vexpand); 965 self 966 } 967 vexpand_set(mut self, vexpand_set: bool) -> Self968 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 969 self.vexpand_set = Some(vexpand_set); 970 self 971 } 972 visible(mut self, visible: bool) -> Self973 pub fn visible(mut self, visible: bool) -> Self { 974 self.visible = Some(visible); 975 self 976 } 977 width_request(mut self, width_request: i32) -> Self978 pub fn width_request(mut self, width_request: i32) -> Self { 979 self.width_request = Some(width_request); 980 self 981 } 982 action_name(mut self, action_name: &str) -> Self983 pub fn action_name(mut self, action_name: &str) -> Self { 984 self.action_name = Some(action_name.to_string()); 985 self 986 } 987 action_target(mut self, action_target: &glib::Variant) -> Self988 pub fn action_target(mut self, action_target: &glib::Variant) -> Self { 989 self.action_target = Some(action_target.clone()); 990 self 991 } 992 } 993 994 impl fmt::Display for ModelButton { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result995 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 996 f.write_str("ModelButton") 997 } 998 } 999