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