Skip to main content

gtk4/auto/
combo_box.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, ConstraintTarget, LayoutManager,
11    Overflow, ScrollType, SensitivityType, TreeIter, TreeModel, Widget, ffi,
12};
13use glib::{
14    object::ObjectType as _,
15    prelude::*,
16    signal::{SignalHandlerId, connect_raw},
17    translate::*,
18};
19use std::boxed::Box as Box_;
20
21#[cfg(feature = "v4_10")]
22#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
23glib::wrapper! {
24    /// Use [`DropDown`][crate::DropDown] instead
25    ///
26    ///
27    /// The [`ComboBox`][crate::ComboBox] displays the selected choice; when activated, the
28    /// [`ComboBox`][crate::ComboBox] displays a popup which allows the user to make a new choice.
29    ///
30    /// The [`ComboBox`][crate::ComboBox] uses the model-view pattern; the list of valid choices
31    /// is specified in the form of a tree model, and the display of the choices
32    /// can be adapted to the data in the model by using cell renderers, as you
33    /// would in a tree view. This is possible since [`ComboBox`][crate::ComboBox] implements the
34    /// [`CellLayout`][crate::CellLayout] interface. The tree model holding the valid
35    /// choices is not restricted to a flat list, it can be a real tree, and the
36    /// popup will reflect the tree structure.
37    ///
38    /// To allow the user to enter values not in the model, the
39    /// [`has-entry`][struct@crate::ComboBox#has-entry] property allows the [`ComboBox`][crate::ComboBox] to
40    /// contain a [`Entry`][crate::Entry]. This entry can be accessed by calling
41    /// [`ComboBoxExt::child()`][crate::prelude::ComboBoxExt::child()] on the combo box.
42    ///
43    /// For a simple list of textual choices, the model-view API of [`ComboBox`][crate::ComboBox]
44    /// can be a bit overwhelming. In this case, [`ComboBoxText`][crate::ComboBoxText] offers
45    /// a simple alternative. Both [`ComboBox`][crate::ComboBox] and [`ComboBoxText`][crate::ComboBoxText] can contain
46    /// an entry.
47    ///
48    /// ## CSS nodes
49    ///
50    /// ```text
51    /// combobox
52    /// ├── box.linked
53    /// │   ╰── button.combo
54    /// │       ╰── box
55    /// │           ├── cellview
56    /// │           ╰── arrow
57    /// ╰── window.popup
58    /// ```
59    ///
60    /// A normal combobox contains a box with the .linked class, a button
61    /// with the .combo class and inside those buttons, there are a cellview and
62    /// an arrow.
63    ///
64    /// ```text
65    /// combobox
66    /// ├── box.linked
67    /// │   ├── entry.combo
68    /// │   ╰── button.combo
69    /// │       ╰── box
70    /// │           ╰── arrow
71    /// ╰── window.popup
72    /// ```
73    ///
74    /// A [`ComboBox`][crate::ComboBox] with an entry has a single CSS node with name combobox.
75    /// It contains a box with the .linked class. That box contains an entry and
76    /// a button, both with the .combo class added. The button also contains another
77    /// node with name arrow.
78    ///
79    /// ## Accessibility
80    ///
81    /// [`ComboBox`][crate::ComboBox] uses the [enum@Gtk.AccessibleRole.combo_box] role.
82    ///
83    /// ## Properties
84    ///
85    ///
86    /// #### `active`
87    ///  The item which is currently active.
88    ///
89    /// If the model is a non-flat treemodel, and the active item is not an
90    /// immediate child of the root of the tree, this property has the value
91    /// `gtk_tree_path_get_indices (path)[0]`, where `path` is the
92    /// [`TreePath`][crate::TreePath] of the active item.
93    ///
94    /// Readable | Writable
95    ///
96    ///
97    /// #### `active-id`
98    ///  The value of the ID column of the active row.
99    ///
100    /// Readable | Writable
101    ///
102    ///
103    /// #### `button-sensitivity`
104    ///  Whether the dropdown button is sensitive when
105    /// the model is empty.
106    ///
107    /// Readable | Writable
108    ///
109    ///
110    /// #### `child`
111    ///  The child widget.
112    ///
113    /// Readable | Writable
114    ///
115    ///
116    /// #### `entry-text-column`
117    ///  The model column to associate with strings from the entry.
118    ///
119    /// This is property only relevant if the combo was created with
120    /// [`has-entry`][struct@crate::ComboBox#has-entry] is [`true`].
121    ///
122    /// Readable | Writable
123    ///
124    ///
125    /// #### `has-entry`
126    ///  Whether the combo box has an entry.
127    ///
128    /// Readable | Writable | Construct Only
129    ///
130    ///
131    /// #### `has-frame`
132    ///  The `has-frame` property controls whether a frame is drawn around the entry.
133    ///
134    /// Readable | Writable
135    ///
136    ///
137    /// #### `id-column`
138    ///  The model column that provides string IDs for the values
139    /// in the model, if != -1.
140    ///
141    /// Readable | Writable
142    ///
143    ///
144    /// #### `model`
145    ///  The model from which the combo box takes its values.
146    ///
147    /// Readable | Writable
148    ///
149    ///
150    /// #### `popup-fixed-width`
151    ///  Whether the popup's width should be a fixed width matching the
152    /// allocated width of the combo box.
153    ///
154    /// Readable | Writable
155    ///
156    ///
157    /// #### `popup-shown`
158    ///  Whether the combo boxes dropdown is popped up.
159    ///
160    /// Note that this property is mainly useful, because
161    /// it allows you to connect to notify::popup-shown.
162    ///
163    /// Readable
164    /// <details><summary><h4>Widget</h4></summary>
165    ///
166    ///
167    /// #### `can-focus`
168    ///  Whether the widget or any of its descendents can accept
169    /// the input focus.
170    ///
171    /// This property is meant to be set by widget implementations,
172    /// typically in their instance init function.
173    ///
174    /// Readable | Writable
175    ///
176    ///
177    /// #### `can-target`
178    ///  Whether the widget can receive pointer events.
179    ///
180    /// Readable | Writable
181    ///
182    ///
183    /// #### `css-classes`
184    ///  A list of css classes applied to this widget.
185    ///
186    /// Readable | Writable
187    ///
188    ///
189    /// #### `css-name`
190    ///  The name of this widget in the CSS tree.
191    ///
192    /// This property is meant to be set by widget implementations,
193    /// typically in their instance init function.
194    ///
195    /// Readable | Writable | Construct Only
196    ///
197    ///
198    /// #### `cursor`
199    ///  The cursor used by @widget.
200    ///
201    /// Readable | Writable
202    ///
203    ///
204    /// #### `focus-on-click`
205    ///  Whether the widget should grab focus when it is clicked with the mouse.
206    ///
207    /// This property is only relevant for widgets that can take focus.
208    ///
209    /// Readable | Writable
210    ///
211    ///
212    /// #### `focusable`
213    ///  Whether this widget itself will accept the input focus.
214    ///
215    /// Readable | Writable
216    ///
217    ///
218    /// #### `halign`
219    ///  How to distribute horizontal space if widget gets extra space.
220    ///
221    /// Readable | Writable
222    ///
223    ///
224    /// #### `has-default`
225    ///  Whether the widget is the default widget.
226    ///
227    /// Readable
228    ///
229    ///
230    /// #### `has-focus`
231    ///  Whether the widget has the input focus.
232    ///
233    /// Readable
234    ///
235    ///
236    /// #### `has-tooltip`
237    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
238    /// signal on @widget.
239    ///
240    /// A true value indicates that @widget can have a tooltip, in this case
241    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
242    /// determine whether it will provide a tooltip or not.
243    ///
244    /// Readable | Writable
245    ///
246    ///
247    /// #### `height-request`
248    ///  Overrides for height request of the widget.
249    ///
250    /// If this is -1, the natural request will be used.
251    ///
252    /// Readable | Writable
253    ///
254    ///
255    /// #### `hexpand`
256    ///  Whether to expand horizontally.
257    ///
258    /// Readable | Writable
259    ///
260    ///
261    /// #### `hexpand-set`
262    ///  Whether to use the `hexpand` property.
263    ///
264    /// Readable | Writable
265    ///
266    ///
267    /// #### `layout-manager`
268    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
269    /// the preferred size of the widget, and allocate its children.
270    ///
271    /// This property is meant to be set by widget implementations,
272    /// typically in their instance init function.
273    ///
274    /// Readable | Writable
275    ///
276    ///
277    /// #### `limit-events`
278    ///  Makes this widget act like a modal dialog, with respect to
279    /// event delivery.
280    ///
281    /// Global event controllers will not handle events with targets
282    /// inside the widget, unless they are set up to ignore propagation
283    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
284    ///
285    /// Readable | Writable
286    ///
287    ///
288    /// #### `margin-bottom`
289    ///  Margin on bottom side of widget.
290    ///
291    /// This property adds margin outside of the widget's normal size
292    /// request, the margin will be added in addition to the size from
293    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
294    ///
295    /// Readable | Writable
296    ///
297    ///
298    /// #### `margin-end`
299    ///  Margin on end of widget, horizontally.
300    ///
301    /// This property supports left-to-right and right-to-left text
302    /// directions.
303    ///
304    /// This property adds margin outside of the widget's normal size
305    /// request, the margin will be added in addition to the size from
306    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
307    ///
308    /// Readable | Writable
309    ///
310    ///
311    /// #### `margin-start`
312    ///  Margin on start of widget, horizontally.
313    ///
314    /// This property supports left-to-right and right-to-left text
315    /// directions.
316    ///
317    /// This property adds margin outside of the widget's normal size
318    /// request, the margin will be added in addition to the size from
319    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
320    ///
321    /// Readable | Writable
322    ///
323    ///
324    /// #### `margin-top`
325    ///  Margin on top side of widget.
326    ///
327    /// This property adds margin outside of the widget's normal size
328    /// request, the margin will be added in addition to the size from
329    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
330    ///
331    /// Readable | Writable
332    ///
333    ///
334    /// #### `name`
335    ///  The name of the widget.
336    ///
337    /// Readable | Writable
338    ///
339    ///
340    /// #### `opacity`
341    ///  The requested opacity of the widget.
342    ///
343    /// Readable | Writable
344    ///
345    ///
346    /// #### `overflow`
347    ///  How content outside the widget's content area is treated.
348    ///
349    /// This property is meant to be set by widget implementations,
350    /// typically in their instance init function.
351    ///
352    /// Readable | Writable
353    ///
354    ///
355    /// #### `parent`
356    ///  The parent widget of this widget.
357    ///
358    /// Readable
359    ///
360    ///
361    /// #### `receives-default`
362    ///  Whether the widget will receive the default action when it is focused.
363    ///
364    /// Readable | Writable
365    ///
366    ///
367    /// #### `root`
368    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
369    ///
370    /// This will be `NULL` if the widget is not contained in a root widget.
371    ///
372    /// Readable
373    ///
374    ///
375    /// #### `scale-factor`
376    ///  The scale factor of the widget.
377    ///
378    /// Readable
379    ///
380    ///
381    /// #### `sensitive`
382    ///  Whether the widget responds to input.
383    ///
384    /// Readable | Writable
385    ///
386    ///
387    /// #### `tooltip-markup`
388    ///  Sets the text of tooltip to be the given string, which is marked up
389    /// with Pango markup.
390    ///
391    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
392    ///
393    /// This is a convenience property which will take care of getting the
394    /// tooltip shown if the given string is not `NULL`:
395    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
396    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
397    /// the default signal handler.
398    ///
399    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
400    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
401    ///
402    /// Readable | Writable
403    ///
404    ///
405    /// #### `tooltip-text`
406    ///  Sets the text of tooltip to be the given string.
407    ///
408    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
409    ///
410    /// This is a convenience property which will take care of getting the
411    /// tooltip shown if the given string is not `NULL`:
412    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
413    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
414    /// the default signal handler.
415    ///
416    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
417    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
418    ///
419    /// Readable | Writable
420    ///
421    ///
422    /// #### `valign`
423    ///  How to distribute vertical space if widget gets extra space.
424    ///
425    /// Readable | Writable
426    ///
427    ///
428    /// #### `vexpand`
429    ///  Whether to expand vertically.
430    ///
431    /// Readable | Writable
432    ///
433    ///
434    /// #### `vexpand-set`
435    ///  Whether to use the `vexpand` property.
436    ///
437    /// Readable | Writable
438    ///
439    ///
440    /// #### `visible`
441    ///  Whether the widget is visible.
442    ///
443    /// Readable | Writable
444    ///
445    ///
446    /// #### `width-request`
447    ///  Overrides for width request of the widget.
448    ///
449    /// If this is -1, the natural request will be used.
450    ///
451    /// Readable | Writable
452    /// </details>
453    /// <details><summary><h4>Accessible</h4></summary>
454    ///
455    ///
456    /// #### `accessible-role`
457    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
458    ///
459    /// The accessible role cannot be changed once set.
460    ///
461    /// Readable | Writable
462    /// </details>
463    /// <details><summary><h4>CellEditable</h4></summary>
464    ///
465    ///
466    /// #### `editing-canceled`
467    ///  Indicates whether editing on the cell has been canceled.
468    ///
469    /// Readable | Writable
470    /// </details>
471    ///
472    /// ## Signals
473    ///
474    ///
475    /// #### `activate`
476    ///  Emitted to when the combo box is activated.
477    ///
478    /// The `::activate` signal on [`ComboBox`][crate::ComboBox] is an action signal and
479    /// emitting it causes the combo box to pop up its dropdown.
480    ///
481    /// Action
482    ///
483    ///
484    /// #### `changed`
485    ///  Emitted when the active item is changed.
486    ///
487    /// The can be due to the user selecting a different item from the list,
488    /// or due to a call to [`ComboBoxExt::set_active_iter()`][crate::prelude::ComboBoxExt::set_active_iter()]. It will
489    /// also be emitted while typing into the entry of a combo box with an entry.
490    ///
491    ///
492    ///
493    ///
494    /// #### `format-entry-text`
495    ///  value,
496    ///                       -1);
497    ///
498    ///   return g_strdup_printf ("`g`", value);
499    /// }
500    /// ```text
501    ///
502    ///
503    ///
504    ///
505    ///
506    /// #### `move-active`
507    ///  Emitted to move the active selection.
508    ///
509    /// This is an [keybinding signal](class.SignalAction.html).
510    ///
511    /// Action
512    ///
513    ///
514    /// #### `popdown`
515    ///  Emitted to popdown the combo box list.
516    ///
517    /// This is an [keybinding signal](class.SignalAction.html).
518    ///
519    /// The default bindings for this signal are Alt+Up and Escape.
520    ///
521    /// Action
522    ///
523    ///
524    /// #### `popup`
525    ///  Emitted to popup the combo box list.
526    ///
527    /// This is an [keybinding signal](class.SignalAction.html).
528    ///
529    /// The default binding for this signal is Alt+Down.
530    ///
531    /// Action
532    /// <details><summary><h4>Widget</h4></summary>
533    ///
534    ///
535    /// #### `destroy`
536    ///  Signals that all holders of a reference to the widget should release
537    /// the reference that they hold.
538    ///
539    /// May result in finalization of the widget if all references are released.
540    ///
541    /// This signal is not suitable for saving widget state.
542    ///
543    ///
544    ///
545    ///
546    /// #### `direction-changed`
547    ///  Emitted when the text direction of a widget changes.
548    ///
549    ///
550    ///
551    ///
552    /// #### `hide`
553    ///  Emitted when @widget is hidden.
554    ///
555    ///
556    ///
557    ///
558    /// #### `keynav-failed`
559    ///  Emitted if keyboard navigation fails.
560    ///
561    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
562    ///
563    ///
564    ///
565    ///
566    /// #### `map`
567    ///  Emitted when @widget is going to be mapped.
568    ///
569    /// A widget is mapped when the widget is visible (which is controlled with
570    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
571    /// are also visible.
572    ///
573    /// The `::map` signal can be used to determine whether a widget will be drawn,
574    /// for instance it can resume an animation that was stopped during the
575    /// emission of [`unmap`][struct@crate::Widget#unmap].
576    ///
577    ///
578    ///
579    ///
580    /// #### `mnemonic-activate`
581    ///  Emitted when a widget is activated via a mnemonic.
582    ///
583    /// The default handler for this signal activates @widget if @group_cycling
584    /// is false, or just makes @widget grab focus if @group_cycling is true.
585    ///
586    ///
587    ///
588    ///
589    /// #### `move-focus`
590    ///   to move backward.
591    ///
592    /// Action
593    ///
594    ///
595    /// #### `query-tooltip`
596    ///  Emitted when the widget’s tooltip is about to be shown.
597    ///
598    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
599    /// is true and the hover timeout has expired with the cursor hovering
600    /// above @widget; or emitted when @widget got focus in keyboard mode.
601    ///
602    /// Using the given coordinates, the signal handler should determine
603    /// whether a tooltip should be shown for @widget. If this is the case
604    /// true should be returned, false otherwise. Note that if @keyboard_mode
605    /// is true, the values of @x and @y are undefined and should not be used.
606    ///
607    /// The signal handler is free to manipulate @tooltip with the therefore
608    /// destined function calls.
609    ///
610    ///
611    ///
612    ///
613    /// #### `realize`
614    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
615    ///
616    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
617    /// or the widget has been mapped (that is, it is going to be drawn).
618    ///
619    ///
620    ///
621    ///
622    /// #### `show`
623    ///  Emitted when @widget is shown.
624    ///
625    ///
626    ///
627    ///
628    /// #### `state-flags-changed`
629    ///  Emitted when the widget state changes.
630    ///
631    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
632    ///
633    ///
634    ///
635    ///
636    /// #### `unmap`
637    ///  Emitted when @widget is going to be unmapped.
638    ///
639    /// A widget is unmapped when either it or any of its parents up to the
640    /// toplevel widget have been set as hidden.
641    ///
642    /// As `::unmap` indicates that a widget will not be shown any longer,
643    /// it can be used to, for example, stop an animation on the widget.
644    ///
645    ///
646    ///
647    ///
648    /// #### `unrealize`
649    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
650    ///
651    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
652    /// or the widget has been unmapped (that is, it is going to be hidden).
653    ///
654    ///
655    /// </details>
656    /// <details><summary><h4>CellEditable</h4></summary>
657    ///
658    ///
659    /// #### `editing-done`
660    ///  This signal is a sign for the cell renderer to update its
661    /// value from the @cell_editable.
662    ///
663    /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
664    /// emitting this signal when they are done editing, e.g.
665    /// [`Entry`][crate::Entry] emits this signal when the user presses Enter. Typical things to
666    /// do in a handler for ::editing-done are to capture the edited value,
667    /// disconnect the @cell_editable from signals on the [`CellRenderer`][crate::CellRenderer], etc.
668    ///
669    /// gtk_cell_editable_editing_done() is a convenience method
670    /// for emitting `GtkCellEditable::editing-done`.
671    ///
672    ///
673    ///
674    ///
675    /// #### `remove-widget`
676    ///  This signal is meant to indicate that the cell is finished
677    /// editing, and the @cell_editable widget is being removed and may
678    /// subsequently be destroyed.
679    ///
680    /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
681    /// emitting this signal when they are done editing. It must
682    /// be emitted after the `GtkCellEditable::editing-done` signal,
683    /// to give the cell renderer a chance to update the cell's value
684    /// before the widget is removed.
685    ///
686    /// gtk_cell_editable_remove_widget() is a convenience method
687    /// for emitting `GtkCellEditable::remove-widget`.
688    ///
689    ///
690    /// </details>
691    ///
692    /// # Implements
693    ///
694    /// [`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]
695    #[doc(alias = "GtkComboBox")]
696    pub struct ComboBox(Object<ffi::GtkComboBox, ffi::GtkComboBoxClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, CellEditable, CellLayout;
697
698    match fn {
699        type_ => || ffi::gtk_combo_box_get_type(),
700    }
701}
702
703#[cfg(not(feature = "v4_10"))]
704glib::wrapper! {
705    #[doc(alias = "GtkComboBox")]
706    pub struct ComboBox(Object<ffi::GtkComboBox, ffi::GtkComboBoxClass>) @extends Widget, @implements Buildable, ConstraintTarget, CellEditable, CellLayout;
707
708    match fn {
709        type_ => || ffi::gtk_combo_box_get_type(),
710    }
711}
712
713impl ComboBox {
714    pub const NONE: Option<&'static ComboBox> = None;
715
716    /// Creates a new empty [`ComboBox`][crate::ComboBox].
717    ///
718    /// # Deprecated since 4.10
719    ///
720    /// Use [`DropDown`][crate::DropDown]
721    ///
722    /// # Returns
723    ///
724    /// A new [`ComboBox`][crate::ComboBox]
725    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
726    #[allow(deprecated)]
727    #[doc(alias = "gtk_combo_box_new")]
728    pub fn new() -> ComboBox {
729        assert_initialized_main_thread!();
730        unsafe { Widget::from_glib_none(ffi::gtk_combo_box_new()).unsafe_cast() }
731    }
732
733    /// Creates a new empty [`ComboBox`][crate::ComboBox] with an entry.
734    ///
735    /// In order to use a combo box with entry, you need to tell it
736    /// which column of the model contains the text for the entry
737    /// by calling [`ComboBoxExt::set_entry_text_column()`][crate::prelude::ComboBoxExt::set_entry_text_column()].
738    ///
739    /// # Deprecated since 4.10
740    ///
741    /// Use [`DropDown`][crate::DropDown]
742    ///
743    /// # Returns
744    ///
745    /// A new [`ComboBox`][crate::ComboBox]
746    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
747    #[allow(deprecated)]
748    #[doc(alias = "gtk_combo_box_new_with_entry")]
749    #[doc(alias = "new_with_entry")]
750    pub fn with_entry() -> ComboBox {
751        assert_initialized_main_thread!();
752        unsafe { Widget::from_glib_none(ffi::gtk_combo_box_new_with_entry()).unsafe_cast() }
753    }
754
755    /// Creates a new [`ComboBox`][crate::ComboBox] with a model.
756    ///
757    /// # Deprecated since 4.10
758    ///
759    /// Use [`DropDown`][crate::DropDown]
760    /// ## `model`
761    /// a [`TreeModel`][crate::TreeModel]
762    ///
763    /// # Returns
764    ///
765    /// A new [`ComboBox`][crate::ComboBox]
766    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
767    #[allow(deprecated)]
768    #[doc(alias = "gtk_combo_box_new_with_model")]
769    #[doc(alias = "new_with_model")]
770    pub fn with_model(model: &impl IsA<TreeModel>) -> ComboBox {
771        skip_assert_initialized!();
772        unsafe {
773            Widget::from_glib_none(ffi::gtk_combo_box_new_with_model(
774                model.as_ref().to_glib_none().0,
775            ))
776            .unsafe_cast()
777        }
778    }
779
780    /// Creates a new empty [`ComboBox`][crate::ComboBox] with an entry and a model.
781    ///
782    /// See also [`with_entry()`][Self::with_entry()].
783    ///
784    /// # Deprecated since 4.10
785    ///
786    /// Use [`DropDown`][crate::DropDown]
787    /// ## `model`
788    /// A [`TreeModel`][crate::TreeModel]
789    ///
790    /// # Returns
791    ///
792    /// A new [`ComboBox`][crate::ComboBox]
793    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
794    #[allow(deprecated)]
795    #[doc(alias = "gtk_combo_box_new_with_model_and_entry")]
796    #[doc(alias = "new_with_model_and_entry")]
797    pub fn with_model_and_entry(model: &impl IsA<TreeModel>) -> ComboBox {
798        skip_assert_initialized!();
799        unsafe {
800            Widget::from_glib_none(ffi::gtk_combo_box_new_with_model_and_entry(
801                model.as_ref().to_glib_none().0,
802            ))
803            .unsafe_cast()
804        }
805    }
806
807    // rustdoc-stripper-ignore-next
808    /// Creates a new builder-pattern struct instance to construct [`ComboBox`] objects.
809    ///
810    /// This method returns an instance of [`ComboBoxBuilder`](crate::builders::ComboBoxBuilder) which can be used to create [`ComboBox`] objects.
811    pub fn builder() -> ComboBoxBuilder {
812        ComboBoxBuilder::new()
813    }
814}
815
816impl Default for ComboBox {
817    fn default() -> Self {
818        Self::new()
819    }
820}
821
822// rustdoc-stripper-ignore-next
823/// A [builder-pattern] type to construct [`ComboBox`] objects.
824///
825/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
826#[must_use = "The builder must be built to be used"]
827pub struct ComboBoxBuilder {
828    builder: glib::object::ObjectBuilder<'static, ComboBox>,
829}
830
831impl ComboBoxBuilder {
832    fn new() -> Self {
833        Self {
834            builder: glib::object::Object::builder(),
835        }
836    }
837
838    /// The item which is currently active.
839    ///
840    /// If the model is a non-flat treemodel, and the active item is not an
841    /// immediate child of the root of the tree, this property has the value
842    /// `gtk_tree_path_get_indices (path)[0]`, where `path` is the
843    /// [`TreePath`][crate::TreePath] of the active item.
844    pub fn active(self, active: i32) -> Self {
845        Self {
846            builder: self.builder.property("active", active),
847        }
848    }
849
850    /// The value of the ID column of the active row.
851    pub fn active_id(self, active_id: impl Into<glib::GString>) -> Self {
852        Self {
853            builder: self.builder.property("active-id", active_id.into()),
854        }
855    }
856
857    /// Whether the dropdown button is sensitive when
858    /// the model is empty.
859    pub fn button_sensitivity(self, button_sensitivity: SensitivityType) -> Self {
860        Self {
861            builder: self
862                .builder
863                .property("button-sensitivity", button_sensitivity),
864        }
865    }
866
867    /// The child widget.
868    pub fn child(self, child: &impl IsA<Widget>) -> Self {
869        Self {
870            builder: self.builder.property("child", child.clone().upcast()),
871        }
872    }
873
874    /// The model column to associate with strings from the entry.
875    ///
876    /// This is property only relevant if the combo was created with
877    /// [`has-entry`][struct@crate::ComboBox#has-entry] is [`true`].
878    pub fn entry_text_column(self, entry_text_column: i32) -> Self {
879        Self {
880            builder: self
881                .builder
882                .property("entry-text-column", entry_text_column),
883        }
884    }
885
886    /// Whether the combo box has an entry.
887    pub fn has_entry(self, has_entry: bool) -> Self {
888        Self {
889            builder: self.builder.property("has-entry", has_entry),
890        }
891    }
892
893    /// The `has-frame` property controls whether a frame is drawn around the entry.
894    pub fn has_frame(self, has_frame: bool) -> Self {
895        Self {
896            builder: self.builder.property("has-frame", has_frame),
897        }
898    }
899
900    /// The model column that provides string IDs for the values
901    /// in the model, if != -1.
902    pub fn id_column(self, id_column: i32) -> Self {
903        Self {
904            builder: self.builder.property("id-column", id_column),
905        }
906    }
907
908    /// The model from which the combo box takes its values.
909    pub fn model(self, model: &impl IsA<TreeModel>) -> Self {
910        Self {
911            builder: self.builder.property("model", model.clone().upcast()),
912        }
913    }
914
915    /// Whether the popup's width should be a fixed width matching the
916    /// allocated width of the combo box.
917    pub fn popup_fixed_width(self, popup_fixed_width: bool) -> Self {
918        Self {
919            builder: self
920                .builder
921                .property("popup-fixed-width", popup_fixed_width),
922        }
923    }
924
925    /// Whether the widget or any of its descendents can accept
926    /// the input focus.
927    ///
928    /// This property is meant to be set by widget implementations,
929    /// typically in their instance init function.
930    pub fn can_focus(self, can_focus: bool) -> Self {
931        Self {
932            builder: self.builder.property("can-focus", can_focus),
933        }
934    }
935
936    /// Whether the widget can receive pointer events.
937    pub fn can_target(self, can_target: bool) -> Self {
938        Self {
939            builder: self.builder.property("can-target", can_target),
940        }
941    }
942
943    /// A list of css classes applied to this widget.
944    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
945        Self {
946            builder: self.builder.property("css-classes", css_classes.into()),
947        }
948    }
949
950    /// The name of this widget in the CSS tree.
951    ///
952    /// This property is meant to be set by widget implementations,
953    /// typically in their instance init function.
954    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
955        Self {
956            builder: self.builder.property("css-name", css_name.into()),
957        }
958    }
959
960    /// The cursor used by @widget.
961    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
962        Self {
963            builder: self.builder.property("cursor", cursor.clone()),
964        }
965    }
966
967    /// Whether the widget should grab focus when it is clicked with the mouse.
968    ///
969    /// This property is only relevant for widgets that can take focus.
970    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
971        Self {
972            builder: self.builder.property("focus-on-click", focus_on_click),
973        }
974    }
975
976    /// Whether this widget itself will accept the input focus.
977    pub fn focusable(self, focusable: bool) -> Self {
978        Self {
979            builder: self.builder.property("focusable", focusable),
980        }
981    }
982
983    /// How to distribute horizontal space if widget gets extra space.
984    pub fn halign(self, halign: Align) -> Self {
985        Self {
986            builder: self.builder.property("halign", halign),
987        }
988    }
989
990    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
991    /// signal on @widget.
992    ///
993    /// A true value indicates that @widget can have a tooltip, in this case
994    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
995    /// determine whether it will provide a tooltip or not.
996    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
997        Self {
998            builder: self.builder.property("has-tooltip", has_tooltip),
999        }
1000    }
1001
1002    /// Overrides for height request of the widget.
1003    ///
1004    /// If this is -1, the natural request will be used.
1005    pub fn height_request(self, height_request: i32) -> Self {
1006        Self {
1007            builder: self.builder.property("height-request", height_request),
1008        }
1009    }
1010
1011    /// Whether to expand horizontally.
1012    pub fn hexpand(self, hexpand: bool) -> Self {
1013        Self {
1014            builder: self.builder.property("hexpand", hexpand),
1015        }
1016    }
1017
1018    /// Whether to use the `hexpand` property.
1019    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1020        Self {
1021            builder: self.builder.property("hexpand-set", hexpand_set),
1022        }
1023    }
1024
1025    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1026    /// the preferred size of the widget, and allocate its children.
1027    ///
1028    /// This property is meant to be set by widget implementations,
1029    /// typically in their instance init function.
1030    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1031        Self {
1032            builder: self
1033                .builder
1034                .property("layout-manager", layout_manager.clone().upcast()),
1035        }
1036    }
1037
1038    /// Makes this widget act like a modal dialog, with respect to
1039    /// event delivery.
1040    ///
1041    /// Global event controllers will not handle events with targets
1042    /// inside the widget, unless they are set up to ignore propagation
1043    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1044    #[cfg(feature = "v4_18")]
1045    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1046    pub fn limit_events(self, limit_events: bool) -> Self {
1047        Self {
1048            builder: self.builder.property("limit-events", limit_events),
1049        }
1050    }
1051
1052    /// Margin on bottom side of widget.
1053    ///
1054    /// This property adds margin outside of the widget's normal size
1055    /// request, the margin will be added in addition to the size from
1056    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1057    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1058        Self {
1059            builder: self.builder.property("margin-bottom", margin_bottom),
1060        }
1061    }
1062
1063    /// Margin on end of widget, horizontally.
1064    ///
1065    /// This property supports left-to-right and right-to-left text
1066    /// directions.
1067    ///
1068    /// This property adds margin outside of the widget's normal size
1069    /// request, the margin will be added in addition to the size from
1070    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1071    pub fn margin_end(self, margin_end: i32) -> Self {
1072        Self {
1073            builder: self.builder.property("margin-end", margin_end),
1074        }
1075    }
1076
1077    /// Margin on start of widget, horizontally.
1078    ///
1079    /// This property supports left-to-right and right-to-left text
1080    /// directions.
1081    ///
1082    /// This property adds margin outside of the widget's normal size
1083    /// request, the margin will be added in addition to the size from
1084    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1085    pub fn margin_start(self, margin_start: i32) -> Self {
1086        Self {
1087            builder: self.builder.property("margin-start", margin_start),
1088        }
1089    }
1090
1091    /// Margin on top side of widget.
1092    ///
1093    /// This property adds margin outside of the widget's normal size
1094    /// request, the margin will be added in addition to the size from
1095    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1096    pub fn margin_top(self, margin_top: i32) -> Self {
1097        Self {
1098            builder: self.builder.property("margin-top", margin_top),
1099        }
1100    }
1101
1102    /// The name of the widget.
1103    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1104        Self {
1105            builder: self.builder.property("name", name.into()),
1106        }
1107    }
1108
1109    /// The requested opacity of the widget.
1110    pub fn opacity(self, opacity: f64) -> Self {
1111        Self {
1112            builder: self.builder.property("opacity", opacity),
1113        }
1114    }
1115
1116    /// How content outside the widget's content area is treated.
1117    ///
1118    /// This property is meant to be set by widget implementations,
1119    /// typically in their instance init function.
1120    pub fn overflow(self, overflow: Overflow) -> Self {
1121        Self {
1122            builder: self.builder.property("overflow", overflow),
1123        }
1124    }
1125
1126    /// Whether the widget will receive the default action when it is focused.
1127    pub fn receives_default(self, receives_default: bool) -> Self {
1128        Self {
1129            builder: self.builder.property("receives-default", receives_default),
1130        }
1131    }
1132
1133    /// Whether the widget responds to input.
1134    pub fn sensitive(self, sensitive: bool) -> Self {
1135        Self {
1136            builder: self.builder.property("sensitive", sensitive),
1137        }
1138    }
1139
1140    /// Sets the text of tooltip to be the given string, which is marked up
1141    /// with Pango markup.
1142    ///
1143    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1144    ///
1145    /// This is a convenience property which will take care of getting the
1146    /// tooltip shown if the given string is not `NULL`:
1147    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1148    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1149    /// the default signal handler.
1150    ///
1151    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1152    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1153    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1154        Self {
1155            builder: self
1156                .builder
1157                .property("tooltip-markup", tooltip_markup.into()),
1158        }
1159    }
1160
1161    /// Sets the text of tooltip to be the given string.
1162    ///
1163    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1164    ///
1165    /// This is a convenience property which will take care of getting the
1166    /// tooltip shown if the given string is not `NULL`:
1167    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1168    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1169    /// the default signal handler.
1170    ///
1171    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1172    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1173    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1174        Self {
1175            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1176        }
1177    }
1178
1179    /// How to distribute vertical space if widget gets extra space.
1180    pub fn valign(self, valign: Align) -> Self {
1181        Self {
1182            builder: self.builder.property("valign", valign),
1183        }
1184    }
1185
1186    /// Whether to expand vertically.
1187    pub fn vexpand(self, vexpand: bool) -> Self {
1188        Self {
1189            builder: self.builder.property("vexpand", vexpand),
1190        }
1191    }
1192
1193    /// Whether to use the `vexpand` property.
1194    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1195        Self {
1196            builder: self.builder.property("vexpand-set", vexpand_set),
1197        }
1198    }
1199
1200    /// Whether the widget is visible.
1201    pub fn visible(self, visible: bool) -> Self {
1202        Self {
1203            builder: self.builder.property("visible", visible),
1204        }
1205    }
1206
1207    /// Overrides for width request of the widget.
1208    ///
1209    /// If this is -1, the natural request will be used.
1210    pub fn width_request(self, width_request: i32) -> Self {
1211        Self {
1212            builder: self.builder.property("width-request", width_request),
1213        }
1214    }
1215
1216    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1217    ///
1218    /// The accessible role cannot be changed once set.
1219    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1220        Self {
1221            builder: self.builder.property("accessible-role", accessible_role),
1222        }
1223    }
1224
1225    /// Indicates whether editing on the cell has been canceled.
1226    pub fn editing_canceled(self, editing_canceled: bool) -> Self {
1227        Self {
1228            builder: self.builder.property("editing-canceled", editing_canceled),
1229        }
1230    }
1231
1232    // rustdoc-stripper-ignore-next
1233    /// Build the [`ComboBox`].
1234    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1235    pub fn build(self) -> ComboBox {
1236        assert_initialized_main_thread!();
1237        self.builder.build()
1238    }
1239}
1240
1241/// Trait containing all [`struct@ComboBox`] methods.
1242///
1243/// # Implementors
1244///
1245/// [`ComboBoxText`][struct@crate::ComboBoxText], [`ComboBox`][struct@crate::ComboBox]
1246pub trait ComboBoxExt: IsA<ComboBox> + 'static {
1247    /// Returns the ID of the active row of @self.
1248    ///
1249    /// This value is taken from the active row and the column specified
1250    /// by the [`id-column`][struct@crate::ComboBox#id-column] property of @self
1251    /// (see [`set_id_column()`][Self::set_id_column()]).
1252    ///
1253    /// The returned value is an interned string which means that you can
1254    /// compare the pointer by value to other interned strings and that you
1255    /// must not free it.
1256    ///
1257    /// If the [`id-column`][struct@crate::ComboBox#id-column] property of @self is
1258    /// not set, or if no row is active, or if the active row has a [`None`]
1259    /// ID value, then [`None`] is returned.
1260    ///
1261    /// # Deprecated since 4.10
1262    ///
1263    /// Use [`DropDown`][crate::DropDown]
1264    ///
1265    /// # Returns
1266    ///
1267    /// the ID of the active row
1268    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1269    #[allow(deprecated)]
1270    #[doc(alias = "gtk_combo_box_get_active_id")]
1271    #[doc(alias = "get_active_id")]
1272    #[doc(alias = "active-id")]
1273    fn active_id(&self) -> Option<glib::GString> {
1274        unsafe {
1275            from_glib_none(ffi::gtk_combo_box_get_active_id(
1276                self.as_ref().to_glib_none().0,
1277            ))
1278        }
1279    }
1280
1281    /// Sets @iter to point to the currently active item.
1282    ///
1283    /// If no item is active, @iter is left unchanged.
1284    ///
1285    /// # Deprecated since 4.10
1286    ///
1287    /// Use [`DropDown`][crate::DropDown]
1288    ///
1289    /// # Returns
1290    ///
1291    /// [`true`] if @iter was set, [`false`] otherwise
1292    ///
1293    /// ## `iter`
1294    /// A [`TreeIter`][crate::TreeIter]
1295    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1296    #[allow(deprecated)]
1297    #[doc(alias = "gtk_combo_box_get_active_iter")]
1298    #[doc(alias = "get_active_iter")]
1299    fn active_iter(&self) -> Option<TreeIter> {
1300        unsafe {
1301            let mut iter = TreeIter::uninitialized();
1302            let ret = from_glib(ffi::gtk_combo_box_get_active_iter(
1303                self.as_ref().to_glib_none().0,
1304                iter.to_glib_none_mut().0,
1305            ));
1306            if ret { Some(iter) } else { None }
1307        }
1308    }
1309
1310    /// Returns whether the combo box sets the dropdown button
1311    /// sensitive or not when there are no items in the model.
1312    ///
1313    /// # Deprecated since 4.10
1314    ///
1315    /// Use [`DropDown`][crate::DropDown]
1316    ///
1317    /// # Returns
1318    ///
1319    /// [`SensitivityType::On`][crate::SensitivityType::On] if the dropdown button
1320    ///   is sensitive when the model is empty, [`SensitivityType::Off`][crate::SensitivityType::Off]
1321    ///   if the button is always insensitive or [`SensitivityType::Auto`][crate::SensitivityType::Auto]
1322    ///   if it is only sensitive as long as the model has one item to
1323    ///   be selected.
1324    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1325    #[allow(deprecated)]
1326    #[doc(alias = "gtk_combo_box_get_button_sensitivity")]
1327    #[doc(alias = "get_button_sensitivity")]
1328    #[doc(alias = "button-sensitivity")]
1329    fn button_sensitivity(&self) -> SensitivityType {
1330        unsafe {
1331            from_glib(ffi::gtk_combo_box_get_button_sensitivity(
1332                self.as_ref().to_glib_none().0,
1333            ))
1334        }
1335    }
1336
1337    /// Gets the child widget of @self.
1338    ///
1339    /// # Deprecated since 4.10
1340    ///
1341    /// Use [`DropDown`][crate::DropDown]
1342    ///
1343    /// # Returns
1344    ///
1345    /// the child widget of @self
1346    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1347    #[allow(deprecated)]
1348    #[doc(alias = "gtk_combo_box_get_child")]
1349    #[doc(alias = "get_child")]
1350    fn child(&self) -> Option<Widget> {
1351        unsafe { from_glib_none(ffi::gtk_combo_box_get_child(self.as_ref().to_glib_none().0)) }
1352    }
1353
1354    /// Returns the column which @self is using to get the strings
1355    /// from to display in the internal entry.
1356    ///
1357    /// # Deprecated since 4.10
1358    ///
1359    /// Use [`DropDown`][crate::DropDown]
1360    ///
1361    /// # Returns
1362    ///
1363    /// A column in the data source model of @self.
1364    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1365    #[allow(deprecated)]
1366    #[doc(alias = "gtk_combo_box_get_entry_text_column")]
1367    #[doc(alias = "get_entry_text_column")]
1368    #[doc(alias = "entry-text-column")]
1369    fn entry_text_column(&self) -> i32 {
1370        unsafe { ffi::gtk_combo_box_get_entry_text_column(self.as_ref().to_glib_none().0) }
1371    }
1372
1373    /// Returns whether the combo box has an entry.
1374    ///
1375    /// # Deprecated since 4.10
1376    ///
1377    /// Use [`DropDown`][crate::DropDown]
1378    ///
1379    /// # Returns
1380    ///
1381    /// whether there is an entry in @self.
1382    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1383    #[allow(deprecated)]
1384    #[doc(alias = "gtk_combo_box_get_has_entry")]
1385    #[doc(alias = "get_has_entry")]
1386    #[doc(alias = "has-entry")]
1387    fn has_entry(&self) -> bool {
1388        unsafe {
1389            from_glib(ffi::gtk_combo_box_get_has_entry(
1390                self.as_ref().to_glib_none().0,
1391            ))
1392        }
1393    }
1394
1395    /// Returns the column which @self is using to get string IDs
1396    /// for values from.
1397    ///
1398    /// # Deprecated since 4.10
1399    ///
1400    /// Use [`DropDown`][crate::DropDown]
1401    ///
1402    /// # Returns
1403    ///
1404    /// A column in the data source model of @self.
1405    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1406    #[allow(deprecated)]
1407    #[doc(alias = "gtk_combo_box_get_id_column")]
1408    #[doc(alias = "get_id_column")]
1409    #[doc(alias = "id-column")]
1410    fn id_column(&self) -> i32 {
1411        unsafe { ffi::gtk_combo_box_get_id_column(self.as_ref().to_glib_none().0) }
1412    }
1413
1414    /// Returns the [`TreeModel`][crate::TreeModel] of @self.
1415    ///
1416    /// # Deprecated since 4.10
1417    ///
1418    /// Use [`DropDown`][crate::DropDown]
1419    ///
1420    /// # Returns
1421    ///
1422    /// A [`TreeModel`][crate::TreeModel] which was passed
1423    ///   during construction.
1424    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1425    #[allow(deprecated)]
1426    #[doc(alias = "gtk_combo_box_get_model")]
1427    #[doc(alias = "get_model")]
1428    fn model(&self) -> Option<TreeModel> {
1429        unsafe { from_glib_none(ffi::gtk_combo_box_get_model(self.as_ref().to_glib_none().0)) }
1430    }
1431
1432    /// Gets whether the popup uses a fixed width.
1433    ///
1434    /// # Deprecated since 4.10
1435    ///
1436    /// Use [`DropDown`][crate::DropDown]
1437    ///
1438    /// # Returns
1439    ///
1440    /// [`true`] if the popup uses a fixed width
1441    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1442    #[allow(deprecated)]
1443    #[doc(alias = "gtk_combo_box_get_popup_fixed_width")]
1444    #[doc(alias = "get_popup_fixed_width")]
1445    #[doc(alias = "popup-fixed-width")]
1446    fn is_popup_fixed_width(&self) -> bool {
1447        unsafe {
1448            from_glib(ffi::gtk_combo_box_get_popup_fixed_width(
1449                self.as_ref().to_glib_none().0,
1450            ))
1451        }
1452    }
1453
1454    /// Hides the menu or dropdown list of @self.
1455    ///
1456    /// This function is mostly intended for use by accessibility technologies;
1457    /// applications should have little use for it.
1458    ///
1459    /// # Deprecated since 4.10
1460    ///
1461    /// Use [`DropDown`][crate::DropDown]
1462    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1463    #[allow(deprecated)]
1464    #[doc(alias = "gtk_combo_box_popdown")]
1465    fn popdown(&self) {
1466        unsafe {
1467            ffi::gtk_combo_box_popdown(self.as_ref().to_glib_none().0);
1468        }
1469    }
1470
1471    /// Pops up the menu or dropdown list of @self.
1472    ///
1473    /// This function is mostly intended for use by accessibility technologies;
1474    /// applications should have little use for it.
1475    ///
1476    /// Before calling this, @self must be mapped, or nothing will happen.
1477    ///
1478    /// # Deprecated since 4.10
1479    ///
1480    /// Use [`DropDown`][crate::DropDown]
1481    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1482    #[allow(deprecated)]
1483    #[doc(alias = "gtk_combo_box_popup")]
1484    fn popup(&self) {
1485        unsafe {
1486            ffi::gtk_combo_box_popup(self.as_ref().to_glib_none().0);
1487        }
1488    }
1489
1490    /// Pops up the menu of @self.
1491    ///
1492    /// Note that currently this does not do anything with the device, as it was
1493    /// previously only used for list-mode combo boxes, and those were removed
1494    /// in GTK 4. However, it is retained in case similar functionality is added
1495    /// back later.
1496    ///
1497    /// # Deprecated since 4.10
1498    ///
1499    /// Use [`DropDown`][crate::DropDown]
1500    /// ## `device`
1501    /// a [`gdk::Device`][crate::gdk::Device]
1502    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1503    #[allow(deprecated)]
1504    #[doc(alias = "gtk_combo_box_popup_for_device")]
1505    fn popup_for_device(&self, device: &gdk::Device) {
1506        unsafe {
1507            ffi::gtk_combo_box_popup_for_device(
1508                self.as_ref().to_glib_none().0,
1509                device.to_glib_none().0,
1510            );
1511        }
1512    }
1513
1514    /// Changes the active row of @self to the one that has an ID equal to
1515    /// @active_id.
1516    ///
1517    /// If @active_id is [`None`], the active row is unset. Rows having
1518    /// a [`None`] ID string cannot be made active by this function.
1519    ///
1520    /// If the [`id-column`][struct@crate::ComboBox#id-column] property of @self is
1521    /// unset or if no row has the given ID then the function does nothing
1522    /// and returns [`false`].
1523    ///
1524    /// # Deprecated since 4.10
1525    ///
1526    /// Use [`DropDown`][crate::DropDown]
1527    /// ## `active_id`
1528    /// the ID of the row to select
1529    ///
1530    /// # Returns
1531    ///
1532    /// [`true`] if a row with a matching ID was found. If a [`None`]
1533    ///   @active_id was given to unset the active row, the function
1534    ///   always returns [`true`].
1535    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1536    #[allow(deprecated)]
1537    #[doc(alias = "gtk_combo_box_set_active_id")]
1538    #[doc(alias = "active-id")]
1539    fn set_active_id(&self, active_id: Option<&str>) -> bool {
1540        unsafe {
1541            from_glib(ffi::gtk_combo_box_set_active_id(
1542                self.as_ref().to_glib_none().0,
1543                active_id.to_glib_none().0,
1544            ))
1545        }
1546    }
1547
1548    /// Sets the current active item to be the one referenced by @iter.
1549    ///
1550    /// If @iter is [`None`], the active item is unset.
1551    ///
1552    /// # Deprecated since 4.10
1553    ///
1554    /// Use [`DropDown`][crate::DropDown]
1555    /// ## `iter`
1556    /// The [`TreeIter`][crate::TreeIter]
1557    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1558    #[allow(deprecated)]
1559    #[doc(alias = "gtk_combo_box_set_active_iter")]
1560    fn set_active_iter(&self, iter: Option<&TreeIter>) {
1561        unsafe {
1562            ffi::gtk_combo_box_set_active_iter(
1563                self.as_ref().to_glib_none().0,
1564                mut_override(iter.to_glib_none().0),
1565            );
1566        }
1567    }
1568
1569    /// Sets whether the dropdown button of the combo box should update
1570    /// its sensitivity depending on the model contents.
1571    ///
1572    /// # Deprecated since 4.10
1573    ///
1574    /// Use [`DropDown`][crate::DropDown]
1575    /// ## `sensitivity`
1576    /// specify the sensitivity of the dropdown button
1577    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1578    #[allow(deprecated)]
1579    #[doc(alias = "gtk_combo_box_set_button_sensitivity")]
1580    #[doc(alias = "button-sensitivity")]
1581    fn set_button_sensitivity(&self, sensitivity: SensitivityType) {
1582        unsafe {
1583            ffi::gtk_combo_box_set_button_sensitivity(
1584                self.as_ref().to_glib_none().0,
1585                sensitivity.into_glib(),
1586            );
1587        }
1588    }
1589
1590    /// Sets the child widget of @self.
1591    ///
1592    /// # Deprecated since 4.10
1593    ///
1594    /// Use [`DropDown`][crate::DropDown]
1595    /// ## `child`
1596    /// the child widget
1597    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1598    #[allow(deprecated)]
1599    #[doc(alias = "gtk_combo_box_set_child")]
1600    #[doc(alias = "child")]
1601    fn set_child(&self, child: Option<&impl IsA<Widget>>) {
1602        unsafe {
1603            ffi::gtk_combo_box_set_child(
1604                self.as_ref().to_glib_none().0,
1605                child.map(|p| p.as_ref()).to_glib_none().0,
1606            );
1607        }
1608    }
1609
1610    /// Sets the model column which @self should use to get strings
1611    /// from to be @text_column.
1612    ///
1613    /// For this column no separate
1614    /// [`CellRenderer`][crate::CellRenderer] is needed.
1615    ///
1616    /// The column @text_column in the model of @self must be of
1617    /// type `G_TYPE_STRING`.
1618    ///
1619    /// This is only relevant if @self has been created with
1620    /// [`has-entry`][struct@crate::ComboBox#has-entry] as [`true`].
1621    ///
1622    /// # Deprecated since 4.10
1623    ///
1624    /// Use [`DropDown`][crate::DropDown]
1625    /// ## `text_column`
1626    /// A column in @model to get the strings from for
1627    ///   the internal entry
1628    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1629    #[allow(deprecated)]
1630    #[doc(alias = "gtk_combo_box_set_entry_text_column")]
1631    #[doc(alias = "entry-text-column")]
1632    fn set_entry_text_column(&self, text_column: i32) {
1633        unsafe {
1634            ffi::gtk_combo_box_set_entry_text_column(self.as_ref().to_glib_none().0, text_column);
1635        }
1636    }
1637
1638    /// Sets the model column which @self should use to get string IDs
1639    /// for values from.
1640    ///
1641    /// The column @id_column in the model of @self must be of type
1642    /// `G_TYPE_STRING`.
1643    ///
1644    /// # Deprecated since 4.10
1645    ///
1646    /// Use [`DropDown`][crate::DropDown]
1647    /// ## `id_column`
1648    /// A column in @model to get string IDs for values from
1649    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1650    #[allow(deprecated)]
1651    #[doc(alias = "gtk_combo_box_set_id_column")]
1652    #[doc(alias = "id-column")]
1653    fn set_id_column(&self, id_column: i32) {
1654        unsafe {
1655            ffi::gtk_combo_box_set_id_column(self.as_ref().to_glib_none().0, id_column);
1656        }
1657    }
1658
1659    /// Sets the model used by @self to be @model.
1660    ///
1661    /// Will unset a previously set model (if applicable). If model is [`None`],
1662    /// then it will unset the model.
1663    ///
1664    /// Note that this function does not clear the cell renderers, you have to
1665    /// call [`CellLayoutExt::clear()`][crate::prelude::CellLayoutExt::clear()] yourself if you need to set up different
1666    /// cell renderers for the new model.
1667    ///
1668    /// # Deprecated since 4.10
1669    ///
1670    /// Use [`DropDown`][crate::DropDown]
1671    /// ## `model`
1672    /// A [`TreeModel`][crate::TreeModel]
1673    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1674    #[allow(deprecated)]
1675    #[doc(alias = "gtk_combo_box_set_model")]
1676    #[doc(alias = "model")]
1677    fn set_model(&self, model: Option<&impl IsA<TreeModel>>) {
1678        unsafe {
1679            ffi::gtk_combo_box_set_model(
1680                self.as_ref().to_glib_none().0,
1681                model.map(|p| p.as_ref()).to_glib_none().0,
1682            );
1683        }
1684    }
1685
1686    /// Specifies whether the popup’s width should be a fixed width.
1687    ///
1688    /// If @fixed is [`true`], the popup's width is set to match the
1689    /// allocated width of the combo box.
1690    ///
1691    /// # Deprecated since 4.10
1692    ///
1693    /// Use [`DropDown`][crate::DropDown]
1694    /// ## `fixed`
1695    /// whether to use a fixed popup width
1696    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1697    #[allow(deprecated)]
1698    #[doc(alias = "gtk_combo_box_set_popup_fixed_width")]
1699    #[doc(alias = "popup-fixed-width")]
1700    fn set_popup_fixed_width(&self, fixed: bool) {
1701        unsafe {
1702            ffi::gtk_combo_box_set_popup_fixed_width(
1703                self.as_ref().to_glib_none().0,
1704                fixed.into_glib(),
1705            );
1706        }
1707    }
1708
1709    /// Sets the row separator function, which is used to determine
1710    /// whether a row should be drawn as a separator.
1711    ///
1712    /// If the row separator function is [`None`], no separators are drawn.
1713    /// This is the default value.
1714    ///
1715    /// # Deprecated since 4.10
1716    ///
1717    /// Use [`DropDown`][crate::DropDown]
1718    /// ## `func`
1719    /// a `GtkTreeViewRowSeparatorFunc`
1720    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1721    #[allow(deprecated)]
1722    #[doc(alias = "gtk_combo_box_set_row_separator_func")]
1723    fn set_row_separator_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(&self, func: P) {
1724        let func_data: Box_<P> = Box_::new(func);
1725        unsafe extern "C" fn func_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(
1726            model: *mut ffi::GtkTreeModel,
1727            iter: *mut ffi::GtkTreeIter,
1728            data: glib::ffi::gpointer,
1729        ) -> glib::ffi::gboolean {
1730            unsafe {
1731                let model = from_glib_borrow(model);
1732                let iter = from_glib_borrow(iter);
1733                let callback = &*(data as *mut P);
1734                (*callback)(&model, &iter).into_glib()
1735            }
1736        }
1737        let func = Some(func_func::<P> as _);
1738        unsafe extern "C" fn destroy_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(
1739            data: glib::ffi::gpointer,
1740        ) {
1741            unsafe {
1742                let _callback = Box_::from_raw(data as *mut P);
1743            }
1744        }
1745        let destroy_call3 = Some(destroy_func::<P> as _);
1746        let super_callback0: Box_<P> = func_data;
1747        unsafe {
1748            ffi::gtk_combo_box_set_row_separator_func(
1749                self.as_ref().to_glib_none().0,
1750                func,
1751                Box_::into_raw(super_callback0) as *mut _,
1752                destroy_call3,
1753            );
1754        }
1755    }
1756
1757    /// The `has-frame` property controls whether a frame is drawn around the entry.
1758    #[doc(alias = "has-frame")]
1759    fn has_frame(&self) -> bool {
1760        ObjectExt::property(self.as_ref(), "has-frame")
1761    }
1762
1763    /// The `has-frame` property controls whether a frame is drawn around the entry.
1764    #[doc(alias = "has-frame")]
1765    fn set_has_frame(&self, has_frame: bool) {
1766        ObjectExt::set_property(self.as_ref(), "has-frame", has_frame)
1767    }
1768
1769    /// Whether the combo boxes dropdown is popped up.
1770    ///
1771    /// Note that this property is mainly useful, because
1772    /// it allows you to connect to notify::popup-shown.
1773    #[doc(alias = "popup-shown")]
1774    fn is_popup_shown(&self) -> bool {
1775        ObjectExt::property(self.as_ref(), "popup-shown")
1776    }
1777
1778    /// Emitted to when the combo box is activated.
1779    ///
1780    /// The `::activate` signal on [`ComboBox`][crate::ComboBox] is an action signal and
1781    /// emitting it causes the combo box to pop up its dropdown.
1782    #[cfg(feature = "v4_6")]
1783    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1784    #[doc(alias = "activate")]
1785    fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1786        unsafe extern "C" fn activate_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
1787            this: *mut ffi::GtkComboBox,
1788            f: glib::ffi::gpointer,
1789        ) {
1790            unsafe {
1791                let f: &F = &*(f as *const F);
1792                f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
1793            }
1794        }
1795        unsafe {
1796            let f: Box_<F> = Box_::new(f);
1797            connect_raw(
1798                self.as_ptr() as *mut _,
1799                c"activate".as_ptr(),
1800                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1801                    activate_trampoline::<Self, F> as *const (),
1802                )),
1803                Box_::into_raw(f),
1804            )
1805        }
1806    }
1807
1808    #[cfg(feature = "v4_6")]
1809    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1810    fn emit_activate(&self) {
1811        self.emit_by_name::<()>("activate", &[]);
1812    }
1813
1814    /// Emitted when the active item is changed.
1815    ///
1816    /// The can be due to the user selecting a different item from the list,
1817    /// or due to a call to [`set_active_iter()`][Self::set_active_iter()]. It will
1818    /// also be emitted while typing into the entry of a combo box with an entry.
1819    #[doc(alias = "changed")]
1820    fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1821        unsafe extern "C" fn changed_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
1822            this: *mut ffi::GtkComboBox,
1823            f: glib::ffi::gpointer,
1824        ) {
1825            unsafe {
1826                let f: &F = &*(f as *const F);
1827                f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
1828            }
1829        }
1830        unsafe {
1831            let f: Box_<F> = Box_::new(f);
1832            connect_raw(
1833                self.as_ptr() as *mut _,
1834                c"changed".as_ptr(),
1835                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1836                    changed_trampoline::<Self, F> as *const (),
1837                )),
1838                Box_::into_raw(f),
1839            )
1840        }
1841    }
1842
1843    /// value,
1844    ///                       -1);
1845    ///
1846    ///   return g_strdup_printf ("`g`", value);
1847    /// }
1848    /// ```text
1849    ///
1850    /// ## `path`
1851    /// the [`TreePath`][crate::TreePath] string from the combo box's current model
1852    ///   to format text for
1853    ///
1854    /// # Returns
1855    ///
1856    /// a newly allocated string representing @path
1857    ///   for the current [`ComboBox`][crate::ComboBox] model.
1858    #[doc(alias = "format-entry-text")]
1859    fn connect_format_entry_text<F: Fn(&Self, &str) -> String + 'static>(
1860        &self,
1861        f: F,
1862    ) -> SignalHandlerId {
1863        unsafe extern "C" fn format_entry_text_trampoline<
1864            P: IsA<ComboBox>,
1865            F: Fn(&P, &str) -> String + 'static,
1866        >(
1867            this: *mut ffi::GtkComboBox,
1868            path: *mut std::ffi::c_char,
1869            f: glib::ffi::gpointer,
1870        ) -> *mut std::ffi::c_char {
1871            unsafe {
1872                let f: &F = &*(f as *const F);
1873                f(
1874                    ComboBox::from_glib_borrow(this).unsafe_cast_ref(),
1875                    &glib::GString::from_glib_borrow(path),
1876                )
1877                .to_glib_full()
1878            }
1879        }
1880        unsafe {
1881            let f: Box_<F> = Box_::new(f);
1882            connect_raw(
1883                self.as_ptr() as *mut _,
1884                c"format-entry-text".as_ptr(),
1885                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1886                    format_entry_text_trampoline::<Self, F> as *const (),
1887                )),
1888                Box_::into_raw(f),
1889            )
1890        }
1891    }
1892
1893    /// Emitted to move the active selection.
1894    ///
1895    /// This is an [keybinding signal](class.SignalAction.html).
1896    /// ## `scroll_type`
1897    /// a [`ScrollType`][crate::ScrollType]
1898    #[doc(alias = "move-active")]
1899    fn connect_move_active<F: Fn(&Self, ScrollType) + 'static>(&self, f: F) -> SignalHandlerId {
1900        unsafe extern "C" fn move_active_trampoline<
1901            P: IsA<ComboBox>,
1902            F: Fn(&P, ScrollType) + 'static,
1903        >(
1904            this: *mut ffi::GtkComboBox,
1905            scroll_type: ffi::GtkScrollType,
1906            f: glib::ffi::gpointer,
1907        ) {
1908            unsafe {
1909                let f: &F = &*(f as *const F);
1910                f(
1911                    ComboBox::from_glib_borrow(this).unsafe_cast_ref(),
1912                    from_glib(scroll_type),
1913                )
1914            }
1915        }
1916        unsafe {
1917            let f: Box_<F> = Box_::new(f);
1918            connect_raw(
1919                self.as_ptr() as *mut _,
1920                c"move-active".as_ptr(),
1921                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1922                    move_active_trampoline::<Self, F> as *const (),
1923                )),
1924                Box_::into_raw(f),
1925            )
1926        }
1927    }
1928
1929    fn emit_move_active(&self, scroll_type: ScrollType) {
1930        self.emit_by_name::<()>("move-active", &[&scroll_type]);
1931    }
1932
1933    /// Emitted to popdown the combo box list.
1934    ///
1935    /// This is an [keybinding signal](class.SignalAction.html).
1936    ///
1937    /// The default bindings for this signal are Alt+Up and Escape.
1938    ///
1939    /// # Returns
1940    ///
1941    /// whether the combo box was popped down
1942    #[doc(alias = "popdown")]
1943    fn connect_popdown<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
1944        unsafe extern "C" fn popdown_trampoline<P: IsA<ComboBox>, F: Fn(&P) -> bool + 'static>(
1945            this: *mut ffi::GtkComboBox,
1946            f: glib::ffi::gpointer,
1947        ) -> glib::ffi::gboolean {
1948            unsafe {
1949                let f: &F = &*(f as *const F);
1950                f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
1951            }
1952        }
1953        unsafe {
1954            let f: Box_<F> = Box_::new(f);
1955            connect_raw(
1956                self.as_ptr() as *mut _,
1957                c"popdown".as_ptr(),
1958                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1959                    popdown_trampoline::<Self, F> as *const (),
1960                )),
1961                Box_::into_raw(f),
1962            )
1963        }
1964    }
1965
1966    fn emit_popdown(&self) -> bool {
1967        self.emit_by_name("popdown", &[])
1968    }
1969
1970    /// Emitted to popup the combo box list.
1971    ///
1972    /// This is an [keybinding signal](class.SignalAction.html).
1973    ///
1974    /// The default binding for this signal is Alt+Down.
1975    #[doc(alias = "popup")]
1976    fn connect_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1977        unsafe extern "C" fn popup_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
1978            this: *mut ffi::GtkComboBox,
1979            f: glib::ffi::gpointer,
1980        ) {
1981            unsafe {
1982                let f: &F = &*(f as *const F);
1983                f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
1984            }
1985        }
1986        unsafe {
1987            let f: Box_<F> = Box_::new(f);
1988            connect_raw(
1989                self.as_ptr() as *mut _,
1990                c"popup".as_ptr(),
1991                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1992                    popup_trampoline::<Self, F> as *const (),
1993                )),
1994                Box_::into_raw(f),
1995            )
1996        }
1997    }
1998
1999    fn emit_popup(&self) {
2000        self.emit_by_name::<()>("popup", &[]);
2001    }
2002
2003    #[doc(alias = "active")]
2004    fn connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2005        unsafe extern "C" fn notify_active_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
2006            this: *mut ffi::GtkComboBox,
2007            _param_spec: glib::ffi::gpointer,
2008            f: glib::ffi::gpointer,
2009        ) {
2010            unsafe {
2011                let f: &F = &*(f as *const F);
2012                f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2013            }
2014        }
2015        unsafe {
2016            let f: Box_<F> = Box_::new(f);
2017            connect_raw(
2018                self.as_ptr() as *mut _,
2019                c"notify::active".as_ptr(),
2020                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2021                    notify_active_trampoline::<Self, F> as *const (),
2022                )),
2023                Box_::into_raw(f),
2024            )
2025        }
2026    }
2027
2028    #[doc(alias = "active-id")]
2029    fn connect_active_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2030        unsafe extern "C" fn notify_active_id_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
2031            this: *mut ffi::GtkComboBox,
2032            _param_spec: glib::ffi::gpointer,
2033            f: glib::ffi::gpointer,
2034        ) {
2035            unsafe {
2036                let f: &F = &*(f as *const F);
2037                f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2038            }
2039        }
2040        unsafe {
2041            let f: Box_<F> = Box_::new(f);
2042            connect_raw(
2043                self.as_ptr() as *mut _,
2044                c"notify::active-id".as_ptr(),
2045                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2046                    notify_active_id_trampoline::<Self, F> as *const (),
2047                )),
2048                Box_::into_raw(f),
2049            )
2050        }
2051    }
2052
2053    #[doc(alias = "button-sensitivity")]
2054    fn connect_button_sensitivity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2055        unsafe extern "C" fn notify_button_sensitivity_trampoline<
2056            P: IsA<ComboBox>,
2057            F: Fn(&P) + 'static,
2058        >(
2059            this: *mut ffi::GtkComboBox,
2060            _param_spec: glib::ffi::gpointer,
2061            f: glib::ffi::gpointer,
2062        ) {
2063            unsafe {
2064                let f: &F = &*(f as *const F);
2065                f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2066            }
2067        }
2068        unsafe {
2069            let f: Box_<F> = Box_::new(f);
2070            connect_raw(
2071                self.as_ptr() as *mut _,
2072                c"notify::button-sensitivity".as_ptr(),
2073                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2074                    notify_button_sensitivity_trampoline::<Self, F> as *const (),
2075                )),
2076                Box_::into_raw(f),
2077            )
2078        }
2079    }
2080
2081    #[doc(alias = "child")]
2082    fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2083        unsafe extern "C" fn notify_child_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
2084            this: *mut ffi::GtkComboBox,
2085            _param_spec: glib::ffi::gpointer,
2086            f: glib::ffi::gpointer,
2087        ) {
2088            unsafe {
2089                let f: &F = &*(f as *const F);
2090                f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2091            }
2092        }
2093        unsafe {
2094            let f: Box_<F> = Box_::new(f);
2095            connect_raw(
2096                self.as_ptr() as *mut _,
2097                c"notify::child".as_ptr(),
2098                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2099                    notify_child_trampoline::<Self, F> as *const (),
2100                )),
2101                Box_::into_raw(f),
2102            )
2103        }
2104    }
2105
2106    #[doc(alias = "entry-text-column")]
2107    fn connect_entry_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2108        unsafe extern "C" fn notify_entry_text_column_trampoline<
2109            P: IsA<ComboBox>,
2110            F: Fn(&P) + 'static,
2111        >(
2112            this: *mut ffi::GtkComboBox,
2113            _param_spec: glib::ffi::gpointer,
2114            f: glib::ffi::gpointer,
2115        ) {
2116            unsafe {
2117                let f: &F = &*(f as *const F);
2118                f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2119            }
2120        }
2121        unsafe {
2122            let f: Box_<F> = Box_::new(f);
2123            connect_raw(
2124                self.as_ptr() as *mut _,
2125                c"notify::entry-text-column".as_ptr(),
2126                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2127                    notify_entry_text_column_trampoline::<Self, F> as *const (),
2128                )),
2129                Box_::into_raw(f),
2130            )
2131        }
2132    }
2133
2134    #[doc(alias = "has-frame")]
2135    fn connect_has_frame_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2136        unsafe extern "C" fn notify_has_frame_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
2137            this: *mut ffi::GtkComboBox,
2138            _param_spec: glib::ffi::gpointer,
2139            f: glib::ffi::gpointer,
2140        ) {
2141            unsafe {
2142                let f: &F = &*(f as *const F);
2143                f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2144            }
2145        }
2146        unsafe {
2147            let f: Box_<F> = Box_::new(f);
2148            connect_raw(
2149                self.as_ptr() as *mut _,
2150                c"notify::has-frame".as_ptr(),
2151                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2152                    notify_has_frame_trampoline::<Self, F> as *const (),
2153                )),
2154                Box_::into_raw(f),
2155            )
2156        }
2157    }
2158
2159    #[doc(alias = "id-column")]
2160    fn connect_id_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2161        unsafe extern "C" fn notify_id_column_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
2162            this: *mut ffi::GtkComboBox,
2163            _param_spec: glib::ffi::gpointer,
2164            f: glib::ffi::gpointer,
2165        ) {
2166            unsafe {
2167                let f: &F = &*(f as *const F);
2168                f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2169            }
2170        }
2171        unsafe {
2172            let f: Box_<F> = Box_::new(f);
2173            connect_raw(
2174                self.as_ptr() as *mut _,
2175                c"notify::id-column".as_ptr(),
2176                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2177                    notify_id_column_trampoline::<Self, F> as *const (),
2178                )),
2179                Box_::into_raw(f),
2180            )
2181        }
2182    }
2183
2184    #[doc(alias = "model")]
2185    fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2186        unsafe extern "C" fn notify_model_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
2187            this: *mut ffi::GtkComboBox,
2188            _param_spec: glib::ffi::gpointer,
2189            f: glib::ffi::gpointer,
2190        ) {
2191            unsafe {
2192                let f: &F = &*(f as *const F);
2193                f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2194            }
2195        }
2196        unsafe {
2197            let f: Box_<F> = Box_::new(f);
2198            connect_raw(
2199                self.as_ptr() as *mut _,
2200                c"notify::model".as_ptr(),
2201                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2202                    notify_model_trampoline::<Self, F> as *const (),
2203                )),
2204                Box_::into_raw(f),
2205            )
2206        }
2207    }
2208
2209    #[doc(alias = "popup-fixed-width")]
2210    fn connect_popup_fixed_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2211        unsafe extern "C" fn notify_popup_fixed_width_trampoline<
2212            P: IsA<ComboBox>,
2213            F: Fn(&P) + 'static,
2214        >(
2215            this: *mut ffi::GtkComboBox,
2216            _param_spec: glib::ffi::gpointer,
2217            f: glib::ffi::gpointer,
2218        ) {
2219            unsafe {
2220                let f: &F = &*(f as *const F);
2221                f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2222            }
2223        }
2224        unsafe {
2225            let f: Box_<F> = Box_::new(f);
2226            connect_raw(
2227                self.as_ptr() as *mut _,
2228                c"notify::popup-fixed-width".as_ptr(),
2229                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2230                    notify_popup_fixed_width_trampoline::<Self, F> as *const (),
2231                )),
2232                Box_::into_raw(f),
2233            )
2234        }
2235    }
2236
2237    #[doc(alias = "popup-shown")]
2238    fn connect_popup_shown_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2239        unsafe extern "C" fn notify_popup_shown_trampoline<
2240            P: IsA<ComboBox>,
2241            F: Fn(&P) + 'static,
2242        >(
2243            this: *mut ffi::GtkComboBox,
2244            _param_spec: glib::ffi::gpointer,
2245            f: glib::ffi::gpointer,
2246        ) {
2247            unsafe {
2248                let f: &F = &*(f as *const F);
2249                f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2250            }
2251        }
2252        unsafe {
2253            let f: Box_<F> = Box_::new(f);
2254            connect_raw(
2255                self.as_ptr() as *mut _,
2256                c"notify::popup-shown".as_ptr(),
2257                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2258                    notify_popup_shown_trampoline::<Self, F> as *const (),
2259                )),
2260                Box_::into_raw(f),
2261            )
2262        }
2263    }
2264}
2265
2266impl<O: IsA<ComboBox>> ComboBoxExt for O {}