1use gdk;
6#[cfg(any(feature = "v3_16", feature = "dox"))]
7use gio;
8use glib::object::Cast;
9#[cfg(any(feature = "v3_16", feature = "dox"))]
10use glib::object::ObjectType as ObjectType_;
11#[cfg(any(feature = "v3_16", feature = "dox"))]
12use glib::signal::connect_raw;
13#[cfg(any(feature = "v3_16", feature = "dox"))]
14use glib::signal::SignalHandlerId;
15use glib::translate::*;
16#[cfg(any(feature = "v3_16", feature = "dox"))]
17use glib::GString;
18use glib::StaticType;
19use glib::ToValue;
20#[cfg(any(feature = "v3_16", feature = "dox"))]
21use glib::Value;
22#[cfg(any(feature = "v3_16", feature = "dox"))]
23use glib_sys;
24#[cfg(any(feature = "v3_16", feature = "dox"))]
25use gobject_sys;
26use gtk_sys;
27#[cfg(any(feature = "v3_16", feature = "dox"))]
28use std::boxed::Box as Box_;
29use std::fmt;
30#[cfg(any(feature = "v3_16", feature = "dox"))]
31use std::mem::transmute;
32use Actionable;
33use Align;
34use Bin;
35use Buildable;
36use Button;
37#[cfg(any(feature = "v3_16", feature = "dox"))]
38use ButtonRole;
39use Container;
40use PositionType;
41use ReliefStyle;
42use ResizeMode;
43use Widget;
44
45glib_wrapper! {
46 pub struct ModelButton(Object<gtk_sys::GtkModelButton, ModelButtonClass>) @extends Button, Bin, Container, Widget, @implements Buildable, Actionable;
47
48 match fn {
49 get_type => || gtk_sys::gtk_model_button_get_type(),
50 }
51}
52
53impl ModelButton {
54 #[cfg(any(feature = "v3_16", feature = "dox"))]
55 pub fn new() -> ModelButton {
56 assert_initialized_main_thread!();
57 unsafe { Widget::from_glib_none(gtk_sys::gtk_model_button_new()).unsafe_cast() }
58 }
59
60 #[cfg(any(feature = "v3_16", feature = "dox"))]
61 pub fn get_property_active(&self) -> bool {
62 unsafe {
63 let mut value = Value::from_type(<bool as StaticType>::static_type());
64 gobject_sys::g_object_get_property(
65 self.as_ptr() as *mut gobject_sys::GObject,
66 b"active\0".as_ptr() as *const _,
67 value.to_glib_none_mut().0,
68 );
69 value.get().unwrap()
70 }
71 }
72
73 #[cfg(any(feature = "v3_16", feature = "dox"))]
74 pub fn set_property_active(&self, active: bool) {
75 unsafe {
76 gobject_sys::g_object_set_property(
77 self.as_ptr() as *mut gobject_sys::GObject,
78 b"active\0".as_ptr() as *const _,
79 Value::from(&active).to_glib_none().0,
80 );
81 }
82 }
83
84 #[cfg(any(feature = "v3_16", feature = "dox"))]
85 pub fn get_property_centered(&self) -> bool {
86 unsafe {
87 let mut value = Value::from_type(<bool as StaticType>::static_type());
88 gobject_sys::g_object_get_property(
89 self.as_ptr() as *mut gobject_sys::GObject,
90 b"centered\0".as_ptr() as *const _,
91 value.to_glib_none_mut().0,
92 );
93 value.get().unwrap()
94 }
95 }
96
97 #[cfg(any(feature = "v3_16", feature = "dox"))]
98 pub fn set_property_centered(&self, centered: bool) {
99 unsafe {
100 gobject_sys::g_object_set_property(
101 self.as_ptr() as *mut gobject_sys::GObject,
102 b"centered\0".as_ptr() as *const _,
103 Value::from(¢ered).to_glib_none().0,
104 );
105 }
106 }
107
108 #[cfg(any(feature = "v3_16", feature = "dox"))]
109 pub fn get_property_icon(&self) -> Option<gio::Icon> {
110 unsafe {
111 let mut value = Value::from_type(<gio::Icon as StaticType>::static_type());
112 gobject_sys::g_object_get_property(
113 self.as_ptr() as *mut gobject_sys::GObject,
114 b"icon\0".as_ptr() as *const _,
115 value.to_glib_none_mut().0,
116 );
117 value.get()
118 }
119 }
120
121 #[cfg(any(feature = "v3_16", feature = "dox"))]
122 pub fn set_property_icon(&self, icon: Option<&gio::Icon>) {
123 unsafe {
124 gobject_sys::g_object_set_property(
125 self.as_ptr() as *mut gobject_sys::GObject,
126 b"icon\0".as_ptr() as *const _,
127 Value::from(icon).to_glib_none().0,
128 );
129 }
130 }
131
132 #[cfg(any(feature = "v3_16", feature = "dox"))]
133 pub fn get_property_iconic(&self) -> bool {
134 unsafe {
135 let mut value = Value::from_type(<bool as StaticType>::static_type());
136 gobject_sys::g_object_get_property(
137 self.as_ptr() as *mut gobject_sys::GObject,
138 b"iconic\0".as_ptr() as *const _,
139 value.to_glib_none_mut().0,
140 );
141 value.get().unwrap()
142 }
143 }
144
145 #[cfg(any(feature = "v3_16", feature = "dox"))]
146 pub fn set_property_iconic(&self, iconic: bool) {
147 unsafe {
148 gobject_sys::g_object_set_property(
149 self.as_ptr() as *mut gobject_sys::GObject,
150 b"iconic\0".as_ptr() as *const _,
151 Value::from(&iconic).to_glib_none().0,
152 );
153 }
154 }
155
156 #[cfg(any(feature = "v3_16", feature = "dox"))]
157 pub fn get_property_inverted(&self) -> bool {
158 unsafe {
159 let mut value = Value::from_type(<bool as StaticType>::static_type());
160 gobject_sys::g_object_get_property(
161 self.as_ptr() as *mut gobject_sys::GObject,
162 b"inverted\0".as_ptr() as *const _,
163 value.to_glib_none_mut().0,
164 );
165 value.get().unwrap()
166 }
167 }
168
169 #[cfg(any(feature = "v3_16", feature = "dox"))]
170 pub fn set_property_inverted(&self, inverted: bool) {
171 unsafe {
172 gobject_sys::g_object_set_property(
173 self.as_ptr() as *mut gobject_sys::GObject,
174 b"inverted\0".as_ptr() as *const _,
175 Value::from(&inverted).to_glib_none().0,
176 );
177 }
178 }
179
180 #[cfg(any(feature = "v3_16", feature = "dox"))]
181 pub fn get_property_menu_name(&self) -> Option<GString> {
182 unsafe {
183 let mut value = Value::from_type(<GString as StaticType>::static_type());
184 gobject_sys::g_object_get_property(
185 self.as_ptr() as *mut gobject_sys::GObject,
186 b"menu-name\0".as_ptr() as *const _,
187 value.to_glib_none_mut().0,
188 );
189 value.get()
190 }
191 }
192
193 #[cfg(any(feature = "v3_16", feature = "dox"))]
194 pub fn set_property_menu_name(&self, menu_name: Option<&str>) {
195 unsafe {
196 gobject_sys::g_object_set_property(
197 self.as_ptr() as *mut gobject_sys::GObject,
198 b"menu-name\0".as_ptr() as *const _,
199 Value::from(menu_name).to_glib_none().0,
200 );
201 }
202 }
203
204 #[cfg(any(feature = "v3_16", feature = "dox"))]
205 pub fn get_property_role(&self) -> ButtonRole {
206 unsafe {
207 let mut value = Value::from_type(<ButtonRole as StaticType>::static_type());
208 gobject_sys::g_object_get_property(
209 self.as_ptr() as *mut gobject_sys::GObject,
210 b"role\0".as_ptr() as *const _,
211 value.to_glib_none_mut().0,
212 );
213 value.get().unwrap()
214 }
215 }
216
217 #[cfg(any(feature = "v3_16", feature = "dox"))]
218 pub fn set_property_role(&self, role: ButtonRole) {
219 unsafe {
220 gobject_sys::g_object_set_property(
221 self.as_ptr() as *mut gobject_sys::GObject,
222 b"role\0".as_ptr() as *const _,
223 Value::from(&role).to_glib_none().0,
224 );
225 }
226 }
227
228 #[cfg(any(feature = "v3_16", feature = "dox"))]
229 pub fn get_property_text(&self) -> Option<GString> {
230 unsafe {
231 let mut value = Value::from_type(<GString as StaticType>::static_type());
232 gobject_sys::g_object_get_property(
233 self.as_ptr() as *mut gobject_sys::GObject,
234 b"text\0".as_ptr() as *const _,
235 value.to_glib_none_mut().0,
236 );
237 value.get()
238 }
239 }
240
241 #[cfg(any(feature = "v3_16", feature = "dox"))]
242 pub fn set_property_text(&self, text: Option<&str>) {
243 unsafe {
244 gobject_sys::g_object_set_property(
245 self.as_ptr() as *mut gobject_sys::GObject,
246 b"text\0".as_ptr() as *const _,
247 Value::from(text).to_glib_none().0,
248 );
249 }
250 }
251
252 #[cfg(any(feature = "v3_24", feature = "dox"))]
253 pub fn get_property_use_markup(&self) -> bool {
254 unsafe {
255 let mut value = Value::from_type(<bool as StaticType>::static_type());
256 gobject_sys::g_object_get_property(
257 self.as_ptr() as *mut gobject_sys::GObject,
258 b"use-markup\0".as_ptr() as *const _,
259 value.to_glib_none_mut().0,
260 );
261 value.get().unwrap()
262 }
263 }
264
265 #[cfg(any(feature = "v3_24", feature = "dox"))]
266 pub fn set_property_use_markup(&self, use_markup: bool) {
267 unsafe {
268 gobject_sys::g_object_set_property(
269 self.as_ptr() as *mut gobject_sys::GObject,
270 b"use-markup\0".as_ptr() as *const _,
271 Value::from(&use_markup).to_glib_none().0,
272 );
273 }
274 }
275
276 #[cfg(any(feature = "v3_16", feature = "dox"))]
277 pub fn connect_property_active_notify<F: Fn(&ModelButton) + 'static>(
278 &self,
279 f: F,
280 ) -> SignalHandlerId {
281 unsafe extern "C" fn notify_active_trampoline<F: Fn(&ModelButton) + 'static>(
282 this: *mut gtk_sys::GtkModelButton,
283 _param_spec: glib_sys::gpointer,
284 f: glib_sys::gpointer,
285 ) {
286 let f: &F = &*(f as *const F);
287 f(&from_glib_borrow(this))
288 }
289 unsafe {
290 let f: Box_<F> = Box_::new(f);
291 connect_raw(
292 self.as_ptr() as *mut _,
293 b"notify::active\0".as_ptr() as *const _,
294 Some(transmute(notify_active_trampoline::<F> as usize)),
295 Box_::into_raw(f),
296 )
297 }
298 }
299
300 #[cfg(any(feature = "v3_16", feature = "dox"))]
301 pub fn connect_property_centered_notify<F: Fn(&ModelButton) + 'static>(
302 &self,
303 f: F,
304 ) -> SignalHandlerId {
305 unsafe extern "C" fn notify_centered_trampoline<F: Fn(&ModelButton) + 'static>(
306 this: *mut gtk_sys::GtkModelButton,
307 _param_spec: glib_sys::gpointer,
308 f: glib_sys::gpointer,
309 ) {
310 let f: &F = &*(f as *const F);
311 f(&from_glib_borrow(this))
312 }
313 unsafe {
314 let f: Box_<F> = Box_::new(f);
315 connect_raw(
316 self.as_ptr() as *mut _,
317 b"notify::centered\0".as_ptr() as *const _,
318 Some(transmute(notify_centered_trampoline::<F> as usize)),
319 Box_::into_raw(f),
320 )
321 }
322 }
323
324 #[cfg(any(feature = "v3_16", feature = "dox"))]
325 pub fn connect_property_icon_notify<F: Fn(&ModelButton) + 'static>(
326 &self,
327 f: F,
328 ) -> SignalHandlerId {
329 unsafe extern "C" fn notify_icon_trampoline<F: Fn(&ModelButton) + 'static>(
330 this: *mut gtk_sys::GtkModelButton,
331 _param_spec: glib_sys::gpointer,
332 f: glib_sys::gpointer,
333 ) {
334 let f: &F = &*(f as *const F);
335 f(&from_glib_borrow(this))
336 }
337 unsafe {
338 let f: Box_<F> = Box_::new(f);
339 connect_raw(
340 self.as_ptr() as *mut _,
341 b"notify::icon\0".as_ptr() as *const _,
342 Some(transmute(notify_icon_trampoline::<F> as usize)),
343 Box_::into_raw(f),
344 )
345 }
346 }
347
348 #[cfg(any(feature = "v3_16", feature = "dox"))]
349 pub fn connect_property_iconic_notify<F: Fn(&ModelButton) + 'static>(
350 &self,
351 f: F,
352 ) -> SignalHandlerId {
353 unsafe extern "C" fn notify_iconic_trampoline<F: Fn(&ModelButton) + 'static>(
354 this: *mut gtk_sys::GtkModelButton,
355 _param_spec: glib_sys::gpointer,
356 f: glib_sys::gpointer,
357 ) {
358 let f: &F = &*(f as *const F);
359 f(&from_glib_borrow(this))
360 }
361 unsafe {
362 let f: Box_<F> = Box_::new(f);
363 connect_raw(
364 self.as_ptr() as *mut _,
365 b"notify::iconic\0".as_ptr() as *const _,
366 Some(transmute(notify_iconic_trampoline::<F> as usize)),
367 Box_::into_raw(f),
368 )
369 }
370 }
371
372 #[cfg(any(feature = "v3_16", feature = "dox"))]
373 pub fn connect_property_inverted_notify<F: Fn(&ModelButton) + 'static>(
374 &self,
375 f: F,
376 ) -> SignalHandlerId {
377 unsafe extern "C" fn notify_inverted_trampoline<F: Fn(&ModelButton) + 'static>(
378 this: *mut gtk_sys::GtkModelButton,
379 _param_spec: glib_sys::gpointer,
380 f: glib_sys::gpointer,
381 ) {
382 let f: &F = &*(f as *const F);
383 f(&from_glib_borrow(this))
384 }
385 unsafe {
386 let f: Box_<F> = Box_::new(f);
387 connect_raw(
388 self.as_ptr() as *mut _,
389 b"notify::inverted\0".as_ptr() as *const _,
390 Some(transmute(notify_inverted_trampoline::<F> as usize)),
391 Box_::into_raw(f),
392 )
393 }
394 }
395
396 #[cfg(any(feature = "v3_16", feature = "dox"))]
397 pub fn connect_property_menu_name_notify<F: Fn(&ModelButton) + 'static>(
398 &self,
399 f: F,
400 ) -> SignalHandlerId {
401 unsafe extern "C" fn notify_menu_name_trampoline<F: Fn(&ModelButton) + 'static>(
402 this: *mut gtk_sys::GtkModelButton,
403 _param_spec: glib_sys::gpointer,
404 f: glib_sys::gpointer,
405 ) {
406 let f: &F = &*(f as *const F);
407 f(&from_glib_borrow(this))
408 }
409 unsafe {
410 let f: Box_<F> = Box_::new(f);
411 connect_raw(
412 self.as_ptr() as *mut _,
413 b"notify::menu-name\0".as_ptr() as *const _,
414 Some(transmute(notify_menu_name_trampoline::<F> as usize)),
415 Box_::into_raw(f),
416 )
417 }
418 }
419
420 #[cfg(any(feature = "v3_16", feature = "dox"))]
421 pub fn connect_property_role_notify<F: Fn(&ModelButton) + 'static>(
422 &self,
423 f: F,
424 ) -> SignalHandlerId {
425 unsafe extern "C" fn notify_role_trampoline<F: Fn(&ModelButton) + 'static>(
426 this: *mut gtk_sys::GtkModelButton,
427 _param_spec: glib_sys::gpointer,
428 f: glib_sys::gpointer,
429 ) {
430 let f: &F = &*(f as *const F);
431 f(&from_glib_borrow(this))
432 }
433 unsafe {
434 let f: Box_<F> = Box_::new(f);
435 connect_raw(
436 self.as_ptr() as *mut _,
437 b"notify::role\0".as_ptr() as *const _,
438 Some(transmute(notify_role_trampoline::<F> as usize)),
439 Box_::into_raw(f),
440 )
441 }
442 }
443
444 #[cfg(any(feature = "v3_16", feature = "dox"))]
445 pub fn connect_property_text_notify<F: Fn(&ModelButton) + 'static>(
446 &self,
447 f: F,
448 ) -> SignalHandlerId {
449 unsafe extern "C" fn notify_text_trampoline<F: Fn(&ModelButton) + 'static>(
450 this: *mut gtk_sys::GtkModelButton,
451 _param_spec: glib_sys::gpointer,
452 f: glib_sys::gpointer,
453 ) {
454 let f: &F = &*(f as *const F);
455 f(&from_glib_borrow(this))
456 }
457 unsafe {
458 let f: Box_<F> = Box_::new(f);
459 connect_raw(
460 self.as_ptr() as *mut _,
461 b"notify::text\0".as_ptr() as *const _,
462 Some(transmute(notify_text_trampoline::<F> as usize)),
463 Box_::into_raw(f),
464 )
465 }
466 }
467
468 #[cfg(any(feature = "v3_24", feature = "dox"))]
469 pub fn connect_property_use_markup_notify<F: Fn(&ModelButton) + 'static>(
470 &self,
471 f: F,
472 ) -> SignalHandlerId {
473 unsafe extern "C" fn notify_use_markup_trampoline<F: Fn(&ModelButton) + 'static>(
474 this: *mut gtk_sys::GtkModelButton,
475 _param_spec: glib_sys::gpointer,
476 f: glib_sys::gpointer,
477 ) {
478 let f: &F = &*(f as *const F);
479 f(&from_glib_borrow(this))
480 }
481 unsafe {
482 let f: Box_<F> = Box_::new(f);
483 connect_raw(
484 self.as_ptr() as *mut _,
485 b"notify::use-markup\0".as_ptr() as *const _,
486 Some(transmute(notify_use_markup_trampoline::<F> as usize)),
487 Box_::into_raw(f),
488 )
489 }
490 }
491}
492
493#[cfg(any(feature = "v3_16", feature = "dox"))]
494impl Default for ModelButton {
495 fn default() -> Self {
496 Self::new()
497 }
498}
499
500pub struct ModelButtonBuilder {
501 #[cfg(any(feature = "v3_16", feature = "dox"))]
502 active: Option<bool>,
503 #[cfg(any(feature = "v3_16", feature = "dox"))]
504 centered: Option<bool>,
505 #[cfg(any(feature = "v3_16", feature = "dox"))]
506 icon: Option<gio::Icon>,
507 #[cfg(any(feature = "v3_16", feature = "dox"))]
508 iconic: Option<bool>,
509 #[cfg(any(feature = "v3_16", feature = "dox"))]
510 inverted: Option<bool>,
511 #[cfg(any(feature = "v3_16", feature = "dox"))]
512 menu_name: Option<String>,
513 #[cfg(any(feature = "v3_16", feature = "dox"))]
514 role: Option<ButtonRole>,
515 #[cfg(any(feature = "v3_16", feature = "dox"))]
516 text: Option<String>,
517 #[cfg(any(feature = "v3_24", feature = "dox"))]
518 use_markup: Option<bool>,
519 always_show_image: Option<bool>,
520 image: Option<Widget>,
521 image_position: Option<PositionType>,
522 label: Option<String>,
523 relief: Option<ReliefStyle>,
524 use_underline: Option<bool>,
525 border_width: Option<u32>,
526 child: Option<Widget>,
527 resize_mode: Option<ResizeMode>,
528 app_paintable: Option<bool>,
529 can_default: Option<bool>,
530 can_focus: Option<bool>,
531 events: Option<gdk::EventMask>,
532 expand: Option<bool>,
533 #[cfg(any(feature = "v3_20", feature = "dox"))]
534 focus_on_click: Option<bool>,
535 halign: Option<Align>,
536 has_default: Option<bool>,
537 has_focus: Option<bool>,
538 has_tooltip: Option<bool>,
539 height_request: Option<i32>,
540 hexpand: Option<bool>,
541 hexpand_set: Option<bool>,
542 is_focus: Option<bool>,
543 margin: Option<i32>,
544 margin_bottom: Option<i32>,
545 margin_end: Option<i32>,
546 margin_start: Option<i32>,
547 margin_top: Option<i32>,
548 name: Option<String>,
549 no_show_all: Option<bool>,
550 opacity: Option<f64>,
551 parent: Option<Container>,
552 receives_default: Option<bool>,
553 sensitive: Option<bool>,
554 tooltip_markup: Option<String>,
556 tooltip_text: Option<String>,
557 valign: Option<Align>,
558 vexpand: Option<bool>,
559 vexpand_set: Option<bool>,
560 visible: Option<bool>,
561 width_request: Option<i32>,
562}
563
564impl ModelButtonBuilder {
565 pub fn new() -> Self {
566 Self {
567 #[cfg(any(feature = "v3_16", feature = "dox"))]
568 active: None,
569 #[cfg(any(feature = "v3_16", feature = "dox"))]
570 centered: None,
571 #[cfg(any(feature = "v3_16", feature = "dox"))]
572 icon: None,
573 #[cfg(any(feature = "v3_16", feature = "dox"))]
574 iconic: None,
575 #[cfg(any(feature = "v3_16", feature = "dox"))]
576 inverted: None,
577 #[cfg(any(feature = "v3_16", feature = "dox"))]
578 menu_name: None,
579 #[cfg(any(feature = "v3_16", feature = "dox"))]
580 role: None,
581 #[cfg(any(feature = "v3_16", feature = "dox"))]
582 text: None,
583 #[cfg(any(feature = "v3_24", feature = "dox"))]
584 use_markup: None,
585 always_show_image: None,
586 image: None,
587 image_position: None,
588 label: None,
589 relief: None,
590 use_underline: None,
591 border_width: None,
592 child: None,
593 resize_mode: None,
594 app_paintable: None,
595 can_default: None,
596 can_focus: None,
597 events: None,
598 expand: None,
599 #[cfg(any(feature = "v3_20", feature = "dox"))]
600 focus_on_click: None,
601 halign: None,
602 has_default: None,
603 has_focus: None,
604 has_tooltip: None,
605 height_request: None,
606 hexpand: None,
607 hexpand_set: None,
608 is_focus: None,
609 margin: None,
610 margin_bottom: None,
611 margin_end: None,
612 margin_start: None,
613 margin_top: None,
614 name: None,
615 no_show_all: None,
616 opacity: None,
617 parent: None,
618 receives_default: None,
619 sensitive: None,
620 tooltip_markup: None,
621 tooltip_text: None,
622 valign: None,
623 vexpand: None,
624 vexpand_set: None,
625 visible: None,
626 width_request: None,
627 }
628 }
629
630 pub fn build(self) -> ModelButton {
631 let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
632 #[cfg(any(feature = "v3_16", feature = "dox"))]
633 {
634 if let Some(ref active) = self.active {
635 properties.push(("active", active));
636 }
637 }
638 #[cfg(any(feature = "v3_16", feature = "dox"))]
639 {
640 if let Some(ref centered) = self.centered {
641 properties.push(("centered", centered));
642 }
643 }
644 #[cfg(any(feature = "v3_16", feature = "dox"))]
645 {
646 if let Some(ref icon) = self.icon {
647 properties.push(("icon", icon));
648 }
649 }
650 #[cfg(any(feature = "v3_16", feature = "dox"))]
651 {
652 if let Some(ref iconic) = self.iconic {
653 properties.push(("iconic", iconic));
654 }
655 }
656 #[cfg(any(feature = "v3_16", feature = "dox"))]
657 {
658 if let Some(ref inverted) = self.inverted {
659 properties.push(("inverted", inverted));
660 }
661 }
662 #[cfg(any(feature = "v3_16", feature = "dox"))]
663 {
664 if let Some(ref menu_name) = self.menu_name {
665 properties.push(("menu-name", menu_name));
666 }
667 }
668 #[cfg(any(feature = "v3_16", feature = "dox"))]
669 {
670 if let Some(ref role) = self.role {
671 properties.push(("role", role));
672 }
673 }
674 #[cfg(any(feature = "v3_16", feature = "dox"))]
675 {
676 if let Some(ref text) = self.text {
677 properties.push(("text", text));
678 }
679 }
680 #[cfg(any(feature = "v3_24", feature = "dox"))]
681 {
682 if let Some(ref use_markup) = self.use_markup {
683 properties.push(("use-markup", use_markup));
684 }
685 }
686 if let Some(ref always_show_image) = self.always_show_image {
687 properties.push(("always-show-image", always_show_image));
688 }
689 if let Some(ref image) = self.image {
690 properties.push(("image", image));
691 }
692 if let Some(ref image_position) = self.image_position {
693 properties.push(("image-position", image_position));
694 }
695 if let Some(ref label) = self.label {
696 properties.push(("label", label));
697 }
698 if let Some(ref relief) = self.relief {
699 properties.push(("relief", relief));
700 }
701 if let Some(ref use_underline) = self.use_underline {
702 properties.push(("use-underline", use_underline));
703 }
704 if let Some(ref border_width) = self.border_width {
705 properties.push(("border-width", border_width));
706 }
707 if let Some(ref child) = self.child {
708 properties.push(("child", child));
709 }
710 if let Some(ref resize_mode) = self.resize_mode {
711 properties.push(("resize-mode", resize_mode));
712 }
713 if let Some(ref app_paintable) = self.app_paintable {
714 properties.push(("app-paintable", app_paintable));
715 }
716 if let Some(ref can_default) = self.can_default {
717 properties.push(("can-default", can_default));
718 }
719 if let Some(ref can_focus) = self.can_focus {
720 properties.push(("can-focus", can_focus));
721 }
722 if let Some(ref events) = self.events {
723 properties.push(("events", events));
724 }
725 if let Some(ref expand) = self.expand {
726 properties.push(("expand", expand));
727 }
728 #[cfg(any(feature = "v3_20", feature = "dox"))]
729 {
730 if let Some(ref focus_on_click) = self.focus_on_click {
731 properties.push(("focus-on-click", focus_on_click));
732 }
733 }
734 if let Some(ref halign) = self.halign {
735 properties.push(("halign", halign));
736 }
737 if let Some(ref has_default) = self.has_default {
738 properties.push(("has-default", has_default));
739 }
740 if let Some(ref has_focus) = self.has_focus {
741 properties.push(("has-focus", has_focus));
742 }
743 if let Some(ref has_tooltip) = self.has_tooltip {
744 properties.push(("has-tooltip", has_tooltip));
745 }
746 if let Some(ref height_request) = self.height_request {
747 properties.push(("height-request", height_request));
748 }
749 if let Some(ref hexpand) = self.hexpand {
750 properties.push(("hexpand", hexpand));
751 }
752 if let Some(ref hexpand_set) = self.hexpand_set {
753 properties.push(("hexpand-set", hexpand_set));
754 }
755 if let Some(ref is_focus) = self.is_focus {
756 properties.push(("is-focus", is_focus));
757 }
758 if let Some(ref margin) = self.margin {
759 properties.push(("margin", margin));
760 }
761 if let Some(ref margin_bottom) = self.margin_bottom {
762 properties.push(("margin-bottom", margin_bottom));
763 }
764 if let Some(ref margin_end) = self.margin_end {
765 properties.push(("margin-end", margin_end));
766 }
767 if let Some(ref margin_start) = self.margin_start {
768 properties.push(("margin-start", margin_start));
769 }
770 if let Some(ref margin_top) = self.margin_top {
771 properties.push(("margin-top", margin_top));
772 }
773 if let Some(ref name) = self.name {
774 properties.push(("name", name));
775 }
776 if let Some(ref no_show_all) = self.no_show_all {
777 properties.push(("no-show-all", no_show_all));
778 }
779 if let Some(ref opacity) = self.opacity {
780 properties.push(("opacity", opacity));
781 }
782 if let Some(ref parent) = self.parent {
783 properties.push(("parent", parent));
784 }
785 if let Some(ref receives_default) = self.receives_default {
786 properties.push(("receives-default", receives_default));
787 }
788 if let Some(ref sensitive) = self.sensitive {
789 properties.push(("sensitive", sensitive));
790 }
791 if let Some(ref tooltip_markup) = self.tooltip_markup {
792 properties.push(("tooltip-markup", tooltip_markup));
793 }
794 if let Some(ref tooltip_text) = self.tooltip_text {
795 properties.push(("tooltip-text", tooltip_text));
796 }
797 if let Some(ref valign) = self.valign {
798 properties.push(("valign", valign));
799 }
800 if let Some(ref vexpand) = self.vexpand {
801 properties.push(("vexpand", vexpand));
802 }
803 if let Some(ref vexpand_set) = self.vexpand_set {
804 properties.push(("vexpand-set", vexpand_set));
805 }
806 if let Some(ref visible) = self.visible {
807 properties.push(("visible", visible));
808 }
809 if let Some(ref width_request) = self.width_request {
810 properties.push(("width-request", width_request));
811 }
812 glib::Object::new(ModelButton::static_type(), &properties)
813 .expect("object new")
814 .downcast()
815 .expect("downcast")
816 }
817
818 #[cfg(any(feature = "v3_16", feature = "dox"))]
819 pub fn active(mut self, active: bool) -> Self {
820 self.active = Some(active);
821 self
822 }
823
824 #[cfg(any(feature = "v3_16", feature = "dox"))]
825 pub fn centered(mut self, centered: bool) -> Self {
826 self.centered = Some(centered);
827 self
828 }
829
830 #[cfg(any(feature = "v3_16", feature = "dox"))]
831 pub fn icon(mut self, icon: &gio::Icon) -> Self {
832 self.icon = Some(icon.clone());
833 self
834 }
835
836 #[cfg(any(feature = "v3_16", feature = "dox"))]
837 pub fn iconic(mut self, iconic: bool) -> Self {
838 self.iconic = Some(iconic);
839 self
840 }
841
842 #[cfg(any(feature = "v3_16", feature = "dox"))]
843 pub fn inverted(mut self, inverted: bool) -> Self {
844 self.inverted = Some(inverted);
845 self
846 }
847
848 #[cfg(any(feature = "v3_16", feature = "dox"))]
849 pub fn menu_name(mut self, menu_name: &str) -> Self {
850 self.menu_name = Some(menu_name.to_string());
851 self
852 }
853
854 #[cfg(any(feature = "v3_16", feature = "dox"))]
855 pub fn role(mut self, role: ButtonRole) -> Self {
856 self.role = Some(role);
857 self
858 }
859
860 #[cfg(any(feature = "v3_16", feature = "dox"))]
861 pub fn text(mut self, text: &str) -> Self {
862 self.text = Some(text.to_string());
863 self
864 }
865
866 #[cfg(any(feature = "v3_24", feature = "dox"))]
867 pub fn use_markup(mut self, use_markup: bool) -> Self {
868 self.use_markup = Some(use_markup);
869 self
870 }
871
872 pub fn always_show_image(mut self, always_show_image: bool) -> Self {
873 self.always_show_image = Some(always_show_image);
874 self
875 }
876
877 pub fn image(mut self, image: &Widget) -> Self {
878 self.image = Some(image.clone());
879 self
880 }
881
882 pub fn image_position(mut self, image_position: PositionType) -> Self {
883 self.image_position = Some(image_position);
884 self
885 }
886
887 pub fn label(mut self, label: &str) -> Self {
888 self.label = Some(label.to_string());
889 self
890 }
891
892 pub fn relief(mut self, relief: ReliefStyle) -> Self {
893 self.relief = Some(relief);
894 self
895 }
896
897 pub fn use_underline(mut self, use_underline: bool) -> Self {
898 self.use_underline = Some(use_underline);
899 self
900 }
901
902 pub fn border_width(mut self, border_width: u32) -> Self {
903 self.border_width = Some(border_width);
904 self
905 }
906
907 pub fn child(mut self, child: &Widget) -> Self {
908 self.child = Some(child.clone());
909 self
910 }
911
912 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
913 self.resize_mode = Some(resize_mode);
914 self
915 }
916
917 pub fn app_paintable(mut self, app_paintable: bool) -> Self {
918 self.app_paintable = Some(app_paintable);
919 self
920 }
921
922 pub fn can_default(mut self, can_default: bool) -> Self {
923 self.can_default = Some(can_default);
924 self
925 }
926
927 pub fn can_focus(mut self, can_focus: bool) -> Self {
928 self.can_focus = Some(can_focus);
929 self
930 }
931
932 pub fn events(mut self, events: gdk::EventMask) -> Self {
933 self.events = Some(events);
934 self
935 }
936
937 pub fn expand(mut self, expand: bool) -> Self {
938 self.expand = Some(expand);
939 self
940 }
941
942 #[cfg(any(feature = "v3_20", feature = "dox"))]
943 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
944 self.focus_on_click = Some(focus_on_click);
945 self
946 }
947
948 pub fn halign(mut self, halign: Align) -> Self {
949 self.halign = Some(halign);
950 self
951 }
952
953 pub fn has_default(mut self, has_default: bool) -> Self {
954 self.has_default = Some(has_default);
955 self
956 }
957
958 pub fn has_focus(mut self, has_focus: bool) -> Self {
959 self.has_focus = Some(has_focus);
960 self
961 }
962
963 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
964 self.has_tooltip = Some(has_tooltip);
965 self
966 }
967
968 pub fn height_request(mut self, height_request: i32) -> Self {
969 self.height_request = Some(height_request);
970 self
971 }
972
973 pub fn hexpand(mut self, hexpand: bool) -> Self {
974 self.hexpand = Some(hexpand);
975 self
976 }
977
978 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
979 self.hexpand_set = Some(hexpand_set);
980 self
981 }
982
983 pub fn is_focus(mut self, is_focus: bool) -> Self {
984 self.is_focus = Some(is_focus);
985 self
986 }
987
988 pub fn margin(mut self, margin: i32) -> Self {
989 self.margin = Some(margin);
990 self
991 }
992
993 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
994 self.margin_bottom = Some(margin_bottom);
995 self
996 }
997
998 pub fn margin_end(mut self, margin_end: i32) -> Self {
999 self.margin_end = Some(margin_end);
1000 self
1001 }
1002
1003 pub fn margin_start(mut self, margin_start: i32) -> Self {
1004 self.margin_start = Some(margin_start);
1005 self
1006 }
1007
1008 pub fn margin_top(mut self, margin_top: i32) -> Self {
1009 self.margin_top = Some(margin_top);
1010 self
1011 }
1012
1013 pub fn name(mut self, name: &str) -> Self {
1014 self.name = Some(name.to_string());
1015 self
1016 }
1017
1018 pub fn no_show_all(mut self, no_show_all: bool) -> Self {
1019 self.no_show_all = Some(no_show_all);
1020 self
1021 }
1022
1023 pub fn opacity(mut self, opacity: f64) -> Self {
1024 self.opacity = Some(opacity);
1025 self
1026 }
1027
1028 pub fn parent(mut self, parent: &Container) -> Self {
1029 self.parent = Some(parent.clone());
1030 self
1031 }
1032
1033 pub fn receives_default(mut self, receives_default: bool) -> Self {
1034 self.receives_default = Some(receives_default);
1035 self
1036 }
1037
1038 pub fn sensitive(mut self, sensitive: bool) -> Self {
1039 self.sensitive = Some(sensitive);
1040 self
1041 }
1042
1043 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
1044 self.tooltip_markup = Some(tooltip_markup.to_string());
1045 self
1046 }
1047
1048 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
1049 self.tooltip_text = Some(tooltip_text.to_string());
1050 self
1051 }
1052
1053 pub fn valign(mut self, valign: Align) -> Self {
1054 self.valign = Some(valign);
1055 self
1056 }
1057
1058 pub fn vexpand(mut self, vexpand: bool) -> Self {
1059 self.vexpand = Some(vexpand);
1060 self
1061 }
1062
1063 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
1064 self.vexpand_set = Some(vexpand_set);
1065 self
1066 }
1067
1068 pub fn visible(mut self, visible: bool) -> Self {
1069 self.visible = Some(visible);
1070 self
1071 }
1072
1073 pub fn width_request(mut self, width_request: i32) -> Self {
1074 self.width_request = Some(width_request);
1075 self
1076 }
1077}
1078
1079impl fmt::Display for ModelButton {
1080 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1081 write!(f, "ModelButton")
1082 }
1083}