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