gtk/auto/app_chooser_button.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, AppChooser, Bin, Buildable, CellArea, CellEditable, CellLayout, ComboBox, Container,
7 ResizeMode, SensitivityType, 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 /// The [`AppChooserButton`][crate::AppChooserButton] is a widget that lets the user select
19 /// an application. It implements the [`AppChooser`][crate::AppChooser] interface.
20 ///
21 /// Initially, a [`AppChooserButton`][crate::AppChooserButton] selects the first application
22 /// in its list, which will either be the most-recently used application
23 /// or, if [`show-default-item`][struct@crate::AppChooserButton#show-default-item] is [`true`], the
24 /// default application.
25 ///
26 /// The list of applications shown in a [`AppChooserButton`][crate::AppChooserButton] includes
27 /// the recommended applications for the given content type. When
28 /// [`show-default-item`][struct@crate::AppChooserButton#show-default-item] is set, the default application
29 /// is also included. To let the user chooser other applications,
30 /// you can set the [`show-dialog-item`][struct@crate::AppChooserButton#show-dialog-item] property,
31 /// which allows to open a full [`AppChooserDialog`][crate::AppChooserDialog].
32 ///
33 /// It is possible to add custom items to the list, using
34 /// [`AppChooserButtonExt::append_custom_item()`][crate::prelude::AppChooserButtonExt::append_custom_item()]. These items cause
35 /// the [`custom-item-activated`][struct@crate::AppChooserButton#custom-item-activated] signal to be
36 /// emitted when they are selected.
37 ///
38 /// To track changes in the selected application, use the
39 /// [`changed`][struct@crate::ComboBox#changed] signal.
40 ///
41 /// ## Properties
42 ///
43 ///
44 /// #### `heading`
45 /// The text to show at the top of the dialog that can be
46 /// opened from the button. The string may contain Pango markup.
47 ///
48 /// Readable | Writable
49 ///
50 ///
51 /// #### `show-default-item`
52 /// The [`show-default-item`][struct@crate::AppChooserButton#show-default-item] property determines
53 /// whether the dropdown menu should show the default application
54 /// on top for the provided content type.
55 ///
56 /// Readable | Writable | Construct
57 ///
58 ///
59 /// #### `show-dialog-item`
60 /// The [`show-dialog-item`][struct@crate::AppChooserButton#show-dialog-item] property determines
61 /// whether the dropdown menu should show an item that triggers
62 /// a [`AppChooserDialog`][crate::AppChooserDialog] when clicked.
63 ///
64 /// Readable | Writable | Construct
65 /// <details><summary><h4>ComboBox</h4></summary>
66 ///
67 ///
68 /// #### `active`
69 /// The item which is currently active. If the model is a non-flat treemodel,
70 /// and the active item is not an immediate child of the root of the tree,
71 /// this property has the value
72 /// `gtk_tree_path_get_indices (path)[0]`,
73 /// where `path` is the [`TreePath`][crate::TreePath] of the active item.
74 ///
75 /// Readable | Writable
76 ///
77 ///
78 /// #### `active-id`
79 /// The value of the ID column of the active row.
80 ///
81 /// Readable | Writable
82 ///
83 ///
84 /// #### `add-tearoffs`
85 /// The add-tearoffs property controls whether generated menus
86 /// have tearoff menu items.
87 ///
88 /// Note that this only affects menu style combo boxes.
89 ///
90 /// Readable | Writable
91 ///
92 ///
93 /// #### `button-sensitivity`
94 /// Whether the dropdown button is sensitive when
95 /// the model is empty.
96 ///
97 /// Readable | Writable
98 ///
99 ///
100 /// #### `cell-area`
101 /// The [`CellArea`][crate::CellArea] used to layout cell renderers for this combo box.
102 ///
103 /// If no area is specified when creating the combo box with [`ComboBox::with_area()`][crate::ComboBox::with_area()]
104 /// a horizontally oriented [`CellAreaBox`][crate::CellAreaBox] will be used.
105 ///
106 /// Readable | Writable | Construct Only
107 ///
108 ///
109 /// #### `column-span-column`
110 /// If this is set to a non-negative value, it must be the index of a column
111 /// of type `G_TYPE_INT` in the model. The value in that column for each item
112 /// will determine how many columns that item will span in the popup.
113 /// Therefore, values in this column must be greater than zero, and the sum of
114 /// an item’s column position + span should not exceed [`wrap-width`][struct@crate::ComboBox#wrap-width].
115 ///
116 /// Readable | Writable
117 ///
118 ///
119 /// #### `entry-text-column`
120 /// The column in the combo box's model to associate with strings from the entry
121 /// if the combo was created with [`has-entry`][struct@crate::ComboBox#has-entry] = [`true`].
122 ///
123 /// Readable | Writable
124 ///
125 ///
126 /// #### `has-entry`
127 /// Whether the combo box has an entry.
128 ///
129 /// Readable | Writable | Construct Only
130 ///
131 ///
132 /// #### `has-frame`
133 /// The has-frame property controls whether a frame
134 /// is drawn around the entry.
135 ///
136 /// Readable | Writable
137 ///
138 ///
139 /// #### `id-column`
140 /// The column in the combo box's model that provides string
141 /// IDs for the values in the model, if != -1.
142 ///
143 /// Readable | Writable
144 ///
145 ///
146 /// #### `model`
147 /// The model from which the combo box takes the values shown
148 /// in the list.
149 ///
150 /// Readable | Writable
151 ///
152 ///
153 /// #### `popup-fixed-width`
154 /// Whether the popup's width should be a fixed width matching the
155 /// allocated width of the combo box.
156 ///
157 /// Readable | Writable
158 ///
159 ///
160 /// #### `popup-shown`
161 /// Whether the combo boxes dropdown is popped up.
162 /// Note that this property is mainly useful, because
163 /// it allows you to connect to notify::popup-shown.
164 ///
165 /// Readable
166 ///
167 ///
168 /// #### `row-span-column`
169 /// If this is set to a non-negative value, it must be the index of a column
170 /// of type `G_TYPE_INT` in the model. The value in that column for each item
171 /// will determine how many rows that item will span in the popup. Therefore,
172 /// values in this column must be greater than zero.
173 ///
174 /// Readable | Writable
175 ///
176 ///
177 /// #### `tearoff-title`
178 /// A title that may be displayed by the window manager
179 /// when the popup is torn-off.
180 ///
181 /// Readable | Writable
182 ///
183 ///
184 /// #### `wrap-width`
185 /// If wrap-width is set to a positive value, items in the popup will be laid
186 /// out along multiple columns, starting a new row on reaching the wrap width.
187 ///
188 /// Readable | Writable
189 /// </details>
190 /// <details><summary><h4>Container</h4></summary>
191 ///
192 ///
193 /// #### `border-width`
194 /// Readable | Writable
195 ///
196 ///
197 /// #### `child`
198 /// Writable
199 ///
200 ///
201 /// #### `resize-mode`
202 /// Readable | Writable
203 /// </details>
204 /// <details><summary><h4>Widget</h4></summary>
205 ///
206 ///
207 /// #### `app-paintable`
208 /// Readable | Writable
209 ///
210 ///
211 /// #### `can-default`
212 /// Readable | Writable
213 ///
214 ///
215 /// #### `can-focus`
216 /// Readable | Writable
217 ///
218 ///
219 /// #### `composite-child`
220 /// Readable
221 ///
222 ///
223 /// #### `double-buffered`
224 /// Whether the widget is double buffered.
225 ///
226 /// Readable | Writable
227 ///
228 ///
229 /// #### `events`
230 /// Readable | Writable
231 ///
232 ///
233 /// #### `expand`
234 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
235 ///
236 /// Readable | Writable
237 ///
238 ///
239 /// #### `focus-on-click`
240 /// Whether the widget should grab focus when it is clicked with the mouse.
241 ///
242 /// This property is only relevant for widgets that can take focus.
243 ///
244 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
245 /// GtkComboBox) implemented this property individually.
246 ///
247 /// Readable | Writable
248 ///
249 ///
250 /// #### `halign`
251 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
252 ///
253 /// Readable | Writable
254 ///
255 ///
256 /// #### `has-default`
257 /// Readable | Writable
258 ///
259 ///
260 /// #### `has-focus`
261 /// Readable | Writable
262 ///
263 ///
264 /// #### `has-tooltip`
265 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
266 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
267 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
268 /// whether it will provide a tooltip or not.
269 ///
270 /// Note that setting this property to [`true`] for the first time will change
271 /// the event masks of the GdkWindows of this widget to include leave-notify
272 /// and motion-notify events. This cannot and will not be undone when the
273 /// property is set to [`false`] again.
274 ///
275 /// Readable | Writable
276 ///
277 ///
278 /// #### `height-request`
279 /// Readable | Writable
280 ///
281 ///
282 /// #### `hexpand`
283 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
284 ///
285 /// Readable | Writable
286 ///
287 ///
288 /// #### `hexpand-set`
289 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
290 ///
291 /// Readable | Writable
292 ///
293 ///
294 /// #### `is-focus`
295 /// Readable | Writable
296 ///
297 ///
298 /// #### `margin`
299 /// Sets all four sides' margin at once. If read, returns max
300 /// margin on any side.
301 ///
302 /// Readable | Writable
303 ///
304 ///
305 /// #### `margin-bottom`
306 /// Margin on bottom side of widget.
307 ///
308 /// This property adds margin outside of the widget's normal size
309 /// request, the margin will be added in addition to the size from
310 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
311 ///
312 /// Readable | Writable
313 ///
314 ///
315 /// #### `margin-end`
316 /// Margin on end of widget, horizontally. This property supports
317 /// left-to-right and right-to-left text directions.
318 ///
319 /// This property adds margin outside of the widget's normal size
320 /// request, the margin will be added in addition to the size from
321 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
322 ///
323 /// Readable | Writable
324 ///
325 ///
326 /// #### `margin-left`
327 /// Margin on left side of widget.
328 ///
329 /// This property adds margin outside of the widget's normal size
330 /// request, the margin will be added in addition to the size from
331 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
332 ///
333 /// Readable | Writable
334 ///
335 ///
336 /// #### `margin-right`
337 /// Margin on right side of widget.
338 ///
339 /// This property adds margin outside of the widget's normal size
340 /// request, the margin will be added in addition to the size from
341 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
342 ///
343 /// Readable | Writable
344 ///
345 ///
346 /// #### `margin-start`
347 /// Margin on start of widget, horizontally. This property supports
348 /// left-to-right and right-to-left text directions.
349 ///
350 /// This property adds margin outside of the widget's normal size
351 /// request, the margin will be added in addition to the size from
352 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
353 ///
354 /// Readable | Writable
355 ///
356 ///
357 /// #### `margin-top`
358 /// Margin on top side of widget.
359 ///
360 /// This property adds margin outside of the widget's normal size
361 /// request, the margin will be added in addition to the size from
362 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
363 ///
364 /// Readable | Writable
365 ///
366 ///
367 /// #### `name`
368 /// Readable | Writable
369 ///
370 ///
371 /// #### `no-show-all`
372 /// Readable | Writable
373 ///
374 ///
375 /// #### `opacity`
376 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
377 /// more details about window opacity.
378 ///
379 /// Before 3.8 this was only available in GtkWindow
380 ///
381 /// Readable | Writable
382 ///
383 ///
384 /// #### `parent`
385 /// Readable | Writable
386 ///
387 ///
388 /// #### `receives-default`
389 /// Readable | Writable
390 ///
391 ///
392 /// #### `scale-factor`
393 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
394 /// more details about widget scaling.
395 ///
396 /// Readable
397 ///
398 ///
399 /// #### `sensitive`
400 /// Readable | Writable
401 ///
402 ///
403 /// #### `style`
404 /// The style of the widget, which contains information about how it will look (colors, etc).
405 ///
406 /// Readable | Writable
407 ///
408 ///
409 /// #### `tooltip-markup`
410 /// Sets the text of tooltip to be the given string, which is marked up
411 /// with the [Pango text markup language][PangoMarkupFormat].
412 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
413 ///
414 /// This is a convenience property which will take care of getting the
415 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
416 /// will automatically be set to [`true`] and there will be taken care of
417 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
418 ///
419 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
420 /// are set, the last one wins.
421 ///
422 /// Readable | Writable
423 ///
424 ///
425 /// #### `tooltip-text`
426 /// Sets the text of tooltip to be the given string.
427 ///
428 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
429 ///
430 /// This is a convenience property which will take care of getting the
431 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
432 /// will automatically be set to [`true`] and there will be taken care of
433 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
434 ///
435 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
436 /// are set, the last one wins.
437 ///
438 /// Readable | Writable
439 ///
440 ///
441 /// #### `valign`
442 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
443 ///
444 /// Readable | Writable
445 ///
446 ///
447 /// #### `vexpand`
448 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
449 ///
450 /// Readable | Writable
451 ///
452 ///
453 /// #### `vexpand-set`
454 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
455 ///
456 /// Readable | Writable
457 ///
458 ///
459 /// #### `visible`
460 /// Readable | Writable
461 ///
462 ///
463 /// #### `width-request`
464 /// Readable | Writable
465 ///
466 ///
467 /// #### `window`
468 /// The widget's window if it is realized, [`None`] otherwise.
469 ///
470 /// Readable
471 /// </details>
472 /// <details><summary><h4>CellEditable</h4></summary>
473 ///
474 ///
475 /// #### `editing-canceled`
476 /// Indicates whether editing on the cell has been canceled.
477 ///
478 /// Readable | Writable
479 /// </details>
480 /// <details><summary><h4>AppChooser</h4></summary>
481 ///
482 ///
483 /// #### `content-type`
484 /// The content type of the [`AppChooser`][crate::AppChooser] object.
485 ///
486 /// See [GContentType][gio-GContentType]
487 /// for more information about content types.
488 ///
489 /// Readable | Writable | Construct Only
490 /// </details>
491 ///
492 /// ## Signals
493 ///
494 ///
495 /// #### `custom-item-activated`
496 /// Emitted when a custom item, previously added with
497 /// [`AppChooserButtonExt::append_custom_item()`][crate::prelude::AppChooserButtonExt::append_custom_item()], is activated from the
498 /// dropdown menu.
499 ///
500 /// Detailed
501 /// <details><summary><h4>ComboBox</h4></summary>
502 ///
503 ///
504 /// #### `changed`
505 /// The changed signal is emitted when the active
506 /// item is changed. The can be due to the user selecting
507 /// a different item from the list, or due to a
508 /// call to [`ComboBoxExt::set_active_iter()`][crate::prelude::ComboBoxExt::set_active_iter()].
509 /// It will also be emitted while typing into the entry of a combo box
510 /// with an entry.
511 ///
512 ///
513 ///
514 ///
515 /// #### `format-entry-text`
516 /// value,
517 /// -1);
518 ///
519 /// return g_strdup_printf ("`g`", value);
520 /// }
521 /// ]|
522 ///
523 ///
524 ///
525 ///
526 /// #### `move-active`
527 /// The ::move-active signal is a
528 /// [keybinding signal][GtkBindingSignal]
529 /// which gets emitted to move the active selection.
530 ///
531 /// Action
532 ///
533 ///
534 /// #### `popdown`
535 /// The ::popdown signal is a
536 /// [keybinding signal][GtkBindingSignal]
537 /// which gets emitted to popdown the combo box list.
538 ///
539 /// The default bindings for this signal are Alt+Up and Escape.
540 ///
541 /// Action
542 ///
543 ///
544 /// #### `popup`
545 /// The ::popup signal is a
546 /// [keybinding signal][GtkBindingSignal]
547 /// which gets emitted to popup the combo box list.
548 ///
549 /// The default binding for this signal is Alt+Down.
550 ///
551 /// Action
552 /// </details>
553 /// <details><summary><h4>Container</h4></summary>
554 ///
555 ///
556 /// #### `add`
557 ///
558 ///
559 ///
560 /// #### `check-resize`
561 ///
562 ///
563 ///
564 /// #### `remove`
565 ///
566 ///
567 ///
568 /// #### `set-focus-child`
569 ///
570 /// </details>
571 /// <details><summary><h4>Widget</h4></summary>
572 ///
573 ///
574 /// #### `accel-closures-changed`
575 ///
576 ///
577 ///
578 /// #### `button-press-event`
579 /// The ::button-press-event signal will be emitted when a button
580 /// (typically from a mouse) is pressed.
581 ///
582 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
583 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
584 ///
585 /// This signal will be sent to the grab widget if there is one.
586 ///
587 ///
588 ///
589 ///
590 /// #### `button-release-event`
591 /// The ::button-release-event signal will be emitted when a button
592 /// (typically from a mouse) is released.
593 ///
594 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
595 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
596 ///
597 /// This signal will be sent to the grab widget if there is one.
598 ///
599 ///
600 ///
601 ///
602 /// #### `can-activate-accel`
603 /// Determines whether an accelerator that activates the signal
604 /// identified by `signal_id` can currently be activated.
605 /// This signal is present to allow applications and derived
606 /// widgets to override the default [`Widget`][crate::Widget] handling
607 /// for determining whether an accelerator can be activated.
608 ///
609 ///
610 ///
611 ///
612 /// #### `child-notify`
613 /// The ::child-notify signal is emitted for each
614 /// [child property][child-properties] that has
615 /// changed on an object. The signal's detail holds the property name.
616 ///
617 /// Detailed
618 ///
619 ///
620 /// #### `composited-changed`
621 /// The ::composited-changed signal is emitted when the composited
622 /// status of `widgets` screen changes.
623 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
624 ///
625 /// Action
626 ///
627 ///
628 /// #### `configure-event`
629 /// The ::configure-event signal will be emitted when the size, position or
630 /// stacking of the `widget`'s window has changed.
631 ///
632 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
633 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
634 /// automatically for all new windows.
635 ///
636 ///
637 ///
638 ///
639 /// #### `damage-event`
640 /// Emitted when a redirected window belonging to `widget` gets drawn into.
641 /// The region/area members of the event shows what area of the redirected
642 /// drawable was drawn into.
643 ///
644 ///
645 ///
646 ///
647 /// #### `delete-event`
648 /// The ::delete-event signal is emitted if a user requests that
649 /// a toplevel window is closed. The default handler for this signal
650 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
651 /// this signal will cause the window to be hidden instead, so that
652 /// it can later be shown again without reconstructing it.
653 ///
654 ///
655 ///
656 ///
657 /// #### `destroy`
658 /// Signals that all holders of a reference to the widget should release
659 /// the reference that they hold. May result in finalization of the widget
660 /// if all references are released.
661 ///
662 /// This signal is not suitable for saving widget state.
663 ///
664 ///
665 ///
666 ///
667 /// #### `destroy-event`
668 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
669 /// You rarely get this signal, because most widgets disconnect themselves
670 /// from their window before they destroy it, so no widget owns the
671 /// window at destroy time.
672 ///
673 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
674 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
675 /// automatically for all new windows.
676 ///
677 ///
678 ///
679 ///
680 /// #### `direction-changed`
681 /// The ::direction-changed signal is emitted when the text direction
682 /// of a widget changes.
683 ///
684 ///
685 ///
686 ///
687 /// #### `drag-begin`
688 /// The ::drag-begin signal is emitted on the drag source when a drag is
689 /// started. A typical reason to connect to this signal is to set up a
690 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
691 ///
692 /// Note that some widgets set up a drag icon in the default handler of
693 /// this signal, so you may have to use `g_signal_connect_after()` to
694 /// override what the default handler did.
695 ///
696 ///
697 ///
698 ///
699 /// #### `drag-data-delete`
700 /// The ::drag-data-delete signal is emitted on the drag source when a drag
701 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
702 /// handler is responsible for deleting the data that has been dropped. What
703 /// "delete" means depends on the context of the drag operation.
704 ///
705 ///
706 ///
707 ///
708 /// #### `drag-data-get`
709 /// The ::drag-data-get signal is emitted on the drag source when the drop
710 /// site requests the data which is dragged. It is the responsibility of
711 /// the signal handler to fill `data` with the data in the format which
712 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
713 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
714 ///
715 ///
716 ///
717 ///
718 /// #### `drag-data-received`
719 /// format == 8))
720 /// {
721 /// GdkDragAction action;
722 ///
723 /// // handle data here
724 ///
725 /// action = gdk_drag_context_get_selected_action (context);
726 /// if (action == GDK_ACTION_ASK)
727 /// {
728 /// GtkWidget *dialog;
729 /// gint response;
730 ///
731 /// dialog = gtk_message_dialog_new (NULL,
732 /// GTK_DIALOG_MODAL |
733 /// GTK_DIALOG_DESTROY_WITH_PARENT,
734 /// GTK_MESSAGE_INFO,
735 /// GTK_BUTTONS_YES_NO,
736 /// "Move the data ?\n");
737 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
738 /// gtk_widget_destroy (dialog);
739 ///
740 /// if (response == GTK_RESPONSE_YES)
741 /// action = GDK_ACTION_MOVE;
742 /// else
743 /// action = GDK_ACTION_COPY;
744 /// }
745 ///
746 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
747 /// }
748 /// else
749 /// gtk_drag_finish (context, FALSE, FALSE, time);
750 /// }
751 /// ]|
752 ///
753 ///
754 ///
755 ///
756 /// #### `drag-drop`
757 /// The ::drag-drop signal is emitted on the drop site when the user drops
758 /// the data onto the widget. The signal handler must determine whether
759 /// the cursor position is in a drop zone or not. If it is not in a drop
760 /// zone, it returns [`false`] and no further processing is necessary.
761 /// Otherwise, the handler returns [`true`]. In this case, the handler must
762 /// ensure that `gtk_drag_finish()` is called to let the source know that
763 /// the drop is done. The call to `gtk_drag_finish()` can be done either
764 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
765 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
766 /// or more of the supported targets.
767 ///
768 ///
769 ///
770 ///
771 /// #### `drag-end`
772 /// The ::drag-end signal is emitted on the drag source when a drag is
773 /// finished. A typical reason to connect to this signal is to undo
774 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
775 ///
776 ///
777 ///
778 ///
779 /// #### `drag-failed`
780 /// The ::drag-failed signal is emitted on the drag source when a drag has
781 /// failed. The signal handler may hook custom code to handle a failed DnD
782 /// operation based on the type of error, it returns [`true`] is the failure has
783 /// been already handled (not showing the default "drag operation failed"
784 /// animation), otherwise it returns [`false`].
785 ///
786 ///
787 ///
788 ///
789 /// #### `drag-leave`
790 /// The ::drag-leave signal is emitted on the drop site when the cursor
791 /// leaves the widget. A typical reason to connect to this signal is to
792 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
793 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
794 ///
795 ///
796 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
797 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
798 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
799 ///
800 ///
801 ///
802 ///
803 /// #### `drag-motion`
804 /// suggested_action,
805 /// time);
806 /// }
807 /// else
808 /// {
809 /// // accept the drop
810 /// }
811 /// }
812 /// ]|
813 ///
814 ///
815 ///
816 ///
817 /// #### `draw`
818 /// This signal is emitted when a widget is supposed to render itself.
819 /// The `widget`'s top left corner must be painted at the origin of
820 /// the passed in context and be sized to the values returned by
821 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
822 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
823 ///
824 /// Signal handlers connected to this signal can modify the cairo
825 /// context passed as `cr` in any way they like and don't need to
826 /// restore it. The signal emission takes care of calling `cairo_save()`
827 /// before and `cairo_restore()` after invoking the handler.
828 ///
829 /// The signal handler will get a `cr` with a clip region already set to the
830 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
831 /// widgets that want to avoid redrawing themselves completely can get the full
832 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
833 /// get a finer-grained representation of the dirty region with
834 /// `cairo_copy_clip_rectangle_list()`.
835 ///
836 ///
837 ///
838 ///
839 /// #### `enter-notify-event`
840 /// The ::enter-notify-event will be emitted when the pointer enters
841 /// the `widget`'s window.
842 ///
843 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
844 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
845 ///
846 /// This signal will be sent to the grab widget if there is one.
847 ///
848 ///
849 ///
850 ///
851 /// #### `event`
852 /// The GTK+ main loop will emit three signals for each GDK event delivered
853 /// to a widget: one generic ::event signal, another, more specific,
854 /// signal that matches the type of event delivered (e.g.
855 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
856 /// [`event-after`][struct@crate::Widget#event-after] signal.
857 ///
858 ///
859 ///
860 ///
861 /// #### `event-after`
862 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
863 /// the second more specific signal, ::event-after will be emitted
864 /// regardless of the previous two signals handlers return values.
865 ///
866 ///
867 ///
868 ///
869 /// #### `focus`
870 ///
871 ///
872 ///
873 /// #### `focus-in-event`
874 /// The ::focus-in-event signal will be emitted when the keyboard focus
875 /// enters the `widget`'s window.
876 ///
877 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
878 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
879 ///
880 ///
881 ///
882 ///
883 /// #### `focus-out-event`
884 /// The ::focus-out-event signal will be emitted when the keyboard focus
885 /// leaves the `widget`'s window.
886 ///
887 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
888 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
889 ///
890 ///
891 ///
892 ///
893 /// #### `grab-broken-event`
894 /// Emitted when a pointer or keyboard grab on a window belonging
895 /// to `widget` gets broken.
896 ///
897 /// On X11, this happens when the grab window becomes unviewable
898 /// (i.e. it or one of its ancestors is unmapped), or if the same
899 /// application grabs the pointer or keyboard again.
900 ///
901 ///
902 ///
903 ///
904 /// #### `grab-focus`
905 /// Action
906 ///
907 ///
908 /// #### `grab-notify`
909 /// The ::grab-notify signal is emitted when a widget becomes
910 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
911 /// another widget, or when it becomes unshadowed due to a grab
912 /// being removed.
913 ///
914 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
915 /// grab widget in the grab stack of its window group is not
916 /// its ancestor.
917 ///
918 ///
919 ///
920 ///
921 /// #### `hide`
922 /// The ::hide signal is emitted when `widget` is hidden, for example with
923 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
924 ///
925 ///
926 ///
927 ///
928 /// #### `hierarchy-changed`
929 /// The ::hierarchy-changed signal is emitted when the
930 /// anchored state of a widget changes. A widget is
931 /// “anchored” when its toplevel
932 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
933 /// a widget changes from un-anchored to anchored or vice-versa.
934 ///
935 ///
936 ///
937 ///
938 /// #### `key-press-event`
939 /// The ::key-press-event signal is emitted when a key is pressed. The signal
940 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
941 ///
942 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
943 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
944 ///
945 /// This signal will be sent to the grab widget if there is one.
946 ///
947 ///
948 ///
949 ///
950 /// #### `key-release-event`
951 /// The ::key-release-event signal is emitted when a key is released.
952 ///
953 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
954 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
955 ///
956 /// This signal will be sent to the grab widget if there is one.
957 ///
958 ///
959 ///
960 ///
961 /// #### `keynav-failed`
962 /// Gets emitted if keyboard navigation fails.
963 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
964 ///
965 ///
966 ///
967 ///
968 /// #### `leave-notify-event`
969 /// The ::leave-notify-event will be emitted when the pointer leaves
970 /// the `widget`'s window.
971 ///
972 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
973 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
974 ///
975 /// This signal will be sent to the grab widget if there is one.
976 ///
977 ///
978 ///
979 ///
980 /// #### `map`
981 /// The ::map signal is emitted when `widget` is going to be mapped, that is
982 /// when the widget is visible (which is controlled with
983 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
984 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
985 /// be emitted.
986 ///
987 /// The ::map signal can be used to determine whether a widget will be drawn,
988 /// for instance it can resume an animation that was stopped during the
989 /// emission of [`unmap`][struct@crate::Widget#unmap].
990 ///
991 ///
992 ///
993 ///
994 /// #### `map-event`
995 /// The ::map-event signal will be emitted when the `widget`'s window is
996 /// mapped. A window is mapped when it becomes visible on the screen.
997 ///
998 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
999 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1000 /// automatically for all new windows.
1001 ///
1002 ///
1003 ///
1004 ///
1005 /// #### `mnemonic-activate`
1006 /// The default handler for this signal activates `widget` if `group_cycling`
1007 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1008 ///
1009 ///
1010 ///
1011 ///
1012 /// #### `motion-notify-event`
1013 /// The ::motion-notify-event signal is emitted when the pointer moves
1014 /// over the widget's [`gdk::Window`][crate::gdk::Window].
1015 ///
1016 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1017 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1018 ///
1019 /// This signal will be sent to the grab widget if there is one.
1020 ///
1021 ///
1022 ///
1023 ///
1024 /// #### `move-focus`
1025 /// Action
1026 ///
1027 ///
1028 /// #### `parent-set`
1029 /// The ::parent-set signal is emitted when a new parent
1030 /// has been set on a widget.
1031 ///
1032 ///
1033 ///
1034 ///
1035 /// #### `popup-menu`
1036 /// This signal gets emitted whenever a widget should pop up a context
1037 /// menu. This usually happens through the standard key binding mechanism;
1038 /// by pressing a certain key while a widget is focused, the user can cause
1039 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1040 /// a menu with clipboard commands. See the
1041 /// [Popup Menu Migration Checklist][checklist-popup-menu]
1042 /// for an example of how to use this signal.
1043 ///
1044 /// Action
1045 ///
1046 ///
1047 /// #### `property-notify-event`
1048 /// The ::property-notify-event signal will be emitted when a property on
1049 /// the `widget`'s window has been changed or deleted.
1050 ///
1051 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1052 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1053 ///
1054 ///
1055 ///
1056 ///
1057 /// #### `proximity-in-event`
1058 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1059 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1060 ///
1061 /// This signal will be sent to the grab widget if there is one.
1062 ///
1063 ///
1064 ///
1065 ///
1066 /// #### `proximity-out-event`
1067 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1068 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1069 ///
1070 /// This signal will be sent to the grab widget if there is one.
1071 ///
1072 ///
1073 ///
1074 ///
1075 /// #### `query-tooltip`
1076 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1077 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1078 /// focus in keyboard mode.
1079 ///
1080 /// Using the given coordinates, the signal handler should determine
1081 /// whether a tooltip should be shown for `widget`. If this is the case
1082 /// [`true`] should be returned, [`false`] otherwise. Note that if
1083 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1084 /// should not be used.
1085 ///
1086 /// The signal handler is free to manipulate `tooltip` with the therefore
1087 /// destined function calls.
1088 ///
1089 ///
1090 ///
1091 ///
1092 /// #### `realize`
1093 /// The ::realize signal is emitted when `widget` is associated with a
1094 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1095 /// widget has been mapped (that is, it is going to be drawn).
1096 ///
1097 ///
1098 ///
1099 ///
1100 /// #### `screen-changed`
1101 /// The ::screen-changed signal gets emitted when the
1102 /// screen of a widget has changed.
1103 ///
1104 ///
1105 ///
1106 ///
1107 /// #### `scroll-event`
1108 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1109 /// range is pressed. Wheel mice are usually configured to generate
1110 /// button press events for buttons 4 and 5 when the wheel is turned.
1111 ///
1112 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1113 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1114 ///
1115 /// This signal will be sent to the grab widget if there is one.
1116 ///
1117 ///
1118 ///
1119 ///
1120 /// #### `selection-clear-event`
1121 /// The ::selection-clear-event signal will be emitted when the
1122 /// the `widget`'s window has lost ownership of a selection.
1123 ///
1124 ///
1125 ///
1126 ///
1127 /// #### `selection-get`
1128 ///
1129 ///
1130 ///
1131 /// #### `selection-notify-event`
1132 ///
1133 ///
1134 ///
1135 /// #### `selection-received`
1136 ///
1137 ///
1138 ///
1139 /// #### `selection-request-event`
1140 /// The ::selection-request-event signal will be emitted when
1141 /// another client requests ownership of the selection owned by
1142 /// the `widget`'s window.
1143 ///
1144 ///
1145 ///
1146 ///
1147 /// #### `show`
1148 /// The ::show signal is emitted when `widget` is shown, for example with
1149 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1150 ///
1151 ///
1152 ///
1153 ///
1154 /// #### `show-help`
1155 /// Action
1156 ///
1157 ///
1158 /// #### `size-allocate`
1159 ///
1160 ///
1161 ///
1162 /// #### `state-changed`
1163 /// The ::state-changed signal is emitted when the widget state changes.
1164 /// See `gtk_widget_get_state()`.
1165 ///
1166 ///
1167 ///
1168 ///
1169 /// #### `state-flags-changed`
1170 /// The ::state-flags-changed signal is emitted when the widget state
1171 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1172 ///
1173 ///
1174 ///
1175 ///
1176 /// #### `style-set`
1177 /// The ::style-set signal is emitted when a new style has been set
1178 /// on a widget. Note that style-modifying functions like
1179 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1180 ///
1181 /// Note that this signal is emitted for changes to the deprecated
1182 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1183 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1184 ///
1185 ///
1186 ///
1187 ///
1188 /// #### `style-updated`
1189 /// The ::style-updated signal is a convenience signal that is emitted when the
1190 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1191 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1192 ///
1193 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1194 /// cause this signal to be emitted.
1195 ///
1196 ///
1197 ///
1198 ///
1199 /// #### `touch-event`
1200 ///
1201 ///
1202 ///
1203 /// #### `unmap`
1204 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1205 /// means that either it or any of its parents up to the toplevel widget have
1206 /// been set as hidden.
1207 ///
1208 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1209 /// used to, for example, stop an animation on the widget.
1210 ///
1211 ///
1212 ///
1213 ///
1214 /// #### `unmap-event`
1215 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1216 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1217 ///
1218 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1219 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1220 /// automatically for all new windows.
1221 ///
1222 ///
1223 ///
1224 ///
1225 /// #### `unrealize`
1226 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1227 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1228 /// called or the widget has been unmapped (that is, it is going to be
1229 /// hidden).
1230 ///
1231 ///
1232 ///
1233 ///
1234 /// #### `visibility-notify-event`
1235 /// The ::visibility-notify-event will be emitted when the `widget`'s
1236 /// window is obscured or unobscured.
1237 ///
1238 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1239 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1240 ///
1241 ///
1242 ///
1243 ///
1244 /// #### `window-state-event`
1245 /// The ::window-state-event will be emitted when the state of the
1246 /// toplevel window associated to the `widget` changes.
1247 ///
1248 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1249 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1250 /// this mask automatically for all new windows.
1251 ///
1252 ///
1253 /// </details>
1254 /// <details><summary><h4>CellEditable</h4></summary>
1255 ///
1256 ///
1257 /// #### `editing-done`
1258 /// This signal is a sign for the cell renderer to update its
1259 /// value from the `cell_editable`.
1260 ///
1261 /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
1262 /// emitting this signal when they are done editing, e.g.
1263 /// [`Entry`][crate::Entry] emits this signal when the user presses Enter. Typical things to
1264 /// do in a handler for ::editing-done are to capture the edited value,
1265 /// disconnect the `cell_editable` from signals on the [`CellRenderer`][crate::CellRenderer], etc.
1266 ///
1267 /// [`CellEditableExt::editing_done()`][crate::prelude::CellEditableExt::editing_done()] is a convenience method
1268 /// for emitting [`editing-done`][struct@crate::CellEditable#editing-done].
1269 ///
1270 ///
1271 ///
1272 ///
1273 /// #### `remove-widget`
1274 /// This signal is meant to indicate that the cell is finished
1275 /// editing, and the `cell_editable` widget is being removed and may
1276 /// subsequently be destroyed.
1277 ///
1278 /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
1279 /// emitting this signal when they are done editing. It must
1280 /// be emitted after the [`editing-done`][struct@crate::CellEditable#editing-done] signal,
1281 /// to give the cell renderer a chance to update the cell's value
1282 /// before the widget is removed.
1283 ///
1284 /// [`CellEditableExt::remove_widget()`][crate::prelude::CellEditableExt::remove_widget()] is a convenience method
1285 /// for emitting [`remove-widget`][struct@crate::CellEditable#remove-widget].
1286 ///
1287 ///
1288 /// </details>
1289 ///
1290 /// # Implements
1291 ///
1292 /// [`AppChooserButtonExt`][trait@crate::prelude::AppChooserButtonExt], [`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], [`AppChooserExt`][trait@crate::prelude::AppChooserExt], [`ComboBoxExtManual`][trait@crate::prelude::ComboBoxExtManual], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1293 #[doc(alias = "GtkAppChooserButton")]
1294 pub struct AppChooserButton(Object<ffi::GtkAppChooserButton, ffi::GtkAppChooserButtonClass>) @extends ComboBox, Bin, Container, Widget, @implements Buildable, CellEditable, CellLayout, AppChooser;
1295
1296 match fn {
1297 type_ => || ffi::gtk_app_chooser_button_get_type(),
1298 }
1299}
1300
1301impl AppChooserButton {
1302 pub const NONE: Option<&'static AppChooserButton> = None;
1303
1304 /// Creates a new [`AppChooserButton`][crate::AppChooserButton] for applications
1305 /// that can handle content of the given type.
1306 /// ## `content_type`
1307 /// the content type to show applications for
1308 ///
1309 /// # Returns
1310 ///
1311 /// a newly created [`AppChooserButton`][crate::AppChooserButton]
1312 #[doc(alias = "gtk_app_chooser_button_new")]
1313 pub fn new(content_type: &str) -> AppChooserButton {
1314 assert_initialized_main_thread!();
1315 unsafe {
1316 Widget::from_glib_none(ffi::gtk_app_chooser_button_new(
1317 content_type.to_glib_none().0,
1318 ))
1319 .unsafe_cast()
1320 }
1321 }
1322
1323 // rustdoc-stripper-ignore-next
1324 /// Creates a new builder-pattern struct instance to construct [`AppChooserButton`] objects.
1325 ///
1326 /// This method returns an instance of [`AppChooserButtonBuilder`](crate::builders::AppChooserButtonBuilder) which can be used to create [`AppChooserButton`] objects.
1327 pub fn builder() -> AppChooserButtonBuilder {
1328 AppChooserButtonBuilder::new()
1329 }
1330}
1331
1332impl Default for AppChooserButton {
1333 fn default() -> Self {
1334 glib::object::Object::new::<Self>()
1335 }
1336}
1337
1338// rustdoc-stripper-ignore-next
1339/// A [builder-pattern] type to construct [`AppChooserButton`] objects.
1340///
1341/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1342#[must_use = "The builder must be built to be used"]
1343pub struct AppChooserButtonBuilder {
1344 builder: glib::object::ObjectBuilder<'static, AppChooserButton>,
1345}
1346
1347impl AppChooserButtonBuilder {
1348 fn new() -> Self {
1349 Self {
1350 builder: glib::object::Object::builder(),
1351 }
1352 }
1353
1354 /// The text to show at the top of the dialog that can be
1355 /// opened from the button. The string may contain Pango markup.
1356 pub fn heading(self, heading: impl Into<glib::GString>) -> Self {
1357 Self {
1358 builder: self.builder.property("heading", heading.into()),
1359 }
1360 }
1361
1362 /// The [`show-default-item`][struct@crate::AppChooserButton#show-default-item] property determines
1363 /// whether the dropdown menu should show the default application
1364 /// on top for the provided content type.
1365 pub fn show_default_item(self, show_default_item: bool) -> Self {
1366 Self {
1367 builder: self
1368 .builder
1369 .property("show-default-item", show_default_item),
1370 }
1371 }
1372
1373 /// The [`show-dialog-item`][struct@crate::AppChooserButton#show-dialog-item] property determines
1374 /// whether the dropdown menu should show an item that triggers
1375 /// a [`AppChooserDialog`][crate::AppChooserDialog] when clicked.
1376 pub fn show_dialog_item(self, show_dialog_item: bool) -> Self {
1377 Self {
1378 builder: self.builder.property("show-dialog-item", show_dialog_item),
1379 }
1380 }
1381
1382 /// The item which is currently active. If the model is a non-flat treemodel,
1383 /// and the active item is not an immediate child of the root of the tree,
1384 /// this property has the value
1385 /// `gtk_tree_path_get_indices (path)[0]`,
1386 /// where `path` is the [`TreePath`][crate::TreePath] of the active item.
1387 pub fn active(self, active: i32) -> Self {
1388 Self {
1389 builder: self.builder.property("active", active),
1390 }
1391 }
1392
1393 /// The value of the ID column of the active row.
1394 pub fn active_id(self, active_id: impl Into<glib::GString>) -> Self {
1395 Self {
1396 builder: self.builder.property("active-id", active_id.into()),
1397 }
1398 }
1399
1400 /// Whether the dropdown button is sensitive when
1401 /// the model is empty.
1402 pub fn button_sensitivity(self, button_sensitivity: SensitivityType) -> Self {
1403 Self {
1404 builder: self
1405 .builder
1406 .property("button-sensitivity", button_sensitivity),
1407 }
1408 }
1409
1410 /// The [`CellArea`][crate::CellArea] used to layout cell renderers for this combo box.
1411 ///
1412 /// If no area is specified when creating the combo box with [`ComboBox::with_area()`][crate::ComboBox::with_area()]
1413 /// a horizontally oriented [`CellAreaBox`][crate::CellAreaBox] will be used.
1414 pub fn cell_area(self, cell_area: &impl IsA<CellArea>) -> Self {
1415 Self {
1416 builder: self
1417 .builder
1418 .property("cell-area", cell_area.clone().upcast()),
1419 }
1420 }
1421
1422 /// If this is set to a non-negative value, it must be the index of a column
1423 /// of type `G_TYPE_INT` in the model. The value in that column for each item
1424 /// will determine how many columns that item will span in the popup.
1425 /// Therefore, values in this column must be greater than zero, and the sum of
1426 /// an item’s column position + span should not exceed [`wrap-width`][struct@crate::ComboBox#wrap-width].
1427 pub fn column_span_column(self, column_span_column: i32) -> Self {
1428 Self {
1429 builder: self
1430 .builder
1431 .property("column-span-column", column_span_column),
1432 }
1433 }
1434
1435 /// The column in the combo box's model to associate with strings from the entry
1436 /// if the combo was created with [`has-entry`][struct@crate::ComboBox#has-entry] = [`true`].
1437 pub fn entry_text_column(self, entry_text_column: i32) -> Self {
1438 Self {
1439 builder: self
1440 .builder
1441 .property("entry-text-column", entry_text_column),
1442 }
1443 }
1444
1445 /// Whether the combo box has an entry.
1446 pub fn has_entry(self, has_entry: bool) -> Self {
1447 Self {
1448 builder: self.builder.property("has-entry", has_entry),
1449 }
1450 }
1451
1452 /// The has-frame property controls whether a frame
1453 /// is drawn around the entry.
1454 pub fn has_frame(self, has_frame: bool) -> Self {
1455 Self {
1456 builder: self.builder.property("has-frame", has_frame),
1457 }
1458 }
1459
1460 /// The column in the combo box's model that provides string
1461 /// IDs for the values in the model, if != -1.
1462 pub fn id_column(self, id_column: i32) -> Self {
1463 Self {
1464 builder: self.builder.property("id-column", id_column),
1465 }
1466 }
1467
1468 /// The model from which the combo box takes the values shown
1469 /// in the list.
1470 pub fn model(self, model: &impl IsA<TreeModel>) -> Self {
1471 Self {
1472 builder: self.builder.property("model", model.clone().upcast()),
1473 }
1474 }
1475
1476 /// Whether the popup's width should be a fixed width matching the
1477 /// allocated width of the combo box.
1478 pub fn popup_fixed_width(self, popup_fixed_width: bool) -> Self {
1479 Self {
1480 builder: self
1481 .builder
1482 .property("popup-fixed-width", popup_fixed_width),
1483 }
1484 }
1485
1486 /// If this is set to a non-negative value, it must be the index of a column
1487 /// of type `G_TYPE_INT` in the model. The value in that column for each item
1488 /// will determine how many rows that item will span in the popup. Therefore,
1489 /// values in this column must be greater than zero.
1490 pub fn row_span_column(self, row_span_column: i32) -> Self {
1491 Self {
1492 builder: self.builder.property("row-span-column", row_span_column),
1493 }
1494 }
1495
1496 /// If wrap-width is set to a positive value, items in the popup will be laid
1497 /// out along multiple columns, starting a new row on reaching the wrap width.
1498 pub fn wrap_width(self, wrap_width: i32) -> Self {
1499 Self {
1500 builder: self.builder.property("wrap-width", wrap_width),
1501 }
1502 }
1503
1504 pub fn border_width(self, border_width: u32) -> Self {
1505 Self {
1506 builder: self.builder.property("border-width", border_width),
1507 }
1508 }
1509
1510 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1511 Self {
1512 builder: self.builder.property("child", child.clone().upcast()),
1513 }
1514 }
1515
1516 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1517 Self {
1518 builder: self.builder.property("resize-mode", resize_mode),
1519 }
1520 }
1521
1522 pub fn app_paintable(self, app_paintable: bool) -> Self {
1523 Self {
1524 builder: self.builder.property("app-paintable", app_paintable),
1525 }
1526 }
1527
1528 pub fn can_default(self, can_default: bool) -> Self {
1529 Self {
1530 builder: self.builder.property("can-default", can_default),
1531 }
1532 }
1533
1534 pub fn can_focus(self, can_focus: bool) -> Self {
1535 Self {
1536 builder: self.builder.property("can-focus", can_focus),
1537 }
1538 }
1539
1540 pub fn events(self, events: gdk::EventMask) -> Self {
1541 Self {
1542 builder: self.builder.property("events", events),
1543 }
1544 }
1545
1546 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1547 pub fn expand(self, expand: bool) -> Self {
1548 Self {
1549 builder: self.builder.property("expand", expand),
1550 }
1551 }
1552
1553 /// Whether the widget should grab focus when it is clicked with the mouse.
1554 ///
1555 /// This property is only relevant for widgets that can take focus.
1556 ///
1557 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1558 /// GtkComboBox) implemented this property individually.
1559 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1560 Self {
1561 builder: self.builder.property("focus-on-click", focus_on_click),
1562 }
1563 }
1564
1565 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1566 pub fn halign(self, halign: Align) -> Self {
1567 Self {
1568 builder: self.builder.property("halign", halign),
1569 }
1570 }
1571
1572 pub fn has_default(self, has_default: bool) -> Self {
1573 Self {
1574 builder: self.builder.property("has-default", has_default),
1575 }
1576 }
1577
1578 pub fn has_focus(self, has_focus: bool) -> Self {
1579 Self {
1580 builder: self.builder.property("has-focus", has_focus),
1581 }
1582 }
1583
1584 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1585 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1586 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1587 /// whether it will provide a tooltip or not.
1588 ///
1589 /// Note that setting this property to [`true`] for the first time will change
1590 /// the event masks of the GdkWindows of this widget to include leave-notify
1591 /// and motion-notify events. This cannot and will not be undone when the
1592 /// property is set to [`false`] again.
1593 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1594 Self {
1595 builder: self.builder.property("has-tooltip", has_tooltip),
1596 }
1597 }
1598
1599 pub fn height_request(self, height_request: i32) -> Self {
1600 Self {
1601 builder: self.builder.property("height-request", height_request),
1602 }
1603 }
1604
1605 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1606 pub fn hexpand(self, hexpand: bool) -> Self {
1607 Self {
1608 builder: self.builder.property("hexpand", hexpand),
1609 }
1610 }
1611
1612 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1613 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1614 Self {
1615 builder: self.builder.property("hexpand-set", hexpand_set),
1616 }
1617 }
1618
1619 pub fn is_focus(self, is_focus: bool) -> Self {
1620 Self {
1621 builder: self.builder.property("is-focus", is_focus),
1622 }
1623 }
1624
1625 /// Sets all four sides' margin at once. If read, returns max
1626 /// margin on any side.
1627 pub fn margin(self, margin: i32) -> Self {
1628 Self {
1629 builder: self.builder.property("margin", margin),
1630 }
1631 }
1632
1633 /// Margin on bottom side of widget.
1634 ///
1635 /// This property adds margin outside of the widget's normal size
1636 /// request, the margin will be added in addition to the size from
1637 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1638 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1639 Self {
1640 builder: self.builder.property("margin-bottom", margin_bottom),
1641 }
1642 }
1643
1644 /// Margin on end of widget, horizontally. This property supports
1645 /// left-to-right and right-to-left text directions.
1646 ///
1647 /// This property adds margin outside of the widget's normal size
1648 /// request, the margin will be added in addition to the size from
1649 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1650 pub fn margin_end(self, margin_end: i32) -> Self {
1651 Self {
1652 builder: self.builder.property("margin-end", margin_end),
1653 }
1654 }
1655
1656 /// Margin on start of widget, horizontally. This property supports
1657 /// left-to-right and right-to-left text directions.
1658 ///
1659 /// This property adds margin outside of the widget's normal size
1660 /// request, the margin will be added in addition to the size from
1661 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1662 pub fn margin_start(self, margin_start: i32) -> Self {
1663 Self {
1664 builder: self.builder.property("margin-start", margin_start),
1665 }
1666 }
1667
1668 /// Margin on top side of widget.
1669 ///
1670 /// This property adds margin outside of the widget's normal size
1671 /// request, the margin will be added in addition to the size from
1672 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1673 pub fn margin_top(self, margin_top: i32) -> Self {
1674 Self {
1675 builder: self.builder.property("margin-top", margin_top),
1676 }
1677 }
1678
1679 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1680 Self {
1681 builder: self.builder.property("name", name.into()),
1682 }
1683 }
1684
1685 pub fn no_show_all(self, no_show_all: bool) -> Self {
1686 Self {
1687 builder: self.builder.property("no-show-all", no_show_all),
1688 }
1689 }
1690
1691 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1692 /// more details about window opacity.
1693 ///
1694 /// Before 3.8 this was only available in GtkWindow
1695 pub fn opacity(self, opacity: f64) -> Self {
1696 Self {
1697 builder: self.builder.property("opacity", opacity),
1698 }
1699 }
1700
1701 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1702 Self {
1703 builder: self.builder.property("parent", parent.clone().upcast()),
1704 }
1705 }
1706
1707 pub fn receives_default(self, receives_default: bool) -> Self {
1708 Self {
1709 builder: self.builder.property("receives-default", receives_default),
1710 }
1711 }
1712
1713 pub fn sensitive(self, sensitive: bool) -> Self {
1714 Self {
1715 builder: self.builder.property("sensitive", sensitive),
1716 }
1717 }
1718
1719 /// Sets the text of tooltip to be the given string, which is marked up
1720 /// with the [Pango text markup language][PangoMarkupFormat].
1721 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1722 ///
1723 /// This is a convenience property which will take care of getting the
1724 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1725 /// will automatically be set to [`true`] and there will be taken care of
1726 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1727 ///
1728 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1729 /// are set, the last one wins.
1730 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1731 Self {
1732 builder: self
1733 .builder
1734 .property("tooltip-markup", tooltip_markup.into()),
1735 }
1736 }
1737
1738 /// Sets the text of tooltip to be the given string.
1739 ///
1740 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1741 ///
1742 /// This is a convenience property which will take care of getting the
1743 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1744 /// will automatically be set to [`true`] and there will be taken care of
1745 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1746 ///
1747 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1748 /// are set, the last one wins.
1749 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1750 Self {
1751 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1752 }
1753 }
1754
1755 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1756 pub fn valign(self, valign: Align) -> Self {
1757 Self {
1758 builder: self.builder.property("valign", valign),
1759 }
1760 }
1761
1762 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1763 pub fn vexpand(self, vexpand: bool) -> Self {
1764 Self {
1765 builder: self.builder.property("vexpand", vexpand),
1766 }
1767 }
1768
1769 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1770 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1771 Self {
1772 builder: self.builder.property("vexpand-set", vexpand_set),
1773 }
1774 }
1775
1776 pub fn visible(self, visible: bool) -> Self {
1777 Self {
1778 builder: self.builder.property("visible", visible),
1779 }
1780 }
1781
1782 pub fn width_request(self, width_request: i32) -> Self {
1783 Self {
1784 builder: self.builder.property("width-request", width_request),
1785 }
1786 }
1787
1788 /// Indicates whether editing on the cell has been canceled.
1789 pub fn editing_canceled(self, editing_canceled: bool) -> Self {
1790 Self {
1791 builder: self.builder.property("editing-canceled", editing_canceled),
1792 }
1793 }
1794
1795 /// The content type of the [`AppChooser`][crate::AppChooser] object.
1796 ///
1797 /// See [GContentType][gio-GContentType]
1798 /// for more information about content types.
1799 pub fn content_type(self, content_type: impl Into<glib::GString>) -> Self {
1800 Self {
1801 builder: self.builder.property("content-type", content_type.into()),
1802 }
1803 }
1804
1805 // rustdoc-stripper-ignore-next
1806 /// Build the [`AppChooserButton`].
1807 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1808 pub fn build(self) -> AppChooserButton {
1809 assert_initialized_main_thread!();
1810 self.builder.build()
1811 }
1812}
1813
1814/// Trait containing all [`struct@AppChooserButton`] methods.
1815///
1816/// # Implementors
1817///
1818/// [`AppChooserButton`][struct@crate::AppChooserButton]
1819pub trait AppChooserButtonExt: IsA<AppChooserButton> + 'static {
1820 /// Appends a custom item to the list of applications that is shown
1821 /// in the popup; the item name must be unique per-widget.
1822 /// Clients can use the provided name as a detail for the
1823 /// [`custom-item-activated`][struct@crate::AppChooserButton#custom-item-activated] signal, to add a
1824 /// callback for the activation of a particular custom item in the list.
1825 /// See also [`append_separator()`][Self::append_separator()].
1826 /// ## `name`
1827 /// the name of the custom item
1828 /// ## `label`
1829 /// the label for the custom item
1830 /// ## `icon`
1831 /// the icon for the custom item
1832 #[doc(alias = "gtk_app_chooser_button_append_custom_item")]
1833 fn append_custom_item(&self, name: &str, label: &str, icon: &impl IsA<gio::Icon>) {
1834 unsafe {
1835 ffi::gtk_app_chooser_button_append_custom_item(
1836 self.as_ref().to_glib_none().0,
1837 name.to_glib_none().0,
1838 label.to_glib_none().0,
1839 icon.as_ref().to_glib_none().0,
1840 );
1841 }
1842 }
1843
1844 /// Appends a separator to the list of applications that is shown
1845 /// in the popup.
1846 #[doc(alias = "gtk_app_chooser_button_append_separator")]
1847 fn append_separator(&self) {
1848 unsafe {
1849 ffi::gtk_app_chooser_button_append_separator(self.as_ref().to_glib_none().0);
1850 }
1851 }
1852
1853 /// Returns the text to display at the top of the dialog.
1854 ///
1855 /// # Returns
1856 ///
1857 /// the text to display at the top of the dialog,
1858 /// or [`None`], in which case a default text is displayed
1859 #[doc(alias = "gtk_app_chooser_button_get_heading")]
1860 #[doc(alias = "get_heading")]
1861 fn heading(&self) -> Option<glib::GString> {
1862 unsafe {
1863 from_glib_none(ffi::gtk_app_chooser_button_get_heading(
1864 self.as_ref().to_glib_none().0,
1865 ))
1866 }
1867 }
1868
1869 /// Returns the current value of the [`show-default-item`][struct@crate::AppChooserButton#show-default-item]
1870 /// property.
1871 ///
1872 /// # Returns
1873 ///
1874 /// the value of [`show-default-item`][struct@crate::AppChooserButton#show-default-item]
1875 #[doc(alias = "gtk_app_chooser_button_get_show_default_item")]
1876 #[doc(alias = "get_show_default_item")]
1877 #[doc(alias = "show-default-item")]
1878 fn shows_default_item(&self) -> bool {
1879 unsafe {
1880 from_glib(ffi::gtk_app_chooser_button_get_show_default_item(
1881 self.as_ref().to_glib_none().0,
1882 ))
1883 }
1884 }
1885
1886 /// Returns the current value of the [`show-dialog-item`][struct@crate::AppChooserButton#show-dialog-item]
1887 /// property.
1888 ///
1889 /// # Returns
1890 ///
1891 /// the value of [`show-dialog-item`][struct@crate::AppChooserButton#show-dialog-item]
1892 #[doc(alias = "gtk_app_chooser_button_get_show_dialog_item")]
1893 #[doc(alias = "get_show_dialog_item")]
1894 #[doc(alias = "show-dialog-item")]
1895 fn shows_dialog_item(&self) -> bool {
1896 unsafe {
1897 from_glib(ffi::gtk_app_chooser_button_get_show_dialog_item(
1898 self.as_ref().to_glib_none().0,
1899 ))
1900 }
1901 }
1902
1903 /// Selects a custom item previously added with
1904 /// [`append_custom_item()`][Self::append_custom_item()].
1905 ///
1906 /// Use [`AppChooserExtManual::refresh()`][crate::prelude::AppChooserExtManual::refresh()] to bring the selection
1907 /// to its initial state.
1908 /// ## `name`
1909 /// the name of the custom item
1910 #[doc(alias = "gtk_app_chooser_button_set_active_custom_item")]
1911 fn set_active_custom_item(&self, name: &str) {
1912 unsafe {
1913 ffi::gtk_app_chooser_button_set_active_custom_item(
1914 self.as_ref().to_glib_none().0,
1915 name.to_glib_none().0,
1916 );
1917 }
1918 }
1919
1920 /// Sets the text to display at the top of the dialog.
1921 /// If the heading is not set, the dialog displays a default text.
1922 /// ## `heading`
1923 /// a string containing Pango markup
1924 #[doc(alias = "gtk_app_chooser_button_set_heading")]
1925 #[doc(alias = "heading")]
1926 fn set_heading(&self, heading: &str) {
1927 unsafe {
1928 ffi::gtk_app_chooser_button_set_heading(
1929 self.as_ref().to_glib_none().0,
1930 heading.to_glib_none().0,
1931 );
1932 }
1933 }
1934
1935 /// Sets whether the dropdown menu of this button should show the
1936 /// default application for the given content type at top.
1937 /// ## `setting`
1938 /// the new value for [`show-default-item`][struct@crate::AppChooserButton#show-default-item]
1939 #[doc(alias = "gtk_app_chooser_button_set_show_default_item")]
1940 #[doc(alias = "show-default-item")]
1941 fn set_show_default_item(&self, setting: bool) {
1942 unsafe {
1943 ffi::gtk_app_chooser_button_set_show_default_item(
1944 self.as_ref().to_glib_none().0,
1945 setting.into_glib(),
1946 );
1947 }
1948 }
1949
1950 /// Sets whether the dropdown menu of this button should show an
1951 /// entry to trigger a [`AppChooserDialog`][crate::AppChooserDialog].
1952 /// ## `setting`
1953 /// the new value for [`show-dialog-item`][struct@crate::AppChooserButton#show-dialog-item]
1954 #[doc(alias = "gtk_app_chooser_button_set_show_dialog_item")]
1955 #[doc(alias = "show-dialog-item")]
1956 fn set_show_dialog_item(&self, setting: bool) {
1957 unsafe {
1958 ffi::gtk_app_chooser_button_set_show_dialog_item(
1959 self.as_ref().to_glib_none().0,
1960 setting.into_glib(),
1961 );
1962 }
1963 }
1964
1965 /// Emitted when a custom item, previously added with
1966 /// [`append_custom_item()`][Self::append_custom_item()], is activated from the
1967 /// dropdown menu.
1968 /// ## `item_name`
1969 /// the name of the activated item
1970 #[doc(alias = "custom-item-activated")]
1971 fn connect_custom_item_activated<F: Fn(&Self, &str) + 'static>(
1972 &self,
1973 detail: Option<&str>,
1974 f: F,
1975 ) -> SignalHandlerId {
1976 unsafe extern "C" fn custom_item_activated_trampoline<
1977 P: IsA<AppChooserButton>,
1978 F: Fn(&P, &str) + 'static,
1979 >(
1980 this: *mut ffi::GtkAppChooserButton,
1981 item_name: *mut std::ffi::c_char,
1982 f: glib::ffi::gpointer,
1983 ) {
1984 unsafe {
1985 let f: &F = &*(f as *const F);
1986 f(
1987 AppChooserButton::from_glib_borrow(this).unsafe_cast_ref(),
1988 &glib::GString::from_glib_borrow(item_name),
1989 )
1990 }
1991 }
1992 unsafe {
1993 let f: Box_<F> = Box_::new(f);
1994 let detailed_signal_name =
1995 detail.map(|name| format!("custom-item-activated::{name}\0"));
1996 let signal_name = detailed_signal_name
1997 .as_ref()
1998 .map_or(c"custom-item-activated", |n| {
1999 std::ffi::CStr::from_bytes_with_nul_unchecked(n.as_bytes())
2000 });
2001 connect_raw(
2002 self.as_ptr() as *mut _,
2003 signal_name.as_ptr(),
2004 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2005 custom_item_activated_trampoline::<Self, F> as *const (),
2006 )),
2007 Box_::into_raw(f),
2008 )
2009 }
2010 }
2011
2012 #[doc(alias = "heading")]
2013 fn connect_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2014 unsafe extern "C" fn notify_heading_trampoline<
2015 P: IsA<AppChooserButton>,
2016 F: Fn(&P) + 'static,
2017 >(
2018 this: *mut ffi::GtkAppChooserButton,
2019 _param_spec: glib::ffi::gpointer,
2020 f: glib::ffi::gpointer,
2021 ) {
2022 unsafe {
2023 let f: &F = &*(f as *const F);
2024 f(AppChooserButton::from_glib_borrow(this).unsafe_cast_ref())
2025 }
2026 }
2027 unsafe {
2028 let f: Box_<F> = Box_::new(f);
2029 connect_raw(
2030 self.as_ptr() as *mut _,
2031 c"notify::heading".as_ptr(),
2032 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2033 notify_heading_trampoline::<Self, F> as *const (),
2034 )),
2035 Box_::into_raw(f),
2036 )
2037 }
2038 }
2039
2040 #[doc(alias = "show-default-item")]
2041 fn connect_show_default_item_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2042 unsafe extern "C" fn notify_show_default_item_trampoline<
2043 P: IsA<AppChooserButton>,
2044 F: Fn(&P) + 'static,
2045 >(
2046 this: *mut ffi::GtkAppChooserButton,
2047 _param_spec: glib::ffi::gpointer,
2048 f: glib::ffi::gpointer,
2049 ) {
2050 unsafe {
2051 let f: &F = &*(f as *const F);
2052 f(AppChooserButton::from_glib_borrow(this).unsafe_cast_ref())
2053 }
2054 }
2055 unsafe {
2056 let f: Box_<F> = Box_::new(f);
2057 connect_raw(
2058 self.as_ptr() as *mut _,
2059 c"notify::show-default-item".as_ptr(),
2060 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2061 notify_show_default_item_trampoline::<Self, F> as *const (),
2062 )),
2063 Box_::into_raw(f),
2064 )
2065 }
2066 }
2067
2068 #[doc(alias = "show-dialog-item")]
2069 fn connect_show_dialog_item_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2070 unsafe extern "C" fn notify_show_dialog_item_trampoline<
2071 P: IsA<AppChooserButton>,
2072 F: Fn(&P) + 'static,
2073 >(
2074 this: *mut ffi::GtkAppChooserButton,
2075 _param_spec: glib::ffi::gpointer,
2076 f: glib::ffi::gpointer,
2077 ) {
2078 unsafe {
2079 let f: &F = &*(f as *const F);
2080 f(AppChooserButton::from_glib_borrow(this).unsafe_cast_ref())
2081 }
2082 }
2083 unsafe {
2084 let f: Box_<F> = Box_::new(f);
2085 connect_raw(
2086 self.as_ptr() as *mut _,
2087 c"notify::show-dialog-item".as_ptr(),
2088 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2089 notify_show_dialog_item_trampoline::<Self, F> as *const (),
2090 )),
2091 Box_::into_raw(f),
2092 )
2093 }
2094 }
2095}
2096
2097impl<O: IsA<AppChooserButton>> AppChooserButtonExt for O {}