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