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