Skip to main content

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    Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, Editable, LayoutManager,
7    Overflow, Widget, ffi,
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    /// #### `complete-text`
367    ///  The contents of the entry, including uncommited content such as the
368    /// preedit.
369    ///
370    /// Readable
371    ///
372    ///
373    /// #### `cursor-position`
374    ///  The current position of the insertion cursor in chars.
375    ///
376    /// Readable
377    ///
378    ///
379    /// #### `editable`
380    ///  Whether the entry contents can be edited.
381    ///
382    /// Readable | Writeable
383    ///
384    ///
385    /// #### `enable-undo`
386    ///  If undo/redo should be enabled for the editable.
387    ///
388    /// Readable | Writeable
389    ///
390    ///
391    /// #### `max-width-chars`
392    ///  The desired maximum width of the entry, in characters.
393    ///
394    /// Readable | Writeable
395    ///
396    ///
397    /// #### `selection-bound`
398    ///  The position of the opposite end of the selection from the cursor in chars.
399    ///
400    /// Readable
401    ///
402    ///
403    /// #### `text`
404    ///  The contents of the entry.
405    ///
406    /// Readable | Writeable
407    ///
408    ///
409    /// #### `width-chars`
410    ///  Number of characters to leave space for in the entry.
411    ///
412    /// Readable | Writeable
413    ///
414    ///
415    /// #### `xalign`
416    ///  The horizontal alignment, from 0 (left) to 1 (right).
417    ///
418    /// Reversed for RTL layouts.
419    ///
420    /// Readable | Writeable
421    /// </details>
422    ///
423    /// # Implements
424    ///
425    /// [`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]
426    #[doc(alias = "GtkEditableLabel")]
427    pub struct EditableLabel(Object<ffi::GtkEditableLabel, ffi::GtkEditableLabelClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Editable;
428
429    match fn {
430        type_ => || ffi::gtk_editable_label_get_type(),
431    }
432}
433
434impl EditableLabel {
435    /// Creates a new [`EditableLabel`][crate::EditableLabel] widget.
436    /// ## `str`
437    /// the text for the label
438    ///
439    /// # Returns
440    ///
441    /// the new [`EditableLabel`][crate::EditableLabel]
442    #[doc(alias = "gtk_editable_label_new")]
443    pub fn new(str: &str) -> EditableLabel {
444        assert_initialized_main_thread!();
445        unsafe {
446            Widget::from_glib_none(ffi::gtk_editable_label_new(str.to_glib_none().0)).unsafe_cast()
447        }
448    }
449
450    // rustdoc-stripper-ignore-next
451    /// Creates a new builder-pattern struct instance to construct [`EditableLabel`] objects.
452    ///
453    /// This method returns an instance of [`EditableLabelBuilder`](crate::builders::EditableLabelBuilder) which can be used to create [`EditableLabel`] objects.
454    pub fn builder() -> EditableLabelBuilder {
455        EditableLabelBuilder::new()
456    }
457
458    /// Returns whether the label is currently in “editing mode”.
459    ///
460    /// # Returns
461    ///
462    /// [`true`] if @self is currently in editing mode
463    #[doc(alias = "gtk_editable_label_get_editing")]
464    #[doc(alias = "get_editing")]
465    #[doc(alias = "editing")]
466    pub fn is_editing(&self) -> bool {
467        unsafe { from_glib(ffi::gtk_editable_label_get_editing(self.to_glib_none().0)) }
468    }
469
470    /// Switches the label into “editing mode”.
471    #[doc(alias = "gtk_editable_label_start_editing")]
472    pub fn start_editing(&self) {
473        unsafe {
474            ffi::gtk_editable_label_start_editing(self.to_glib_none().0);
475        }
476    }
477
478    /// Switches the label out of “editing mode”.
479    ///
480    /// If @commit is [`true`], the resulting text is kept as the
481    /// [`text`][struct@crate::Editable#text] property value, otherwise the
482    /// resulting text is discarded and the label will keep its
483    /// previous [`text`][struct@crate::Editable#text] property value.
484    /// ## `commit`
485    /// whether to set the edited text on the label
486    #[doc(alias = "gtk_editable_label_stop_editing")]
487    pub fn stop_editing(&self, commit: bool) {
488        unsafe {
489            ffi::gtk_editable_label_stop_editing(self.to_glib_none().0, commit.into_glib());
490        }
491    }
492
493    /// This property is [`true`] while the widget is in edit mode.
494    #[cfg(feature = "v4_8")]
495    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
496    pub fn set_editing(&self, editing: bool) {
497        ObjectExt::set_property(self, "editing", editing)
498    }
499}
500
501impl Default for EditableLabel {
502    fn default() -> Self {
503        glib::object::Object::new::<Self>()
504    }
505}
506
507// rustdoc-stripper-ignore-next
508/// A [builder-pattern] type to construct [`EditableLabel`] objects.
509///
510/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
511#[must_use = "The builder must be built to be used"]
512pub struct EditableLabelBuilder {
513    builder: glib::object::ObjectBuilder<'static, EditableLabel>,
514}
515
516impl EditableLabelBuilder {
517    fn new() -> Self {
518        Self {
519            builder: glib::object::Object::builder(),
520        }
521    }
522
523    /// This property is [`true`] while the widget is in edit mode.
524    #[cfg(feature = "v4_8")]
525    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
526    pub fn editing(self, editing: bool) -> Self {
527        Self {
528            builder: self.builder.property("editing", editing),
529        }
530    }
531
532    /// Whether the widget or any of its descendents can accept
533    /// the input focus.
534    ///
535    /// This property is meant to be set by widget implementations,
536    /// typically in their instance init function.
537    pub fn can_focus(self, can_focus: bool) -> Self {
538        Self {
539            builder: self.builder.property("can-focus", can_focus),
540        }
541    }
542
543    /// Whether the widget can receive pointer events.
544    pub fn can_target(self, can_target: bool) -> Self {
545        Self {
546            builder: self.builder.property("can-target", can_target),
547        }
548    }
549
550    /// A list of css classes applied to this widget.
551    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
552        Self {
553            builder: self.builder.property("css-classes", css_classes.into()),
554        }
555    }
556
557    /// The name of this widget in the CSS tree.
558    ///
559    /// This property is meant to be set by widget implementations,
560    /// typically in their instance init function.
561    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
562        Self {
563            builder: self.builder.property("css-name", css_name.into()),
564        }
565    }
566
567    /// The cursor used by @widget.
568    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
569        Self {
570            builder: self.builder.property("cursor", cursor.clone()),
571        }
572    }
573
574    /// Whether the widget should grab focus when it is clicked with the mouse.
575    ///
576    /// This property is only relevant for widgets that can take focus.
577    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
578        Self {
579            builder: self.builder.property("focus-on-click", focus_on_click),
580        }
581    }
582
583    /// Whether this widget itself will accept the input focus.
584    pub fn focusable(self, focusable: bool) -> Self {
585        Self {
586            builder: self.builder.property("focusable", focusable),
587        }
588    }
589
590    /// How to distribute horizontal space if widget gets extra space.
591    pub fn halign(self, halign: Align) -> Self {
592        Self {
593            builder: self.builder.property("halign", halign),
594        }
595    }
596
597    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
598    /// signal on @widget.
599    ///
600    /// A true value indicates that @widget can have a tooltip, in this case
601    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
602    /// determine whether it will provide a tooltip or not.
603    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
604        Self {
605            builder: self.builder.property("has-tooltip", has_tooltip),
606        }
607    }
608
609    /// Overrides for height request of the widget.
610    ///
611    /// If this is -1, the natural request will be used.
612    pub fn height_request(self, height_request: i32) -> Self {
613        Self {
614            builder: self.builder.property("height-request", height_request),
615        }
616    }
617
618    /// Whether to expand horizontally.
619    pub fn hexpand(self, hexpand: bool) -> Self {
620        Self {
621            builder: self.builder.property("hexpand", hexpand),
622        }
623    }
624
625    /// Whether to use the `hexpand` property.
626    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
627        Self {
628            builder: self.builder.property("hexpand-set", hexpand_set),
629        }
630    }
631
632    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
633    /// the preferred size of the widget, and allocate its children.
634    ///
635    /// This property is meant to be set by widget implementations,
636    /// typically in their instance init function.
637    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
638        Self {
639            builder: self
640                .builder
641                .property("layout-manager", layout_manager.clone().upcast()),
642        }
643    }
644
645    /// Makes this widget act like a modal dialog, with respect to
646    /// event delivery.
647    ///
648    /// Global event controllers will not handle events with targets
649    /// inside the widget, unless they are set up to ignore propagation
650    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
651    #[cfg(feature = "v4_18")]
652    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
653    pub fn limit_events(self, limit_events: bool) -> Self {
654        Self {
655            builder: self.builder.property("limit-events", limit_events),
656        }
657    }
658
659    /// Margin on bottom side of widget.
660    ///
661    /// This property adds margin outside of the widget's normal size
662    /// request, the margin will be added in addition to the size from
663    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
664    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
665        Self {
666            builder: self.builder.property("margin-bottom", margin_bottom),
667        }
668    }
669
670    /// Margin on end of widget, horizontally.
671    ///
672    /// This property supports left-to-right and right-to-left text
673    /// directions.
674    ///
675    /// This property adds margin outside of the widget's normal size
676    /// request, the margin will be added in addition to the size from
677    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
678    pub fn margin_end(self, margin_end: i32) -> Self {
679        Self {
680            builder: self.builder.property("margin-end", margin_end),
681        }
682    }
683
684    /// Margin on start of widget, horizontally.
685    ///
686    /// This property supports left-to-right and right-to-left text
687    /// directions.
688    ///
689    /// This property adds margin outside of the widget's normal size
690    /// request, the margin will be added in addition to the size from
691    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
692    pub fn margin_start(self, margin_start: i32) -> Self {
693        Self {
694            builder: self.builder.property("margin-start", margin_start),
695        }
696    }
697
698    /// Margin on top side of widget.
699    ///
700    /// This property adds margin outside of the widget's normal size
701    /// request, the margin will be added in addition to the size from
702    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
703    pub fn margin_top(self, margin_top: i32) -> Self {
704        Self {
705            builder: self.builder.property("margin-top", margin_top),
706        }
707    }
708
709    /// The name of the widget.
710    pub fn name(self, name: impl Into<glib::GString>) -> Self {
711        Self {
712            builder: self.builder.property("name", name.into()),
713        }
714    }
715
716    /// The requested opacity of the widget.
717    pub fn opacity(self, opacity: f64) -> Self {
718        Self {
719            builder: self.builder.property("opacity", opacity),
720        }
721    }
722
723    /// How content outside the widget's content area is treated.
724    ///
725    /// This property is meant to be set by widget implementations,
726    /// typically in their instance init function.
727    pub fn overflow(self, overflow: Overflow) -> Self {
728        Self {
729            builder: self.builder.property("overflow", overflow),
730        }
731    }
732
733    /// Whether the widget will receive the default action when it is focused.
734    pub fn receives_default(self, receives_default: bool) -> Self {
735        Self {
736            builder: self.builder.property("receives-default", receives_default),
737        }
738    }
739
740    /// Whether the widget responds to input.
741    pub fn sensitive(self, sensitive: bool) -> Self {
742        Self {
743            builder: self.builder.property("sensitive", sensitive),
744        }
745    }
746
747    /// Sets the text of tooltip to be the given string, which is marked up
748    /// with Pango markup.
749    ///
750    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
751    ///
752    /// This is a convenience property which will take care of getting the
753    /// tooltip shown if the given string is not `NULL`:
754    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
755    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
756    /// the default signal handler.
757    ///
758    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
759    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
760    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
761        Self {
762            builder: self
763                .builder
764                .property("tooltip-markup", tooltip_markup.into()),
765        }
766    }
767
768    /// Sets the text of tooltip to be the given string.
769    ///
770    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
771    ///
772    /// This is a convenience property which will take care of getting the
773    /// tooltip shown if the given string is not `NULL`:
774    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
775    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
776    /// the default signal handler.
777    ///
778    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
779    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
780    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
781        Self {
782            builder: self.builder.property("tooltip-text", tooltip_text.into()),
783        }
784    }
785
786    /// How to distribute vertical space if widget gets extra space.
787    pub fn valign(self, valign: Align) -> Self {
788        Self {
789            builder: self.builder.property("valign", valign),
790        }
791    }
792
793    /// Whether to expand vertically.
794    pub fn vexpand(self, vexpand: bool) -> Self {
795        Self {
796            builder: self.builder.property("vexpand", vexpand),
797        }
798    }
799
800    /// Whether to use the `vexpand` property.
801    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
802        Self {
803            builder: self.builder.property("vexpand-set", vexpand_set),
804        }
805    }
806
807    /// Whether the widget is visible.
808    pub fn visible(self, visible: bool) -> Self {
809        Self {
810            builder: self.builder.property("visible", visible),
811        }
812    }
813
814    /// Overrides for width request of the widget.
815    ///
816    /// If this is -1, the natural request will be used.
817    pub fn width_request(self, width_request: i32) -> Self {
818        Self {
819            builder: self.builder.property("width-request", width_request),
820        }
821    }
822
823    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
824    ///
825    /// The accessible role cannot be changed once set.
826    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
827        Self {
828            builder: self.builder.property("accessible-role", accessible_role),
829        }
830    }
831
832    /// Whether the entry contents can be edited.
833    pub fn editable(self, editable: bool) -> Self {
834        Self {
835            builder: self.builder.property("editable", editable),
836        }
837    }
838
839    /// If undo/redo should be enabled for the editable.
840    pub fn enable_undo(self, enable_undo: bool) -> Self {
841        Self {
842            builder: self.builder.property("enable-undo", enable_undo),
843        }
844    }
845
846    /// The desired maximum width of the entry, in characters.
847    pub fn max_width_chars(self, max_width_chars: i32) -> Self {
848        Self {
849            builder: self.builder.property("max-width-chars", max_width_chars),
850        }
851    }
852
853    /// The contents of the entry.
854    pub fn text(self, text: impl Into<glib::GString>) -> Self {
855        Self {
856            builder: self.builder.property("text", text.into()),
857        }
858    }
859
860    /// Number of characters to leave space for in the entry.
861    pub fn width_chars(self, width_chars: i32) -> Self {
862        Self {
863            builder: self.builder.property("width-chars", width_chars),
864        }
865    }
866
867    /// The horizontal alignment, from 0 (left) to 1 (right).
868    ///
869    /// Reversed for RTL layouts.
870    pub fn xalign(self, xalign: f32) -> Self {
871        Self {
872            builder: self.builder.property("xalign", xalign),
873        }
874    }
875
876    // rustdoc-stripper-ignore-next
877    /// Build the [`EditableLabel`].
878    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
879    pub fn build(self) -> EditableLabel {
880        assert_initialized_main_thread!();
881        self.builder.build()
882    }
883}