gtk/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
5use crate::{
6 Align, Bin, Buildable, CellArea, CellEditable, CellLayout, Container, ResizeMode, ScrollType,
7 SensitivityType, TreeIter, TreeModel, Widget, ffi,
8};
9use glib::{
10 object::ObjectType as _,
11 prelude::*,
12 signal::{SignalHandlerId, connect_raw},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 ///
19 /// combobox
20 /// ├── box.linked
21 /// │ ├── entry.combo
22 /// │ ╰── button.combo
23 /// │ ╰── box
24 /// │ ╰── arrow
25 /// ╰── window.popup
26 /// ]|
27 ///
28 /// A GtkComboBox with an entry has a single CSS node with name combobox. It
29 /// contains a box with the .linked class. That box contains an entry and a
30 /// button, both with the .combo class added.
31 /// The button also contains another node with name arrow.
32 ///
33 /// ## Properties
34 ///
35 ///
36 /// #### `active`
37 /// The item which is currently active. If the model is a non-flat treemodel,
38 /// and the active item is not an immediate child of the root of the tree,
39 /// this property has the value
40 /// `gtk_tree_path_get_indices (path)[0]`,
41 /// where `path` is the [`TreePath`][crate::TreePath] of the active item.
42 ///
43 /// Readable | Writable
44 ///
45 ///
46 /// #### `active-id`
47 /// The value of the ID column of the active row.
48 ///
49 /// Readable | Writable
50 ///
51 ///
52 /// #### `add-tearoffs`
53 /// The add-tearoffs property controls whether generated menus
54 /// have tearoff menu items.
55 ///
56 /// Note that this only affects menu style combo boxes.
57 ///
58 /// Readable | Writable
59 ///
60 ///
61 /// #### `button-sensitivity`
62 /// Whether the dropdown button is sensitive when
63 /// the model is empty.
64 ///
65 /// Readable | Writable
66 ///
67 ///
68 /// #### `cell-area`
69 /// The [`CellArea`][crate::CellArea] used to layout cell renderers for this combo box.
70 ///
71 /// If no area is specified when creating the combo box with [`ComboBox::with_area()`][crate::ComboBox::with_area()]
72 /// a horizontally oriented [`CellAreaBox`][crate::CellAreaBox] will be used.
73 ///
74 /// Readable | Writable | Construct Only
75 ///
76 ///
77 /// #### `column-span-column`
78 /// If this is set to a non-negative value, it must be the index of a column
79 /// of type `G_TYPE_INT` in the model. The value in that column for each item
80 /// will determine how many columns that item will span in the popup.
81 /// Therefore, values in this column must be greater than zero, and the sum of
82 /// an item’s column position + span should not exceed [`wrap-width`][struct@crate::ComboBox#wrap-width].
83 ///
84 /// Readable | Writable
85 ///
86 ///
87 /// #### `entry-text-column`
88 /// The column in the combo box's model to associate with strings from the entry
89 /// if the combo was created with [`has-entry`][struct@crate::ComboBox#has-entry] = [`true`].
90 ///
91 /// Readable | Writable
92 ///
93 ///
94 /// #### `has-entry`
95 /// Whether the combo box has an entry.
96 ///
97 /// Readable | Writable | Construct Only
98 ///
99 ///
100 /// #### `has-frame`
101 /// The has-frame property controls whether a frame
102 /// is drawn around the entry.
103 ///
104 /// Readable | Writable
105 ///
106 ///
107 /// #### `id-column`
108 /// The column in the combo box's model that provides string
109 /// IDs for the values in the model, if != -1.
110 ///
111 /// Readable | Writable
112 ///
113 ///
114 /// #### `model`
115 /// The model from which the combo box takes the values shown
116 /// in the list.
117 ///
118 /// Readable | Writable
119 ///
120 ///
121 /// #### `popup-fixed-width`
122 /// Whether the popup's width should be a fixed width matching the
123 /// allocated width of the combo box.
124 ///
125 /// Readable | Writable
126 ///
127 ///
128 /// #### `popup-shown`
129 /// Whether the combo boxes dropdown is popped up.
130 /// Note that this property is mainly useful, because
131 /// it allows you to connect to notify::popup-shown.
132 ///
133 /// Readable
134 ///
135 ///
136 /// #### `row-span-column`
137 /// If this is set to a non-negative value, it must be the index of a column
138 /// of type `G_TYPE_INT` in the model. The value in that column for each item
139 /// will determine how many rows that item will span in the popup. Therefore,
140 /// values in this column must be greater than zero.
141 ///
142 /// Readable | Writable
143 ///
144 ///
145 /// #### `tearoff-title`
146 /// A title that may be displayed by the window manager
147 /// when the popup is torn-off.
148 ///
149 /// Readable | Writable
150 ///
151 ///
152 /// #### `wrap-width`
153 /// If wrap-width is set to a positive value, items in the popup will be laid
154 /// out along multiple columns, starting a new row on reaching the wrap width.
155 ///
156 /// Readable | Writable
157 /// <details><summary><h4>Container</h4></summary>
158 ///
159 ///
160 /// #### `border-width`
161 /// Readable | Writable
162 ///
163 ///
164 /// #### `child`
165 /// Writable
166 ///
167 ///
168 /// #### `resize-mode`
169 /// Readable | Writable
170 /// </details>
171 /// <details><summary><h4>Widget</h4></summary>
172 ///
173 ///
174 /// #### `app-paintable`
175 /// Readable | Writable
176 ///
177 ///
178 /// #### `can-default`
179 /// Readable | Writable
180 ///
181 ///
182 /// #### `can-focus`
183 /// Readable | Writable
184 ///
185 ///
186 /// #### `composite-child`
187 /// Readable
188 ///
189 ///
190 /// #### `double-buffered`
191 /// Whether the widget is double buffered.
192 ///
193 /// Readable | Writable
194 ///
195 ///
196 /// #### `events`
197 /// Readable | Writable
198 ///
199 ///
200 /// #### `expand`
201 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
202 ///
203 /// Readable | Writable
204 ///
205 ///
206 /// #### `focus-on-click`
207 /// Whether the widget should grab focus when it is clicked with the mouse.
208 ///
209 /// This property is only relevant for widgets that can take focus.
210 ///
211 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
212 /// GtkComboBox) implemented this property individually.
213 ///
214 /// Readable | Writable
215 ///
216 ///
217 /// #### `halign`
218 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
219 ///
220 /// Readable | Writable
221 ///
222 ///
223 /// #### `has-default`
224 /// Readable | Writable
225 ///
226 ///
227 /// #### `has-focus`
228 /// Readable | Writable
229 ///
230 ///
231 /// #### `has-tooltip`
232 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
233 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
234 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
235 /// whether it will provide a tooltip or not.
236 ///
237 /// Note that setting this property to [`true`] for the first time will change
238 /// the event masks of the GdkWindows of this widget to include leave-notify
239 /// and motion-notify events. This cannot and will not be undone when the
240 /// property is set to [`false`] again.
241 ///
242 /// Readable | Writable
243 ///
244 ///
245 /// #### `height-request`
246 /// Readable | Writable
247 ///
248 ///
249 /// #### `hexpand`
250 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
251 ///
252 /// Readable | Writable
253 ///
254 ///
255 /// #### `hexpand-set`
256 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
257 ///
258 /// Readable | Writable
259 ///
260 ///
261 /// #### `is-focus`
262 /// Readable | Writable
263 ///
264 ///
265 /// #### `margin`
266 /// Sets all four sides' margin at once. If read, returns max
267 /// margin on any side.
268 ///
269 /// Readable | Writable
270 ///
271 ///
272 /// #### `margin-bottom`
273 /// Margin on bottom side of widget.
274 ///
275 /// This property adds margin outside of the widget's normal size
276 /// request, the margin will be added in addition to the size from
277 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
278 ///
279 /// Readable | Writable
280 ///
281 ///
282 /// #### `margin-end`
283 /// Margin on end of widget, horizontally. This property supports
284 /// left-to-right and right-to-left text directions.
285 ///
286 /// This property adds margin outside of the widget's normal size
287 /// request, the margin will be added in addition to the size from
288 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
289 ///
290 /// Readable | Writable
291 ///
292 ///
293 /// #### `margin-left`
294 /// Margin on left side of widget.
295 ///
296 /// This property adds margin outside of the widget's normal size
297 /// request, the margin will be added in addition to the size from
298 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
299 ///
300 /// Readable | Writable
301 ///
302 ///
303 /// #### `margin-right`
304 /// Margin on right side of widget.
305 ///
306 /// This property adds margin outside of the widget's normal size
307 /// request, the margin will be added in addition to the size from
308 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
309 ///
310 /// Readable | Writable
311 ///
312 ///
313 /// #### `margin-start`
314 /// Margin on start of widget, horizontally. This property supports
315 /// left-to-right and right-to-left text directions.
316 ///
317 /// This property adds margin outside of the widget's normal size
318 /// request, the margin will be added in addition to the size from
319 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
320 ///
321 /// Readable | Writable
322 ///
323 ///
324 /// #### `margin-top`
325 /// Margin on top side of widget.
326 ///
327 /// This property adds margin outside of the widget's normal size
328 /// request, the margin will be added in addition to the size from
329 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
330 ///
331 /// Readable | Writable
332 ///
333 ///
334 /// #### `name`
335 /// Readable | Writable
336 ///
337 ///
338 /// #### `no-show-all`
339 /// Readable | Writable
340 ///
341 ///
342 /// #### `opacity`
343 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
344 /// more details about window opacity.
345 ///
346 /// Before 3.8 this was only available in GtkWindow
347 ///
348 /// Readable | Writable
349 ///
350 ///
351 /// #### `parent`
352 /// Readable | Writable
353 ///
354 ///
355 /// #### `receives-default`
356 /// Readable | Writable
357 ///
358 ///
359 /// #### `scale-factor`
360 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
361 /// more details about widget scaling.
362 ///
363 /// Readable
364 ///
365 ///
366 /// #### `sensitive`
367 /// Readable | Writable
368 ///
369 ///
370 /// #### `style`
371 /// The style of the widget, which contains information about how it will look (colors, etc).
372 ///
373 /// Readable | Writable
374 ///
375 ///
376 /// #### `tooltip-markup`
377 /// Sets the text of tooltip to be the given string, which is marked up
378 /// with the [Pango text markup language][PangoMarkupFormat].
379 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
380 ///
381 /// This is a convenience property which will take care of getting the
382 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
383 /// will automatically be set to [`true`] and there will be taken care of
384 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
385 ///
386 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
387 /// are set, the last one wins.
388 ///
389 /// Readable | Writable
390 ///
391 ///
392 /// #### `tooltip-text`
393 /// Sets the text of tooltip to be the given string.
394 ///
395 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
396 ///
397 /// This is a convenience property which will take care of getting the
398 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
399 /// will automatically be set to [`true`] and there will be taken care of
400 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
401 ///
402 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
403 /// are set, the last one wins.
404 ///
405 /// Readable | Writable
406 ///
407 ///
408 /// #### `valign`
409 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
410 ///
411 /// Readable | Writable
412 ///
413 ///
414 /// #### `vexpand`
415 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
416 ///
417 /// Readable | Writable
418 ///
419 ///
420 /// #### `vexpand-set`
421 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
422 ///
423 /// Readable | Writable
424 ///
425 ///
426 /// #### `visible`
427 /// Readable | Writable
428 ///
429 ///
430 /// #### `width-request`
431 /// Readable | Writable
432 ///
433 ///
434 /// #### `window`
435 /// The widget's window if it is realized, [`None`] otherwise.
436 ///
437 /// Readable
438 /// </details>
439 /// <details><summary><h4>CellEditable</h4></summary>
440 ///
441 ///
442 /// #### `editing-canceled`
443 /// Indicates whether editing on the cell has been canceled.
444 ///
445 /// Readable | Writable
446 /// </details>
447 ///
448 /// ## Signals
449 ///
450 ///
451 /// #### `changed`
452 /// The changed signal is emitted when the active
453 /// item is changed. The can be due to the user selecting
454 /// a different item from the list, or due to a
455 /// call to [`ComboBoxExt::set_active_iter()`][crate::prelude::ComboBoxExt::set_active_iter()].
456 /// It will also be emitted while typing into the entry of a combo box
457 /// with an entry.
458 ///
459 ///
460 ///
461 ///
462 /// #### `format-entry-text`
463 /// value,
464 /// -1);
465 ///
466 /// return g_strdup_printf ("`g`", value);
467 /// }
468 /// ]|
469 ///
470 ///
471 ///
472 ///
473 /// #### `move-active`
474 /// The ::move-active signal is a
475 /// [keybinding signal][GtkBindingSignal]
476 /// which gets emitted to move the active selection.
477 ///
478 /// Action
479 ///
480 ///
481 /// #### `popdown`
482 /// The ::popdown signal is a
483 /// [keybinding signal][GtkBindingSignal]
484 /// which gets emitted to popdown the combo box list.
485 ///
486 /// The default bindings for this signal are Alt+Up and Escape.
487 ///
488 /// Action
489 ///
490 ///
491 /// #### `popup`
492 /// The ::popup signal is a
493 /// [keybinding signal][GtkBindingSignal]
494 /// which gets emitted to popup the combo box list.
495 ///
496 /// The default binding for this signal is Alt+Down.
497 ///
498 /// Action
499 /// <details><summary><h4>Container</h4></summary>
500 ///
501 ///
502 /// #### `add`
503 ///
504 ///
505 ///
506 /// #### `check-resize`
507 ///
508 ///
509 ///
510 /// #### `remove`
511 ///
512 ///
513 ///
514 /// #### `set-focus-child`
515 ///
516 /// </details>
517 /// <details><summary><h4>Widget</h4></summary>
518 ///
519 ///
520 /// #### `accel-closures-changed`
521 ///
522 ///
523 ///
524 /// #### `button-press-event`
525 /// The ::button-press-event signal will be emitted when a button
526 /// (typically from a mouse) is pressed.
527 ///
528 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
529 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
530 ///
531 /// This signal will be sent to the grab widget if there is one.
532 ///
533 ///
534 ///
535 ///
536 /// #### `button-release-event`
537 /// The ::button-release-event signal will be emitted when a button
538 /// (typically from a mouse) is released.
539 ///
540 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
541 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
542 ///
543 /// This signal will be sent to the grab widget if there is one.
544 ///
545 ///
546 ///
547 ///
548 /// #### `can-activate-accel`
549 /// Determines whether an accelerator that activates the signal
550 /// identified by `signal_id` can currently be activated.
551 /// This signal is present to allow applications and derived
552 /// widgets to override the default [`Widget`][crate::Widget] handling
553 /// for determining whether an accelerator can be activated.
554 ///
555 ///
556 ///
557 ///
558 /// #### `child-notify`
559 /// The ::child-notify signal is emitted for each
560 /// [child property][child-properties] that has
561 /// changed on an object. The signal's detail holds the property name.
562 ///
563 /// Detailed
564 ///
565 ///
566 /// #### `composited-changed`
567 /// The ::composited-changed signal is emitted when the composited
568 /// status of `widgets` screen changes.
569 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
570 ///
571 /// Action
572 ///
573 ///
574 /// #### `configure-event`
575 /// The ::configure-event signal will be emitted when the size, position or
576 /// stacking of the `widget`'s window has changed.
577 ///
578 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
579 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
580 /// automatically for all new windows.
581 ///
582 ///
583 ///
584 ///
585 /// #### `damage-event`
586 /// Emitted when a redirected window belonging to `widget` gets drawn into.
587 /// The region/area members of the event shows what area of the redirected
588 /// drawable was drawn into.
589 ///
590 ///
591 ///
592 ///
593 /// #### `delete-event`
594 /// The ::delete-event signal is emitted if a user requests that
595 /// a toplevel window is closed. The default handler for this signal
596 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
597 /// this signal will cause the window to be hidden instead, so that
598 /// it can later be shown again without reconstructing it.
599 ///
600 ///
601 ///
602 ///
603 /// #### `destroy`
604 /// Signals that all holders of a reference to the widget should release
605 /// the reference that they hold. May result in finalization of the widget
606 /// if all references are released.
607 ///
608 /// This signal is not suitable for saving widget state.
609 ///
610 ///
611 ///
612 ///
613 /// #### `destroy-event`
614 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
615 /// You rarely get this signal, because most widgets disconnect themselves
616 /// from their window before they destroy it, so no widget owns the
617 /// window at destroy time.
618 ///
619 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
620 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
621 /// automatically for all new windows.
622 ///
623 ///
624 ///
625 ///
626 /// #### `direction-changed`
627 /// The ::direction-changed signal is emitted when the text direction
628 /// of a widget changes.
629 ///
630 ///
631 ///
632 ///
633 /// #### `drag-begin`
634 /// The ::drag-begin signal is emitted on the drag source when a drag is
635 /// started. A typical reason to connect to this signal is to set up a
636 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
637 ///
638 /// Note that some widgets set up a drag icon in the default handler of
639 /// this signal, so you may have to use `g_signal_connect_after()` to
640 /// override what the default handler did.
641 ///
642 ///
643 ///
644 ///
645 /// #### `drag-data-delete`
646 /// The ::drag-data-delete signal is emitted on the drag source when a drag
647 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
648 /// handler is responsible for deleting the data that has been dropped. What
649 /// "delete" means depends on the context of the drag operation.
650 ///
651 ///
652 ///
653 ///
654 /// #### `drag-data-get`
655 /// The ::drag-data-get signal is emitted on the drag source when the drop
656 /// site requests the data which is dragged. It is the responsibility of
657 /// the signal handler to fill `data` with the data in the format which
658 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
659 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
660 ///
661 ///
662 ///
663 ///
664 /// #### `drag-data-received`
665 /// format == 8))
666 /// {
667 /// GdkDragAction action;
668 ///
669 /// // handle data here
670 ///
671 /// action = gdk_drag_context_get_selected_action (context);
672 /// if (action == GDK_ACTION_ASK)
673 /// {
674 /// GtkWidget *dialog;
675 /// gint response;
676 ///
677 /// dialog = gtk_message_dialog_new (NULL,
678 /// GTK_DIALOG_MODAL |
679 /// GTK_DIALOG_DESTROY_WITH_PARENT,
680 /// GTK_MESSAGE_INFO,
681 /// GTK_BUTTONS_YES_NO,
682 /// "Move the data ?\n");
683 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
684 /// gtk_widget_destroy (dialog);
685 ///
686 /// if (response == GTK_RESPONSE_YES)
687 /// action = GDK_ACTION_MOVE;
688 /// else
689 /// action = GDK_ACTION_COPY;
690 /// }
691 ///
692 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
693 /// }
694 /// else
695 /// gtk_drag_finish (context, FALSE, FALSE, time);
696 /// }
697 /// ]|
698 ///
699 ///
700 ///
701 ///
702 /// #### `drag-drop`
703 /// The ::drag-drop signal is emitted on the drop site when the user drops
704 /// the data onto the widget. The signal handler must determine whether
705 /// the cursor position is in a drop zone or not. If it is not in a drop
706 /// zone, it returns [`false`] and no further processing is necessary.
707 /// Otherwise, the handler returns [`true`]. In this case, the handler must
708 /// ensure that `gtk_drag_finish()` is called to let the source know that
709 /// the drop is done. The call to `gtk_drag_finish()` can be done either
710 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
711 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
712 /// or more of the supported targets.
713 ///
714 ///
715 ///
716 ///
717 /// #### `drag-end`
718 /// The ::drag-end signal is emitted on the drag source when a drag is
719 /// finished. A typical reason to connect to this signal is to undo
720 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
721 ///
722 ///
723 ///
724 ///
725 /// #### `drag-failed`
726 /// The ::drag-failed signal is emitted on the drag source when a drag has
727 /// failed. The signal handler may hook custom code to handle a failed DnD
728 /// operation based on the type of error, it returns [`true`] is the failure has
729 /// been already handled (not showing the default "drag operation failed"
730 /// animation), otherwise it returns [`false`].
731 ///
732 ///
733 ///
734 ///
735 /// #### `drag-leave`
736 /// The ::drag-leave signal is emitted on the drop site when the cursor
737 /// leaves the widget. A typical reason to connect to this signal is to
738 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
739 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
740 ///
741 ///
742 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
743 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
744 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
745 ///
746 ///
747 ///
748 ///
749 /// #### `drag-motion`
750 /// suggested_action,
751 /// time);
752 /// }
753 /// else
754 /// {
755 /// // accept the drop
756 /// }
757 /// }
758 /// ]|
759 ///
760 ///
761 ///
762 ///
763 /// #### `draw`
764 /// This signal is emitted when a widget is supposed to render itself.
765 /// The `widget`'s top left corner must be painted at the origin of
766 /// the passed in context and be sized to the values returned by
767 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
768 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
769 ///
770 /// Signal handlers connected to this signal can modify the cairo
771 /// context passed as `cr` in any way they like and don't need to
772 /// restore it. The signal emission takes care of calling `cairo_save()`
773 /// before and `cairo_restore()` after invoking the handler.
774 ///
775 /// The signal handler will get a `cr` with a clip region already set to the
776 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
777 /// widgets that want to avoid redrawing themselves completely can get the full
778 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
779 /// get a finer-grained representation of the dirty region with
780 /// `cairo_copy_clip_rectangle_list()`.
781 ///
782 ///
783 ///
784 ///
785 /// #### `enter-notify-event`
786 /// The ::enter-notify-event will be emitted when the pointer enters
787 /// the `widget`'s window.
788 ///
789 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
790 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
791 ///
792 /// This signal will be sent to the grab widget if there is one.
793 ///
794 ///
795 ///
796 ///
797 /// #### `event`
798 /// The GTK+ main loop will emit three signals for each GDK event delivered
799 /// to a widget: one generic ::event signal, another, more specific,
800 /// signal that matches the type of event delivered (e.g.
801 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
802 /// [`event-after`][struct@crate::Widget#event-after] signal.
803 ///
804 ///
805 ///
806 ///
807 /// #### `event-after`
808 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
809 /// the second more specific signal, ::event-after will be emitted
810 /// regardless of the previous two signals handlers return values.
811 ///
812 ///
813 ///
814 ///
815 /// #### `focus`
816 ///
817 ///
818 ///
819 /// #### `focus-in-event`
820 /// The ::focus-in-event signal will be emitted when the keyboard focus
821 /// enters the `widget`'s window.
822 ///
823 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
824 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
825 ///
826 ///
827 ///
828 ///
829 /// #### `focus-out-event`
830 /// The ::focus-out-event signal will be emitted when the keyboard focus
831 /// leaves the `widget`'s window.
832 ///
833 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
834 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
835 ///
836 ///
837 ///
838 ///
839 /// #### `grab-broken-event`
840 /// Emitted when a pointer or keyboard grab on a window belonging
841 /// to `widget` gets broken.
842 ///
843 /// On X11, this happens when the grab window becomes unviewable
844 /// (i.e. it or one of its ancestors is unmapped), or if the same
845 /// application grabs the pointer or keyboard again.
846 ///
847 ///
848 ///
849 ///
850 /// #### `grab-focus`
851 /// Action
852 ///
853 ///
854 /// #### `grab-notify`
855 /// The ::grab-notify signal is emitted when a widget becomes
856 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
857 /// another widget, or when it becomes unshadowed due to a grab
858 /// being removed.
859 ///
860 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
861 /// grab widget in the grab stack of its window group is not
862 /// its ancestor.
863 ///
864 ///
865 ///
866 ///
867 /// #### `hide`
868 /// The ::hide signal is emitted when `widget` is hidden, for example with
869 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
870 ///
871 ///
872 ///
873 ///
874 /// #### `hierarchy-changed`
875 /// The ::hierarchy-changed signal is emitted when the
876 /// anchored state of a widget changes. A widget is
877 /// “anchored” when its toplevel
878 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
879 /// a widget changes from un-anchored to anchored or vice-versa.
880 ///
881 ///
882 ///
883 ///
884 /// #### `key-press-event`
885 /// The ::key-press-event signal is emitted when a key is pressed. The signal
886 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
887 ///
888 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
889 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
890 ///
891 /// This signal will be sent to the grab widget if there is one.
892 ///
893 ///
894 ///
895 ///
896 /// #### `key-release-event`
897 /// The ::key-release-event signal is emitted when a key is released.
898 ///
899 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
900 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
901 ///
902 /// This signal will be sent to the grab widget if there is one.
903 ///
904 ///
905 ///
906 ///
907 /// #### `keynav-failed`
908 /// Gets emitted if keyboard navigation fails.
909 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
910 ///
911 ///
912 ///
913 ///
914 /// #### `leave-notify-event`
915 /// The ::leave-notify-event will be emitted when the pointer leaves
916 /// the `widget`'s window.
917 ///
918 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
919 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
920 ///
921 /// This signal will be sent to the grab widget if there is one.
922 ///
923 ///
924 ///
925 ///
926 /// #### `map`
927 /// The ::map signal is emitted when `widget` is going to be mapped, that is
928 /// when the widget is visible (which is controlled with
929 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
930 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
931 /// be emitted.
932 ///
933 /// The ::map signal can be used to determine whether a widget will be drawn,
934 /// for instance it can resume an animation that was stopped during the
935 /// emission of [`unmap`][struct@crate::Widget#unmap].
936 ///
937 ///
938 ///
939 ///
940 /// #### `map-event`
941 /// The ::map-event signal will be emitted when the `widget`'s window is
942 /// mapped. A window is mapped when it becomes visible on the screen.
943 ///
944 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
945 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
946 /// automatically for all new windows.
947 ///
948 ///
949 ///
950 ///
951 /// #### `mnemonic-activate`
952 /// The default handler for this signal activates `widget` if `group_cycling`
953 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
954 ///
955 ///
956 ///
957 ///
958 /// #### `motion-notify-event`
959 /// The ::motion-notify-event signal is emitted when the pointer moves
960 /// over the widget's [`gdk::Window`][crate::gdk::Window].
961 ///
962 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
963 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
964 ///
965 /// This signal will be sent to the grab widget if there is one.
966 ///
967 ///
968 ///
969 ///
970 /// #### `move-focus`
971 /// Action
972 ///
973 ///
974 /// #### `parent-set`
975 /// The ::parent-set signal is emitted when a new parent
976 /// has been set on a widget.
977 ///
978 ///
979 ///
980 ///
981 /// #### `popup-menu`
982 /// This signal gets emitted whenever a widget should pop up a context
983 /// menu. This usually happens through the standard key binding mechanism;
984 /// by pressing a certain key while a widget is focused, the user can cause
985 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
986 /// a menu with clipboard commands. See the
987 /// [Popup Menu Migration Checklist][checklist-popup-menu]
988 /// for an example of how to use this signal.
989 ///
990 /// Action
991 ///
992 ///
993 /// #### `property-notify-event`
994 /// The ::property-notify-event signal will be emitted when a property on
995 /// the `widget`'s window has been changed or deleted.
996 ///
997 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
998 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
999 ///
1000 ///
1001 ///
1002 ///
1003 /// #### `proximity-in-event`
1004 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1005 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1006 ///
1007 /// This signal will be sent to the grab widget if there is one.
1008 ///
1009 ///
1010 ///
1011 ///
1012 /// #### `proximity-out-event`
1013 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1014 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1015 ///
1016 /// This signal will be sent to the grab widget if there is one.
1017 ///
1018 ///
1019 ///
1020 ///
1021 /// #### `query-tooltip`
1022 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1023 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1024 /// focus in keyboard mode.
1025 ///
1026 /// Using the given coordinates, the signal handler should determine
1027 /// whether a tooltip should be shown for `widget`. If this is the case
1028 /// [`true`] should be returned, [`false`] otherwise. Note that if
1029 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1030 /// should not be used.
1031 ///
1032 /// The signal handler is free to manipulate `tooltip` with the therefore
1033 /// destined function calls.
1034 ///
1035 ///
1036 ///
1037 ///
1038 /// #### `realize`
1039 /// The ::realize signal is emitted when `widget` is associated with a
1040 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1041 /// widget has been mapped (that is, it is going to be drawn).
1042 ///
1043 ///
1044 ///
1045 ///
1046 /// #### `screen-changed`
1047 /// The ::screen-changed signal gets emitted when the
1048 /// screen of a widget has changed.
1049 ///
1050 ///
1051 ///
1052 ///
1053 /// #### `scroll-event`
1054 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1055 /// range is pressed. Wheel mice are usually configured to generate
1056 /// button press events for buttons 4 and 5 when the wheel is turned.
1057 ///
1058 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1059 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1060 ///
1061 /// This signal will be sent to the grab widget if there is one.
1062 ///
1063 ///
1064 ///
1065 ///
1066 /// #### `selection-clear-event`
1067 /// The ::selection-clear-event signal will be emitted when the
1068 /// the `widget`'s window has lost ownership of a selection.
1069 ///
1070 ///
1071 ///
1072 ///
1073 /// #### `selection-get`
1074 ///
1075 ///
1076 ///
1077 /// #### `selection-notify-event`
1078 ///
1079 ///
1080 ///
1081 /// #### `selection-received`
1082 ///
1083 ///
1084 ///
1085 /// #### `selection-request-event`
1086 /// The ::selection-request-event signal will be emitted when
1087 /// another client requests ownership of the selection owned by
1088 /// the `widget`'s window.
1089 ///
1090 ///
1091 ///
1092 ///
1093 /// #### `show`
1094 /// The ::show signal is emitted when `widget` is shown, for example with
1095 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1096 ///
1097 ///
1098 ///
1099 ///
1100 /// #### `show-help`
1101 /// Action
1102 ///
1103 ///
1104 /// #### `size-allocate`
1105 ///
1106 ///
1107 ///
1108 /// #### `state-changed`
1109 /// The ::state-changed signal is emitted when the widget state changes.
1110 /// See `gtk_widget_get_state()`.
1111 ///
1112 ///
1113 ///
1114 ///
1115 /// #### `state-flags-changed`
1116 /// The ::state-flags-changed signal is emitted when the widget state
1117 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1118 ///
1119 ///
1120 ///
1121 ///
1122 /// #### `style-set`
1123 /// The ::style-set signal is emitted when a new style has been set
1124 /// on a widget. Note that style-modifying functions like
1125 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1126 ///
1127 /// Note that this signal is emitted for changes to the deprecated
1128 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1129 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1130 ///
1131 ///
1132 ///
1133 ///
1134 /// #### `style-updated`
1135 /// The ::style-updated signal is a convenience signal that is emitted when the
1136 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1137 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1138 ///
1139 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1140 /// cause this signal to be emitted.
1141 ///
1142 ///
1143 ///
1144 ///
1145 /// #### `touch-event`
1146 ///
1147 ///
1148 ///
1149 /// #### `unmap`
1150 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1151 /// means that either it or any of its parents up to the toplevel widget have
1152 /// been set as hidden.
1153 ///
1154 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1155 /// used to, for example, stop an animation on the widget.
1156 ///
1157 ///
1158 ///
1159 ///
1160 /// #### `unmap-event`
1161 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1162 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1163 ///
1164 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1165 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1166 /// automatically for all new windows.
1167 ///
1168 ///
1169 ///
1170 ///
1171 /// #### `unrealize`
1172 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1173 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1174 /// called or the widget has been unmapped (that is, it is going to be
1175 /// hidden).
1176 ///
1177 ///
1178 ///
1179 ///
1180 /// #### `visibility-notify-event`
1181 /// The ::visibility-notify-event will be emitted when the `widget`'s
1182 /// window is obscured or unobscured.
1183 ///
1184 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1185 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1186 ///
1187 ///
1188 ///
1189 ///
1190 /// #### `window-state-event`
1191 /// The ::window-state-event will be emitted when the state of the
1192 /// toplevel window associated to the `widget` changes.
1193 ///
1194 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1195 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1196 /// this mask automatically for all new windows.
1197 ///
1198 ///
1199 /// </details>
1200 /// <details><summary><h4>CellEditable</h4></summary>
1201 ///
1202 ///
1203 /// #### `editing-done`
1204 /// This signal is a sign for the cell renderer to update its
1205 /// value from the `cell_editable`.
1206 ///
1207 /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
1208 /// emitting this signal when they are done editing, e.g.
1209 /// [`Entry`][crate::Entry] emits this signal when the user presses Enter. Typical things to
1210 /// do in a handler for ::editing-done are to capture the edited value,
1211 /// disconnect the `cell_editable` from signals on the [`CellRenderer`][crate::CellRenderer], etc.
1212 ///
1213 /// [`CellEditableExt::editing_done()`][crate::prelude::CellEditableExt::editing_done()] is a convenience method
1214 /// for emitting [`editing-done`][struct@crate::CellEditable#editing-done].
1215 ///
1216 ///
1217 ///
1218 ///
1219 /// #### `remove-widget`
1220 /// This signal is meant to indicate that the cell is finished
1221 /// editing, and the `cell_editable` widget is being removed and may
1222 /// subsequently be destroyed.
1223 ///
1224 /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
1225 /// emitting this signal when they are done editing. It must
1226 /// be emitted after the [`editing-done`][struct@crate::CellEditable#editing-done] signal,
1227 /// to give the cell renderer a chance to update the cell's value
1228 /// before the widget is removed.
1229 ///
1230 /// [`CellEditableExt::remove_widget()`][crate::prelude::CellEditableExt::remove_widget()] is a convenience method
1231 /// for emitting [`remove-widget`][struct@crate::CellEditable#remove-widget].
1232 ///
1233 ///
1234 /// </details>
1235 ///
1236 /// # Implements
1237 ///
1238 /// [`ComboBoxExt`][trait@crate::prelude::ComboBoxExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`CellEditableExt`][trait@crate::prelude::CellEditableExt], [`CellLayoutExt`][trait@crate::prelude::CellLayoutExt], [`ComboBoxExtManual`][trait@crate::prelude::ComboBoxExtManual], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1239 #[doc(alias = "GtkComboBox")]
1240 pub struct ComboBox(Object<ffi::GtkComboBox, ffi::GtkComboBoxClass>) @extends Bin, Container, Widget, @implements Buildable, CellEditable, CellLayout;
1241
1242 match fn {
1243 type_ => || ffi::gtk_combo_box_get_type(),
1244 }
1245}
1246
1247impl ComboBox {
1248 pub const NONE: Option<&'static ComboBox> = None;
1249
1250 /// Creates a new empty [`ComboBox`][crate::ComboBox].
1251 ///
1252 /// # Returns
1253 ///
1254 /// A new [`ComboBox`][crate::ComboBox].
1255 #[doc(alias = "gtk_combo_box_new")]
1256 pub fn new() -> ComboBox {
1257 assert_initialized_main_thread!();
1258 unsafe { Widget::from_glib_none(ffi::gtk_combo_box_new()).unsafe_cast() }
1259 }
1260
1261 /// Creates a new empty [`ComboBox`][crate::ComboBox] using `area` to layout cells.
1262 /// ## `area`
1263 /// the [`CellArea`][crate::CellArea] to use to layout cell renderers
1264 ///
1265 /// # Returns
1266 ///
1267 /// A new [`ComboBox`][crate::ComboBox].
1268 #[doc(alias = "gtk_combo_box_new_with_area")]
1269 #[doc(alias = "new_with_area")]
1270 pub fn with_area(area: &impl IsA<CellArea>) -> ComboBox {
1271 skip_assert_initialized!();
1272 unsafe {
1273 Widget::from_glib_none(ffi::gtk_combo_box_new_with_area(
1274 area.as_ref().to_glib_none().0,
1275 ))
1276 .unsafe_cast()
1277 }
1278 }
1279
1280 /// Creates a new empty [`ComboBox`][crate::ComboBox] with an entry.
1281 ///
1282 /// The new combo box will use `area` to layout cells.
1283 /// ## `area`
1284 /// the [`CellArea`][crate::CellArea] to use to layout cell renderers
1285 ///
1286 /// # Returns
1287 ///
1288 /// A new [`ComboBox`][crate::ComboBox].
1289 #[doc(alias = "gtk_combo_box_new_with_area_and_entry")]
1290 #[doc(alias = "new_with_area_and_entry")]
1291 pub fn with_area_and_entry(area: &impl IsA<CellArea>) -> ComboBox {
1292 skip_assert_initialized!();
1293 unsafe {
1294 Widget::from_glib_none(ffi::gtk_combo_box_new_with_area_and_entry(
1295 area.as_ref().to_glib_none().0,
1296 ))
1297 .unsafe_cast()
1298 }
1299 }
1300
1301 /// Creates a new empty [`ComboBox`][crate::ComboBox] with an entry.
1302 ///
1303 /// # Returns
1304 ///
1305 /// A new [`ComboBox`][crate::ComboBox].
1306 #[doc(alias = "gtk_combo_box_new_with_entry")]
1307 #[doc(alias = "new_with_entry")]
1308 pub fn with_entry() -> ComboBox {
1309 assert_initialized_main_thread!();
1310 unsafe { Widget::from_glib_none(ffi::gtk_combo_box_new_with_entry()).unsafe_cast() }
1311 }
1312
1313 /// Creates a new [`ComboBox`][crate::ComboBox] with the model initialized to `model`.
1314 /// ## `model`
1315 /// A [`TreeModel`][crate::TreeModel].
1316 ///
1317 /// # Returns
1318 ///
1319 /// A new [`ComboBox`][crate::ComboBox].
1320 #[doc(alias = "gtk_combo_box_new_with_model")]
1321 #[doc(alias = "new_with_model")]
1322 pub fn with_model(model: &impl IsA<TreeModel>) -> ComboBox {
1323 skip_assert_initialized!();
1324 unsafe {
1325 Widget::from_glib_none(ffi::gtk_combo_box_new_with_model(
1326 model.as_ref().to_glib_none().0,
1327 ))
1328 .unsafe_cast()
1329 }
1330 }
1331
1332 /// Creates a new empty [`ComboBox`][crate::ComboBox] with an entry
1333 /// and with the model initialized to `model`.
1334 /// ## `model`
1335 /// A [`TreeModel`][crate::TreeModel]
1336 ///
1337 /// # Returns
1338 ///
1339 /// A new [`ComboBox`][crate::ComboBox]
1340 #[doc(alias = "gtk_combo_box_new_with_model_and_entry")]
1341 #[doc(alias = "new_with_model_and_entry")]
1342 pub fn with_model_and_entry(model: &impl IsA<TreeModel>) -> ComboBox {
1343 skip_assert_initialized!();
1344 unsafe {
1345 Widget::from_glib_none(ffi::gtk_combo_box_new_with_model_and_entry(
1346 model.as_ref().to_glib_none().0,
1347 ))
1348 .unsafe_cast()
1349 }
1350 }
1351
1352 // rustdoc-stripper-ignore-next
1353 /// Creates a new builder-pattern struct instance to construct [`ComboBox`] objects.
1354 ///
1355 /// This method returns an instance of [`ComboBoxBuilder`](crate::builders::ComboBoxBuilder) which can be used to create [`ComboBox`] objects.
1356 pub fn builder() -> ComboBoxBuilder {
1357 ComboBoxBuilder::new()
1358 }
1359}
1360
1361impl Default for ComboBox {
1362 fn default() -> Self {
1363 Self::new()
1364 }
1365}
1366
1367// rustdoc-stripper-ignore-next
1368/// A [builder-pattern] type to construct [`ComboBox`] objects.
1369///
1370/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1371#[must_use = "The builder must be built to be used"]
1372pub struct ComboBoxBuilder {
1373 builder: glib::object::ObjectBuilder<'static, ComboBox>,
1374}
1375
1376impl ComboBoxBuilder {
1377 fn new() -> Self {
1378 Self {
1379 builder: glib::object::Object::builder(),
1380 }
1381 }
1382
1383 /// The item which is currently active. If the model is a non-flat treemodel,
1384 /// and the active item is not an immediate child of the root of the tree,
1385 /// this property has the value
1386 /// `gtk_tree_path_get_indices (path)[0]`,
1387 /// where `path` is the [`TreePath`][crate::TreePath] of the active item.
1388 pub fn active(self, active: i32) -> Self {
1389 Self {
1390 builder: self.builder.property("active", active),
1391 }
1392 }
1393
1394 /// The value of the ID column of the active row.
1395 pub fn active_id(self, active_id: impl Into<glib::GString>) -> Self {
1396 Self {
1397 builder: self.builder.property("active-id", active_id.into()),
1398 }
1399 }
1400
1401 /// Whether the dropdown button is sensitive when
1402 /// the model is empty.
1403 pub fn button_sensitivity(self, button_sensitivity: SensitivityType) -> Self {
1404 Self {
1405 builder: self
1406 .builder
1407 .property("button-sensitivity", button_sensitivity),
1408 }
1409 }
1410
1411 /// The [`CellArea`][crate::CellArea] used to layout cell renderers for this combo box.
1412 ///
1413 /// If no area is specified when creating the combo box with [`ComboBox::with_area()`][crate::ComboBox::with_area()]
1414 /// a horizontally oriented [`CellAreaBox`][crate::CellAreaBox] will be used.
1415 pub fn cell_area(self, cell_area: &impl IsA<CellArea>) -> Self {
1416 Self {
1417 builder: self
1418 .builder
1419 .property("cell-area", cell_area.clone().upcast()),
1420 }
1421 }
1422
1423 /// If this is set to a non-negative value, it must be the index of a column
1424 /// of type `G_TYPE_INT` in the model. The value in that column for each item
1425 /// will determine how many columns that item will span in the popup.
1426 /// Therefore, values in this column must be greater than zero, and the sum of
1427 /// an item’s column position + span should not exceed [`wrap-width`][struct@crate::ComboBox#wrap-width].
1428 pub fn column_span_column(self, column_span_column: i32) -> Self {
1429 Self {
1430 builder: self
1431 .builder
1432 .property("column-span-column", column_span_column),
1433 }
1434 }
1435
1436 /// The column in the combo box's model to associate with strings from the entry
1437 /// if the combo was created with [`has-entry`][struct@crate::ComboBox#has-entry] = [`true`].
1438 pub fn entry_text_column(self, entry_text_column: i32) -> Self {
1439 Self {
1440 builder: self
1441 .builder
1442 .property("entry-text-column", entry_text_column),
1443 }
1444 }
1445
1446 /// Whether the combo box has an entry.
1447 pub fn has_entry(self, has_entry: bool) -> Self {
1448 Self {
1449 builder: self.builder.property("has-entry", has_entry),
1450 }
1451 }
1452
1453 /// The has-frame property controls whether a frame
1454 /// is drawn around the entry.
1455 pub fn has_frame(self, has_frame: bool) -> Self {
1456 Self {
1457 builder: self.builder.property("has-frame", has_frame),
1458 }
1459 }
1460
1461 /// The column in the combo box's model that provides string
1462 /// IDs for the values in the model, if != -1.
1463 pub fn id_column(self, id_column: i32) -> Self {
1464 Self {
1465 builder: self.builder.property("id-column", id_column),
1466 }
1467 }
1468
1469 /// The model from which the combo box takes the values shown
1470 /// in the list.
1471 pub fn model(self, model: &impl IsA<TreeModel>) -> Self {
1472 Self {
1473 builder: self.builder.property("model", model.clone().upcast()),
1474 }
1475 }
1476
1477 /// Whether the popup's width should be a fixed width matching the
1478 /// allocated width of the combo box.
1479 pub fn popup_fixed_width(self, popup_fixed_width: bool) -> Self {
1480 Self {
1481 builder: self
1482 .builder
1483 .property("popup-fixed-width", popup_fixed_width),
1484 }
1485 }
1486
1487 /// If this is set to a non-negative value, it must be the index of a column
1488 /// of type `G_TYPE_INT` in the model. The value in that column for each item
1489 /// will determine how many rows that item will span in the popup. Therefore,
1490 /// values in this column must be greater than zero.
1491 pub fn row_span_column(self, row_span_column: i32) -> Self {
1492 Self {
1493 builder: self.builder.property("row-span-column", row_span_column),
1494 }
1495 }
1496
1497 /// If wrap-width is set to a positive value, items in the popup will be laid
1498 /// out along multiple columns, starting a new row on reaching the wrap width.
1499 pub fn wrap_width(self, wrap_width: i32) -> Self {
1500 Self {
1501 builder: self.builder.property("wrap-width", wrap_width),
1502 }
1503 }
1504
1505 pub fn border_width(self, border_width: u32) -> Self {
1506 Self {
1507 builder: self.builder.property("border-width", border_width),
1508 }
1509 }
1510
1511 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1512 Self {
1513 builder: self.builder.property("child", child.clone().upcast()),
1514 }
1515 }
1516
1517 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1518 Self {
1519 builder: self.builder.property("resize-mode", resize_mode),
1520 }
1521 }
1522
1523 pub fn app_paintable(self, app_paintable: bool) -> Self {
1524 Self {
1525 builder: self.builder.property("app-paintable", app_paintable),
1526 }
1527 }
1528
1529 pub fn can_default(self, can_default: bool) -> Self {
1530 Self {
1531 builder: self.builder.property("can-default", can_default),
1532 }
1533 }
1534
1535 pub fn can_focus(self, can_focus: bool) -> Self {
1536 Self {
1537 builder: self.builder.property("can-focus", can_focus),
1538 }
1539 }
1540
1541 pub fn events(self, events: gdk::EventMask) -> Self {
1542 Self {
1543 builder: self.builder.property("events", events),
1544 }
1545 }
1546
1547 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1548 pub fn expand(self, expand: bool) -> Self {
1549 Self {
1550 builder: self.builder.property("expand", expand),
1551 }
1552 }
1553
1554 /// Whether the widget should grab focus when it is clicked with the mouse.
1555 ///
1556 /// This property is only relevant for widgets that can take focus.
1557 ///
1558 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1559 /// GtkComboBox) implemented this property individually.
1560 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1561 Self {
1562 builder: self.builder.property("focus-on-click", focus_on_click),
1563 }
1564 }
1565
1566 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1567 pub fn halign(self, halign: Align) -> Self {
1568 Self {
1569 builder: self.builder.property("halign", halign),
1570 }
1571 }
1572
1573 pub fn has_default(self, has_default: bool) -> Self {
1574 Self {
1575 builder: self.builder.property("has-default", has_default),
1576 }
1577 }
1578
1579 pub fn has_focus(self, has_focus: bool) -> Self {
1580 Self {
1581 builder: self.builder.property("has-focus", has_focus),
1582 }
1583 }
1584
1585 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1586 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1587 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1588 /// whether it will provide a tooltip or not.
1589 ///
1590 /// Note that setting this property to [`true`] for the first time will change
1591 /// the event masks of the GdkWindows of this widget to include leave-notify
1592 /// and motion-notify events. This cannot and will not be undone when the
1593 /// property is set to [`false`] again.
1594 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1595 Self {
1596 builder: self.builder.property("has-tooltip", has_tooltip),
1597 }
1598 }
1599
1600 pub fn height_request(self, height_request: i32) -> Self {
1601 Self {
1602 builder: self.builder.property("height-request", height_request),
1603 }
1604 }
1605
1606 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1607 pub fn hexpand(self, hexpand: bool) -> Self {
1608 Self {
1609 builder: self.builder.property("hexpand", hexpand),
1610 }
1611 }
1612
1613 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1614 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1615 Self {
1616 builder: self.builder.property("hexpand-set", hexpand_set),
1617 }
1618 }
1619
1620 pub fn is_focus(self, is_focus: bool) -> Self {
1621 Self {
1622 builder: self.builder.property("is-focus", is_focus),
1623 }
1624 }
1625
1626 /// Sets all four sides' margin at once. If read, returns max
1627 /// margin on any side.
1628 pub fn margin(self, margin: i32) -> Self {
1629 Self {
1630 builder: self.builder.property("margin", margin),
1631 }
1632 }
1633
1634 /// Margin on bottom side of widget.
1635 ///
1636 /// This property adds margin outside of the widget's normal size
1637 /// request, the margin will be added in addition to the size from
1638 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1639 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1640 Self {
1641 builder: self.builder.property("margin-bottom", margin_bottom),
1642 }
1643 }
1644
1645 /// Margin on end of widget, horizontally. This property supports
1646 /// left-to-right and right-to-left text directions.
1647 ///
1648 /// This property adds margin outside of the widget's normal size
1649 /// request, the margin will be added in addition to the size from
1650 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1651 pub fn margin_end(self, margin_end: i32) -> Self {
1652 Self {
1653 builder: self.builder.property("margin-end", margin_end),
1654 }
1655 }
1656
1657 /// Margin on start of widget, horizontally. This property supports
1658 /// left-to-right and right-to-left text directions.
1659 ///
1660 /// This property adds margin outside of the widget's normal size
1661 /// request, the margin will be added in addition to the size from
1662 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1663 pub fn margin_start(self, margin_start: i32) -> Self {
1664 Self {
1665 builder: self.builder.property("margin-start", margin_start),
1666 }
1667 }
1668
1669 /// Margin on top side of widget.
1670 ///
1671 /// This property adds margin outside of the widget's normal size
1672 /// request, the margin will be added in addition to the size from
1673 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1674 pub fn margin_top(self, margin_top: i32) -> Self {
1675 Self {
1676 builder: self.builder.property("margin-top", margin_top),
1677 }
1678 }
1679
1680 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1681 Self {
1682 builder: self.builder.property("name", name.into()),
1683 }
1684 }
1685
1686 pub fn no_show_all(self, no_show_all: bool) -> Self {
1687 Self {
1688 builder: self.builder.property("no-show-all", no_show_all),
1689 }
1690 }
1691
1692 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1693 /// more details about window opacity.
1694 ///
1695 /// Before 3.8 this was only available in GtkWindow
1696 pub fn opacity(self, opacity: f64) -> Self {
1697 Self {
1698 builder: self.builder.property("opacity", opacity),
1699 }
1700 }
1701
1702 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1703 Self {
1704 builder: self.builder.property("parent", parent.clone().upcast()),
1705 }
1706 }
1707
1708 pub fn receives_default(self, receives_default: bool) -> Self {
1709 Self {
1710 builder: self.builder.property("receives-default", receives_default),
1711 }
1712 }
1713
1714 pub fn sensitive(self, sensitive: bool) -> Self {
1715 Self {
1716 builder: self.builder.property("sensitive", sensitive),
1717 }
1718 }
1719
1720 /// Sets the text of tooltip to be the given string, which is marked up
1721 /// with the [Pango text markup language][PangoMarkupFormat].
1722 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1723 ///
1724 /// This is a convenience property which will take care of getting the
1725 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1726 /// will automatically be set to [`true`] and there will be taken care of
1727 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1728 ///
1729 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1730 /// are set, the last one wins.
1731 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1732 Self {
1733 builder: self
1734 .builder
1735 .property("tooltip-markup", tooltip_markup.into()),
1736 }
1737 }
1738
1739 /// Sets the text of tooltip to be the given string.
1740 ///
1741 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1742 ///
1743 /// This is a convenience property which will take care of getting the
1744 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1745 /// will automatically be set to [`true`] and there will be taken care of
1746 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1747 ///
1748 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1749 /// are set, the last one wins.
1750 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1751 Self {
1752 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1753 }
1754 }
1755
1756 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1757 pub fn valign(self, valign: Align) -> Self {
1758 Self {
1759 builder: self.builder.property("valign", valign),
1760 }
1761 }
1762
1763 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1764 pub fn vexpand(self, vexpand: bool) -> Self {
1765 Self {
1766 builder: self.builder.property("vexpand", vexpand),
1767 }
1768 }
1769
1770 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1771 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1772 Self {
1773 builder: self.builder.property("vexpand-set", vexpand_set),
1774 }
1775 }
1776
1777 pub fn visible(self, visible: bool) -> Self {
1778 Self {
1779 builder: self.builder.property("visible", visible),
1780 }
1781 }
1782
1783 pub fn width_request(self, width_request: i32) -> Self {
1784 Self {
1785 builder: self.builder.property("width-request", width_request),
1786 }
1787 }
1788
1789 /// Indicates whether editing on the cell has been canceled.
1790 pub fn editing_canceled(self, editing_canceled: bool) -> Self {
1791 Self {
1792 builder: self.builder.property("editing-canceled", editing_canceled),
1793 }
1794 }
1795
1796 // rustdoc-stripper-ignore-next
1797 /// Build the [`ComboBox`].
1798 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1799 pub fn build(self) -> ComboBox {
1800 assert_initialized_main_thread!();
1801 self.builder.build()
1802 }
1803}
1804
1805/// Trait containing all [`struct@ComboBox`] methods.
1806///
1807/// # Implementors
1808///
1809/// [`AppChooserButton`][struct@crate::AppChooserButton], [`ComboBoxText`][struct@crate::ComboBoxText], [`ComboBox`][struct@crate::ComboBox]
1810pub trait ComboBoxExt: IsA<ComboBox> + 'static {
1811 /// Returns the ID of the active row of `self`. This value is taken
1812 /// from the active row and the column specified by the [`id-column`][struct@crate::ComboBox#id-column]
1813 /// property of `self` (see [`set_id_column()`][Self::set_id_column()]).
1814 ///
1815 /// The returned value is an interned string which means that you can
1816 /// compare the pointer by value to other interned strings and that you
1817 /// must not free it.
1818 ///
1819 /// If the [`id-column`][struct@crate::ComboBox#id-column] property of `self` is not set, or if
1820 /// no row is active, or if the active row has a [`None`] ID value, then [`None`]
1821 /// is returned.
1822 ///
1823 /// # Returns
1824 ///
1825 /// the ID of the active row, or [`None`]
1826 #[doc(alias = "gtk_combo_box_get_active_id")]
1827 #[doc(alias = "get_active_id")]
1828 #[doc(alias = "active-id")]
1829 fn active_id(&self) -> Option<glib::GString> {
1830 unsafe {
1831 from_glib_none(ffi::gtk_combo_box_get_active_id(
1832 self.as_ref().to_glib_none().0,
1833 ))
1834 }
1835 }
1836
1837 /// Sets `iter` to point to the currently active item, if any item is active.
1838 /// Otherwise, `iter` is left unchanged.
1839 ///
1840 /// # Returns
1841 ///
1842 /// [`true`] if `iter` was set, [`false`] otherwise
1843 ///
1844 /// ## `iter`
1845 /// A [`TreeIter`][crate::TreeIter]
1846 #[doc(alias = "gtk_combo_box_get_active_iter")]
1847 #[doc(alias = "get_active_iter")]
1848 fn active_iter(&self) -> Option<TreeIter> {
1849 unsafe {
1850 let mut iter = TreeIter::uninitialized();
1851 let ret = from_glib(ffi::gtk_combo_box_get_active_iter(
1852 self.as_ref().to_glib_none().0,
1853 iter.to_glib_none_mut().0,
1854 ));
1855 if ret { Some(iter) } else { None }
1856 }
1857 }
1858
1859 /// Returns whether the combo box sets the dropdown button
1860 /// sensitive or not when there are no items in the model.
1861 ///
1862 /// # Returns
1863 ///
1864 /// [`SensitivityType::On`][crate::SensitivityType::On] if the dropdown button
1865 /// is sensitive when the model is empty, [`SensitivityType::Off`][crate::SensitivityType::Off]
1866 /// if the button is always insensitive or
1867 /// [`SensitivityType::Auto`][crate::SensitivityType::Auto] if it is only sensitive as long as
1868 /// the model has one item to be selected.
1869 #[doc(alias = "gtk_combo_box_get_button_sensitivity")]
1870 #[doc(alias = "get_button_sensitivity")]
1871 #[doc(alias = "button-sensitivity")]
1872 fn button_sensitivity(&self) -> SensitivityType {
1873 unsafe {
1874 from_glib(ffi::gtk_combo_box_get_button_sensitivity(
1875 self.as_ref().to_glib_none().0,
1876 ))
1877 }
1878 }
1879
1880 /// Returns the column with column span information for `self`.
1881 ///
1882 /// # Returns
1883 ///
1884 /// the column span column.
1885 #[doc(alias = "gtk_combo_box_get_column_span_column")]
1886 #[doc(alias = "get_column_span_column")]
1887 #[doc(alias = "column-span-column")]
1888 fn column_span_column(&self) -> i32 {
1889 unsafe { ffi::gtk_combo_box_get_column_span_column(self.as_ref().to_glib_none().0) }
1890 }
1891
1892 /// Returns the column which `self` is using to get the strings
1893 /// from to display in the internal entry.
1894 ///
1895 /// # Returns
1896 ///
1897 /// A column in the data source model of `self`.
1898 #[doc(alias = "gtk_combo_box_get_entry_text_column")]
1899 #[doc(alias = "get_entry_text_column")]
1900 #[doc(alias = "entry-text-column")]
1901 fn entry_text_column(&self) -> i32 {
1902 unsafe { ffi::gtk_combo_box_get_entry_text_column(self.as_ref().to_glib_none().0) }
1903 }
1904
1905 /// Returns whether the combo box has an entry.
1906 ///
1907 /// # Returns
1908 ///
1909 /// whether there is an entry in `self`.
1910 #[doc(alias = "gtk_combo_box_get_has_entry")]
1911 #[doc(alias = "get_has_entry")]
1912 #[doc(alias = "has-entry")]
1913 fn has_entry(&self) -> bool {
1914 unsafe {
1915 from_glib(ffi::gtk_combo_box_get_has_entry(
1916 self.as_ref().to_glib_none().0,
1917 ))
1918 }
1919 }
1920
1921 /// Returns the column which `self` is using to get string IDs
1922 /// for values from.
1923 ///
1924 /// # Returns
1925 ///
1926 /// A column in the data source model of `self`.
1927 #[doc(alias = "gtk_combo_box_get_id_column")]
1928 #[doc(alias = "get_id_column")]
1929 #[doc(alias = "id-column")]
1930 fn id_column(&self) -> i32 {
1931 unsafe { ffi::gtk_combo_box_get_id_column(self.as_ref().to_glib_none().0) }
1932 }
1933
1934 /// Returns the [`TreeModel`][crate::TreeModel] which is acting as data source for `self`.
1935 ///
1936 /// # Returns
1937 ///
1938 /// A [`TreeModel`][crate::TreeModel] which was passed
1939 /// during construction.
1940 #[doc(alias = "gtk_combo_box_get_model")]
1941 #[doc(alias = "get_model")]
1942 fn model(&self) -> Option<TreeModel> {
1943 unsafe { from_glib_none(ffi::gtk_combo_box_get_model(self.as_ref().to_glib_none().0)) }
1944 }
1945
1946 /// Gets the accessible object corresponding to the combo box’s popup.
1947 ///
1948 /// This function is mostly intended for use by accessibility technologies;
1949 /// applications should have little use for it.
1950 ///
1951 /// # Returns
1952 ///
1953 /// the accessible object corresponding
1954 /// to the combo box’s popup.
1955 #[doc(alias = "gtk_combo_box_get_popup_accessible")]
1956 #[doc(alias = "get_popup_accessible")]
1957 fn popup_accessible(&self) -> Option<atk::Object> {
1958 unsafe {
1959 from_glib_none(ffi::gtk_combo_box_get_popup_accessible(
1960 self.as_ref().to_glib_none().0,
1961 ))
1962 }
1963 }
1964
1965 /// Gets whether the popup uses a fixed width matching
1966 /// the allocated width of the combo box.
1967 ///
1968 /// # Returns
1969 ///
1970 /// [`true`] if the popup uses a fixed width
1971 #[doc(alias = "gtk_combo_box_get_popup_fixed_width")]
1972 #[doc(alias = "get_popup_fixed_width")]
1973 #[doc(alias = "popup-fixed-width")]
1974 fn is_popup_fixed_width(&self) -> bool {
1975 unsafe {
1976 from_glib(ffi::gtk_combo_box_get_popup_fixed_width(
1977 self.as_ref().to_glib_none().0,
1978 ))
1979 }
1980 }
1981
1982 //#[doc(alias = "gtk_combo_box_get_row_separator_func")]
1983 //#[doc(alias = "get_row_separator_func")]
1984 //fn row_separator_func(&self) -> Option<Box_<dyn Fn(&TreeModel, &TreeIter) -> bool + 'static>> {
1985 // unsafe { TODO: call ffi:gtk_combo_box_get_row_separator_func() }
1986 //}
1987
1988 /// Returns the column with row span information for `self`.
1989 ///
1990 /// # Returns
1991 ///
1992 /// the row span column.
1993 #[doc(alias = "gtk_combo_box_get_row_span_column")]
1994 #[doc(alias = "get_row_span_column")]
1995 #[doc(alias = "row-span-column")]
1996 fn row_span_column(&self) -> i32 {
1997 unsafe { ffi::gtk_combo_box_get_row_span_column(self.as_ref().to_glib_none().0) }
1998 }
1999
2000 /// Returns the wrap width which is used to determine the number of columns
2001 /// for the popup menu. If the wrap width is larger than 1, the combo box
2002 /// is in table mode.
2003 ///
2004 /// # Returns
2005 ///
2006 /// the wrap width.
2007 #[doc(alias = "gtk_combo_box_get_wrap_width")]
2008 #[doc(alias = "get_wrap_width")]
2009 #[doc(alias = "wrap-width")]
2010 fn wrap_width(&self) -> i32 {
2011 unsafe { ffi::gtk_combo_box_get_wrap_width(self.as_ref().to_glib_none().0) }
2012 }
2013
2014 /// Hides the menu or dropdown list of `self`.
2015 ///
2016 /// This function is mostly intended for use by accessibility technologies;
2017 /// applications should have little use for it.
2018 #[doc(alias = "gtk_combo_box_popdown")]
2019 fn popdown(&self) {
2020 unsafe {
2021 ffi::gtk_combo_box_popdown(self.as_ref().to_glib_none().0);
2022 }
2023 }
2024
2025 /// Pops up the menu or dropdown list of `self`.
2026 ///
2027 /// This function is mostly intended for use by accessibility technologies;
2028 /// applications should have little use for it.
2029 ///
2030 /// Before calling this, `self` must be mapped, or nothing will happen.
2031 #[doc(alias = "gtk_combo_box_popup")]
2032 fn popup(&self) {
2033 unsafe {
2034 ffi::gtk_combo_box_popup(self.as_ref().to_glib_none().0);
2035 }
2036 }
2037
2038 /// Pops up the menu or dropdown list of `self`, the popup window
2039 /// will be grabbed so only `device` and its associated pointer/keyboard
2040 /// are the only `GdkDevices` able to send events to it.
2041 /// ## `device`
2042 /// a [`gdk::Device`][crate::gdk::Device]
2043 #[doc(alias = "gtk_combo_box_popup_for_device")]
2044 fn popup_for_device(&self, device: &gdk::Device) {
2045 unsafe {
2046 ffi::gtk_combo_box_popup_for_device(
2047 self.as_ref().to_glib_none().0,
2048 device.to_glib_none().0,
2049 );
2050 }
2051 }
2052
2053 /// Changes the active row of `self` to the one that has an ID equal to
2054 /// `active_id`, or unsets the active row if `active_id` is [`None`]. Rows having
2055 /// a [`None`] ID string cannot be made active by this function.
2056 ///
2057 /// If the [`id-column`][struct@crate::ComboBox#id-column] property of `self` is unset or if no
2058 /// row has the given ID then the function does nothing and returns [`false`].
2059 /// ## `active_id`
2060 /// the ID of the row to select, or [`None`]
2061 ///
2062 /// # Returns
2063 ///
2064 /// [`true`] if a row with a matching ID was found. If a [`None`]
2065 /// `active_id` was given to unset the active row, the function
2066 /// always returns [`true`].
2067 #[doc(alias = "gtk_combo_box_set_active_id")]
2068 #[doc(alias = "active-id")]
2069 fn set_active_id(&self, active_id: Option<&str>) -> bool {
2070 unsafe {
2071 from_glib(ffi::gtk_combo_box_set_active_id(
2072 self.as_ref().to_glib_none().0,
2073 active_id.to_glib_none().0,
2074 ))
2075 }
2076 }
2077
2078 /// Sets the current active item to be the one referenced by `iter`, or
2079 /// unsets the active item if `iter` is [`None`].
2080 /// ## `iter`
2081 /// The [`TreeIter`][crate::TreeIter], or [`None`]
2082 #[doc(alias = "gtk_combo_box_set_active_iter")]
2083 fn set_active_iter(&self, iter: Option<&TreeIter>) {
2084 unsafe {
2085 ffi::gtk_combo_box_set_active_iter(
2086 self.as_ref().to_glib_none().0,
2087 mut_override(iter.to_glib_none().0),
2088 );
2089 }
2090 }
2091
2092 /// Sets whether the dropdown button of the combo box should be
2093 /// always sensitive ([`SensitivityType::On`][crate::SensitivityType::On]), never sensitive ([`SensitivityType::Off`][crate::SensitivityType::Off])
2094 /// or only if there is at least one item to display ([`SensitivityType::Auto`][crate::SensitivityType::Auto]).
2095 /// ## `sensitivity`
2096 /// specify the sensitivity of the dropdown button
2097 #[doc(alias = "gtk_combo_box_set_button_sensitivity")]
2098 #[doc(alias = "button-sensitivity")]
2099 fn set_button_sensitivity(&self, sensitivity: SensitivityType) {
2100 unsafe {
2101 ffi::gtk_combo_box_set_button_sensitivity(
2102 self.as_ref().to_glib_none().0,
2103 sensitivity.into_glib(),
2104 );
2105 }
2106 }
2107
2108 /// Sets the column with column span information for `self` to be
2109 /// `column_span`. The column span column contains integers which indicate
2110 /// how many columns an item should span.
2111 /// ## `column_span`
2112 /// A column in the model passed during construction
2113 #[doc(alias = "gtk_combo_box_set_column_span_column")]
2114 #[doc(alias = "column-span-column")]
2115 fn set_column_span_column(&self, column_span: i32) {
2116 unsafe {
2117 ffi::gtk_combo_box_set_column_span_column(self.as_ref().to_glib_none().0, column_span);
2118 }
2119 }
2120
2121 /// Sets the model column which `self` should use to get strings from
2122 /// to be `text_column`. The column `text_column` in the model of `self`
2123 /// must be of type `G_TYPE_STRING`.
2124 ///
2125 /// This is only relevant if `self` has been created with
2126 /// [`has-entry`][struct@crate::ComboBox#has-entry] as [`true`].
2127 /// ## `text_column`
2128 /// A column in `model` to get the strings from for
2129 /// the internal entry
2130 #[doc(alias = "gtk_combo_box_set_entry_text_column")]
2131 #[doc(alias = "entry-text-column")]
2132 fn set_entry_text_column(&self, text_column: i32) {
2133 unsafe {
2134 ffi::gtk_combo_box_set_entry_text_column(self.as_ref().to_glib_none().0, text_column);
2135 }
2136 }
2137
2138 /// Sets the model column which `self` should use to get string IDs
2139 /// for values from. The column `id_column` in the model of `self`
2140 /// must be of type `G_TYPE_STRING`.
2141 /// ## `id_column`
2142 /// A column in `model` to get string IDs for values from
2143 #[doc(alias = "gtk_combo_box_set_id_column")]
2144 #[doc(alias = "id-column")]
2145 fn set_id_column(&self, id_column: i32) {
2146 unsafe {
2147 ffi::gtk_combo_box_set_id_column(self.as_ref().to_glib_none().0, id_column);
2148 }
2149 }
2150
2151 /// Sets the model used by `self` to be `model`. Will unset a previously set
2152 /// model (if applicable). If model is [`None`], then it will unset the model.
2153 ///
2154 /// Note that this function does not clear the cell renderers, you have to
2155 /// call [`CellLayoutExt::clear()`][crate::prelude::CellLayoutExt::clear()] yourself if you need to set up different
2156 /// cell renderers for the new model.
2157 /// ## `model`
2158 /// A [`TreeModel`][crate::TreeModel]
2159 #[doc(alias = "gtk_combo_box_set_model")]
2160 #[doc(alias = "model")]
2161 fn set_model(&self, model: Option<&impl IsA<TreeModel>>) {
2162 unsafe {
2163 ffi::gtk_combo_box_set_model(
2164 self.as_ref().to_glib_none().0,
2165 model.map(|p| p.as_ref()).to_glib_none().0,
2166 );
2167 }
2168 }
2169
2170 /// Specifies whether the popup’s width should be a fixed width
2171 /// matching the allocated width of the combo box.
2172 /// ## `fixed`
2173 /// whether to use a fixed popup width
2174 #[doc(alias = "gtk_combo_box_set_popup_fixed_width")]
2175 #[doc(alias = "popup-fixed-width")]
2176 fn set_popup_fixed_width(&self, fixed: bool) {
2177 unsafe {
2178 ffi::gtk_combo_box_set_popup_fixed_width(
2179 self.as_ref().to_glib_none().0,
2180 fixed.into_glib(),
2181 );
2182 }
2183 }
2184
2185 /// Sets the row separator function, which is used to determine
2186 /// whether a row should be drawn as a separator. If the row separator
2187 /// function is [`None`], no separators are drawn. This is the default value.
2188 /// ## `func`
2189 /// a `GtkTreeViewRowSeparatorFunc`
2190 #[doc(alias = "gtk_combo_box_set_row_separator_func")]
2191 fn set_row_separator_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(&self, func: P) {
2192 let func_data: Box_<P> = Box_::new(func);
2193 unsafe extern "C" fn func_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(
2194 model: *mut ffi::GtkTreeModel,
2195 iter: *mut ffi::GtkTreeIter,
2196 data: glib::ffi::gpointer,
2197 ) -> glib::ffi::gboolean {
2198 unsafe {
2199 let model = from_glib_borrow(model);
2200 let iter = from_glib_borrow(iter);
2201 let callback = &*(data as *mut P);
2202 (*callback)(&model, &iter).into_glib()
2203 }
2204 }
2205 let func = Some(func_func::<P> as _);
2206 unsafe extern "C" fn destroy_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(
2207 data: glib::ffi::gpointer,
2208 ) {
2209 unsafe {
2210 let _callback = Box_::from_raw(data as *mut P);
2211 }
2212 }
2213 let destroy_call3 = Some(destroy_func::<P> as _);
2214 let super_callback0: Box_<P> = func_data;
2215 unsafe {
2216 ffi::gtk_combo_box_set_row_separator_func(
2217 self.as_ref().to_glib_none().0,
2218 func,
2219 Box_::into_raw(super_callback0) as *mut _,
2220 destroy_call3,
2221 );
2222 }
2223 }
2224
2225 /// Sets the column with row span information for `self` to be `row_span`.
2226 /// The row span column contains integers which indicate how many rows
2227 /// an item should span.
2228 /// ## `row_span`
2229 /// A column in the model passed during construction.
2230 #[doc(alias = "gtk_combo_box_set_row_span_column")]
2231 #[doc(alias = "row-span-column")]
2232 fn set_row_span_column(&self, row_span: i32) {
2233 unsafe {
2234 ffi::gtk_combo_box_set_row_span_column(self.as_ref().to_glib_none().0, row_span);
2235 }
2236 }
2237
2238 /// Sets the wrap width of `self` to be `width`. The wrap width is basically
2239 /// the preferred number of columns when you want the popup to be layed out
2240 /// in a table.
2241 /// ## `width`
2242 /// Preferred number of columns
2243 #[doc(alias = "gtk_combo_box_set_wrap_width")]
2244 #[doc(alias = "wrap-width")]
2245 fn set_wrap_width(&self, width: i32) {
2246 unsafe {
2247 ffi::gtk_combo_box_set_wrap_width(self.as_ref().to_glib_none().0, width);
2248 }
2249 }
2250
2251 /// The [`CellArea`][crate::CellArea] used to layout cell renderers for this combo box.
2252 ///
2253 /// If no area is specified when creating the combo box with [`ComboBox::with_area()`][crate::ComboBox::with_area()]
2254 /// a horizontally oriented [`CellAreaBox`][crate::CellAreaBox] will be used.
2255 #[doc(alias = "cell-area")]
2256 fn cell_area(&self) -> Option<CellArea> {
2257 ObjectExt::property(self.as_ref(), "cell-area")
2258 }
2259
2260 /// The has-frame property controls whether a frame
2261 /// is drawn around the entry.
2262 #[doc(alias = "has-frame")]
2263 fn has_frame(&self) -> bool {
2264 ObjectExt::property(self.as_ref(), "has-frame")
2265 }
2266
2267 /// The has-frame property controls whether a frame
2268 /// is drawn around the entry.
2269 #[doc(alias = "has-frame")]
2270 fn set_has_frame(&self, has_frame: bool) {
2271 ObjectExt::set_property(self.as_ref(), "has-frame", has_frame)
2272 }
2273
2274 /// Whether the combo boxes dropdown is popped up.
2275 /// Note that this property is mainly useful, because
2276 /// it allows you to connect to notify::popup-shown.
2277 #[doc(alias = "popup-shown")]
2278 fn is_popup_shown(&self) -> bool {
2279 ObjectExt::property(self.as_ref(), "popup-shown")
2280 }
2281
2282 /// The changed signal is emitted when the active
2283 /// item is changed. The can be due to the user selecting
2284 /// a different item from the list, or due to a
2285 /// call to [`set_active_iter()`][Self::set_active_iter()].
2286 /// It will also be emitted while typing into the entry of a combo box
2287 /// with an entry.
2288 #[doc(alias = "changed")]
2289 fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2290 unsafe extern "C" fn changed_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
2291 this: *mut ffi::GtkComboBox,
2292 f: glib::ffi::gpointer,
2293 ) {
2294 unsafe {
2295 let f: &F = &*(f as *const F);
2296 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2297 }
2298 }
2299 unsafe {
2300 let f: Box_<F> = Box_::new(f);
2301 connect_raw(
2302 self.as_ptr() as *mut _,
2303 c"changed".as_ptr(),
2304 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2305 changed_trampoline::<Self, F> as *const (),
2306 )),
2307 Box_::into_raw(f),
2308 )
2309 }
2310 }
2311
2312 /// value,
2313 /// -1);
2314 ///
2315 /// return g_strdup_printf ("`g`", value);
2316 /// }
2317 /// ]|
2318 /// ## `path`
2319 /// the GtkTreePath string from the combo box's current model to format text for
2320 ///
2321 /// # Returns
2322 ///
2323 /// a newly allocated string representing `path`
2324 /// for the current GtkComboBox model.
2325 #[doc(alias = "format-entry-text")]
2326 fn connect_format_entry_text<F: Fn(&Self, &str) -> String + 'static>(
2327 &self,
2328 f: F,
2329 ) -> SignalHandlerId {
2330 unsafe extern "C" fn format_entry_text_trampoline<
2331 P: IsA<ComboBox>,
2332 F: Fn(&P, &str) -> String + 'static,
2333 >(
2334 this: *mut ffi::GtkComboBox,
2335 path: *mut std::ffi::c_char,
2336 f: glib::ffi::gpointer,
2337 ) -> *mut std::ffi::c_char {
2338 unsafe {
2339 let f: &F = &*(f as *const F);
2340 f(
2341 ComboBox::from_glib_borrow(this).unsafe_cast_ref(),
2342 &glib::GString::from_glib_borrow(path),
2343 )
2344 .to_glib_full()
2345 }
2346 }
2347 unsafe {
2348 let f: Box_<F> = Box_::new(f);
2349 connect_raw(
2350 self.as_ptr() as *mut _,
2351 c"format-entry-text".as_ptr(),
2352 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2353 format_entry_text_trampoline::<Self, F> as *const (),
2354 )),
2355 Box_::into_raw(f),
2356 )
2357 }
2358 }
2359
2360 /// The ::move-active signal is a
2361 /// [keybinding signal][GtkBindingSignal]
2362 /// which gets emitted to move the active selection.
2363 /// ## `scroll_type`
2364 /// a [`ScrollType`][crate::ScrollType]
2365 #[doc(alias = "move-active")]
2366 fn connect_move_active<F: Fn(&Self, ScrollType) + 'static>(&self, f: F) -> SignalHandlerId {
2367 unsafe extern "C" fn move_active_trampoline<
2368 P: IsA<ComboBox>,
2369 F: Fn(&P, ScrollType) + 'static,
2370 >(
2371 this: *mut ffi::GtkComboBox,
2372 scroll_type: ffi::GtkScrollType,
2373 f: glib::ffi::gpointer,
2374 ) {
2375 unsafe {
2376 let f: &F = &*(f as *const F);
2377 f(
2378 ComboBox::from_glib_borrow(this).unsafe_cast_ref(),
2379 from_glib(scroll_type),
2380 )
2381 }
2382 }
2383 unsafe {
2384 let f: Box_<F> = Box_::new(f);
2385 connect_raw(
2386 self.as_ptr() as *mut _,
2387 c"move-active".as_ptr(),
2388 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2389 move_active_trampoline::<Self, F> as *const (),
2390 )),
2391 Box_::into_raw(f),
2392 )
2393 }
2394 }
2395
2396 fn emit_move_active(&self, scroll_type: ScrollType) {
2397 self.emit_by_name::<()>("move-active", &[&scroll_type]);
2398 }
2399
2400 /// The ::popdown signal is a
2401 /// [keybinding signal][GtkBindingSignal]
2402 /// which gets emitted to popdown the combo box list.
2403 ///
2404 /// The default bindings for this signal are Alt+Up and Escape.
2405 #[doc(alias = "popdown")]
2406 fn connect_popdown<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
2407 unsafe extern "C" fn popdown_trampoline<P: IsA<ComboBox>, F: Fn(&P) -> bool + 'static>(
2408 this: *mut ffi::GtkComboBox,
2409 f: glib::ffi::gpointer,
2410 ) -> glib::ffi::gboolean {
2411 unsafe {
2412 let f: &F = &*(f as *const F);
2413 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
2414 }
2415 }
2416 unsafe {
2417 let f: Box_<F> = Box_::new(f);
2418 connect_raw(
2419 self.as_ptr() as *mut _,
2420 c"popdown".as_ptr(),
2421 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2422 popdown_trampoline::<Self, F> as *const (),
2423 )),
2424 Box_::into_raw(f),
2425 )
2426 }
2427 }
2428
2429 fn emit_popdown(&self) -> bool {
2430 self.emit_by_name("popdown", &[])
2431 }
2432
2433 /// The ::popup signal is a
2434 /// [keybinding signal][GtkBindingSignal]
2435 /// which gets emitted to popup the combo box list.
2436 ///
2437 /// The default binding for this signal is Alt+Down.
2438 #[doc(alias = "popup")]
2439 fn connect_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2440 unsafe extern "C" fn popup_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
2441 this: *mut ffi::GtkComboBox,
2442 f: glib::ffi::gpointer,
2443 ) {
2444 unsafe {
2445 let f: &F = &*(f as *const F);
2446 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2447 }
2448 }
2449 unsafe {
2450 let f: Box_<F> = Box_::new(f);
2451 connect_raw(
2452 self.as_ptr() as *mut _,
2453 c"popup".as_ptr(),
2454 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2455 popup_trampoline::<Self, F> as *const (),
2456 )),
2457 Box_::into_raw(f),
2458 )
2459 }
2460 }
2461
2462 fn emit_popup(&self) {
2463 self.emit_by_name::<()>("popup", &[]);
2464 }
2465
2466 #[doc(alias = "active")]
2467 fn connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2468 unsafe extern "C" fn notify_active_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
2469 this: *mut ffi::GtkComboBox,
2470 _param_spec: glib::ffi::gpointer,
2471 f: glib::ffi::gpointer,
2472 ) {
2473 unsafe {
2474 let f: &F = &*(f as *const F);
2475 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2476 }
2477 }
2478 unsafe {
2479 let f: Box_<F> = Box_::new(f);
2480 connect_raw(
2481 self.as_ptr() as *mut _,
2482 c"notify::active".as_ptr(),
2483 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2484 notify_active_trampoline::<Self, F> as *const (),
2485 )),
2486 Box_::into_raw(f),
2487 )
2488 }
2489 }
2490
2491 #[doc(alias = "active-id")]
2492 fn connect_active_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2493 unsafe extern "C" fn notify_active_id_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
2494 this: *mut ffi::GtkComboBox,
2495 _param_spec: glib::ffi::gpointer,
2496 f: glib::ffi::gpointer,
2497 ) {
2498 unsafe {
2499 let f: &F = &*(f as *const F);
2500 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2501 }
2502 }
2503 unsafe {
2504 let f: Box_<F> = Box_::new(f);
2505 connect_raw(
2506 self.as_ptr() as *mut _,
2507 c"notify::active-id".as_ptr(),
2508 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2509 notify_active_id_trampoline::<Self, F> as *const (),
2510 )),
2511 Box_::into_raw(f),
2512 )
2513 }
2514 }
2515
2516 #[doc(alias = "button-sensitivity")]
2517 fn connect_button_sensitivity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2518 unsafe extern "C" fn notify_button_sensitivity_trampoline<
2519 P: IsA<ComboBox>,
2520 F: Fn(&P) + 'static,
2521 >(
2522 this: *mut ffi::GtkComboBox,
2523 _param_spec: glib::ffi::gpointer,
2524 f: glib::ffi::gpointer,
2525 ) {
2526 unsafe {
2527 let f: &F = &*(f as *const F);
2528 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2529 }
2530 }
2531 unsafe {
2532 let f: Box_<F> = Box_::new(f);
2533 connect_raw(
2534 self.as_ptr() as *mut _,
2535 c"notify::button-sensitivity".as_ptr(),
2536 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2537 notify_button_sensitivity_trampoline::<Self, F> as *const (),
2538 )),
2539 Box_::into_raw(f),
2540 )
2541 }
2542 }
2543
2544 #[doc(alias = "column-span-column")]
2545 fn connect_column_span_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2546 unsafe extern "C" fn notify_column_span_column_trampoline<
2547 P: IsA<ComboBox>,
2548 F: Fn(&P) + 'static,
2549 >(
2550 this: *mut ffi::GtkComboBox,
2551 _param_spec: glib::ffi::gpointer,
2552 f: glib::ffi::gpointer,
2553 ) {
2554 unsafe {
2555 let f: &F = &*(f as *const F);
2556 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2557 }
2558 }
2559 unsafe {
2560 let f: Box_<F> = Box_::new(f);
2561 connect_raw(
2562 self.as_ptr() as *mut _,
2563 c"notify::column-span-column".as_ptr(),
2564 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2565 notify_column_span_column_trampoline::<Self, F> as *const (),
2566 )),
2567 Box_::into_raw(f),
2568 )
2569 }
2570 }
2571
2572 #[doc(alias = "entry-text-column")]
2573 fn connect_entry_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2574 unsafe extern "C" fn notify_entry_text_column_trampoline<
2575 P: IsA<ComboBox>,
2576 F: Fn(&P) + 'static,
2577 >(
2578 this: *mut ffi::GtkComboBox,
2579 _param_spec: glib::ffi::gpointer,
2580 f: glib::ffi::gpointer,
2581 ) {
2582 unsafe {
2583 let f: &F = &*(f as *const F);
2584 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2585 }
2586 }
2587 unsafe {
2588 let f: Box_<F> = Box_::new(f);
2589 connect_raw(
2590 self.as_ptr() as *mut _,
2591 c"notify::entry-text-column".as_ptr(),
2592 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2593 notify_entry_text_column_trampoline::<Self, F> as *const (),
2594 )),
2595 Box_::into_raw(f),
2596 )
2597 }
2598 }
2599
2600 #[doc(alias = "has-frame")]
2601 fn connect_has_frame_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2602 unsafe extern "C" fn notify_has_frame_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
2603 this: *mut ffi::GtkComboBox,
2604 _param_spec: glib::ffi::gpointer,
2605 f: glib::ffi::gpointer,
2606 ) {
2607 unsafe {
2608 let f: &F = &*(f as *const F);
2609 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2610 }
2611 }
2612 unsafe {
2613 let f: Box_<F> = Box_::new(f);
2614 connect_raw(
2615 self.as_ptr() as *mut _,
2616 c"notify::has-frame".as_ptr(),
2617 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2618 notify_has_frame_trampoline::<Self, F> as *const (),
2619 )),
2620 Box_::into_raw(f),
2621 )
2622 }
2623 }
2624
2625 #[doc(alias = "id-column")]
2626 fn connect_id_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2627 unsafe extern "C" fn notify_id_column_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
2628 this: *mut ffi::GtkComboBox,
2629 _param_spec: glib::ffi::gpointer,
2630 f: glib::ffi::gpointer,
2631 ) {
2632 unsafe {
2633 let f: &F = &*(f as *const F);
2634 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2635 }
2636 }
2637 unsafe {
2638 let f: Box_<F> = Box_::new(f);
2639 connect_raw(
2640 self.as_ptr() as *mut _,
2641 c"notify::id-column".as_ptr(),
2642 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2643 notify_id_column_trampoline::<Self, F> as *const (),
2644 )),
2645 Box_::into_raw(f),
2646 )
2647 }
2648 }
2649
2650 #[doc(alias = "model")]
2651 fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2652 unsafe extern "C" fn notify_model_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
2653 this: *mut ffi::GtkComboBox,
2654 _param_spec: glib::ffi::gpointer,
2655 f: glib::ffi::gpointer,
2656 ) {
2657 unsafe {
2658 let f: &F = &*(f as *const F);
2659 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2660 }
2661 }
2662 unsafe {
2663 let f: Box_<F> = Box_::new(f);
2664 connect_raw(
2665 self.as_ptr() as *mut _,
2666 c"notify::model".as_ptr(),
2667 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2668 notify_model_trampoline::<Self, F> as *const (),
2669 )),
2670 Box_::into_raw(f),
2671 )
2672 }
2673 }
2674
2675 #[doc(alias = "popup-fixed-width")]
2676 fn connect_popup_fixed_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2677 unsafe extern "C" fn notify_popup_fixed_width_trampoline<
2678 P: IsA<ComboBox>,
2679 F: Fn(&P) + 'static,
2680 >(
2681 this: *mut ffi::GtkComboBox,
2682 _param_spec: glib::ffi::gpointer,
2683 f: glib::ffi::gpointer,
2684 ) {
2685 unsafe {
2686 let f: &F = &*(f as *const F);
2687 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2688 }
2689 }
2690 unsafe {
2691 let f: Box_<F> = Box_::new(f);
2692 connect_raw(
2693 self.as_ptr() as *mut _,
2694 c"notify::popup-fixed-width".as_ptr(),
2695 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2696 notify_popup_fixed_width_trampoline::<Self, F> as *const (),
2697 )),
2698 Box_::into_raw(f),
2699 )
2700 }
2701 }
2702
2703 #[doc(alias = "popup-shown")]
2704 fn connect_popup_shown_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2705 unsafe extern "C" fn notify_popup_shown_trampoline<
2706 P: IsA<ComboBox>,
2707 F: Fn(&P) + 'static,
2708 >(
2709 this: *mut ffi::GtkComboBox,
2710 _param_spec: glib::ffi::gpointer,
2711 f: glib::ffi::gpointer,
2712 ) {
2713 unsafe {
2714 let f: &F = &*(f as *const F);
2715 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2716 }
2717 }
2718 unsafe {
2719 let f: Box_<F> = Box_::new(f);
2720 connect_raw(
2721 self.as_ptr() as *mut _,
2722 c"notify::popup-shown".as_ptr(),
2723 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2724 notify_popup_shown_trampoline::<Self, F> as *const (),
2725 )),
2726 Box_::into_raw(f),
2727 )
2728 }
2729 }
2730
2731 #[doc(alias = "row-span-column")]
2732 fn connect_row_span_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2733 unsafe extern "C" fn notify_row_span_column_trampoline<
2734 P: IsA<ComboBox>,
2735 F: Fn(&P) + 'static,
2736 >(
2737 this: *mut ffi::GtkComboBox,
2738 _param_spec: glib::ffi::gpointer,
2739 f: glib::ffi::gpointer,
2740 ) {
2741 unsafe {
2742 let f: &F = &*(f as *const F);
2743 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2744 }
2745 }
2746 unsafe {
2747 let f: Box_<F> = Box_::new(f);
2748 connect_raw(
2749 self.as_ptr() as *mut _,
2750 c"notify::row-span-column".as_ptr(),
2751 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2752 notify_row_span_column_trampoline::<Self, F> as *const (),
2753 )),
2754 Box_::into_raw(f),
2755 )
2756 }
2757 }
2758
2759 #[doc(alias = "wrap-width")]
2760 fn connect_wrap_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2761 unsafe extern "C" fn notify_wrap_width_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>(
2762 this: *mut ffi::GtkComboBox,
2763 _param_spec: glib::ffi::gpointer,
2764 f: glib::ffi::gpointer,
2765 ) {
2766 unsafe {
2767 let f: &F = &*(f as *const F);
2768 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref())
2769 }
2770 }
2771 unsafe {
2772 let f: Box_<F> = Box_::new(f);
2773 connect_raw(
2774 self.as_ptr() as *mut _,
2775 c"notify::wrap-width".as_ptr(),
2776 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2777 notify_wrap_width_trampoline::<Self, F> as *const (),
2778 )),
2779 Box_::into_raw(f),
2780 )
2781 }
2782 }
2783}
2784
2785impl<O: IsA<ComboBox>> ComboBoxExt for O {}