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