Skip to main content

gtk4/auto/
image.rs

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#![allow(deprecated)]
5
6use crate::{
7    Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, IconSize, ImageType,
8    LayoutManager, Overflow, Widget, ffi,
9};
10use glib::{
11    prelude::*,
12    signal::{SignalHandlerId, connect_raw},
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    // rustdoc-stripper-ignore-next
106    /// Creates a new builder-pattern struct instance to construct [`Image`] objects.
107    ///
108    /// This method returns an instance of [`ImageBuilder`](crate::builders::ImageBuilder) which can be used to create [`Image`] objects.
109    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            unsafe {
260                let f: &F = &*(f as *const F);
261                f(&from_glib_borrow(this))
262            }
263        }
264        unsafe {
265            let f: Box_<F> = Box_::new(f);
266            connect_raw(
267                self.as_ptr() as *mut _,
268                c"notify::file".as_ptr(),
269                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
270                    notify_file_trampoline::<F> as *const (),
271                )),
272                Box_::into_raw(f),
273            )
274        }
275    }
276
277    #[doc(alias = "gicon")]
278    pub fn connect_gicon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
279        unsafe extern "C" fn notify_gicon_trampoline<F: Fn(&Image) + 'static>(
280            this: *mut ffi::GtkImage,
281            _param_spec: glib::ffi::gpointer,
282            f: glib::ffi::gpointer,
283        ) {
284            unsafe {
285                let f: &F = &*(f as *const F);
286                f(&from_glib_borrow(this))
287            }
288        }
289        unsafe {
290            let f: Box_<F> = Box_::new(f);
291            connect_raw(
292                self.as_ptr() as *mut _,
293                c"notify::gicon".as_ptr(),
294                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
295                    notify_gicon_trampoline::<F> as *const (),
296                )),
297                Box_::into_raw(f),
298            )
299        }
300    }
301
302    #[doc(alias = "icon-name")]
303    pub fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
304        unsafe extern "C" fn notify_icon_name_trampoline<F: Fn(&Image) + 'static>(
305            this: *mut ffi::GtkImage,
306            _param_spec: glib::ffi::gpointer,
307            f: glib::ffi::gpointer,
308        ) {
309            unsafe {
310                let f: &F = &*(f as *const F);
311                f(&from_glib_borrow(this))
312            }
313        }
314        unsafe {
315            let f: Box_<F> = Box_::new(f);
316            connect_raw(
317                self.as_ptr() as *mut _,
318                c"notify::icon-name".as_ptr(),
319                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
320                    notify_icon_name_trampoline::<F> as *const (),
321                )),
322                Box_::into_raw(f),
323            )
324        }
325    }
326
327    #[doc(alias = "icon-size")]
328    pub fn connect_icon_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
329        unsafe extern "C" fn notify_icon_size_trampoline<F: Fn(&Image) + 'static>(
330            this: *mut ffi::GtkImage,
331            _param_spec: glib::ffi::gpointer,
332            f: glib::ffi::gpointer,
333        ) {
334            unsafe {
335                let f: &F = &*(f as *const F);
336                f(&from_glib_borrow(this))
337            }
338        }
339        unsafe {
340            let f: Box_<F> = Box_::new(f);
341            connect_raw(
342                self.as_ptr() as *mut _,
343                c"notify::icon-size".as_ptr(),
344                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
345                    notify_icon_size_trampoline::<F> as *const (),
346                )),
347                Box_::into_raw(f),
348            )
349        }
350    }
351
352    #[doc(alias = "paintable")]
353    pub fn connect_paintable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
354        unsafe extern "C" fn notify_paintable_trampoline<F: Fn(&Image) + 'static>(
355            this: *mut ffi::GtkImage,
356            _param_spec: glib::ffi::gpointer,
357            f: glib::ffi::gpointer,
358        ) {
359            unsafe {
360                let f: &F = &*(f as *const F);
361                f(&from_glib_borrow(this))
362            }
363        }
364        unsafe {
365            let f: Box_<F> = Box_::new(f);
366            connect_raw(
367                self.as_ptr() as *mut _,
368                c"notify::paintable".as_ptr(),
369                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
370                    notify_paintable_trampoline::<F> as *const (),
371                )),
372                Box_::into_raw(f),
373            )
374        }
375    }
376
377    #[doc(alias = "pixel-size")]
378    pub fn connect_pixel_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
379        unsafe extern "C" fn notify_pixel_size_trampoline<F: Fn(&Image) + 'static>(
380            this: *mut ffi::GtkImage,
381            _param_spec: glib::ffi::gpointer,
382            f: glib::ffi::gpointer,
383        ) {
384            unsafe {
385                let f: &F = &*(f as *const F);
386                f(&from_glib_borrow(this))
387            }
388        }
389        unsafe {
390            let f: Box_<F> = Box_::new(f);
391            connect_raw(
392                self.as_ptr() as *mut _,
393                c"notify::pixel-size".as_ptr(),
394                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
395                    notify_pixel_size_trampoline::<F> as *const (),
396                )),
397                Box_::into_raw(f),
398            )
399        }
400    }
401
402    #[doc(alias = "resource")]
403    pub fn connect_resource_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
404        unsafe extern "C" fn notify_resource_trampoline<F: Fn(&Image) + 'static>(
405            this: *mut ffi::GtkImage,
406            _param_spec: glib::ffi::gpointer,
407            f: glib::ffi::gpointer,
408        ) {
409            unsafe {
410                let f: &F = &*(f as *const F);
411                f(&from_glib_borrow(this))
412            }
413        }
414        unsafe {
415            let f: Box_<F> = Box_::new(f);
416            connect_raw(
417                self.as_ptr() as *mut _,
418                c"notify::resource".as_ptr(),
419                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
420                    notify_resource_trampoline::<F> as *const (),
421                )),
422                Box_::into_raw(f),
423            )
424        }
425    }
426
427    #[doc(alias = "storage-type")]
428    pub fn connect_storage_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
429        unsafe extern "C" fn notify_storage_type_trampoline<F: Fn(&Image) + 'static>(
430            this: *mut ffi::GtkImage,
431            _param_spec: glib::ffi::gpointer,
432            f: glib::ffi::gpointer,
433        ) {
434            unsafe {
435                let f: &F = &*(f as *const F);
436                f(&from_glib_borrow(this))
437            }
438        }
439        unsafe {
440            let f: Box_<F> = Box_::new(f);
441            connect_raw(
442                self.as_ptr() as *mut _,
443                c"notify::storage-type".as_ptr(),
444                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
445                    notify_storage_type_trampoline::<F> as *const (),
446                )),
447                Box_::into_raw(f),
448            )
449        }
450    }
451
452    #[doc(alias = "use-fallback")]
453    pub fn connect_use_fallback_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
454        unsafe extern "C" fn notify_use_fallback_trampoline<F: Fn(&Image) + 'static>(
455            this: *mut ffi::GtkImage,
456            _param_spec: glib::ffi::gpointer,
457            f: glib::ffi::gpointer,
458        ) {
459            unsafe {
460                let f: &F = &*(f as *const F);
461                f(&from_glib_borrow(this))
462            }
463        }
464        unsafe {
465            let f: Box_<F> = Box_::new(f);
466            connect_raw(
467                self.as_ptr() as *mut _,
468                c"notify::use-fallback".as_ptr(),
469                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
470                    notify_use_fallback_trampoline::<F> as *const (),
471                )),
472                Box_::into_raw(f),
473            )
474        }
475    }
476}
477
478impl Default for Image {
479    fn default() -> Self {
480        Self::new()
481    }
482}
483
484// rustdoc-stripper-ignore-next
485/// A [builder-pattern] type to construct [`Image`] objects.
486///
487/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
488#[must_use = "The builder must be built to be used"]
489pub struct ImageBuilder {
490    builder: glib::object::ObjectBuilder<'static, Image>,
491}
492
493impl ImageBuilder {
494    fn new() -> Self {
495        Self {
496            builder: glib::object::Object::builder(),
497        }
498    }
499
500    pub fn file(self, file: impl Into<glib::GString>) -> Self {
501        Self {
502            builder: self.builder.property("file", file.into()),
503        }
504    }
505
506    pub fn gicon(self, gicon: &impl IsA<gio::Icon>) -> Self {
507        Self {
508            builder: self.builder.property("gicon", gicon.clone().upcast()),
509        }
510    }
511
512    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
513        Self {
514            builder: self.builder.property("icon-name", icon_name.into()),
515        }
516    }
517
518    pub fn icon_size(self, icon_size: IconSize) -> Self {
519        Self {
520            builder: self.builder.property("icon-size", icon_size),
521        }
522    }
523
524    pub fn paintable(self, paintable: &impl IsA<gdk::Paintable>) -> Self {
525        Self {
526            builder: self
527                .builder
528                .property("paintable", paintable.clone().upcast()),
529        }
530    }
531
532    pub fn pixel_size(self, pixel_size: i32) -> Self {
533        Self {
534            builder: self.builder.property("pixel-size", pixel_size),
535        }
536    }
537
538    pub fn resource(self, resource: impl Into<glib::GString>) -> Self {
539        Self {
540            builder: self.builder.property("resource", resource.into()),
541        }
542    }
543
544    pub fn use_fallback(self, use_fallback: bool) -> Self {
545        Self {
546            builder: self.builder.property("use-fallback", use_fallback),
547        }
548    }
549
550    pub fn can_focus(self, can_focus: bool) -> Self {
551        Self {
552            builder: self.builder.property("can-focus", can_focus),
553        }
554    }
555
556    pub fn can_target(self, can_target: bool) -> Self {
557        Self {
558            builder: self.builder.property("can-target", can_target),
559        }
560    }
561
562    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
563        Self {
564            builder: self.builder.property("css-classes", css_classes.into()),
565        }
566    }
567
568    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
569        Self {
570            builder: self.builder.property("css-name", css_name.into()),
571        }
572    }
573
574    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
575        Self {
576            builder: self.builder.property("cursor", cursor.clone()),
577        }
578    }
579
580    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
581        Self {
582            builder: self.builder.property("focus-on-click", focus_on_click),
583        }
584    }
585
586    pub fn focusable(self, focusable: bool) -> Self {
587        Self {
588            builder: self.builder.property("focusable", focusable),
589        }
590    }
591
592    pub fn halign(self, halign: Align) -> Self {
593        Self {
594            builder: self.builder.property("halign", halign),
595        }
596    }
597
598    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
599        Self {
600            builder: self.builder.property("has-tooltip", has_tooltip),
601        }
602    }
603
604    pub fn height_request(self, height_request: i32) -> Self {
605        Self {
606            builder: self.builder.property("height-request", height_request),
607        }
608    }
609
610    pub fn hexpand(self, hexpand: bool) -> Self {
611        Self {
612            builder: self.builder.property("hexpand", hexpand),
613        }
614    }
615
616    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
617        Self {
618            builder: self.builder.property("hexpand-set", hexpand_set),
619        }
620    }
621
622    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
623        Self {
624            builder: self
625                .builder
626                .property("layout-manager", layout_manager.clone().upcast()),
627        }
628    }
629
630    #[cfg(feature = "v4_18")]
631    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
632    pub fn limit_events(self, limit_events: bool) -> Self {
633        Self {
634            builder: self.builder.property("limit-events", limit_events),
635        }
636    }
637
638    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
639        Self {
640            builder: self.builder.property("margin-bottom", margin_bottom),
641        }
642    }
643
644    pub fn margin_end(self, margin_end: i32) -> Self {
645        Self {
646            builder: self.builder.property("margin-end", margin_end),
647        }
648    }
649
650    pub fn margin_start(self, margin_start: i32) -> Self {
651        Self {
652            builder: self.builder.property("margin-start", margin_start),
653        }
654    }
655
656    pub fn margin_top(self, margin_top: i32) -> Self {
657        Self {
658            builder: self.builder.property("margin-top", margin_top),
659        }
660    }
661
662    pub fn name(self, name: impl Into<glib::GString>) -> Self {
663        Self {
664            builder: self.builder.property("name", name.into()),
665        }
666    }
667
668    pub fn opacity(self, opacity: f64) -> Self {
669        Self {
670            builder: self.builder.property("opacity", opacity),
671        }
672    }
673
674    pub fn overflow(self, overflow: Overflow) -> Self {
675        Self {
676            builder: self.builder.property("overflow", overflow),
677        }
678    }
679
680    pub fn receives_default(self, receives_default: bool) -> Self {
681        Self {
682            builder: self.builder.property("receives-default", receives_default),
683        }
684    }
685
686    pub fn sensitive(self, sensitive: bool) -> Self {
687        Self {
688            builder: self.builder.property("sensitive", sensitive),
689        }
690    }
691
692    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
693        Self {
694            builder: self
695                .builder
696                .property("tooltip-markup", tooltip_markup.into()),
697        }
698    }
699
700    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
701        Self {
702            builder: self.builder.property("tooltip-text", tooltip_text.into()),
703        }
704    }
705
706    pub fn valign(self, valign: Align) -> Self {
707        Self {
708            builder: self.builder.property("valign", valign),
709        }
710    }
711
712    pub fn vexpand(self, vexpand: bool) -> Self {
713        Self {
714            builder: self.builder.property("vexpand", vexpand),
715        }
716    }
717
718    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
719        Self {
720            builder: self.builder.property("vexpand-set", vexpand_set),
721        }
722    }
723
724    pub fn visible(self, visible: bool) -> Self {
725        Self {
726            builder: self.builder.property("visible", visible),
727        }
728    }
729
730    pub fn width_request(self, width_request: i32) -> Self {
731        Self {
732            builder: self.builder.property("width-request", width_request),
733        }
734    }
735
736    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
737        Self {
738            builder: self.builder.property("accessible-role", accessible_role),
739        }
740    }
741
742    // rustdoc-stripper-ignore-next
743    /// Build the [`Image`].
744    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
745    pub fn build(self) -> Image {
746        assert_initialized_main_thread!();
747        self.builder.build()
748    }
749}