Skip to main content

gtk4/auto/
combo_box_text.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#![allow(deprecated)]
5
6#[cfg(feature = "v4_10")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
8use crate::Accessible;
9use crate::{
10    AccessibleRole, Align, Buildable, CellEditable, CellLayout, ComboBox, ConstraintTarget,
11    LayoutManager, Overflow, SensitivityType, TreeModel, Widget, ffi,
12};
13use glib::{prelude::*, translate::*};
14
15#[cfg(feature = "v4_10")]
16#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
17glib::wrapper! {
18    /// Use [`DropDown`][crate::DropDown] with a [`StringList`][crate::StringList]
19    ///   instead
20    /// A [`ComboBoxText`][crate::ComboBoxText] is a simple variant of [`ComboBox`][crate::ComboBox] for text-only
21    /// use cases.
22    ///
23    /// <picture>
24    ///   <source srcset="combo-box-text-dark.png" media="(prefers-color-scheme: dark)">
25    ///   <img alt="An example GtkComboBoxText" src="combo-box-text.png">
26    /// </picture>
27    ///
28    /// [`ComboBoxText`][crate::ComboBoxText] hides the model-view complexity of [`ComboBox`][crate::ComboBox].
29    ///
30    /// To create a [`ComboBoxText`][crate::ComboBoxText], use [`new()`][Self::new()] or
31    /// [`with_entry()`][Self::with_entry()].
32    ///
33    /// You can add items to a [`ComboBoxText`][crate::ComboBoxText] with
34    /// [`append_text()`][Self::append_text()],
35    /// [`insert_text()`][Self::insert_text()] or
36    /// [`prepend_text()`][Self::prepend_text()] and remove options with
37    /// [`remove()`][Self::remove()].
38    ///
39    /// If the [`ComboBoxText`][crate::ComboBoxText] contains an entry (via the
40    /// [`has-entry`][struct@crate::ComboBox#has-entry] property), its contents can be retrieved
41    /// using [`active_text()`][Self::active_text()].
42    ///
43    /// You should not call [`ComboBoxExt::set_model()`][crate::prelude::ComboBoxExt::set_model()] or attempt to pack more
44    /// cells into this combo box via its [`CellLayout`][crate::CellLayout] interface.
45    ///
46    /// ## GtkComboBoxText as GtkBuildable
47    ///
48    /// The [`ComboBoxText`][crate::ComboBoxText] implementation of the [`Buildable`][crate::Buildable] interface supports
49    /// adding items directly using the `<items>` element and specifying `<item>`
50    /// elements for each item. Each `<item>` element can specify the “id”
51    /// corresponding to the appended text and also supports the regular
52    /// translation attributes “translatable”, “context” and “comments”.
53    ///
54    /// Here is a UI definition fragment specifying [`ComboBoxText`][crate::ComboBoxText] items:
55    /// ```xml
56    /// <object class="GtkComboBoxText">
57    ///   <items>
58    ///     <item translatable="yes" id="factory">Factory</item>
59    ///     <item translatable="yes" id="home">Home</item>
60    ///     <item translatable="yes" id="subway">Subway</item>
61    ///   </items>
62    /// </object>
63    /// ```
64    ///
65    /// ## CSS nodes
66    ///
67    /// ```text
68    /// combobox
69    /// ╰── box.linked
70    ///     ├── entry.combo
71    ///     ├── button.combo
72    ///     ╰── window.popup
73    /// ```
74    ///
75    /// [`ComboBoxText`][crate::ComboBoxText] has a single CSS node with name combobox. It adds
76    /// the style class .combo to the main CSS nodes of its entry and button
77    /// children, and the .linked class to the node of its internal box.
78    ///
79    /// # Implements
80    ///
81    /// [`ComboBoxExt`][trait@crate::prelude::ComboBoxExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`CellEditableExt`][trait@crate::prelude::CellEditableExt], [`CellLayoutExt`][trait@crate::prelude::CellLayoutExt], [`ComboBoxExtManual`][trait@crate::prelude::ComboBoxExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual], [`CellLayoutExtManual`][trait@crate::prelude::CellLayoutExtManual]
82    #[doc(alias = "GtkComboBoxText")]
83    pub struct ComboBoxText(Object<ffi::GtkComboBoxText>) @extends ComboBox, Widget, @implements Accessible, Buildable, ConstraintTarget, CellEditable, CellLayout;
84
85    match fn {
86        type_ => || ffi::gtk_combo_box_text_get_type(),
87    }
88}
89
90#[cfg(not(feature = "v4_10"))]
91glib::wrapper! {
92    #[doc(alias = "GtkComboBoxText")]
93    pub struct ComboBoxText(Object<ffi::GtkComboBoxText>) @extends ComboBox, Widget, @implements Buildable, ConstraintTarget, CellEditable, CellLayout;
94
95    match fn {
96        type_ => || ffi::gtk_combo_box_text_get_type(),
97    }
98}
99
100impl ComboBoxText {
101    /// Creates a new [`ComboBoxText`][crate::ComboBoxText].
102    ///
103    /// # Deprecated since 4.10
104    ///
105    /// Use [`DropDown`][crate::DropDown]
106    ///
107    /// # Returns
108    ///
109    /// A new [`ComboBoxText`][crate::ComboBoxText]
110    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
111    #[allow(deprecated)]
112    #[doc(alias = "gtk_combo_box_text_new")]
113    pub fn new() -> ComboBoxText {
114        assert_initialized_main_thread!();
115        unsafe { Widget::from_glib_none(ffi::gtk_combo_box_text_new()).unsafe_cast() }
116    }
117
118    /// Creates a new [`ComboBoxText`][crate::ComboBoxText] with an entry.
119    ///
120    /// # Deprecated since 4.10
121    ///
122    /// Use [`DropDown`][crate::DropDown]
123    ///
124    /// # Returns
125    ///
126    /// a new [`ComboBoxText`][crate::ComboBoxText]
127    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
128    #[allow(deprecated)]
129    #[doc(alias = "gtk_combo_box_text_new_with_entry")]
130    #[doc(alias = "new_with_entry")]
131    pub fn with_entry() -> ComboBoxText {
132        assert_initialized_main_thread!();
133        unsafe { Widget::from_glib_none(ffi::gtk_combo_box_text_new_with_entry()).unsafe_cast() }
134    }
135
136    // rustdoc-stripper-ignore-next
137    /// Creates a new builder-pattern struct instance to construct [`ComboBoxText`] objects.
138    ///
139    /// This method returns an instance of [`ComboBoxTextBuilder`](crate::builders::ComboBoxTextBuilder) which can be used to create [`ComboBoxText`] objects.
140    pub fn builder() -> ComboBoxTextBuilder {
141        ComboBoxTextBuilder::new()
142    }
143
144    /// Appends @text to the list of strings stored in @self.
145    ///
146    /// If @id is non-[`None`] then it is used as the ID of the row.
147    ///
148    /// This is the same as calling [`insert()`][Self::insert()]
149    /// with a position of -1.
150    ///
151    /// # Deprecated since 4.10
152    ///
153    /// Use [`DropDown`][crate::DropDown]
154    /// ## `id`
155    /// a string ID for this value
156    /// ## `text`
157    /// A string
158    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
159    #[allow(deprecated)]
160    #[doc(alias = "gtk_combo_box_text_append")]
161    pub fn append(&self, id: Option<&str>, text: &str) {
162        unsafe {
163            ffi::gtk_combo_box_text_append(
164                self.to_glib_none().0,
165                id.to_glib_none().0,
166                text.to_glib_none().0,
167            );
168        }
169    }
170
171    /// Appends @text to the list of strings stored in @self.
172    ///
173    /// This is the same as calling [`insert_text()`][Self::insert_text()]
174    /// with a position of -1.
175    ///
176    /// # Deprecated since 4.10
177    ///
178    /// Use [`DropDown`][crate::DropDown]
179    /// ## `text`
180    /// A string
181    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
182    #[allow(deprecated)]
183    #[doc(alias = "gtk_combo_box_text_append_text")]
184    pub fn append_text(&self, text: &str) {
185        unsafe {
186            ffi::gtk_combo_box_text_append_text(self.to_glib_none().0, text.to_glib_none().0);
187        }
188    }
189
190    /// Returns the currently active string in @self.
191    ///
192    /// If no row is currently selected, [`None`] is returned.
193    /// If @self contains an entry, this function will
194    /// return its contents (which will not necessarily
195    /// be an item from the list).
196    ///
197    /// # Deprecated since 4.10
198    ///
199    /// Use [`DropDown`][crate::DropDown]
200    ///
201    /// # Returns
202    ///
203    /// a newly allocated
204    ///   string containing the currently active text.
205    ///   Must be freed with g_free().
206    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
207    #[allow(deprecated)]
208    #[doc(alias = "gtk_combo_box_text_get_active_text")]
209    #[doc(alias = "get_active_text")]
210    pub fn active_text(&self) -> Option<glib::GString> {
211        unsafe {
212            from_glib_full(ffi::gtk_combo_box_text_get_active_text(
213                self.to_glib_none().0,
214            ))
215        }
216    }
217
218    /// Inserts @text at @position in the list of strings stored in @self.
219    ///
220    /// If @id is non-[`None`] then it is used as the ID of the row.
221    /// See [`id-column`][struct@crate::ComboBox#id-column].
222    ///
223    /// If @position is negative then @text is appended.
224    ///
225    /// # Deprecated since 4.10
226    ///
227    /// Use [`DropDown`][crate::DropDown]
228    /// ## `position`
229    /// An index to insert @text
230    /// ## `id`
231    /// a string ID for this value
232    /// ## `text`
233    /// A string to display
234    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
235    #[allow(deprecated)]
236    #[doc(alias = "gtk_combo_box_text_insert")]
237    pub fn insert(&self, position: i32, id: Option<&str>, text: &str) {
238        unsafe {
239            ffi::gtk_combo_box_text_insert(
240                self.to_glib_none().0,
241                position,
242                id.to_glib_none().0,
243                text.to_glib_none().0,
244            );
245        }
246    }
247
248    /// Inserts @text at @position in the list of strings stored in @self.
249    ///
250    /// If @position is negative then @text is appended.
251    ///
252    /// This is the same as calling [`insert()`][Self::insert()]
253    /// with a [`None`] ID string.
254    ///
255    /// # Deprecated since 4.10
256    ///
257    /// Use [`DropDown`][crate::DropDown]
258    /// ## `position`
259    /// An index to insert @text
260    /// ## `text`
261    /// A string
262    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
263    #[allow(deprecated)]
264    #[doc(alias = "gtk_combo_box_text_insert_text")]
265    pub fn insert_text(&self, position: i32, text: &str) {
266        unsafe {
267            ffi::gtk_combo_box_text_insert_text(
268                self.to_glib_none().0,
269                position,
270                text.to_glib_none().0,
271            );
272        }
273    }
274
275    /// Prepends @text to the list of strings stored in @self.
276    ///
277    /// If @id is non-[`None`] then it is used as the ID of the row.
278    ///
279    /// This is the same as calling [`insert()`][Self::insert()]
280    /// with a position of 0.
281    ///
282    /// # Deprecated since 4.10
283    ///
284    /// Use [`DropDown`][crate::DropDown]
285    /// ## `id`
286    /// a string ID for this value
287    /// ## `text`
288    /// a string
289    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
290    #[allow(deprecated)]
291    #[doc(alias = "gtk_combo_box_text_prepend")]
292    pub fn prepend(&self, id: Option<&str>, text: &str) {
293        unsafe {
294            ffi::gtk_combo_box_text_prepend(
295                self.to_glib_none().0,
296                id.to_glib_none().0,
297                text.to_glib_none().0,
298            );
299        }
300    }
301
302    /// Prepends @text to the list of strings stored in @self.
303    ///
304    /// This is the same as calling [`insert_text()`][Self::insert_text()]
305    /// with a position of 0.
306    ///
307    /// # Deprecated since 4.10
308    ///
309    /// Use [`DropDown`][crate::DropDown]
310    /// ## `text`
311    /// A string
312    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
313    #[allow(deprecated)]
314    #[doc(alias = "gtk_combo_box_text_prepend_text")]
315    pub fn prepend_text(&self, text: &str) {
316        unsafe {
317            ffi::gtk_combo_box_text_prepend_text(self.to_glib_none().0, text.to_glib_none().0);
318        }
319    }
320
321    /// Removes the string at @position from @self.
322    ///
323    /// # Deprecated since 4.10
324    ///
325    /// Use [`DropDown`][crate::DropDown]
326    /// ## `position`
327    /// Index of the item to remove
328    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
329    #[allow(deprecated)]
330    #[doc(alias = "gtk_combo_box_text_remove")]
331    pub fn remove(&self, position: i32) {
332        unsafe {
333            ffi::gtk_combo_box_text_remove(self.to_glib_none().0, position);
334        }
335    }
336
337    /// Removes all the text entries from the combo box.
338    ///
339    /// # Deprecated since 4.10
340    ///
341    /// Use [`DropDown`][crate::DropDown]
342    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
343    #[allow(deprecated)]
344    #[doc(alias = "gtk_combo_box_text_remove_all")]
345    pub fn remove_all(&self) {
346        unsafe {
347            ffi::gtk_combo_box_text_remove_all(self.to_glib_none().0);
348        }
349    }
350}
351
352impl Default for ComboBoxText {
353    fn default() -> Self {
354        Self::new()
355    }
356}
357
358// rustdoc-stripper-ignore-next
359/// A [builder-pattern] type to construct [`ComboBoxText`] objects.
360///
361/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
362#[must_use = "The builder must be built to be used"]
363pub struct ComboBoxTextBuilder {
364    builder: glib::object::ObjectBuilder<'static, ComboBoxText>,
365}
366
367impl ComboBoxTextBuilder {
368    fn new() -> Self {
369        Self {
370            builder: glib::object::Object::builder(),
371        }
372    }
373
374    /// The item which is currently active.
375    ///
376    /// If the model is a non-flat treemodel, and the active item is not an
377    /// immediate child of the root of the tree, this property has the value
378    /// `gtk_tree_path_get_indices (path)[0]`, where `path` is the
379    /// [`TreePath`][crate::TreePath] of the active item.
380    pub fn active(self, active: i32) -> Self {
381        Self {
382            builder: self.builder.property("active", active),
383        }
384    }
385
386    /// The value of the ID column of the active row.
387    pub fn active_id(self, active_id: impl Into<glib::GString>) -> Self {
388        Self {
389            builder: self.builder.property("active-id", active_id.into()),
390        }
391    }
392
393    /// Whether the dropdown button is sensitive when
394    /// the model is empty.
395    pub fn button_sensitivity(self, button_sensitivity: SensitivityType) -> Self {
396        Self {
397            builder: self
398                .builder
399                .property("button-sensitivity", button_sensitivity),
400        }
401    }
402
403    /// The child widget.
404    pub fn child(self, child: &impl IsA<Widget>) -> Self {
405        Self {
406            builder: self.builder.property("child", child.clone().upcast()),
407        }
408    }
409
410    /// The model column to associate with strings from the entry.
411    ///
412    /// This is property only relevant if the combo was created with
413    /// [`has-entry`][struct@crate::ComboBox#has-entry] is [`true`].
414    pub fn entry_text_column(self, entry_text_column: i32) -> Self {
415        Self {
416            builder: self
417                .builder
418                .property("entry-text-column", entry_text_column),
419        }
420    }
421
422    /// Whether the combo box has an entry.
423    pub fn has_entry(self, has_entry: bool) -> Self {
424        Self {
425            builder: self.builder.property("has-entry", has_entry),
426        }
427    }
428
429    /// The `has-frame` property controls whether a frame is drawn around the entry.
430    pub fn has_frame(self, has_frame: bool) -> Self {
431        Self {
432            builder: self.builder.property("has-frame", has_frame),
433        }
434    }
435
436    /// The model column that provides string IDs for the values
437    /// in the model, if != -1.
438    pub fn id_column(self, id_column: i32) -> Self {
439        Self {
440            builder: self.builder.property("id-column", id_column),
441        }
442    }
443
444    /// The model from which the combo box takes its values.
445    pub fn model(self, model: &impl IsA<TreeModel>) -> Self {
446        Self {
447            builder: self.builder.property("model", model.clone().upcast()),
448        }
449    }
450
451    /// Whether the popup's width should be a fixed width matching the
452    /// allocated width of the combo box.
453    pub fn popup_fixed_width(self, popup_fixed_width: bool) -> Self {
454        Self {
455            builder: self
456                .builder
457                .property("popup-fixed-width", popup_fixed_width),
458        }
459    }
460
461    /// Whether the widget or any of its descendents can accept
462    /// the input focus.
463    ///
464    /// This property is meant to be set by widget implementations,
465    /// typically in their instance init function.
466    pub fn can_focus(self, can_focus: bool) -> Self {
467        Self {
468            builder: self.builder.property("can-focus", can_focus),
469        }
470    }
471
472    /// Whether the widget can receive pointer events.
473    pub fn can_target(self, can_target: bool) -> Self {
474        Self {
475            builder: self.builder.property("can-target", can_target),
476        }
477    }
478
479    /// A list of css classes applied to this widget.
480    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
481        Self {
482            builder: self.builder.property("css-classes", css_classes.into()),
483        }
484    }
485
486    /// The name of this widget in the CSS tree.
487    ///
488    /// This property is meant to be set by widget implementations,
489    /// typically in their instance init function.
490    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
491        Self {
492            builder: self.builder.property("css-name", css_name.into()),
493        }
494    }
495
496    /// The cursor used by @widget.
497    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
498        Self {
499            builder: self.builder.property("cursor", cursor.clone()),
500        }
501    }
502
503    /// Whether the widget should grab focus when it is clicked with the mouse.
504    ///
505    /// This property is only relevant for widgets that can take focus.
506    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
507        Self {
508            builder: self.builder.property("focus-on-click", focus_on_click),
509        }
510    }
511
512    /// Whether this widget itself will accept the input focus.
513    pub fn focusable(self, focusable: bool) -> Self {
514        Self {
515            builder: self.builder.property("focusable", focusable),
516        }
517    }
518
519    /// How to distribute horizontal space if widget gets extra space.
520    pub fn halign(self, halign: Align) -> Self {
521        Self {
522            builder: self.builder.property("halign", halign),
523        }
524    }
525
526    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
527    /// signal on @widget.
528    ///
529    /// A true value indicates that @widget can have a tooltip, in this case
530    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
531    /// determine whether it will provide a tooltip or not.
532    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
533        Self {
534            builder: self.builder.property("has-tooltip", has_tooltip),
535        }
536    }
537
538    /// Overrides for height request of the widget.
539    ///
540    /// If this is -1, the natural request will be used.
541    pub fn height_request(self, height_request: i32) -> Self {
542        Self {
543            builder: self.builder.property("height-request", height_request),
544        }
545    }
546
547    /// Whether to expand horizontally.
548    pub fn hexpand(self, hexpand: bool) -> Self {
549        Self {
550            builder: self.builder.property("hexpand", hexpand),
551        }
552    }
553
554    /// Whether to use the `hexpand` property.
555    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
556        Self {
557            builder: self.builder.property("hexpand-set", hexpand_set),
558        }
559    }
560
561    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
562    /// the preferred size of the widget, and allocate its children.
563    ///
564    /// This property is meant to be set by widget implementations,
565    /// typically in their instance init function.
566    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
567        Self {
568            builder: self
569                .builder
570                .property("layout-manager", layout_manager.clone().upcast()),
571        }
572    }
573
574    /// Makes this widget act like a modal dialog, with respect to
575    /// event delivery.
576    ///
577    /// Global event controllers will not handle events with targets
578    /// inside the widget, unless they are set up to ignore propagation
579    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
580    #[cfg(feature = "v4_18")]
581    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
582    pub fn limit_events(self, limit_events: bool) -> Self {
583        Self {
584            builder: self.builder.property("limit-events", limit_events),
585        }
586    }
587
588    /// Margin on bottom side of widget.
589    ///
590    /// This property adds margin outside of the widget's normal size
591    /// request, the margin will be added in addition to the size from
592    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
593    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
594        Self {
595            builder: self.builder.property("margin-bottom", margin_bottom),
596        }
597    }
598
599    /// Margin on end of widget, horizontally.
600    ///
601    /// This property supports left-to-right and right-to-left text
602    /// directions.
603    ///
604    /// This property adds margin outside of the widget's normal size
605    /// request, the margin will be added in addition to the size from
606    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
607    pub fn margin_end(self, margin_end: i32) -> Self {
608        Self {
609            builder: self.builder.property("margin-end", margin_end),
610        }
611    }
612
613    /// Margin on start of widget, horizontally.
614    ///
615    /// This property supports left-to-right and right-to-left text
616    /// directions.
617    ///
618    /// This property adds margin outside of the widget's normal size
619    /// request, the margin will be added in addition to the size from
620    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
621    pub fn margin_start(self, margin_start: i32) -> Self {
622        Self {
623            builder: self.builder.property("margin-start", margin_start),
624        }
625    }
626
627    /// Margin on top side of widget.
628    ///
629    /// This property adds margin outside of the widget's normal size
630    /// request, the margin will be added in addition to the size from
631    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
632    pub fn margin_top(self, margin_top: i32) -> Self {
633        Self {
634            builder: self.builder.property("margin-top", margin_top),
635        }
636    }
637
638    /// The name of the widget.
639    pub fn name(self, name: impl Into<glib::GString>) -> Self {
640        Self {
641            builder: self.builder.property("name", name.into()),
642        }
643    }
644
645    /// The requested opacity of the widget.
646    pub fn opacity(self, opacity: f64) -> Self {
647        Self {
648            builder: self.builder.property("opacity", opacity),
649        }
650    }
651
652    /// How content outside the widget's content area is treated.
653    ///
654    /// This property is meant to be set by widget implementations,
655    /// typically in their instance init function.
656    pub fn overflow(self, overflow: Overflow) -> Self {
657        Self {
658            builder: self.builder.property("overflow", overflow),
659        }
660    }
661
662    /// Whether the widget will receive the default action when it is focused.
663    pub fn receives_default(self, receives_default: bool) -> Self {
664        Self {
665            builder: self.builder.property("receives-default", receives_default),
666        }
667    }
668
669    /// Whether the widget responds to input.
670    pub fn sensitive(self, sensitive: bool) -> Self {
671        Self {
672            builder: self.builder.property("sensitive", sensitive),
673        }
674    }
675
676    /// Sets the text of tooltip to be the given string, which is marked up
677    /// with Pango markup.
678    ///
679    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
680    ///
681    /// This is a convenience property which will take care of getting the
682    /// tooltip shown if the given string is not `NULL`:
683    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
684    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
685    /// the default signal handler.
686    ///
687    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
688    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
689    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
690        Self {
691            builder: self
692                .builder
693                .property("tooltip-markup", tooltip_markup.into()),
694        }
695    }
696
697    /// Sets the text of tooltip to be the given string.
698    ///
699    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
700    ///
701    /// This is a convenience property which will take care of getting the
702    /// tooltip shown if the given string is not `NULL`:
703    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
704    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
705    /// the default signal handler.
706    ///
707    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
708    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
709    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
710        Self {
711            builder: self.builder.property("tooltip-text", tooltip_text.into()),
712        }
713    }
714
715    /// How to distribute vertical space if widget gets extra space.
716    pub fn valign(self, valign: Align) -> Self {
717        Self {
718            builder: self.builder.property("valign", valign),
719        }
720    }
721
722    /// Whether to expand vertically.
723    pub fn vexpand(self, vexpand: bool) -> Self {
724        Self {
725            builder: self.builder.property("vexpand", vexpand),
726        }
727    }
728
729    /// Whether to use the `vexpand` property.
730    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
731        Self {
732            builder: self.builder.property("vexpand-set", vexpand_set),
733        }
734    }
735
736    /// Whether the widget is visible.
737    pub fn visible(self, visible: bool) -> Self {
738        Self {
739            builder: self.builder.property("visible", visible),
740        }
741    }
742
743    /// Overrides for width request of the widget.
744    ///
745    /// If this is -1, the natural request will be used.
746    pub fn width_request(self, width_request: i32) -> Self {
747        Self {
748            builder: self.builder.property("width-request", width_request),
749        }
750    }
751
752    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
753    ///
754    /// The accessible role cannot be changed once set.
755    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
756        Self {
757            builder: self.builder.property("accessible-role", accessible_role),
758        }
759    }
760
761    /// Indicates whether editing on the cell has been canceled.
762    pub fn editing_canceled(self, editing_canceled: bool) -> Self {
763        Self {
764            builder: self.builder.property("editing-canceled", editing_canceled),
765        }
766    }
767
768    // rustdoc-stripper-ignore-next
769    /// Build the [`ComboBoxText`].
770    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
771    pub fn build(self) -> ComboBoxText {
772        assert_initialized_main_thread!();
773        self.builder.build()
774    }
775}