libadwaita/auto/
window_title.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use crate::ffi;
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// A helper widget for setting a window's title and subtitle.
16    ///
17    /// <picture>
18    ///   <source srcset="window-title-dark.png" media="(prefers-color-scheme: dark)">
19    ///   <img src="window-title.png" alt="window-title">
20    /// </picture>
21    ///
22    /// [`WindowTitle`][crate::WindowTitle] shows a title and subtitle. It's intended to be used as the
23    /// title child of [`gtk::HeaderBar`][crate::gtk::HeaderBar] or [`HeaderBar`][crate::HeaderBar].
24    ///
25    /// ## CSS nodes
26    ///
27    /// [`WindowTitle`][crate::WindowTitle] has a single CSS node with name `windowtitle`.
28    ///
29    /// ## Properties
30    ///
31    ///
32    /// #### `subtitle`
33    ///  The subtitle to display.
34    ///
35    /// The subtitle should give the user additional details.
36    ///
37    /// Readable | Writeable
38    ///
39    ///
40    /// #### `title`
41    ///  The title to display.
42    ///
43    /// The title typically identifies the current view or content item, and
44    /// generally does not use the application name.
45    ///
46    /// Readable | Writeable
47    /// <details><summary><h4>Widget</h4></summary>
48    ///
49    ///
50    /// #### `can-focus`
51    ///  Whether the widget or any of its descendents can accept
52    /// the input focus.
53    ///
54    /// This property is meant to be set by widget implementations,
55    /// typically in their instance init function.
56    ///
57    /// Readable | Writeable
58    ///
59    ///
60    /// #### `can-target`
61    ///  Whether the widget can receive pointer events.
62    ///
63    /// Readable | Writeable
64    ///
65    ///
66    /// #### `css-classes`
67    ///  A list of css classes applied to this widget.
68    ///
69    /// Readable | Writeable
70    ///
71    ///
72    /// #### `css-name`
73    ///  The name of this widget in the CSS tree.
74    ///
75    /// This property is meant to be set by widget implementations,
76    /// typically in their instance init function.
77    ///
78    /// Readable | Writeable | Construct Only
79    ///
80    ///
81    /// #### `cursor`
82    ///  The cursor used by @widget.
83    ///
84    /// Readable | Writeable
85    ///
86    ///
87    /// #### `focus-on-click`
88    ///  Whether the widget should grab focus when it is clicked with the mouse.
89    ///
90    /// This property is only relevant for widgets that can take focus.
91    ///
92    /// Readable | Writeable
93    ///
94    ///
95    /// #### `focusable`
96    ///  Whether this widget itself will accept the input focus.
97    ///
98    /// Readable | Writeable
99    ///
100    ///
101    /// #### `halign`
102    ///  How to distribute horizontal space if widget gets extra space.
103    ///
104    /// Readable | Writeable
105    ///
106    ///
107    /// #### `has-default`
108    ///  Whether the widget is the default widget.
109    ///
110    /// Readable
111    ///
112    ///
113    /// #### `has-focus`
114    ///  Whether the widget has the input focus.
115    ///
116    /// Readable
117    ///
118    ///
119    /// #### `has-tooltip`
120    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
121    /// signal on @widget.
122    ///
123    /// A true value indicates that @widget can have a tooltip, in this case
124    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
125    /// determine whether it will provide a tooltip or not.
126    ///
127    /// Readable | Writeable
128    ///
129    ///
130    /// #### `height-request`
131    ///  Overrides for height request of the widget.
132    ///
133    /// If this is -1, the natural request will be used.
134    ///
135    /// Readable | Writeable
136    ///
137    ///
138    /// #### `hexpand`
139    ///  Whether to expand horizontally.
140    ///
141    /// Readable | Writeable
142    ///
143    ///
144    /// #### `hexpand-set`
145    ///  Whether to use the `hexpand` property.
146    ///
147    /// Readable | Writeable
148    ///
149    ///
150    /// #### `layout-manager`
151    ///  The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
152    /// the preferred size of the widget, and allocate its children.
153    ///
154    /// This property is meant to be set by widget implementations,
155    /// typically in their instance init function.
156    ///
157    /// Readable | Writeable
158    ///
159    ///
160    /// #### `limit-events`
161    ///  Makes this widget act like a modal dialog, with respect to
162    /// event delivery.
163    ///
164    /// Global event controllers will not handle events with targets
165    /// inside the widget, unless they are set up to ignore propagation
166    /// limits. See `Gtk::EventController::set_propagation_limit()`.
167    ///
168    /// Readable | Writeable
169    ///
170    ///
171    /// #### `margin-bottom`
172    ///  Margin on bottom side of widget.
173    ///
174    /// This property adds margin outside of the widget's normal size
175    /// request, the margin will be added in addition to the size from
176    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
177    ///
178    /// Readable | Writeable
179    ///
180    ///
181    /// #### `margin-end`
182    ///  Margin on end of widget, horizontally.
183    ///
184    /// This property supports left-to-right and right-to-left text
185    /// directions.
186    ///
187    /// This property adds margin outside of the widget's normal size
188    /// request, the margin will be added in addition to the size from
189    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
190    ///
191    /// Readable | Writeable
192    ///
193    ///
194    /// #### `margin-start`
195    ///  Margin on start of widget, horizontally.
196    ///
197    /// This property supports left-to-right and right-to-left text
198    /// directions.
199    ///
200    /// This property adds margin outside of the widget's normal size
201    /// request, the margin will be added in addition to the size from
202    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
203    ///
204    /// Readable | Writeable
205    ///
206    ///
207    /// #### `margin-top`
208    ///  Margin on top side of widget.
209    ///
210    /// This property adds margin outside of the widget's normal size
211    /// request, the margin will be added in addition to the size from
212    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
213    ///
214    /// Readable | Writeable
215    ///
216    ///
217    /// #### `name`
218    ///  The name of the widget.
219    ///
220    /// Readable | Writeable
221    ///
222    ///
223    /// #### `opacity`
224    ///  The requested opacity of the widget.
225    ///
226    /// Readable | Writeable
227    ///
228    ///
229    /// #### `overflow`
230    ///  How content outside the widget's content area is treated.
231    ///
232    /// This property is meant to be set by widget implementations,
233    /// typically in their instance init function.
234    ///
235    /// Readable | Writeable
236    ///
237    ///
238    /// #### `parent`
239    ///  The parent widget of this widget.
240    ///
241    /// Readable
242    ///
243    ///
244    /// #### `receives-default`
245    ///  Whether the widget will receive the default action when it is focused.
246    ///
247    /// Readable | Writeable
248    ///
249    ///
250    /// #### `root`
251    ///  The [`gtk::Root`][crate::gtk::Root] widget of the widget tree containing this widget.
252    ///
253    /// This will be `NULL` if the widget is not contained in a root widget.
254    ///
255    /// Readable
256    ///
257    ///
258    /// #### `scale-factor`
259    ///  The scale factor of the widget.
260    ///
261    /// Readable
262    ///
263    ///
264    /// #### `sensitive`
265    ///  Whether the widget responds to input.
266    ///
267    /// Readable | Writeable
268    ///
269    ///
270    /// #### `tooltip-markup`
271    ///  Sets the text of tooltip to be the given string, which is marked up
272    /// with Pango markup.
273    ///
274    /// Also see `Gtk::Tooltip::set_markup()`.
275    ///
276    /// This is a convenience property which will take care of getting the
277    /// tooltip shown if the given string is not `NULL`:
278    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
279    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
280    /// the default signal handler.
281    ///
282    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
283    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
284    ///
285    /// Readable | Writeable
286    ///
287    ///
288    /// #### `tooltip-text`
289    ///  Sets the text of tooltip to be the given string.
290    ///
291    /// Also see `Gtk::Tooltip::set_text()`.
292    ///
293    /// This is a convenience property which will take care of getting the
294    /// tooltip shown if the given string is not `NULL`:
295    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
296    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
297    /// the default signal handler.
298    ///
299    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
300    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
301    ///
302    /// Readable | Writeable
303    ///
304    ///
305    /// #### `valign`
306    ///  How to distribute vertical space if widget gets extra space.
307    ///
308    /// Readable | Writeable
309    ///
310    ///
311    /// #### `vexpand`
312    ///  Whether to expand vertically.
313    ///
314    /// Readable | Writeable
315    ///
316    ///
317    /// #### `vexpand-set`
318    ///  Whether to use the `vexpand` property.
319    ///
320    /// Readable | Writeable
321    ///
322    ///
323    /// #### `visible`
324    ///  Whether the widget is visible.
325    ///
326    /// Readable | Writeable
327    ///
328    ///
329    /// #### `width-request`
330    ///  Overrides for width request of the widget.
331    ///
332    /// If this is -1, the natural request will be used.
333    ///
334    /// Readable | Writeable
335    /// </details>
336    /// <details><summary><h4>Accessible</h4></summary>
337    ///
338    ///
339    /// #### `accessible-role`
340    ///  The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
341    ///
342    /// The accessible role cannot be changed once set.
343    ///
344    /// Readable | Writeable
345    /// </details>
346    ///
347    /// # Implements
348    ///
349    /// [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`]
350    #[doc(alias = "AdwWindowTitle")]
351    pub struct WindowTitle(Object<ffi::AdwWindowTitle, ffi::AdwWindowTitleClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;
352
353    match fn {
354        type_ => || ffi::adw_window_title_get_type(),
355    }
356}
357
358impl WindowTitle {
359    /// Creates a new [`WindowTitle`][crate::WindowTitle].
360    /// ## `title`
361    /// a title
362    /// ## `subtitle`
363    /// a subtitle
364    ///
365    /// # Returns
366    ///
367    /// the newly created [`WindowTitle`][crate::WindowTitle]
368    #[doc(alias = "adw_window_title_new")]
369    pub fn new(title: &str, subtitle: &str) -> WindowTitle {
370        assert_initialized_main_thread!();
371        unsafe {
372            gtk::Widget::from_glib_none(ffi::adw_window_title_new(
373                title.to_glib_none().0,
374                subtitle.to_glib_none().0,
375            ))
376            .unsafe_cast()
377        }
378    }
379
380    // rustdoc-stripper-ignore-next
381    /// Creates a new builder-pattern struct instance to construct [`WindowTitle`] objects.
382    ///
383    /// This method returns an instance of [`WindowTitleBuilder`](crate::builders::WindowTitleBuilder) which can be used to create [`WindowTitle`] objects.
384    pub fn builder() -> WindowTitleBuilder {
385        WindowTitleBuilder::new()
386    }
387
388    /// Gets the subtitle of @self.
389    ///
390    /// # Returns
391    ///
392    /// the subtitle
393    #[doc(alias = "adw_window_title_get_subtitle")]
394    #[doc(alias = "get_subtitle")]
395    pub fn subtitle(&self) -> glib::GString {
396        unsafe { from_glib_none(ffi::adw_window_title_get_subtitle(self.to_glib_none().0)) }
397    }
398
399    /// Gets the title of @self.
400    ///
401    /// # Returns
402    ///
403    /// the title
404    #[doc(alias = "adw_window_title_get_title")]
405    #[doc(alias = "get_title")]
406    pub fn title(&self) -> glib::GString {
407        unsafe { from_glib_none(ffi::adw_window_title_get_title(self.to_glib_none().0)) }
408    }
409
410    /// Sets the subtitle of @self.
411    ///
412    /// The subtitle should give the user additional details.
413    /// ## `subtitle`
414    /// a subtitle
415    #[doc(alias = "adw_window_title_set_subtitle")]
416    #[doc(alias = "subtitle")]
417    pub fn set_subtitle(&self, subtitle: &str) {
418        unsafe {
419            ffi::adw_window_title_set_subtitle(self.to_glib_none().0, subtitle.to_glib_none().0);
420        }
421    }
422
423    /// Sets the title of @self.
424    ///
425    /// The title typically identifies the current view or content item, and
426    /// generally does not use the application name.
427    /// ## `title`
428    /// a title
429    #[doc(alias = "adw_window_title_set_title")]
430    #[doc(alias = "title")]
431    pub fn set_title(&self, title: &str) {
432        unsafe {
433            ffi::adw_window_title_set_title(self.to_glib_none().0, title.to_glib_none().0);
434        }
435    }
436
437    #[doc(alias = "subtitle")]
438    pub fn connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
439        unsafe extern "C" fn notify_subtitle_trampoline<F: Fn(&WindowTitle) + 'static>(
440            this: *mut ffi::AdwWindowTitle,
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                c"notify::subtitle".as_ptr() as *const _,
452                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
453                    notify_subtitle_trampoline::<F> as *const (),
454                )),
455                Box_::into_raw(f),
456            )
457        }
458    }
459
460    #[doc(alias = "title")]
461    pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
462        unsafe extern "C" fn notify_title_trampoline<F: Fn(&WindowTitle) + 'static>(
463            this: *mut ffi::AdwWindowTitle,
464            _param_spec: glib::ffi::gpointer,
465            f: glib::ffi::gpointer,
466        ) {
467            let f: &F = &*(f as *const F);
468            f(&from_glib_borrow(this))
469        }
470        unsafe {
471            let f: Box_<F> = Box_::new(f);
472            connect_raw(
473                self.as_ptr() as *mut _,
474                c"notify::title".as_ptr() as *const _,
475                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
476                    notify_title_trampoline::<F> as *const (),
477                )),
478                Box_::into_raw(f),
479            )
480        }
481    }
482}
483
484impl Default for WindowTitle {
485    fn default() -> Self {
486        glib::object::Object::new::<Self>()
487    }
488}
489
490// rustdoc-stripper-ignore-next
491/// A [builder-pattern] type to construct [`WindowTitle`] objects.
492///
493/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
494#[must_use = "The builder must be built to be used"]
495pub struct WindowTitleBuilder {
496    builder: glib::object::ObjectBuilder<'static, WindowTitle>,
497}
498
499impl WindowTitleBuilder {
500    fn new() -> Self {
501        Self {
502            builder: glib::object::Object::builder(),
503        }
504    }
505
506    /// The subtitle to display.
507    ///
508    /// The subtitle should give the user additional details.
509    pub fn subtitle(self, subtitle: impl Into<glib::GString>) -> Self {
510        Self {
511            builder: self.builder.property("subtitle", subtitle.into()),
512        }
513    }
514
515    /// The title to display.
516    ///
517    /// The title typically identifies the current view or content item, and
518    /// generally does not use the application name.
519    pub fn title(self, title: impl Into<glib::GString>) -> Self {
520        Self {
521            builder: self.builder.property("title", title.into()),
522        }
523    }
524
525    /// Whether the widget or any of its descendents can accept
526    /// the input focus.
527    ///
528    /// This property is meant to be set by widget implementations,
529    /// typically in their instance init function.
530    pub fn can_focus(self, can_focus: bool) -> Self {
531        Self {
532            builder: self.builder.property("can-focus", can_focus),
533        }
534    }
535
536    /// Whether the widget can receive pointer events.
537    pub fn can_target(self, can_target: bool) -> Self {
538        Self {
539            builder: self.builder.property("can-target", can_target),
540        }
541    }
542
543    /// A list of css classes applied to this widget.
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    /// The name of this widget in the CSS tree.
551    ///
552    /// This property is meant to be set by widget implementations,
553    /// typically in their instance init function.
554    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
555        Self {
556            builder: self.builder.property("css-name", css_name.into()),
557        }
558    }
559
560    /// The cursor used by @widget.
561    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
562        Self {
563            builder: self.builder.property("cursor", cursor.clone()),
564        }
565    }
566
567    /// Whether the widget should grab focus when it is clicked with the mouse.
568    ///
569    /// This property is only relevant for widgets that can take focus.
570    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
571        Self {
572            builder: self.builder.property("focus-on-click", focus_on_click),
573        }
574    }
575
576    /// Whether this widget itself will accept the input focus.
577    pub fn focusable(self, focusable: bool) -> Self {
578        Self {
579            builder: self.builder.property("focusable", focusable),
580        }
581    }
582
583    /// How to distribute horizontal space if widget gets extra space.
584    pub fn halign(self, halign: gtk::Align) -> Self {
585        Self {
586            builder: self.builder.property("halign", halign),
587        }
588    }
589
590    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
591    /// signal on @widget.
592    ///
593    /// A true value indicates that @widget can have a tooltip, in this case
594    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
595    /// determine whether it will provide a tooltip or not.
596    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
597        Self {
598            builder: self.builder.property("has-tooltip", has_tooltip),
599        }
600    }
601
602    /// Overrides for height request of the widget.
603    ///
604    /// If this is -1, the natural request will be used.
605    pub fn height_request(self, height_request: i32) -> Self {
606        Self {
607            builder: self.builder.property("height-request", height_request),
608        }
609    }
610
611    /// Whether to expand horizontally.
612    pub fn hexpand(self, hexpand: bool) -> Self {
613        Self {
614            builder: self.builder.property("hexpand", hexpand),
615        }
616    }
617
618    /// Whether to use the `hexpand` property.
619    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
620        Self {
621            builder: self.builder.property("hexpand-set", hexpand_set),
622        }
623    }
624
625    /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
626    /// the preferred size of the widget, and allocate its children.
627    ///
628    /// This property is meant to be set by widget implementations,
629    /// typically in their instance init function.
630    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
631        Self {
632            builder: self
633                .builder
634                .property("layout-manager", layout_manager.clone().upcast()),
635        }
636    }
637
638    /// Makes this widget act like a modal dialog, with respect to
639    /// event delivery.
640    ///
641    /// Global event controllers will not handle events with targets
642    /// inside the widget, unless they are set up to ignore propagation
643    /// limits. See `Gtk::EventController::set_propagation_limit()`.
644    #[cfg(feature = "gtk_v4_18")]
645    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
646    pub fn limit_events(self, limit_events: bool) -> Self {
647        Self {
648            builder: self.builder.property("limit-events", limit_events),
649        }
650    }
651
652    /// Margin on bottom side of widget.
653    ///
654    /// This property adds margin outside of the widget's normal size
655    /// request, the margin will be added in addition to the size from
656    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
657    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
658        Self {
659            builder: self.builder.property("margin-bottom", margin_bottom),
660        }
661    }
662
663    /// Margin on end of widget, horizontally.
664    ///
665    /// This property supports left-to-right and right-to-left text
666    /// directions.
667    ///
668    /// This property adds margin outside of the widget's normal size
669    /// request, the margin will be added in addition to the size from
670    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
671    pub fn margin_end(self, margin_end: i32) -> Self {
672        Self {
673            builder: self.builder.property("margin-end", margin_end),
674        }
675    }
676
677    /// Margin on start of widget, horizontally.
678    ///
679    /// This property supports left-to-right and right-to-left text
680    /// directions.
681    ///
682    /// This property adds margin outside of the widget's normal size
683    /// request, the margin will be added in addition to the size from
684    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
685    pub fn margin_start(self, margin_start: i32) -> Self {
686        Self {
687            builder: self.builder.property("margin-start", margin_start),
688        }
689    }
690
691    /// Margin on top side of widget.
692    ///
693    /// This property adds margin outside of the widget's normal size
694    /// request, the margin will be added in addition to the size from
695    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
696    pub fn margin_top(self, margin_top: i32) -> Self {
697        Self {
698            builder: self.builder.property("margin-top", margin_top),
699        }
700    }
701
702    /// The name of the widget.
703    pub fn name(self, name: impl Into<glib::GString>) -> Self {
704        Self {
705            builder: self.builder.property("name", name.into()),
706        }
707    }
708
709    /// The requested opacity of the widget.
710    pub fn opacity(self, opacity: f64) -> Self {
711        Self {
712            builder: self.builder.property("opacity", opacity),
713        }
714    }
715
716    /// How content outside the widget's content area is treated.
717    ///
718    /// This property is meant to be set by widget implementations,
719    /// typically in their instance init function.
720    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
721        Self {
722            builder: self.builder.property("overflow", overflow),
723        }
724    }
725
726    /// Whether the widget will receive the default action when it is focused.
727    pub fn receives_default(self, receives_default: bool) -> Self {
728        Self {
729            builder: self.builder.property("receives-default", receives_default),
730        }
731    }
732
733    /// Whether the widget responds to input.
734    pub fn sensitive(self, sensitive: bool) -> Self {
735        Self {
736            builder: self.builder.property("sensitive", sensitive),
737        }
738    }
739
740    /// Sets the text of tooltip to be the given string, which is marked up
741    /// with Pango markup.
742    ///
743    /// Also see `Gtk::Tooltip::set_markup()`.
744    ///
745    /// This is a convenience property which will take care of getting the
746    /// tooltip shown if the given string is not `NULL`:
747    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
748    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
749    /// the default signal handler.
750    ///
751    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
752    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
753    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
754        Self {
755            builder: self
756                .builder
757                .property("tooltip-markup", tooltip_markup.into()),
758        }
759    }
760
761    /// Sets the text of tooltip to be the given string.
762    ///
763    /// Also see `Gtk::Tooltip::set_text()`.
764    ///
765    /// This is a convenience property which will take care of getting the
766    /// tooltip shown if the given string is not `NULL`:
767    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
768    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
769    /// the default signal handler.
770    ///
771    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
772    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
773    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
774        Self {
775            builder: self.builder.property("tooltip-text", tooltip_text.into()),
776        }
777    }
778
779    /// How to distribute vertical space if widget gets extra space.
780    pub fn valign(self, valign: gtk::Align) -> Self {
781        Self {
782            builder: self.builder.property("valign", valign),
783        }
784    }
785
786    /// Whether to expand vertically.
787    pub fn vexpand(self, vexpand: bool) -> Self {
788        Self {
789            builder: self.builder.property("vexpand", vexpand),
790        }
791    }
792
793    /// Whether to use the `vexpand` property.
794    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
795        Self {
796            builder: self.builder.property("vexpand-set", vexpand_set),
797        }
798    }
799
800    /// Whether the widget is visible.
801    pub fn visible(self, visible: bool) -> Self {
802        Self {
803            builder: self.builder.property("visible", visible),
804        }
805    }
806
807    /// Overrides for width request of the widget.
808    ///
809    /// If this is -1, the natural request will be used.
810    pub fn width_request(self, width_request: i32) -> Self {
811        Self {
812            builder: self.builder.property("width-request", width_request),
813        }
814    }
815
816    /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
817    ///
818    /// The accessible role cannot be changed once set.
819    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
820        Self {
821            builder: self.builder.property("accessible-role", accessible_role),
822        }
823    }
824
825    // rustdoc-stripper-ignore-next
826    /// Build the [`WindowTitle`].
827    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
828    pub fn build(self) -> WindowTitle {
829        assert_initialized_main_thread!();
830        self.builder.build()
831    }
832}