1#![allow(deprecated)]
5
6use crate::{
7 ffi, Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, IconSize, ImageType,
8 LayoutManager, Overflow, Widget,
9};
10use glib::{
11 prelude::*,
12 signal::{connect_raw, SignalHandlerId},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 #[doc(alias = "GtkImage")]
19 pub struct Image(Object<ffi::GtkImage>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
20
21 match fn {
22 type_ => || ffi::gtk_image_get_type(),
23 }
24}
25
26impl Image {
27 #[doc(alias = "gtk_image_new")]
28 pub fn new() -> Image {
29 assert_initialized_main_thread!();
30 unsafe { Widget::from_glib_none(ffi::gtk_image_new()).unsafe_cast() }
31 }
32
33 #[doc(alias = "gtk_image_new_from_file")]
34 #[doc(alias = "new_from_file")]
35 pub fn from_file(filename: impl AsRef<std::path::Path>) -> Image {
36 assert_initialized_main_thread!();
37 unsafe {
38 Widget::from_glib_none(ffi::gtk_image_new_from_file(
39 filename.as_ref().to_glib_none().0,
40 ))
41 .unsafe_cast()
42 }
43 }
44
45 #[doc(alias = "gtk_image_new_from_gicon")]
46 #[doc(alias = "new_from_gicon")]
47 pub fn from_gicon(icon: &impl IsA<gio::Icon>) -> Image {
48 assert_initialized_main_thread!();
49 unsafe {
50 Widget::from_glib_none(ffi::gtk_image_new_from_gicon(
51 icon.as_ref().to_glib_none().0,
52 ))
53 .unsafe_cast()
54 }
55 }
56
57 #[doc(alias = "gtk_image_new_from_icon_name")]
58 #[doc(alias = "new_from_icon_name")]
59 pub fn from_icon_name(icon_name: &str) -> Image {
60 assert_initialized_main_thread!();
61 unsafe {
62 Widget::from_glib_none(ffi::gtk_image_new_from_icon_name(
63 icon_name.to_glib_none().0,
64 ))
65 .unsafe_cast()
66 }
67 }
68
69 #[doc(alias = "gtk_image_new_from_paintable")]
70 #[doc(alias = "new_from_paintable")]
71 pub fn from_paintable(paintable: Option<&impl IsA<gdk::Paintable>>) -> Image {
72 assert_initialized_main_thread!();
73 unsafe {
74 Widget::from_glib_none(ffi::gtk_image_new_from_paintable(
75 paintable.map(|p| p.as_ref()).to_glib_none().0,
76 ))
77 .unsafe_cast()
78 }
79 }
80
81 #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
82 #[allow(deprecated)]
83 #[doc(alias = "gtk_image_new_from_pixbuf")]
84 #[doc(alias = "new_from_pixbuf")]
85 pub fn from_pixbuf(pixbuf: Option<&gdk_pixbuf::Pixbuf>) -> Image {
86 assert_initialized_main_thread!();
87 unsafe {
88 Widget::from_glib_none(ffi::gtk_image_new_from_pixbuf(pixbuf.to_glib_none().0))
89 .unsafe_cast()
90 }
91 }
92
93 #[doc(alias = "gtk_image_new_from_resource")]
94 #[doc(alias = "new_from_resource")]
95 pub fn from_resource(resource_path: &str) -> Image {
96 assert_initialized_main_thread!();
97 unsafe {
98 Widget::from_glib_none(ffi::gtk_image_new_from_resource(
99 resource_path.to_glib_none().0,
100 ))
101 .unsafe_cast()
102 }
103 }
104
105 pub fn builder() -> ImageBuilder {
110 ImageBuilder::new()
111 }
112
113 #[doc(alias = "gtk_image_clear")]
114 pub fn clear(&self) {
115 unsafe {
116 ffi::gtk_image_clear(self.to_glib_none().0);
117 }
118 }
119
120 #[doc(alias = "gtk_image_get_gicon")]
121 #[doc(alias = "get_gicon")]
122 pub fn gicon(&self) -> Option<gio::Icon> {
123 unsafe { from_glib_none(ffi::gtk_image_get_gicon(self.to_glib_none().0)) }
124 }
125
126 #[doc(alias = "gtk_image_get_icon_name")]
127 #[doc(alias = "get_icon_name")]
128 #[doc(alias = "icon-name")]
129 pub fn icon_name(&self) -> Option<glib::GString> {
130 unsafe { from_glib_none(ffi::gtk_image_get_icon_name(self.to_glib_none().0)) }
131 }
132
133 #[doc(alias = "gtk_image_get_icon_size")]
134 #[doc(alias = "get_icon_size")]
135 #[doc(alias = "icon-size")]
136 pub fn icon_size(&self) -> IconSize {
137 unsafe { from_glib(ffi::gtk_image_get_icon_size(self.to_glib_none().0)) }
138 }
139
140 #[doc(alias = "gtk_image_get_paintable")]
141 #[doc(alias = "get_paintable")]
142 pub fn paintable(&self) -> Option<gdk::Paintable> {
143 unsafe { from_glib_none(ffi::gtk_image_get_paintable(self.to_glib_none().0)) }
144 }
145
146 #[doc(alias = "gtk_image_get_pixel_size")]
147 #[doc(alias = "get_pixel_size")]
148 #[doc(alias = "pixel-size")]
149 pub fn pixel_size(&self) -> i32 {
150 unsafe { ffi::gtk_image_get_pixel_size(self.to_glib_none().0) }
151 }
152
153 #[doc(alias = "gtk_image_get_storage_type")]
154 #[doc(alias = "get_storage_type")]
155 #[doc(alias = "storage-type")]
156 pub fn storage_type(&self) -> ImageType {
157 unsafe { from_glib(ffi::gtk_image_get_storage_type(self.to_glib_none().0)) }
158 }
159
160 #[doc(alias = "gtk_image_set_from_file")]
161 #[doc(alias = "file")]
162 pub fn set_from_file(&self, filename: Option<impl AsRef<std::path::Path>>) {
163 unsafe {
164 ffi::gtk_image_set_from_file(
165 self.to_glib_none().0,
166 filename.as_ref().map(|p| p.as_ref()).to_glib_none().0,
167 );
168 }
169 }
170
171 #[doc(alias = "gtk_image_set_from_gicon")]
172 #[doc(alias = "gicon")]
173 pub fn set_from_gicon(&self, icon: &impl IsA<gio::Icon>) {
174 unsafe {
175 ffi::gtk_image_set_from_gicon(self.to_glib_none().0, icon.as_ref().to_glib_none().0);
176 }
177 }
178
179 #[doc(alias = "gtk_image_set_from_icon_name")]
180 #[doc(alias = "set_from_icon_name")]
181 #[doc(alias = "icon-name")]
182 pub fn set_icon_name(&self, icon_name: Option<&str>) {
183 unsafe {
184 ffi::gtk_image_set_from_icon_name(self.to_glib_none().0, icon_name.to_glib_none().0);
185 }
186 }
187
188 #[doc(alias = "gtk_image_set_from_paintable")]
189 #[doc(alias = "set_from_paintable")]
190 #[doc(alias = "paintable")]
191 pub fn set_paintable(&self, paintable: Option<&impl IsA<gdk::Paintable>>) {
192 unsafe {
193 ffi::gtk_image_set_from_paintable(
194 self.to_glib_none().0,
195 paintable.map(|p| p.as_ref()).to_glib_none().0,
196 );
197 }
198 }
199
200 #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
201 #[allow(deprecated)]
202 #[doc(alias = "gtk_image_set_from_pixbuf")]
203 pub fn set_from_pixbuf(&self, pixbuf: Option<&gdk_pixbuf::Pixbuf>) {
204 unsafe {
205 ffi::gtk_image_set_from_pixbuf(self.to_glib_none().0, pixbuf.to_glib_none().0);
206 }
207 }
208
209 #[doc(alias = "gtk_image_set_from_resource")]
210 #[doc(alias = "set_from_resource")]
211 #[doc(alias = "resource")]
212 pub fn set_resource(&self, resource_path: Option<&str>) {
213 unsafe {
214 ffi::gtk_image_set_from_resource(self.to_glib_none().0, resource_path.to_glib_none().0);
215 }
216 }
217
218 #[doc(alias = "gtk_image_set_icon_size")]
219 #[doc(alias = "icon-size")]
220 pub fn set_icon_size(&self, icon_size: IconSize) {
221 unsafe {
222 ffi::gtk_image_set_icon_size(self.to_glib_none().0, icon_size.into_glib());
223 }
224 }
225
226 #[doc(alias = "gtk_image_set_pixel_size")]
227 #[doc(alias = "pixel-size")]
228 pub fn set_pixel_size(&self, pixel_size: i32) {
229 unsafe {
230 ffi::gtk_image_set_pixel_size(self.to_glib_none().0, pixel_size);
231 }
232 }
233
234 pub fn file(&self) -> Option<glib::GString> {
235 ObjectExt::property(self, "file")
236 }
237
238 pub fn resource(&self) -> Option<glib::GString> {
239 ObjectExt::property(self, "resource")
240 }
241
242 #[doc(alias = "use-fallback")]
243 pub fn uses_fallback(&self) -> bool {
244 ObjectExt::property(self, "use-fallback")
245 }
246
247 #[doc(alias = "use-fallback")]
248 pub fn set_use_fallback(&self, use_fallback: bool) {
249 ObjectExt::set_property(self, "use-fallback", use_fallback)
250 }
251
252 #[doc(alias = "file")]
253 pub fn connect_file_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
254 unsafe extern "C" fn notify_file_trampoline<F: Fn(&Image) + 'static>(
255 this: *mut ffi::GtkImage,
256 _param_spec: glib::ffi::gpointer,
257 f: glib::ffi::gpointer,
258 ) {
259 let f: &F = &*(f as *const F);
260 f(&from_glib_borrow(this))
261 }
262 unsafe {
263 let f: Box_<F> = Box_::new(f);
264 connect_raw(
265 self.as_ptr() as *mut _,
266 c"notify::file".as_ptr() as *const _,
267 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
268 notify_file_trampoline::<F> as *const (),
269 )),
270 Box_::into_raw(f),
271 )
272 }
273 }
274
275 #[doc(alias = "gicon")]
276 pub fn connect_gicon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
277 unsafe extern "C" fn notify_gicon_trampoline<F: Fn(&Image) + 'static>(
278 this: *mut ffi::GtkImage,
279 _param_spec: glib::ffi::gpointer,
280 f: glib::ffi::gpointer,
281 ) {
282 let f: &F = &*(f as *const F);
283 f(&from_glib_borrow(this))
284 }
285 unsafe {
286 let f: Box_<F> = Box_::new(f);
287 connect_raw(
288 self.as_ptr() as *mut _,
289 c"notify::gicon".as_ptr() as *const _,
290 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
291 notify_gicon_trampoline::<F> as *const (),
292 )),
293 Box_::into_raw(f),
294 )
295 }
296 }
297
298 #[doc(alias = "icon-name")]
299 pub fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
300 unsafe extern "C" fn notify_icon_name_trampoline<F: Fn(&Image) + 'static>(
301 this: *mut ffi::GtkImage,
302 _param_spec: glib::ffi::gpointer,
303 f: glib::ffi::gpointer,
304 ) {
305 let f: &F = &*(f as *const F);
306 f(&from_glib_borrow(this))
307 }
308 unsafe {
309 let f: Box_<F> = Box_::new(f);
310 connect_raw(
311 self.as_ptr() as *mut _,
312 c"notify::icon-name".as_ptr() as *const _,
313 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
314 notify_icon_name_trampoline::<F> as *const (),
315 )),
316 Box_::into_raw(f),
317 )
318 }
319 }
320
321 #[doc(alias = "icon-size")]
322 pub fn connect_icon_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
323 unsafe extern "C" fn notify_icon_size_trampoline<F: Fn(&Image) + 'static>(
324 this: *mut ffi::GtkImage,
325 _param_spec: glib::ffi::gpointer,
326 f: glib::ffi::gpointer,
327 ) {
328 let f: &F = &*(f as *const F);
329 f(&from_glib_borrow(this))
330 }
331 unsafe {
332 let f: Box_<F> = Box_::new(f);
333 connect_raw(
334 self.as_ptr() as *mut _,
335 c"notify::icon-size".as_ptr() as *const _,
336 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
337 notify_icon_size_trampoline::<F> as *const (),
338 )),
339 Box_::into_raw(f),
340 )
341 }
342 }
343
344 #[doc(alias = "paintable")]
345 pub fn connect_paintable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
346 unsafe extern "C" fn notify_paintable_trampoline<F: Fn(&Image) + 'static>(
347 this: *mut ffi::GtkImage,
348 _param_spec: glib::ffi::gpointer,
349 f: glib::ffi::gpointer,
350 ) {
351 let f: &F = &*(f as *const F);
352 f(&from_glib_borrow(this))
353 }
354 unsafe {
355 let f: Box_<F> = Box_::new(f);
356 connect_raw(
357 self.as_ptr() as *mut _,
358 c"notify::paintable".as_ptr() as *const _,
359 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
360 notify_paintable_trampoline::<F> as *const (),
361 )),
362 Box_::into_raw(f),
363 )
364 }
365 }
366
367 #[doc(alias = "pixel-size")]
368 pub fn connect_pixel_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
369 unsafe extern "C" fn notify_pixel_size_trampoline<F: Fn(&Image) + 'static>(
370 this: *mut ffi::GtkImage,
371 _param_spec: glib::ffi::gpointer,
372 f: glib::ffi::gpointer,
373 ) {
374 let f: &F = &*(f as *const F);
375 f(&from_glib_borrow(this))
376 }
377 unsafe {
378 let f: Box_<F> = Box_::new(f);
379 connect_raw(
380 self.as_ptr() as *mut _,
381 c"notify::pixel-size".as_ptr() as *const _,
382 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
383 notify_pixel_size_trampoline::<F> as *const (),
384 )),
385 Box_::into_raw(f),
386 )
387 }
388 }
389
390 #[doc(alias = "resource")]
391 pub fn connect_resource_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
392 unsafe extern "C" fn notify_resource_trampoline<F: Fn(&Image) + 'static>(
393 this: *mut ffi::GtkImage,
394 _param_spec: glib::ffi::gpointer,
395 f: glib::ffi::gpointer,
396 ) {
397 let f: &F = &*(f as *const F);
398 f(&from_glib_borrow(this))
399 }
400 unsafe {
401 let f: Box_<F> = Box_::new(f);
402 connect_raw(
403 self.as_ptr() as *mut _,
404 c"notify::resource".as_ptr() as *const _,
405 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
406 notify_resource_trampoline::<F> as *const (),
407 )),
408 Box_::into_raw(f),
409 )
410 }
411 }
412
413 #[doc(alias = "storage-type")]
414 pub fn connect_storage_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
415 unsafe extern "C" fn notify_storage_type_trampoline<F: Fn(&Image) + 'static>(
416 this: *mut ffi::GtkImage,
417 _param_spec: glib::ffi::gpointer,
418 f: glib::ffi::gpointer,
419 ) {
420 let f: &F = &*(f as *const F);
421 f(&from_glib_borrow(this))
422 }
423 unsafe {
424 let f: Box_<F> = Box_::new(f);
425 connect_raw(
426 self.as_ptr() as *mut _,
427 c"notify::storage-type".as_ptr() as *const _,
428 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
429 notify_storage_type_trampoline::<F> as *const (),
430 )),
431 Box_::into_raw(f),
432 )
433 }
434 }
435
436 #[doc(alias = "use-fallback")]
437 pub fn connect_use_fallback_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
438 unsafe extern "C" fn notify_use_fallback_trampoline<F: Fn(&Image) + 'static>(
439 this: *mut ffi::GtkImage,
440 _param_spec: glib::ffi::gpointer,
441 f: glib::ffi::gpointer,
442 ) {
443 let f: &F = &*(f as *const F);
444 f(&from_glib_borrow(this))
445 }
446 unsafe {
447 let f: Box_<F> = Box_::new(f);
448 connect_raw(
449 self.as_ptr() as *mut _,
450 c"notify::use-fallback".as_ptr() as *const _,
451 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
452 notify_use_fallback_trampoline::<F> as *const (),
453 )),
454 Box_::into_raw(f),
455 )
456 }
457 }
458}
459
460impl Default for Image {
461 fn default() -> Self {
462 Self::new()
463 }
464}
465
466#[must_use = "The builder must be built to be used"]
471pub struct ImageBuilder {
472 builder: glib::object::ObjectBuilder<'static, Image>,
473}
474
475impl ImageBuilder {
476 fn new() -> Self {
477 Self {
478 builder: glib::object::Object::builder(),
479 }
480 }
481
482 pub fn file(self, file: impl Into<glib::GString>) -> Self {
483 Self {
484 builder: self.builder.property("file", file.into()),
485 }
486 }
487
488 pub fn gicon(self, gicon: &impl IsA<gio::Icon>) -> Self {
489 Self {
490 builder: self.builder.property("gicon", gicon.clone().upcast()),
491 }
492 }
493
494 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
495 Self {
496 builder: self.builder.property("icon-name", icon_name.into()),
497 }
498 }
499
500 pub fn icon_size(self, icon_size: IconSize) -> Self {
501 Self {
502 builder: self.builder.property("icon-size", icon_size),
503 }
504 }
505
506 pub fn paintable(self, paintable: &impl IsA<gdk::Paintable>) -> Self {
507 Self {
508 builder: self
509 .builder
510 .property("paintable", paintable.clone().upcast()),
511 }
512 }
513
514 pub fn pixel_size(self, pixel_size: i32) -> Self {
515 Self {
516 builder: self.builder.property("pixel-size", pixel_size),
517 }
518 }
519
520 pub fn resource(self, resource: impl Into<glib::GString>) -> Self {
521 Self {
522 builder: self.builder.property("resource", resource.into()),
523 }
524 }
525
526 pub fn use_fallback(self, use_fallback: bool) -> Self {
527 Self {
528 builder: self.builder.property("use-fallback", use_fallback),
529 }
530 }
531
532 pub fn can_focus(self, can_focus: bool) -> Self {
533 Self {
534 builder: self.builder.property("can-focus", can_focus),
535 }
536 }
537
538 pub fn can_target(self, can_target: bool) -> Self {
539 Self {
540 builder: self.builder.property("can-target", can_target),
541 }
542 }
543
544 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
545 Self {
546 builder: self.builder.property("css-classes", css_classes.into()),
547 }
548 }
549
550 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
551 Self {
552 builder: self.builder.property("css-name", css_name.into()),
553 }
554 }
555
556 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
557 Self {
558 builder: self.builder.property("cursor", cursor.clone()),
559 }
560 }
561
562 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
563 Self {
564 builder: self.builder.property("focus-on-click", focus_on_click),
565 }
566 }
567
568 pub fn focusable(self, focusable: bool) -> Self {
569 Self {
570 builder: self.builder.property("focusable", focusable),
571 }
572 }
573
574 pub fn halign(self, halign: Align) -> Self {
575 Self {
576 builder: self.builder.property("halign", halign),
577 }
578 }
579
580 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
581 Self {
582 builder: self.builder.property("has-tooltip", has_tooltip),
583 }
584 }
585
586 pub fn height_request(self, height_request: i32) -> Self {
587 Self {
588 builder: self.builder.property("height-request", height_request),
589 }
590 }
591
592 pub fn hexpand(self, hexpand: bool) -> Self {
593 Self {
594 builder: self.builder.property("hexpand", hexpand),
595 }
596 }
597
598 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
599 Self {
600 builder: self.builder.property("hexpand-set", hexpand_set),
601 }
602 }
603
604 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
605 Self {
606 builder: self
607 .builder
608 .property("layout-manager", layout_manager.clone().upcast()),
609 }
610 }
611
612 #[cfg(feature = "v4_18")]
613 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
614 pub fn limit_events(self, limit_events: bool) -> Self {
615 Self {
616 builder: self.builder.property("limit-events", limit_events),
617 }
618 }
619
620 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
621 Self {
622 builder: self.builder.property("margin-bottom", margin_bottom),
623 }
624 }
625
626 pub fn margin_end(self, margin_end: i32) -> Self {
627 Self {
628 builder: self.builder.property("margin-end", margin_end),
629 }
630 }
631
632 pub fn margin_start(self, margin_start: i32) -> Self {
633 Self {
634 builder: self.builder.property("margin-start", margin_start),
635 }
636 }
637
638 pub fn margin_top(self, margin_top: i32) -> Self {
639 Self {
640 builder: self.builder.property("margin-top", margin_top),
641 }
642 }
643
644 pub fn name(self, name: impl Into<glib::GString>) -> Self {
645 Self {
646 builder: self.builder.property("name", name.into()),
647 }
648 }
649
650 pub fn opacity(self, opacity: f64) -> Self {
651 Self {
652 builder: self.builder.property("opacity", opacity),
653 }
654 }
655
656 pub fn overflow(self, overflow: Overflow) -> Self {
657 Self {
658 builder: self.builder.property("overflow", overflow),
659 }
660 }
661
662 pub fn receives_default(self, receives_default: bool) -> Self {
663 Self {
664 builder: self.builder.property("receives-default", receives_default),
665 }
666 }
667
668 pub fn sensitive(self, sensitive: bool) -> Self {
669 Self {
670 builder: self.builder.property("sensitive", sensitive),
671 }
672 }
673
674 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
675 Self {
676 builder: self
677 .builder
678 .property("tooltip-markup", tooltip_markup.into()),
679 }
680 }
681
682 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
683 Self {
684 builder: self.builder.property("tooltip-text", tooltip_text.into()),
685 }
686 }
687
688 pub fn valign(self, valign: Align) -> Self {
689 Self {
690 builder: self.builder.property("valign", valign),
691 }
692 }
693
694 pub fn vexpand(self, vexpand: bool) -> Self {
695 Self {
696 builder: self.builder.property("vexpand", vexpand),
697 }
698 }
699
700 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
701 Self {
702 builder: self.builder.property("vexpand-set", vexpand_set),
703 }
704 }
705
706 pub fn visible(self, visible: bool) -> Self {
707 Self {
708 builder: self.builder.property("visible", visible),
709 }
710 }
711
712 pub fn width_request(self, width_request: i32) -> Self {
713 Self {
714 builder: self.builder.property("width-request", width_request),
715 }
716 }
717
718 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
719 Self {
720 builder: self.builder.property("accessible-role", accessible_role),
721 }
722 }
723
724 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
727 pub fn build(self) -> Image {
728 assert_initialized_main_thread!();
729 self.builder.build()
730 }
731}