Skip to main content

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