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