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