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