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