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