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