gtk4/auto/
inscription.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
5#[cfg(feature = "v4_14")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
7use crate::AccessibleText;
8use crate::{
9    ffi, Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, InscriptionOverflow,
10    LayoutManager, Overflow, Widget,
11};
12use glib::{
13    prelude::*,
14    signal::{connect_raw, SignalHandlerId},
15    translate::*,
16};
17use std::boxed::Box as Box_;
18
19#[cfg(feature = "v4_14")]
20#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
21glib::wrapper! {
22    /// [`Inscription`][crate::Inscription] is a widget to show text in a predefined area.
23    ///
24    /// You likely want to use [`Label`][crate::Label] instead as this widget is intended only
25    /// for a small subset of use cases. The main scenario envisaged is inside lists
26    /// such as [`ColumnView`][crate::ColumnView].
27    ///
28    /// While a [`Label`][crate::Label] sizes itself depending on the text that is displayed,
29    /// [`Inscription`][crate::Inscription] is given a size and inscribes the given text into that
30    /// space as well as it can.
31    ///
32    /// Users of this widget should take care to plan behaviour for the common case
33    /// where the text doesn't fit exactly in the allocated space.
34    ///
35    /// ## CSS nodes
36    ///
37    /// [`Inscription`][crate::Inscription] has a single CSS node with the name label.
38    ///
39    /// ## Properties
40    ///
41    ///
42    /// #### `attributes`
43    ///  A list of style attributes to apply to the text of the inscription.
44    ///
45    /// Readable | Writeable
46    ///
47    ///
48    /// #### `markup`
49    ///  Utility property that sets both the [`text`][struct@crate::Inscription#text] and
50    /// [`attributes`][struct@crate::Inscription#attributes] properties, mainly intended for use in
51    /// GtkBuilder ui files to ease translation support and bindings.
52    ///
53    /// This function uses `parse_markup()` to parse the markup into text and
54    /// attributes. The markup must be valid. If you cannot ensure that, consider using
55    /// `parse_markup()` and setting the two properties yourself.
56    ///
57    /// Writeable
58    ///
59    ///
60    /// #### `min-chars`
61    ///  The number of characters that should fit into the inscription at minimum.
62    ///
63    /// This influences the requested width, not the width actually given to the widget,
64    /// which might turn out to be larger.
65    ///
66    /// Note that this is an approximate character width, so some characters might be
67    /// wider and some might be thinner, so do not expect the number of characters to
68    /// exactly match.
69    ///
70    /// If you set this property to 0, the inscription will not request any width at all
71    /// and its width will be determined entirely by its surroundings.
72    ///
73    /// Readable | Writeable
74    ///
75    ///
76    /// #### `min-lines`
77    ///  The number of lines that should fit into the inscription at minimum.
78    ///
79    /// This influences the requested height, not the height actually given to the widget,
80    /// which might turn out to be larger.
81    ///
82    /// Note that this is an approximate line height, so if the text uses things like fancy
83    /// Unicode or attribute that influence the height, the text might not fit.
84    ///
85    /// If you set this property to 0, the inscription will not request any height at all
86    /// and its height will be determined entirely by its surroundings.
87    ///
88    /// Readable | Writeable
89    ///
90    ///
91    /// #### `nat-chars`
92    ///  The number of characters that should ideally fit into the inscription.
93    ///
94    /// This influences the requested width, not the width actually given to the widget.
95    /// The widget might turn out larger as well as smaller.
96    ///
97    /// If this property is set to a value smaller than [`min-chars`][struct@crate::Inscription#min-chars],
98    /// that value will be used. In particular, for the default value of 0, this will always
99    /// be the case.
100    ///
101    /// Readable | Writeable
102    ///
103    ///
104    /// #### `nat-lines`
105    ///  The number of lines that should ideally fit into the inscription.
106    ///
107    /// This influences the requested height, not the height actually given to the widget.
108    /// The widget might turn out larger as well as smaller.
109    ///
110    /// If this property is set to a value smaller than [`min-lines`][struct@crate::Inscription#min-lines],
111    /// that value will be used. In particular, for the default value of 0, this will always
112    /// be the case.
113    ///
114    /// Readable | Writeable
115    ///
116    ///
117    /// #### `text`
118    ///  The displayed text.
119    ///
120    /// Readable | Writeable
121    ///
122    ///
123    /// #### `text-overflow`
124    ///  The overflow method to use for the text.
125    ///
126    /// Readable | Writeable
127    ///
128    ///
129    /// #### `wrap-mode`
130    ///  Controls how the line wrapping is done.
131    ///
132    /// Note that unlike [`Label`][crate::Label], the default here is [`pango::WrapMode::WordChar`][crate::pango::WrapMode::WordChar].
133    ///
134    /// Readable | Writeable
135    ///
136    ///
137    /// #### `xalign`
138    ///  The horizontal alignment of the text inside the allocated size.
139    ///
140    /// Compare this to [`halign`][struct@crate::Widget#halign], which determines how the
141    /// inscription's size allocation is positioned in the available space.
142    ///
143    /// Readable | Writeable
144    ///
145    ///
146    /// #### `yalign`
147    ///  The vertical alignment of the text inside the allocated size.
148    ///
149    /// Compare this to [`valign`][struct@crate::Widget#valign], which determines how the
150    /// inscription's size allocation is positioned in the available space.
151    ///
152    /// Readable | Writeable
153    /// <details><summary><h4>Widget</h4></summary>
154    ///
155    ///
156    /// #### `can-focus`
157    ///  Whether the widget or any of its descendents can accept
158    /// the input focus.
159    ///
160    /// This property is meant to be set by widget implementations,
161    /// typically in their instance init function.
162    ///
163    /// Readable | Writeable
164    ///
165    ///
166    /// #### `can-target`
167    ///  Whether the widget can receive pointer events.
168    ///
169    /// Readable | Writeable
170    ///
171    ///
172    /// #### `css-classes`
173    ///  A list of css classes applied to this widget.
174    ///
175    /// Readable | Writeable
176    ///
177    ///
178    /// #### `css-name`
179    ///  The name of this widget in the CSS tree.
180    ///
181    /// This property is meant to be set by widget implementations,
182    /// typically in their instance init function.
183    ///
184    /// Readable | Writeable | Construct Only
185    ///
186    ///
187    /// #### `cursor`
188    ///  The cursor used by @widget.
189    ///
190    /// Readable | Writeable
191    ///
192    ///
193    /// #### `focus-on-click`
194    ///  Whether the widget should grab focus when it is clicked with the mouse.
195    ///
196    /// This property is only relevant for widgets that can take focus.
197    ///
198    /// Readable | Writeable
199    ///
200    ///
201    /// #### `focusable`
202    ///  Whether this widget itself will accept the input focus.
203    ///
204    /// Readable | Writeable
205    ///
206    ///
207    /// #### `halign`
208    ///  How to distribute horizontal space if widget gets extra space.
209    ///
210    /// Readable | Writeable
211    ///
212    ///
213    /// #### `has-default`
214    ///  Whether the widget is the default widget.
215    ///
216    /// Readable
217    ///
218    ///
219    /// #### `has-focus`
220    ///  Whether the widget has the input focus.
221    ///
222    /// Readable
223    ///
224    ///
225    /// #### `has-tooltip`
226    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
227    /// signal on @widget.
228    ///
229    /// A true value indicates that @widget can have a tooltip, in this case
230    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
231    /// determine whether it will provide a tooltip or not.
232    ///
233    /// Readable | Writeable
234    ///
235    ///
236    /// #### `height-request`
237    ///  Overrides for height request of the widget.
238    ///
239    /// If this is -1, the natural request will be used.
240    ///
241    /// Readable | Writeable
242    ///
243    ///
244    /// #### `hexpand`
245    ///  Whether to expand horizontally.
246    ///
247    /// Readable | Writeable
248    ///
249    ///
250    /// #### `hexpand-set`
251    ///  Whether to use the `hexpand` property.
252    ///
253    /// Readable | Writeable
254    ///
255    ///
256    /// #### `layout-manager`
257    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
258    /// the preferred size of the widget, and allocate its children.
259    ///
260    /// This property is meant to be set by widget implementations,
261    /// typically in their instance init function.
262    ///
263    /// Readable | Writeable
264    ///
265    ///
266    /// #### `limit-events`
267    ///  Makes this widget act like a modal dialog, with respect to
268    /// event delivery.
269    ///
270    /// Global event controllers will not handle events with targets
271    /// inside the widget, unless they are set up to ignore propagation
272    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
273    ///
274    /// Readable | Writeable
275    ///
276    ///
277    /// #### `margin-bottom`
278    ///  Margin on bottom side of widget.
279    ///
280    /// This property adds margin outside of the widget's normal size
281    /// request, the margin will be added in addition to the size from
282    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
283    ///
284    /// Readable | Writeable
285    ///
286    ///
287    /// #### `margin-end`
288    ///  Margin on end of widget, horizontally.
289    ///
290    /// This property supports left-to-right and right-to-left text
291    /// directions.
292    ///
293    /// This property adds margin outside of the widget's normal size
294    /// request, the margin will be added in addition to the size from
295    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
296    ///
297    /// Readable | Writeable
298    ///
299    ///
300    /// #### `margin-start`
301    ///  Margin on start of widget, horizontally.
302    ///
303    /// This property supports left-to-right and right-to-left text
304    /// directions.
305    ///
306    /// This property adds margin outside of the widget's normal size
307    /// request, the margin will be added in addition to the size from
308    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
309    ///
310    /// Readable | Writeable
311    ///
312    ///
313    /// #### `margin-top`
314    ///  Margin on top side of widget.
315    ///
316    /// This property adds margin outside of the widget's normal size
317    /// request, the margin will be added in addition to the size from
318    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
319    ///
320    /// Readable | Writeable
321    ///
322    ///
323    /// #### `name`
324    ///  The name of the widget.
325    ///
326    /// Readable | Writeable
327    ///
328    ///
329    /// #### `opacity`
330    ///  The requested opacity of the widget.
331    ///
332    /// Readable | Writeable
333    ///
334    ///
335    /// #### `overflow`
336    ///  How content outside the widget's content area is treated.
337    ///
338    /// This property is meant to be set by widget implementations,
339    /// typically in their instance init function.
340    ///
341    /// Readable | Writeable
342    ///
343    ///
344    /// #### `parent`
345    ///  The parent widget of this widget.
346    ///
347    /// Readable
348    ///
349    ///
350    /// #### `receives-default`
351    ///  Whether the widget will receive the default action when it is focused.
352    ///
353    /// Readable | Writeable
354    ///
355    ///
356    /// #### `root`
357    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
358    ///
359    /// This will be `NULL` if the widget is not contained in a root widget.
360    ///
361    /// Readable
362    ///
363    ///
364    /// #### `scale-factor`
365    ///  The scale factor of the widget.
366    ///
367    /// Readable
368    ///
369    ///
370    /// #### `sensitive`
371    ///  Whether the widget responds to input.
372    ///
373    /// Readable | Writeable
374    ///
375    ///
376    /// #### `tooltip-markup`
377    ///  Sets the text of tooltip to be the given string, which is marked up
378    /// with Pango markup.
379    ///
380    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
381    ///
382    /// This is a convenience property which will take care of getting the
383    /// tooltip shown if the given string is not `NULL`:
384    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
385    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
386    /// the default signal handler.
387    ///
388    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
389    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
390    ///
391    /// Readable | Writeable
392    ///
393    ///
394    /// #### `tooltip-text`
395    ///  Sets the text of tooltip to be the given string.
396    ///
397    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
398    ///
399    /// This is a convenience property which will take care of getting the
400    /// tooltip shown if the given string is not `NULL`:
401    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
402    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
403    /// the default signal handler.
404    ///
405    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
406    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
407    ///
408    /// Readable | Writeable
409    ///
410    ///
411    /// #### `valign`
412    ///  How to distribute vertical space if widget gets extra space.
413    ///
414    /// Readable | Writeable
415    ///
416    ///
417    /// #### `vexpand`
418    ///  Whether to expand vertically.
419    ///
420    /// Readable | Writeable
421    ///
422    ///
423    /// #### `vexpand-set`
424    ///  Whether to use the `vexpand` property.
425    ///
426    /// Readable | Writeable
427    ///
428    ///
429    /// #### `visible`
430    ///  Whether the widget is visible.
431    ///
432    /// Readable | Writeable
433    ///
434    ///
435    /// #### `width-request`
436    ///  Overrides for width request of the widget.
437    ///
438    /// If this is -1, the natural request will be used.
439    ///
440    /// Readable | Writeable
441    /// </details>
442    /// <details><summary><h4>Accessible</h4></summary>
443    ///
444    ///
445    /// #### `accessible-role`
446    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
447    ///
448    /// The accessible role cannot be changed once set.
449    ///
450    /// Readable | Writeable
451    /// </details>
452    ///
453    /// # Implements
454    ///
455    /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`AccessibleTextExt`][trait@crate::prelude::AccessibleTextExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
456    #[doc(alias = "GtkInscription")]
457    pub struct Inscription(Object<ffi::GtkInscription, ffi::GtkInscriptionClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, AccessibleText;
458
459    match fn {
460        type_ => || ffi::gtk_inscription_get_type(),
461    }
462}
463
464#[cfg(not(any(feature = "v4_14")))]
465glib::wrapper! {
466    #[doc(alias = "GtkInscription")]
467    pub struct Inscription(Object<ffi::GtkInscription, ffi::GtkInscriptionClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
468
469    match fn {
470        type_ => || ffi::gtk_inscription_get_type(),
471    }
472}
473
474impl Inscription {
475    /// Creates a new [`Inscription`][crate::Inscription] with the given text.
476    /// ## `text`
477    /// The text to display.
478    ///
479    /// # Returns
480    ///
481    /// a new [`Inscription`][crate::Inscription]
482    #[doc(alias = "gtk_inscription_new")]
483    pub fn new(text: Option<&str>) -> Inscription {
484        assert_initialized_main_thread!();
485        unsafe {
486            Widget::from_glib_none(ffi::gtk_inscription_new(text.to_glib_none().0)).unsafe_cast()
487        }
488    }
489
490    // rustdoc-stripper-ignore-next
491    /// Creates a new builder-pattern struct instance to construct [`Inscription`] objects.
492    ///
493    /// This method returns an instance of [`InscriptionBuilder`](crate::builders::InscriptionBuilder) which can be used to create [`Inscription`] objects.
494    pub fn builder() -> InscriptionBuilder {
495        InscriptionBuilder::new()
496    }
497
498    /// Gets the inscription's attribute list.
499    ///
500    /// # Returns
501    ///
502    /// the attribute list
503    #[doc(alias = "gtk_inscription_get_attributes")]
504    #[doc(alias = "get_attributes")]
505    pub fn attributes(&self) -> Option<pango::AttrList> {
506        unsafe { from_glib_none(ffi::gtk_inscription_get_attributes(self.to_glib_none().0)) }
507    }
508
509    /// Gets the `min-chars` of the inscription.
510    ///
511    /// See the [`min-chars`][struct@crate::Inscription#min-chars] property.
512    ///
513    /// # Returns
514    ///
515    /// the min-chars property
516    #[doc(alias = "gtk_inscription_get_min_chars")]
517    #[doc(alias = "get_min_chars")]
518    #[doc(alias = "min-chars")]
519    pub fn min_chars(&self) -> u32 {
520        unsafe { ffi::gtk_inscription_get_min_chars(self.to_glib_none().0) }
521    }
522
523    /// Gets the `min-lines` of the inscription.
524    ///
525    /// See the [`min-lines`][struct@crate::Inscription#min-lines] property.
526    ///
527    /// # Returns
528    ///
529    /// the min-lines property
530    #[doc(alias = "gtk_inscription_get_min_lines")]
531    #[doc(alias = "get_min_lines")]
532    #[doc(alias = "min-lines")]
533    pub fn min_lines(&self) -> u32 {
534        unsafe { ffi::gtk_inscription_get_min_lines(self.to_glib_none().0) }
535    }
536
537    /// Gets the `nat-chars` of the inscription.
538    ///
539    /// See the [`nat-chars`][struct@crate::Inscription#nat-chars] property.
540    ///
541    /// # Returns
542    ///
543    /// the nat-chars property
544    #[doc(alias = "gtk_inscription_get_nat_chars")]
545    #[doc(alias = "get_nat_chars")]
546    #[doc(alias = "nat-chars")]
547    pub fn nat_chars(&self) -> u32 {
548        unsafe { ffi::gtk_inscription_get_nat_chars(self.to_glib_none().0) }
549    }
550
551    /// Gets the `nat-lines` of the inscription.
552    ///
553    /// See the [`nat-lines`][struct@crate::Inscription#nat-lines] property.
554    ///
555    /// # Returns
556    ///
557    /// the nat-lines property
558    #[doc(alias = "gtk_inscription_get_nat_lines")]
559    #[doc(alias = "get_nat_lines")]
560    #[doc(alias = "nat-lines")]
561    pub fn nat_lines(&self) -> u32 {
562        unsafe { ffi::gtk_inscription_get_nat_lines(self.to_glib_none().0) }
563    }
564
565    /// Gets the text that is displayed.
566    ///
567    /// # Returns
568    ///
569    /// The displayed text
570    #[doc(alias = "gtk_inscription_get_text")]
571    #[doc(alias = "get_text")]
572    pub fn text(&self) -> Option<glib::GString> {
573        unsafe { from_glib_none(ffi::gtk_inscription_get_text(self.to_glib_none().0)) }
574    }
575
576    /// Gets the inscription's overflow method.
577    ///
578    /// # Returns
579    ///
580    /// the overflow method
581    #[doc(alias = "gtk_inscription_get_text_overflow")]
582    #[doc(alias = "get_text_overflow")]
583    #[doc(alias = "text-overflow")]
584    pub fn text_overflow(&self) -> InscriptionOverflow {
585        unsafe {
586            from_glib(ffi::gtk_inscription_get_text_overflow(
587                self.to_glib_none().0,
588            ))
589        }
590    }
591
592    /// Returns line wrap mode used by the inscription.
593    ///
594    /// See [`set_wrap_mode()`][Self::set_wrap_mode()].
595    ///
596    /// # Returns
597    ///
598    /// the line wrap mode
599    #[doc(alias = "gtk_inscription_get_wrap_mode")]
600    #[doc(alias = "get_wrap_mode")]
601    #[doc(alias = "wrap-mode")]
602    pub fn wrap_mode(&self) -> pango::WrapMode {
603        unsafe { from_glib(ffi::gtk_inscription_get_wrap_mode(self.to_glib_none().0)) }
604    }
605
606    /// Gets the `xalign` of the inscription.
607    ///
608    /// See the [`xalign`][struct@crate::Inscription#xalign] property.
609    ///
610    /// # Returns
611    ///
612    /// the xalign property
613    #[doc(alias = "gtk_inscription_get_xalign")]
614    #[doc(alias = "get_xalign")]
615    pub fn xalign(&self) -> f32 {
616        unsafe { ffi::gtk_inscription_get_xalign(self.to_glib_none().0) }
617    }
618
619    /// Gets the `yalign` of the inscription.
620    ///
621    /// See the [`yalign`][struct@crate::Inscription#yalign] property.
622    ///
623    /// # Returns
624    ///
625    /// the yalign property
626    #[doc(alias = "gtk_inscription_get_yalign")]
627    #[doc(alias = "get_yalign")]
628    pub fn yalign(&self) -> f32 {
629        unsafe { ffi::gtk_inscription_get_yalign(self.to_glib_none().0) }
630    }
631
632    /// Apply attributes to the inscription text.
633    ///
634    /// These attributes will not be evaluated for sizing the inscription.
635    /// ## `attrs`
636    /// a [`pango::AttrList`][crate::pango::AttrList]
637    #[doc(alias = "gtk_inscription_set_attributes")]
638    #[doc(alias = "attributes")]
639    pub fn set_attributes(&self, attrs: Option<&pango::AttrList>) {
640        unsafe {
641            ffi::gtk_inscription_set_attributes(self.to_glib_none().0, attrs.to_glib_none().0);
642        }
643    }
644
645    /// Utility function to set the text and attributes to be displayed.
646    ///
647    /// See the [`markup`][struct@crate::Inscription#markup] property.
648    /// ## `markup`
649    /// The markup to display
650    #[doc(alias = "gtk_inscription_set_markup")]
651    #[doc(alias = "markup")]
652    pub fn set_markup(&self, markup: Option<&str>) {
653        unsafe {
654            ffi::gtk_inscription_set_markup(self.to_glib_none().0, markup.to_glib_none().0);
655        }
656    }
657
658    /// Sets the `min-chars` of the inscription.
659    ///
660    /// See the [`min-chars`][struct@crate::Inscription#min-chars] property.
661    /// ## `min_chars`
662    /// the minimum number of characters that should fit, approximately
663    #[doc(alias = "gtk_inscription_set_min_chars")]
664    #[doc(alias = "min-chars")]
665    pub fn set_min_chars(&self, min_chars: u32) {
666        unsafe {
667            ffi::gtk_inscription_set_min_chars(self.to_glib_none().0, min_chars);
668        }
669    }
670
671    /// Sets the `min-lines` of the inscription.
672    ///
673    /// See the [`min-lines`][struct@crate::Inscription#min-lines] property.
674    /// ## `min_lines`
675    /// the minimum number of lines that should fit, approximately
676    #[doc(alias = "gtk_inscription_set_min_lines")]
677    #[doc(alias = "min-lines")]
678    pub fn set_min_lines(&self, min_lines: u32) {
679        unsafe {
680            ffi::gtk_inscription_set_min_lines(self.to_glib_none().0, min_lines);
681        }
682    }
683
684    /// Sets the `nat-chars` of the inscription.
685    ///
686    /// See the [`nat-chars`][struct@crate::Inscription#nat-chars] property.
687    /// ## `nat_chars`
688    /// the number of characters that should ideally fit, approximately
689    #[doc(alias = "gtk_inscription_set_nat_chars")]
690    #[doc(alias = "nat-chars")]
691    pub fn set_nat_chars(&self, nat_chars: u32) {
692        unsafe {
693            ffi::gtk_inscription_set_nat_chars(self.to_glib_none().0, nat_chars);
694        }
695    }
696
697    /// Sets the `nat-lines` of the inscription.
698    ///
699    /// See the [`nat-lines`][struct@crate::Inscription#nat-lines] property.
700    /// ## `nat_lines`
701    /// the number of lines that should ideally fit
702    #[doc(alias = "gtk_inscription_set_nat_lines")]
703    #[doc(alias = "nat-lines")]
704    pub fn set_nat_lines(&self, nat_lines: u32) {
705        unsafe {
706            ffi::gtk_inscription_set_nat_lines(self.to_glib_none().0, nat_lines);
707        }
708    }
709
710    /// Sets the text to be displayed.
711    /// ## `text`
712    /// The text to display
713    #[doc(alias = "gtk_inscription_set_text")]
714    #[doc(alias = "text")]
715    pub fn set_text(&self, text: Option<&str>) {
716        unsafe {
717            ffi::gtk_inscription_set_text(self.to_glib_none().0, text.to_glib_none().0);
718        }
719    }
720
721    /// Sets what to do when the text doesn't fit.
722    /// ## `overflow`
723    /// the overflow method to use
724    #[doc(alias = "gtk_inscription_set_text_overflow")]
725    #[doc(alias = "text-overflow")]
726    pub fn set_text_overflow(&self, overflow: InscriptionOverflow) {
727        unsafe {
728            ffi::gtk_inscription_set_text_overflow(self.to_glib_none().0, overflow.into_glib());
729        }
730    }
731
732    /// Controls how line wrapping is done.
733    /// ## `wrap_mode`
734    /// the line wrapping mode
735    #[doc(alias = "gtk_inscription_set_wrap_mode")]
736    #[doc(alias = "wrap-mode")]
737    pub fn set_wrap_mode(&self, wrap_mode: pango::WrapMode) {
738        unsafe {
739            ffi::gtk_inscription_set_wrap_mode(self.to_glib_none().0, wrap_mode.into_glib());
740        }
741    }
742
743    /// Sets the `xalign` of the inscription.
744    ///
745    /// See the [`xalign`][struct@crate::Inscription#xalign] property.
746    /// ## `xalign`
747    /// the new xalign value, between 0 and 1
748    #[doc(alias = "gtk_inscription_set_xalign")]
749    #[doc(alias = "xalign")]
750    pub fn set_xalign(&self, xalign: f32) {
751        unsafe {
752            ffi::gtk_inscription_set_xalign(self.to_glib_none().0, xalign);
753        }
754    }
755
756    /// Sets the `yalign` of the inscription.
757    ///
758    /// See the [`yalign`][struct@crate::Inscription#yalign] property.
759    /// ## `yalign`
760    /// the new yalign value, between 0 and 1
761    #[doc(alias = "gtk_inscription_set_yalign")]
762    #[doc(alias = "yalign")]
763    pub fn set_yalign(&self, yalign: f32) {
764        unsafe {
765            ffi::gtk_inscription_set_yalign(self.to_glib_none().0, yalign);
766        }
767    }
768
769    #[cfg(feature = "v4_8")]
770    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
771    #[doc(alias = "attributes")]
772    pub fn connect_attributes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
773        unsafe extern "C" fn notify_attributes_trampoline<F: Fn(&Inscription) + 'static>(
774            this: *mut ffi::GtkInscription,
775            _param_spec: glib::ffi::gpointer,
776            f: glib::ffi::gpointer,
777        ) {
778            let f: &F = &*(f as *const F);
779            f(&from_glib_borrow(this))
780        }
781        unsafe {
782            let f: Box_<F> = Box_::new(f);
783            connect_raw(
784                self.as_ptr() as *mut _,
785                b"notify::attributes\0".as_ptr() as *const _,
786                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
787                    notify_attributes_trampoline::<F> as *const (),
788                )),
789                Box_::into_raw(f),
790            )
791        }
792    }
793
794    #[cfg(feature = "v4_8")]
795    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
796    #[doc(alias = "markup")]
797    pub fn connect_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
798        unsafe extern "C" fn notify_markup_trampoline<F: Fn(&Inscription) + 'static>(
799            this: *mut ffi::GtkInscription,
800            _param_spec: glib::ffi::gpointer,
801            f: glib::ffi::gpointer,
802        ) {
803            let f: &F = &*(f as *const F);
804            f(&from_glib_borrow(this))
805        }
806        unsafe {
807            let f: Box_<F> = Box_::new(f);
808            connect_raw(
809                self.as_ptr() as *mut _,
810                b"notify::markup\0".as_ptr() as *const _,
811                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
812                    notify_markup_trampoline::<F> as *const (),
813                )),
814                Box_::into_raw(f),
815            )
816        }
817    }
818
819    #[cfg(feature = "v4_8")]
820    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
821    #[doc(alias = "min-chars")]
822    pub fn connect_min_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
823        unsafe extern "C" fn notify_min_chars_trampoline<F: Fn(&Inscription) + 'static>(
824            this: *mut ffi::GtkInscription,
825            _param_spec: glib::ffi::gpointer,
826            f: glib::ffi::gpointer,
827        ) {
828            let f: &F = &*(f as *const F);
829            f(&from_glib_borrow(this))
830        }
831        unsafe {
832            let f: Box_<F> = Box_::new(f);
833            connect_raw(
834                self.as_ptr() as *mut _,
835                b"notify::min-chars\0".as_ptr() as *const _,
836                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
837                    notify_min_chars_trampoline::<F> as *const (),
838                )),
839                Box_::into_raw(f),
840            )
841        }
842    }
843
844    #[cfg(feature = "v4_8")]
845    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
846    #[doc(alias = "min-lines")]
847    pub fn connect_min_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
848        unsafe extern "C" fn notify_min_lines_trampoline<F: Fn(&Inscription) + 'static>(
849            this: *mut ffi::GtkInscription,
850            _param_spec: glib::ffi::gpointer,
851            f: glib::ffi::gpointer,
852        ) {
853            let f: &F = &*(f as *const F);
854            f(&from_glib_borrow(this))
855        }
856        unsafe {
857            let f: Box_<F> = Box_::new(f);
858            connect_raw(
859                self.as_ptr() as *mut _,
860                b"notify::min-lines\0".as_ptr() as *const _,
861                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
862                    notify_min_lines_trampoline::<F> as *const (),
863                )),
864                Box_::into_raw(f),
865            )
866        }
867    }
868
869    #[cfg(feature = "v4_8")]
870    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
871    #[doc(alias = "nat-chars")]
872    pub fn connect_nat_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
873        unsafe extern "C" fn notify_nat_chars_trampoline<F: Fn(&Inscription) + 'static>(
874            this: *mut ffi::GtkInscription,
875            _param_spec: glib::ffi::gpointer,
876            f: glib::ffi::gpointer,
877        ) {
878            let f: &F = &*(f as *const F);
879            f(&from_glib_borrow(this))
880        }
881        unsafe {
882            let f: Box_<F> = Box_::new(f);
883            connect_raw(
884                self.as_ptr() as *mut _,
885                b"notify::nat-chars\0".as_ptr() as *const _,
886                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
887                    notify_nat_chars_trampoline::<F> as *const (),
888                )),
889                Box_::into_raw(f),
890            )
891        }
892    }
893
894    #[cfg(feature = "v4_8")]
895    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
896    #[doc(alias = "nat-lines")]
897    pub fn connect_nat_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
898        unsafe extern "C" fn notify_nat_lines_trampoline<F: Fn(&Inscription) + 'static>(
899            this: *mut ffi::GtkInscription,
900            _param_spec: glib::ffi::gpointer,
901            f: glib::ffi::gpointer,
902        ) {
903            let f: &F = &*(f as *const F);
904            f(&from_glib_borrow(this))
905        }
906        unsafe {
907            let f: Box_<F> = Box_::new(f);
908            connect_raw(
909                self.as_ptr() as *mut _,
910                b"notify::nat-lines\0".as_ptr() as *const _,
911                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
912                    notify_nat_lines_trampoline::<F> as *const (),
913                )),
914                Box_::into_raw(f),
915            )
916        }
917    }
918
919    #[cfg(feature = "v4_8")]
920    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
921    #[doc(alias = "text")]
922    pub fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
923        unsafe extern "C" fn notify_text_trampoline<F: Fn(&Inscription) + 'static>(
924            this: *mut ffi::GtkInscription,
925            _param_spec: glib::ffi::gpointer,
926            f: glib::ffi::gpointer,
927        ) {
928            let f: &F = &*(f as *const F);
929            f(&from_glib_borrow(this))
930        }
931        unsafe {
932            let f: Box_<F> = Box_::new(f);
933            connect_raw(
934                self.as_ptr() as *mut _,
935                b"notify::text\0".as_ptr() as *const _,
936                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
937                    notify_text_trampoline::<F> as *const (),
938                )),
939                Box_::into_raw(f),
940            )
941        }
942    }
943
944    #[cfg(feature = "v4_8")]
945    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
946    #[doc(alias = "text-overflow")]
947    pub fn connect_text_overflow_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
948        unsafe extern "C" fn notify_text_overflow_trampoline<F: Fn(&Inscription) + 'static>(
949            this: *mut ffi::GtkInscription,
950            _param_spec: glib::ffi::gpointer,
951            f: glib::ffi::gpointer,
952        ) {
953            let f: &F = &*(f as *const F);
954            f(&from_glib_borrow(this))
955        }
956        unsafe {
957            let f: Box_<F> = Box_::new(f);
958            connect_raw(
959                self.as_ptr() as *mut _,
960                b"notify::text-overflow\0".as_ptr() as *const _,
961                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
962                    notify_text_overflow_trampoline::<F> as *const (),
963                )),
964                Box_::into_raw(f),
965            )
966        }
967    }
968
969    #[cfg(feature = "v4_8")]
970    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
971    #[doc(alias = "wrap-mode")]
972    pub fn connect_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
973        unsafe extern "C" fn notify_wrap_mode_trampoline<F: Fn(&Inscription) + 'static>(
974            this: *mut ffi::GtkInscription,
975            _param_spec: glib::ffi::gpointer,
976            f: glib::ffi::gpointer,
977        ) {
978            let f: &F = &*(f as *const F);
979            f(&from_glib_borrow(this))
980        }
981        unsafe {
982            let f: Box_<F> = Box_::new(f);
983            connect_raw(
984                self.as_ptr() as *mut _,
985                b"notify::wrap-mode\0".as_ptr() as *const _,
986                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
987                    notify_wrap_mode_trampoline::<F> as *const (),
988                )),
989                Box_::into_raw(f),
990            )
991        }
992    }
993
994    #[cfg(feature = "v4_8")]
995    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
996    #[doc(alias = "xalign")]
997    pub fn connect_xalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
998        unsafe extern "C" fn notify_xalign_trampoline<F: Fn(&Inscription) + 'static>(
999            this: *mut ffi::GtkInscription,
1000            _param_spec: glib::ffi::gpointer,
1001            f: glib::ffi::gpointer,
1002        ) {
1003            let f: &F = &*(f as *const F);
1004            f(&from_glib_borrow(this))
1005        }
1006        unsafe {
1007            let f: Box_<F> = Box_::new(f);
1008            connect_raw(
1009                self.as_ptr() as *mut _,
1010                b"notify::xalign\0".as_ptr() as *const _,
1011                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1012                    notify_xalign_trampoline::<F> as *const (),
1013                )),
1014                Box_::into_raw(f),
1015            )
1016        }
1017    }
1018
1019    #[cfg(feature = "v4_8")]
1020    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1021    #[doc(alias = "yalign")]
1022    pub fn connect_yalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1023        unsafe extern "C" fn notify_yalign_trampoline<F: Fn(&Inscription) + 'static>(
1024            this: *mut ffi::GtkInscription,
1025            _param_spec: glib::ffi::gpointer,
1026            f: glib::ffi::gpointer,
1027        ) {
1028            let f: &F = &*(f as *const F);
1029            f(&from_glib_borrow(this))
1030        }
1031        unsafe {
1032            let f: Box_<F> = Box_::new(f);
1033            connect_raw(
1034                self.as_ptr() as *mut _,
1035                b"notify::yalign\0".as_ptr() as *const _,
1036                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1037                    notify_yalign_trampoline::<F> as *const (),
1038                )),
1039                Box_::into_raw(f),
1040            )
1041        }
1042    }
1043}
1044
1045#[cfg(feature = "v4_8")]
1046#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1047impl Default for Inscription {
1048    fn default() -> Self {
1049        glib::object::Object::new::<Self>()
1050    }
1051}
1052
1053// rustdoc-stripper-ignore-next
1054/// A [builder-pattern] type to construct [`Inscription`] objects.
1055///
1056/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1057#[must_use = "The builder must be built to be used"]
1058pub struct InscriptionBuilder {
1059    builder: glib::object::ObjectBuilder<'static, Inscription>,
1060}
1061
1062impl InscriptionBuilder {
1063    fn new() -> Self {
1064        Self {
1065            builder: glib::object::Object::builder(),
1066        }
1067    }
1068
1069    /// A list of style attributes to apply to the text of the inscription.
1070    #[cfg(feature = "v4_8")]
1071    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1072    pub fn attributes(self, attributes: &pango::AttrList) -> Self {
1073        Self {
1074            builder: self.builder.property("attributes", attributes.clone()),
1075        }
1076    }
1077
1078    /// Utility property that sets both the [`text`][struct@crate::Inscription#text] and
1079    /// [`attributes`][struct@crate::Inscription#attributes] properties, mainly intended for use in
1080    /// GtkBuilder ui files to ease translation support and bindings.
1081    ///
1082    /// This function uses `parse_markup()` to parse the markup into text and
1083    /// attributes. The markup must be valid. If you cannot ensure that, consider using
1084    /// `parse_markup()` and setting the two properties yourself.
1085    #[cfg(feature = "v4_8")]
1086    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1087    pub fn markup(self, markup: impl Into<glib::GString>) -> Self {
1088        Self {
1089            builder: self.builder.property("markup", markup.into()),
1090        }
1091    }
1092
1093    /// The number of characters that should fit into the inscription at minimum.
1094    ///
1095    /// This influences the requested width, not the width actually given to the widget,
1096    /// which might turn out to be larger.
1097    ///
1098    /// Note that this is an approximate character width, so some characters might be
1099    /// wider and some might be thinner, so do not expect the number of characters to
1100    /// exactly match.
1101    ///
1102    /// If you set this property to 0, the inscription will not request any width at all
1103    /// and its width will be determined entirely by its surroundings.
1104    #[cfg(feature = "v4_8")]
1105    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1106    pub fn min_chars(self, min_chars: u32) -> Self {
1107        Self {
1108            builder: self.builder.property("min-chars", min_chars),
1109        }
1110    }
1111
1112    /// The number of lines that should fit into the inscription at minimum.
1113    ///
1114    /// This influences the requested height, not the height actually given to the widget,
1115    /// which might turn out to be larger.
1116    ///
1117    /// Note that this is an approximate line height, so if the text uses things like fancy
1118    /// Unicode or attribute that influence the height, the text might not fit.
1119    ///
1120    /// If you set this property to 0, the inscription will not request any height at all
1121    /// and its height will be determined entirely by its surroundings.
1122    #[cfg(feature = "v4_8")]
1123    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1124    pub fn min_lines(self, min_lines: u32) -> Self {
1125        Self {
1126            builder: self.builder.property("min-lines", min_lines),
1127        }
1128    }
1129
1130    /// The number of characters that should ideally fit into the inscription.
1131    ///
1132    /// This influences the requested width, not the width actually given to the widget.
1133    /// The widget might turn out larger as well as smaller.
1134    ///
1135    /// If this property is set to a value smaller than [`min-chars`][struct@crate::Inscription#min-chars],
1136    /// that value will be used. In particular, for the default value of 0, this will always
1137    /// be the case.
1138    #[cfg(feature = "v4_8")]
1139    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1140    pub fn nat_chars(self, nat_chars: u32) -> Self {
1141        Self {
1142            builder: self.builder.property("nat-chars", nat_chars),
1143        }
1144    }
1145
1146    /// The number of lines that should ideally fit into the inscription.
1147    ///
1148    /// This influences the requested height, not the height actually given to the widget.
1149    /// The widget might turn out larger as well as smaller.
1150    ///
1151    /// If this property is set to a value smaller than [`min-lines`][struct@crate::Inscription#min-lines],
1152    /// that value will be used. In particular, for the default value of 0, this will always
1153    /// be the case.
1154    #[cfg(feature = "v4_8")]
1155    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1156    pub fn nat_lines(self, nat_lines: u32) -> Self {
1157        Self {
1158            builder: self.builder.property("nat-lines", nat_lines),
1159        }
1160    }
1161
1162    /// The displayed text.
1163    #[cfg(feature = "v4_8")]
1164    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1165    pub fn text(self, text: impl Into<glib::GString>) -> Self {
1166        Self {
1167            builder: self.builder.property("text", text.into()),
1168        }
1169    }
1170
1171    /// The overflow method to use for the text.
1172    #[cfg(feature = "v4_8")]
1173    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1174    pub fn text_overflow(self, text_overflow: InscriptionOverflow) -> Self {
1175        Self {
1176            builder: self.builder.property("text-overflow", text_overflow),
1177        }
1178    }
1179
1180    /// Controls how the line wrapping is done.
1181    ///
1182    /// Note that unlike [`Label`][crate::Label], the default here is [`pango::WrapMode::WordChar`][crate::pango::WrapMode::WordChar].
1183    #[cfg(feature = "v4_8")]
1184    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1185    pub fn wrap_mode(self, wrap_mode: pango::WrapMode) -> Self {
1186        Self {
1187            builder: self.builder.property("wrap-mode", wrap_mode),
1188        }
1189    }
1190
1191    /// The horizontal alignment of the text inside the allocated size.
1192    ///
1193    /// Compare this to [`halign`][struct@crate::Widget#halign], which determines how the
1194    /// inscription's size allocation is positioned in the available space.
1195    #[cfg(feature = "v4_8")]
1196    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1197    pub fn xalign(self, xalign: f32) -> Self {
1198        Self {
1199            builder: self.builder.property("xalign", xalign),
1200        }
1201    }
1202
1203    /// The vertical alignment of the text inside the allocated size.
1204    ///
1205    /// Compare this to [`valign`][struct@crate::Widget#valign], which determines how the
1206    /// inscription's size allocation is positioned in the available space.
1207    #[cfg(feature = "v4_8")]
1208    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1209    pub fn yalign(self, yalign: f32) -> Self {
1210        Self {
1211            builder: self.builder.property("yalign", yalign),
1212        }
1213    }
1214
1215    /// Whether the widget or any of its descendents can accept
1216    /// the input focus.
1217    ///
1218    /// This property is meant to be set by widget implementations,
1219    /// typically in their instance init function.
1220    pub fn can_focus(self, can_focus: bool) -> Self {
1221        Self {
1222            builder: self.builder.property("can-focus", can_focus),
1223        }
1224    }
1225
1226    /// Whether the widget can receive pointer events.
1227    pub fn can_target(self, can_target: bool) -> Self {
1228        Self {
1229            builder: self.builder.property("can-target", can_target),
1230        }
1231    }
1232
1233    /// A list of css classes applied to this widget.
1234    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1235        Self {
1236            builder: self.builder.property("css-classes", css_classes.into()),
1237        }
1238    }
1239
1240    /// The name of this widget in the CSS tree.
1241    ///
1242    /// This property is meant to be set by widget implementations,
1243    /// typically in their instance init function.
1244    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1245        Self {
1246            builder: self.builder.property("css-name", css_name.into()),
1247        }
1248    }
1249
1250    /// The cursor used by @widget.
1251    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1252        Self {
1253            builder: self.builder.property("cursor", cursor.clone()),
1254        }
1255    }
1256
1257    /// Whether the widget should grab focus when it is clicked with the mouse.
1258    ///
1259    /// This property is only relevant for widgets that can take focus.
1260    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1261        Self {
1262            builder: self.builder.property("focus-on-click", focus_on_click),
1263        }
1264    }
1265
1266    /// Whether this widget itself will accept the input focus.
1267    pub fn focusable(self, focusable: bool) -> Self {
1268        Self {
1269            builder: self.builder.property("focusable", focusable),
1270        }
1271    }
1272
1273    /// How to distribute horizontal space if widget gets extra space.
1274    pub fn halign(self, halign: Align) -> Self {
1275        Self {
1276            builder: self.builder.property("halign", halign),
1277        }
1278    }
1279
1280    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1281    /// signal on @widget.
1282    ///
1283    /// A true value indicates that @widget can have a tooltip, in this case
1284    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1285    /// determine whether it will provide a tooltip or not.
1286    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1287        Self {
1288            builder: self.builder.property("has-tooltip", has_tooltip),
1289        }
1290    }
1291
1292    /// Overrides for height request of the widget.
1293    ///
1294    /// If this is -1, the natural request will be used.
1295    pub fn height_request(self, height_request: i32) -> Self {
1296        Self {
1297            builder: self.builder.property("height-request", height_request),
1298        }
1299    }
1300
1301    /// Whether to expand horizontally.
1302    pub fn hexpand(self, hexpand: bool) -> Self {
1303        Self {
1304            builder: self.builder.property("hexpand", hexpand),
1305        }
1306    }
1307
1308    /// Whether to use the `hexpand` property.
1309    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1310        Self {
1311            builder: self.builder.property("hexpand-set", hexpand_set),
1312        }
1313    }
1314
1315    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1316    /// the preferred size of the widget, and allocate its children.
1317    ///
1318    /// This property is meant to be set by widget implementations,
1319    /// typically in their instance init function.
1320    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1321        Self {
1322            builder: self
1323                .builder
1324                .property("layout-manager", layout_manager.clone().upcast()),
1325        }
1326    }
1327
1328    /// Makes this widget act like a modal dialog, with respect to
1329    /// event delivery.
1330    ///
1331    /// Global event controllers will not handle events with targets
1332    /// inside the widget, unless they are set up to ignore propagation
1333    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1334    #[cfg(feature = "v4_18")]
1335    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1336    pub fn limit_events(self, limit_events: bool) -> Self {
1337        Self {
1338            builder: self.builder.property("limit-events", limit_events),
1339        }
1340    }
1341
1342    /// Margin on bottom side of widget.
1343    ///
1344    /// This property adds margin outside of the widget's normal size
1345    /// request, the margin will be added in addition to the size from
1346    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1347    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1348        Self {
1349            builder: self.builder.property("margin-bottom", margin_bottom),
1350        }
1351    }
1352
1353    /// Margin on end of widget, horizontally.
1354    ///
1355    /// This property supports left-to-right and right-to-left text
1356    /// directions.
1357    ///
1358    /// This property adds margin outside of the widget's normal size
1359    /// request, the margin will be added in addition to the size from
1360    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1361    pub fn margin_end(self, margin_end: i32) -> Self {
1362        Self {
1363            builder: self.builder.property("margin-end", margin_end),
1364        }
1365    }
1366
1367    /// Margin on start of widget, horizontally.
1368    ///
1369    /// This property supports left-to-right and right-to-left text
1370    /// directions.
1371    ///
1372    /// This property adds margin outside of the widget's normal size
1373    /// request, the margin will be added in addition to the size from
1374    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1375    pub fn margin_start(self, margin_start: i32) -> Self {
1376        Self {
1377            builder: self.builder.property("margin-start", margin_start),
1378        }
1379    }
1380
1381    /// Margin on top side of widget.
1382    ///
1383    /// This property adds margin outside of the widget's normal size
1384    /// request, the margin will be added in addition to the size from
1385    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1386    pub fn margin_top(self, margin_top: i32) -> Self {
1387        Self {
1388            builder: self.builder.property("margin-top", margin_top),
1389        }
1390    }
1391
1392    /// The name of the widget.
1393    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1394        Self {
1395            builder: self.builder.property("name", name.into()),
1396        }
1397    }
1398
1399    /// The requested opacity of the widget.
1400    pub fn opacity(self, opacity: f64) -> Self {
1401        Self {
1402            builder: self.builder.property("opacity", opacity),
1403        }
1404    }
1405
1406    /// How content outside the widget's content area is treated.
1407    ///
1408    /// This property is meant to be set by widget implementations,
1409    /// typically in their instance init function.
1410    pub fn overflow(self, overflow: Overflow) -> Self {
1411        Self {
1412            builder: self.builder.property("overflow", overflow),
1413        }
1414    }
1415
1416    /// Whether the widget will receive the default action when it is focused.
1417    pub fn receives_default(self, receives_default: bool) -> Self {
1418        Self {
1419            builder: self.builder.property("receives-default", receives_default),
1420        }
1421    }
1422
1423    /// Whether the widget responds to input.
1424    pub fn sensitive(self, sensitive: bool) -> Self {
1425        Self {
1426            builder: self.builder.property("sensitive", sensitive),
1427        }
1428    }
1429
1430    /// Sets the text of tooltip to be the given string, which is marked up
1431    /// with Pango markup.
1432    ///
1433    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1434    ///
1435    /// This is a convenience property which will take care of getting the
1436    /// tooltip shown if the given string is not `NULL`:
1437    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1438    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1439    /// the default signal handler.
1440    ///
1441    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1442    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1443    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1444        Self {
1445            builder: self
1446                .builder
1447                .property("tooltip-markup", tooltip_markup.into()),
1448        }
1449    }
1450
1451    /// Sets the text of tooltip to be the given string.
1452    ///
1453    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1454    ///
1455    /// This is a convenience property which will take care of getting the
1456    /// tooltip shown if the given string is not `NULL`:
1457    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1458    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1459    /// the default signal handler.
1460    ///
1461    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1462    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1463    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1464        Self {
1465            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1466        }
1467    }
1468
1469    /// How to distribute vertical space if widget gets extra space.
1470    pub fn valign(self, valign: Align) -> Self {
1471        Self {
1472            builder: self.builder.property("valign", valign),
1473        }
1474    }
1475
1476    /// Whether to expand vertically.
1477    pub fn vexpand(self, vexpand: bool) -> Self {
1478        Self {
1479            builder: self.builder.property("vexpand", vexpand),
1480        }
1481    }
1482
1483    /// Whether to use the `vexpand` property.
1484    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1485        Self {
1486            builder: self.builder.property("vexpand-set", vexpand_set),
1487        }
1488    }
1489
1490    /// Whether the widget is visible.
1491    pub fn visible(self, visible: bool) -> Self {
1492        Self {
1493            builder: self.builder.property("visible", visible),
1494        }
1495    }
1496
1497    /// Overrides for width request of the widget.
1498    ///
1499    /// If this is -1, the natural request will be used.
1500    pub fn width_request(self, width_request: i32) -> Self {
1501        Self {
1502            builder: self.builder.property("width-request", width_request),
1503        }
1504    }
1505
1506    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1507    ///
1508    /// The accessible role cannot be changed once set.
1509    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1510        Self {
1511            builder: self.builder.property("accessible-role", accessible_role),
1512        }
1513    }
1514
1515    // rustdoc-stripper-ignore-next
1516    /// Build the [`Inscription`].
1517    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1518    pub fn build(self) -> Inscription {
1519        assert_initialized_main_thread!();
1520        self.builder.build()
1521    }
1522}