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