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_14")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
7use crate::AccessibleText;
8use crate::{
9    Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, InscriptionOverflow,
10    LayoutManager, Overflow, Widget, ffi,
11};
12use glib::{
13    prelude::*,
14    signal::{SignalHandlerId, connect_raw},
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    /// Shows 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            unsafe {
779                let f: &F = &*(f as *const F);
780                f(&from_glib_borrow(this))
781            }
782        }
783        unsafe {
784            let f: Box_<F> = Box_::new(f);
785            connect_raw(
786                self.as_ptr() as *mut _,
787                c"notify::attributes".as_ptr() as *const _,
788                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
789                    notify_attributes_trampoline::<F> as *const (),
790                )),
791                Box_::into_raw(f),
792            )
793        }
794    }
795
796    #[cfg(feature = "v4_8")]
797    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
798    #[doc(alias = "markup")]
799    pub fn connect_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
800        unsafe extern "C" fn notify_markup_trampoline<F: Fn(&Inscription) + 'static>(
801            this: *mut ffi::GtkInscription,
802            _param_spec: glib::ffi::gpointer,
803            f: glib::ffi::gpointer,
804        ) {
805            unsafe {
806                let f: &F = &*(f as *const F);
807                f(&from_glib_borrow(this))
808            }
809        }
810        unsafe {
811            let f: Box_<F> = Box_::new(f);
812            connect_raw(
813                self.as_ptr() as *mut _,
814                c"notify::markup".as_ptr() as *const _,
815                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
816                    notify_markup_trampoline::<F> as *const (),
817                )),
818                Box_::into_raw(f),
819            )
820        }
821    }
822
823    #[cfg(feature = "v4_8")]
824    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
825    #[doc(alias = "min-chars")]
826    pub fn connect_min_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
827        unsafe extern "C" fn notify_min_chars_trampoline<F: Fn(&Inscription) + 'static>(
828            this: *mut ffi::GtkInscription,
829            _param_spec: glib::ffi::gpointer,
830            f: glib::ffi::gpointer,
831        ) {
832            unsafe {
833                let f: &F = &*(f as *const F);
834                f(&from_glib_borrow(this))
835            }
836        }
837        unsafe {
838            let f: Box_<F> = Box_::new(f);
839            connect_raw(
840                self.as_ptr() as *mut _,
841                c"notify::min-chars".as_ptr() as *const _,
842                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
843                    notify_min_chars_trampoline::<F> as *const (),
844                )),
845                Box_::into_raw(f),
846            )
847        }
848    }
849
850    #[cfg(feature = "v4_8")]
851    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
852    #[doc(alias = "min-lines")]
853    pub fn connect_min_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
854        unsafe extern "C" fn notify_min_lines_trampoline<F: Fn(&Inscription) + 'static>(
855            this: *mut ffi::GtkInscription,
856            _param_spec: glib::ffi::gpointer,
857            f: glib::ffi::gpointer,
858        ) {
859            unsafe {
860                let f: &F = &*(f as *const F);
861                f(&from_glib_borrow(this))
862            }
863        }
864        unsafe {
865            let f: Box_<F> = Box_::new(f);
866            connect_raw(
867                self.as_ptr() as *mut _,
868                c"notify::min-lines".as_ptr() as *const _,
869                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
870                    notify_min_lines_trampoline::<F> as *const (),
871                )),
872                Box_::into_raw(f),
873            )
874        }
875    }
876
877    #[cfg(feature = "v4_8")]
878    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
879    #[doc(alias = "nat-chars")]
880    pub fn connect_nat_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
881        unsafe extern "C" fn notify_nat_chars_trampoline<F: Fn(&Inscription) + 'static>(
882            this: *mut ffi::GtkInscription,
883            _param_spec: glib::ffi::gpointer,
884            f: glib::ffi::gpointer,
885        ) {
886            unsafe {
887                let f: &F = &*(f as *const F);
888                f(&from_glib_borrow(this))
889            }
890        }
891        unsafe {
892            let f: Box_<F> = Box_::new(f);
893            connect_raw(
894                self.as_ptr() as *mut _,
895                c"notify::nat-chars".as_ptr() as *const _,
896                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
897                    notify_nat_chars_trampoline::<F> as *const (),
898                )),
899                Box_::into_raw(f),
900            )
901        }
902    }
903
904    #[cfg(feature = "v4_8")]
905    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
906    #[doc(alias = "nat-lines")]
907    pub fn connect_nat_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
908        unsafe extern "C" fn notify_nat_lines_trampoline<F: Fn(&Inscription) + 'static>(
909            this: *mut ffi::GtkInscription,
910            _param_spec: glib::ffi::gpointer,
911            f: glib::ffi::gpointer,
912        ) {
913            unsafe {
914                let f: &F = &*(f as *const F);
915                f(&from_glib_borrow(this))
916            }
917        }
918        unsafe {
919            let f: Box_<F> = Box_::new(f);
920            connect_raw(
921                self.as_ptr() as *mut _,
922                c"notify::nat-lines".as_ptr() as *const _,
923                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
924                    notify_nat_lines_trampoline::<F> as *const (),
925                )),
926                Box_::into_raw(f),
927            )
928        }
929    }
930
931    #[cfg(feature = "v4_8")]
932    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
933    #[doc(alias = "text")]
934    pub fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
935        unsafe extern "C" fn notify_text_trampoline<F: Fn(&Inscription) + 'static>(
936            this: *mut ffi::GtkInscription,
937            _param_spec: glib::ffi::gpointer,
938            f: glib::ffi::gpointer,
939        ) {
940            unsafe {
941                let f: &F = &*(f as *const F);
942                f(&from_glib_borrow(this))
943            }
944        }
945        unsafe {
946            let f: Box_<F> = Box_::new(f);
947            connect_raw(
948                self.as_ptr() as *mut _,
949                c"notify::text".as_ptr() as *const _,
950                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
951                    notify_text_trampoline::<F> as *const (),
952                )),
953                Box_::into_raw(f),
954            )
955        }
956    }
957
958    #[cfg(feature = "v4_8")]
959    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
960    #[doc(alias = "text-overflow")]
961    pub fn connect_text_overflow_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
962        unsafe extern "C" fn notify_text_overflow_trampoline<F: Fn(&Inscription) + 'static>(
963            this: *mut ffi::GtkInscription,
964            _param_spec: glib::ffi::gpointer,
965            f: glib::ffi::gpointer,
966        ) {
967            unsafe {
968                let f: &F = &*(f as *const F);
969                f(&from_glib_borrow(this))
970            }
971        }
972        unsafe {
973            let f: Box_<F> = Box_::new(f);
974            connect_raw(
975                self.as_ptr() as *mut _,
976                c"notify::text-overflow".as_ptr() as *const _,
977                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
978                    notify_text_overflow_trampoline::<F> as *const (),
979                )),
980                Box_::into_raw(f),
981            )
982        }
983    }
984
985    #[cfg(feature = "v4_8")]
986    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
987    #[doc(alias = "wrap-mode")]
988    pub fn connect_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
989        unsafe extern "C" fn notify_wrap_mode_trampoline<F: Fn(&Inscription) + 'static>(
990            this: *mut ffi::GtkInscription,
991            _param_spec: glib::ffi::gpointer,
992            f: glib::ffi::gpointer,
993        ) {
994            unsafe {
995                let f: &F = &*(f as *const F);
996                f(&from_glib_borrow(this))
997            }
998        }
999        unsafe {
1000            let f: Box_<F> = Box_::new(f);
1001            connect_raw(
1002                self.as_ptr() as *mut _,
1003                c"notify::wrap-mode".as_ptr() as *const _,
1004                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1005                    notify_wrap_mode_trampoline::<F> as *const (),
1006                )),
1007                Box_::into_raw(f),
1008            )
1009        }
1010    }
1011
1012    #[cfg(feature = "v4_8")]
1013    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1014    #[doc(alias = "xalign")]
1015    pub fn connect_xalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1016        unsafe extern "C" fn notify_xalign_trampoline<F: Fn(&Inscription) + 'static>(
1017            this: *mut ffi::GtkInscription,
1018            _param_spec: glib::ffi::gpointer,
1019            f: glib::ffi::gpointer,
1020        ) {
1021            unsafe {
1022                let f: &F = &*(f as *const F);
1023                f(&from_glib_borrow(this))
1024            }
1025        }
1026        unsafe {
1027            let f: Box_<F> = Box_::new(f);
1028            connect_raw(
1029                self.as_ptr() as *mut _,
1030                c"notify::xalign".as_ptr() as *const _,
1031                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1032                    notify_xalign_trampoline::<F> as *const (),
1033                )),
1034                Box_::into_raw(f),
1035            )
1036        }
1037    }
1038
1039    #[cfg(feature = "v4_8")]
1040    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1041    #[doc(alias = "yalign")]
1042    pub fn connect_yalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1043        unsafe extern "C" fn notify_yalign_trampoline<F: Fn(&Inscription) + 'static>(
1044            this: *mut ffi::GtkInscription,
1045            _param_spec: glib::ffi::gpointer,
1046            f: glib::ffi::gpointer,
1047        ) {
1048            unsafe {
1049                let f: &F = &*(f as *const F);
1050                f(&from_glib_borrow(this))
1051            }
1052        }
1053        unsafe {
1054            let f: Box_<F> = Box_::new(f);
1055            connect_raw(
1056                self.as_ptr() as *mut _,
1057                c"notify::yalign".as_ptr() as *const _,
1058                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1059                    notify_yalign_trampoline::<F> as *const (),
1060                )),
1061                Box_::into_raw(f),
1062            )
1063        }
1064    }
1065}
1066
1067#[cfg(feature = "v4_8")]
1068#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1069impl Default for Inscription {
1070    fn default() -> Self {
1071        glib::object::Object::new::<Self>()
1072    }
1073}
1074
1075// rustdoc-stripper-ignore-next
1076/// A [builder-pattern] type to construct [`Inscription`] objects.
1077///
1078/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1079#[must_use = "The builder must be built to be used"]
1080pub struct InscriptionBuilder {
1081    builder: glib::object::ObjectBuilder<'static, Inscription>,
1082}
1083
1084impl InscriptionBuilder {
1085    fn new() -> Self {
1086        Self {
1087            builder: glib::object::Object::builder(),
1088        }
1089    }
1090
1091    /// A list of style attributes to apply to the text of the inscription.
1092    #[cfg(feature = "v4_8")]
1093    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1094    pub fn attributes(self, attributes: &pango::AttrList) -> Self {
1095        Self {
1096            builder: self.builder.property("attributes", attributes.clone()),
1097        }
1098    }
1099
1100    /// Utility property that sets both the [`text`][struct@crate::Inscription#text] and
1101    /// [`attributes`][struct@crate::Inscription#attributes] properties, mainly intended for use in
1102    /// GtkBuilder ui files to ease translation support and bindings.
1103    ///
1104    /// This function uses `parse_markup()` to parse the markup into text and
1105    /// attributes. The markup must be valid. If you cannot ensure that, consider using
1106    /// `parse_markup()` and setting the two properties yourself.
1107    #[cfg(feature = "v4_8")]
1108    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1109    pub fn markup(self, markup: impl Into<glib::GString>) -> Self {
1110        Self {
1111            builder: self.builder.property("markup", markup.into()),
1112        }
1113    }
1114
1115    /// The number of characters that should fit into the inscription at minimum.
1116    ///
1117    /// This influences the requested width, not the width actually given to the widget,
1118    /// which might turn out to be larger.
1119    ///
1120    /// Note that this is an approximate character width, so some characters might be
1121    /// wider and some might be thinner, so do not expect the number of characters to
1122    /// exactly match.
1123    ///
1124    /// If you set this property to 0, the inscription will not request any width at all
1125    /// and its width will be determined entirely by its surroundings.
1126    #[cfg(feature = "v4_8")]
1127    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1128    pub fn min_chars(self, min_chars: u32) -> Self {
1129        Self {
1130            builder: self.builder.property("min-chars", min_chars),
1131        }
1132    }
1133
1134    /// The number of lines that should fit into the inscription at minimum.
1135    ///
1136    /// This influences the requested height, not the height actually given to the widget,
1137    /// which might turn out to be larger.
1138    ///
1139    /// Note that this is an approximate line height, so if the text uses things like fancy
1140    /// Unicode or attribute that influence the height, the text might not fit.
1141    ///
1142    /// If you set this property to 0, the inscription will not request any height at all
1143    /// and its height will be determined entirely by its surroundings.
1144    #[cfg(feature = "v4_8")]
1145    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1146    pub fn min_lines(self, min_lines: u32) -> Self {
1147        Self {
1148            builder: self.builder.property("min-lines", min_lines),
1149        }
1150    }
1151
1152    /// The number of characters that should ideally fit into the inscription.
1153    ///
1154    /// This influences the requested width, not the width actually given to the widget.
1155    /// The widget might turn out larger as well as smaller.
1156    ///
1157    /// If this property is set to a value smaller than [`min-chars`][struct@crate::Inscription#min-chars],
1158    /// that value will be used. In particular, for the default value of 0, this will always
1159    /// be the case.
1160    #[cfg(feature = "v4_8")]
1161    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1162    pub fn nat_chars(self, nat_chars: u32) -> Self {
1163        Self {
1164            builder: self.builder.property("nat-chars", nat_chars),
1165        }
1166    }
1167
1168    /// The number of lines that should ideally fit into the inscription.
1169    ///
1170    /// This influences the requested height, not the height actually given to the widget.
1171    /// The widget might turn out larger as well as smaller.
1172    ///
1173    /// If this property is set to a value smaller than [`min-lines`][struct@crate::Inscription#min-lines],
1174    /// that value will be used. In particular, for the default value of 0, this will always
1175    /// be the case.
1176    #[cfg(feature = "v4_8")]
1177    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1178    pub fn nat_lines(self, nat_lines: u32) -> Self {
1179        Self {
1180            builder: self.builder.property("nat-lines", nat_lines),
1181        }
1182    }
1183
1184    /// The displayed text.
1185    #[cfg(feature = "v4_8")]
1186    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1187    pub fn text(self, text: impl Into<glib::GString>) -> Self {
1188        Self {
1189            builder: self.builder.property("text", text.into()),
1190        }
1191    }
1192
1193    /// The overflow method to use for the text.
1194    #[cfg(feature = "v4_8")]
1195    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1196    pub fn text_overflow(self, text_overflow: InscriptionOverflow) -> Self {
1197        Self {
1198            builder: self.builder.property("text-overflow", text_overflow),
1199        }
1200    }
1201
1202    /// Controls how the line wrapping is done.
1203    ///
1204    /// Note that unlike [`Label`][crate::Label], the default here is [`pango::WrapMode::WordChar`][crate::pango::WrapMode::WordChar].
1205    #[cfg(feature = "v4_8")]
1206    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1207    pub fn wrap_mode(self, wrap_mode: pango::WrapMode) -> Self {
1208        Self {
1209            builder: self.builder.property("wrap-mode", wrap_mode),
1210        }
1211    }
1212
1213    /// The horizontal alignment of the text inside the allocated size.
1214    ///
1215    /// Compare this to [`halign`][struct@crate::Widget#halign], which determines how the
1216    /// inscription's size allocation is positioned in the available space.
1217    #[cfg(feature = "v4_8")]
1218    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1219    pub fn xalign(self, xalign: f32) -> Self {
1220        Self {
1221            builder: self.builder.property("xalign", xalign),
1222        }
1223    }
1224
1225    /// The vertical alignment of the text inside the allocated size.
1226    ///
1227    /// Compare this to [`valign`][struct@crate::Widget#valign], which determines how the
1228    /// inscription's size allocation is positioned in the available space.
1229    #[cfg(feature = "v4_8")]
1230    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1231    pub fn yalign(self, yalign: f32) -> Self {
1232        Self {
1233            builder: self.builder.property("yalign", yalign),
1234        }
1235    }
1236
1237    /// Whether the widget or any of its descendents can accept
1238    /// the input focus.
1239    ///
1240    /// This property is meant to be set by widget implementations,
1241    /// typically in their instance init function.
1242    pub fn can_focus(self, can_focus: bool) -> Self {
1243        Self {
1244            builder: self.builder.property("can-focus", can_focus),
1245        }
1246    }
1247
1248    /// Whether the widget can receive pointer events.
1249    pub fn can_target(self, can_target: bool) -> Self {
1250        Self {
1251            builder: self.builder.property("can-target", can_target),
1252        }
1253    }
1254
1255    /// A list of css classes applied to this widget.
1256    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1257        Self {
1258            builder: self.builder.property("css-classes", css_classes.into()),
1259        }
1260    }
1261
1262    /// The name of this widget in the CSS tree.
1263    ///
1264    /// This property is meant to be set by widget implementations,
1265    /// typically in their instance init function.
1266    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1267        Self {
1268            builder: self.builder.property("css-name", css_name.into()),
1269        }
1270    }
1271
1272    /// The cursor used by @widget.
1273    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1274        Self {
1275            builder: self.builder.property("cursor", cursor.clone()),
1276        }
1277    }
1278
1279    /// Whether the widget should grab focus when it is clicked with the mouse.
1280    ///
1281    /// This property is only relevant for widgets that can take focus.
1282    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1283        Self {
1284            builder: self.builder.property("focus-on-click", focus_on_click),
1285        }
1286    }
1287
1288    /// Whether this widget itself will accept the input focus.
1289    pub fn focusable(self, focusable: bool) -> Self {
1290        Self {
1291            builder: self.builder.property("focusable", focusable),
1292        }
1293    }
1294
1295    /// How to distribute horizontal space if widget gets extra space.
1296    pub fn halign(self, halign: Align) -> Self {
1297        Self {
1298            builder: self.builder.property("halign", halign),
1299        }
1300    }
1301
1302    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1303    /// signal on @widget.
1304    ///
1305    /// A true value indicates that @widget can have a tooltip, in this case
1306    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1307    /// determine whether it will provide a tooltip or not.
1308    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1309        Self {
1310            builder: self.builder.property("has-tooltip", has_tooltip),
1311        }
1312    }
1313
1314    /// Overrides for height request of the widget.
1315    ///
1316    /// If this is -1, the natural request will be used.
1317    pub fn height_request(self, height_request: i32) -> Self {
1318        Self {
1319            builder: self.builder.property("height-request", height_request),
1320        }
1321    }
1322
1323    /// Whether to expand horizontally.
1324    pub fn hexpand(self, hexpand: bool) -> Self {
1325        Self {
1326            builder: self.builder.property("hexpand", hexpand),
1327        }
1328    }
1329
1330    /// Whether to use the `hexpand` property.
1331    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1332        Self {
1333            builder: self.builder.property("hexpand-set", hexpand_set),
1334        }
1335    }
1336
1337    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1338    /// the preferred size of the widget, and allocate its children.
1339    ///
1340    /// This property is meant to be set by widget implementations,
1341    /// typically in their instance init function.
1342    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1343        Self {
1344            builder: self
1345                .builder
1346                .property("layout-manager", layout_manager.clone().upcast()),
1347        }
1348    }
1349
1350    /// Makes this widget act like a modal dialog, with respect to
1351    /// event delivery.
1352    ///
1353    /// Global event controllers will not handle events with targets
1354    /// inside the widget, unless they are set up to ignore propagation
1355    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1356    #[cfg(feature = "v4_18")]
1357    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1358    pub fn limit_events(self, limit_events: bool) -> Self {
1359        Self {
1360            builder: self.builder.property("limit-events", limit_events),
1361        }
1362    }
1363
1364    /// Margin on bottom side of widget.
1365    ///
1366    /// This property adds margin outside of the widget's normal size
1367    /// request, the margin will be added in addition to the size from
1368    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1369    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1370        Self {
1371            builder: self.builder.property("margin-bottom", margin_bottom),
1372        }
1373    }
1374
1375    /// Margin on end of widget, horizontally.
1376    ///
1377    /// This property supports left-to-right and right-to-left text
1378    /// directions.
1379    ///
1380    /// This property adds margin outside of the widget's normal size
1381    /// request, the margin will be added in addition to the size from
1382    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1383    pub fn margin_end(self, margin_end: i32) -> Self {
1384        Self {
1385            builder: self.builder.property("margin-end", margin_end),
1386        }
1387    }
1388
1389    /// Margin on start of widget, horizontally.
1390    ///
1391    /// This property supports left-to-right and right-to-left text
1392    /// directions.
1393    ///
1394    /// This property adds margin outside of the widget's normal size
1395    /// request, the margin will be added in addition to the size from
1396    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1397    pub fn margin_start(self, margin_start: i32) -> Self {
1398        Self {
1399            builder: self.builder.property("margin-start", margin_start),
1400        }
1401    }
1402
1403    /// Margin on top side of widget.
1404    ///
1405    /// This property adds margin outside of the widget's normal size
1406    /// request, the margin will be added in addition to the size from
1407    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1408    pub fn margin_top(self, margin_top: i32) -> Self {
1409        Self {
1410            builder: self.builder.property("margin-top", margin_top),
1411        }
1412    }
1413
1414    /// The name of the widget.
1415    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1416        Self {
1417            builder: self.builder.property("name", name.into()),
1418        }
1419    }
1420
1421    /// The requested opacity of the widget.
1422    pub fn opacity(self, opacity: f64) -> Self {
1423        Self {
1424            builder: self.builder.property("opacity", opacity),
1425        }
1426    }
1427
1428    /// How content outside the widget's content area is treated.
1429    ///
1430    /// This property is meant to be set by widget implementations,
1431    /// typically in their instance init function.
1432    pub fn overflow(self, overflow: Overflow) -> Self {
1433        Self {
1434            builder: self.builder.property("overflow", overflow),
1435        }
1436    }
1437
1438    /// Whether the widget will receive the default action when it is focused.
1439    pub fn receives_default(self, receives_default: bool) -> Self {
1440        Self {
1441            builder: self.builder.property("receives-default", receives_default),
1442        }
1443    }
1444
1445    /// Whether the widget responds to input.
1446    pub fn sensitive(self, sensitive: bool) -> Self {
1447        Self {
1448            builder: self.builder.property("sensitive", sensitive),
1449        }
1450    }
1451
1452    /// Sets the text of tooltip to be the given string, which is marked up
1453    /// with Pango markup.
1454    ///
1455    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1456    ///
1457    /// This is a convenience property which will take care of getting the
1458    /// tooltip shown if the given string is not `NULL`:
1459    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1460    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1461    /// the default signal handler.
1462    ///
1463    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1464    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1465    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1466        Self {
1467            builder: self
1468                .builder
1469                .property("tooltip-markup", tooltip_markup.into()),
1470        }
1471    }
1472
1473    /// Sets the text of tooltip to be the given string.
1474    ///
1475    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1476    ///
1477    /// This is a convenience property which will take care of getting the
1478    /// tooltip shown if the given string is not `NULL`:
1479    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1480    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1481    /// the default signal handler.
1482    ///
1483    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1484    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1485    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1486        Self {
1487            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1488        }
1489    }
1490
1491    /// How to distribute vertical space if widget gets extra space.
1492    pub fn valign(self, valign: Align) -> Self {
1493        Self {
1494            builder: self.builder.property("valign", valign),
1495        }
1496    }
1497
1498    /// Whether to expand vertically.
1499    pub fn vexpand(self, vexpand: bool) -> Self {
1500        Self {
1501            builder: self.builder.property("vexpand", vexpand),
1502        }
1503    }
1504
1505    /// Whether to use the `vexpand` property.
1506    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1507        Self {
1508            builder: self.builder.property("vexpand-set", vexpand_set),
1509        }
1510    }
1511
1512    /// Whether the widget is visible.
1513    pub fn visible(self, visible: bool) -> Self {
1514        Self {
1515            builder: self.builder.property("visible", visible),
1516        }
1517    }
1518
1519    /// Overrides for width request of the widget.
1520    ///
1521    /// If this is -1, the natural request will be used.
1522    pub fn width_request(self, width_request: i32) -> Self {
1523        Self {
1524            builder: self.builder.property("width-request", width_request),
1525        }
1526    }
1527
1528    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1529    ///
1530    /// The accessible role cannot be changed once set.
1531    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1532        Self {
1533            builder: self.builder.property("accessible-role", accessible_role),
1534        }
1535    }
1536
1537    // rustdoc-stripper-ignore-next
1538    /// Build the [`Inscription`].
1539    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1540    pub fn build(self) -> Inscription {
1541        assert_initialized_main_thread!();
1542        self.builder.build()
1543    }
1544}