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 /// For combo boxes that are created with an entry (See GtkComboBox:has-entry).
517 ///
518 /// A signal which allows you to change how the text displayed in a combo box's
519 /// entry is displayed.
520 ///
521 /// Connect a signal handler which returns an allocated string representing
522 /// `path`. That string will then be used to set the text in the combo box's entry.
523 /// The default signal handler uses the text from the GtkComboBox::entry-text-column
524 /// model column.
525 ///
526 /// Here's an example signal handler which fetches data from the model and
527 /// displays it in the entry.
528 ///
529 ///
530 /// **⚠️ The following code is in C ⚠️**
531 ///
532 /// ```C
533 /// static gchar*
534 /// format_entry_text_callback (GtkComboBox *combo,
535 /// const gchar *path,
536 /// gpointer user_data)
537 /// {
538 /// GtkTreeIter iter;
539 /// GtkTreeModel model;
540 /// gdouble value;
541 ///
542 /// model = gtk_combo_box_get_model (combo);
543 ///
544 /// gtk_tree_model_get_iter_from_string (model, &iter, path);
545 /// gtk_tree_model_get (model, &iter,
546 /// THE_DOUBLE_VALUE_COLUMN, &value,
547 /// -1);
548 ///
549 /// return g_strdup_printf ("%g", value);
550 /// }
551 /// ```
552 ///
553 ///
554 ///
555 ///
556 /// #### `move-active`
557 /// The ::move-active signal is a
558 /// [keybinding signal][GtkBindingSignal]
559 /// which gets emitted to move the active selection.
560 ///
561 /// Action
562 ///
563 ///
564 /// #### `popdown`
565 /// The ::popdown signal is a
566 /// [keybinding signal][GtkBindingSignal]
567 /// which gets emitted to popdown the combo box list.
568 ///
569 /// The default bindings for this signal are Alt+Up and Escape.
570 ///
571 /// Action
572 ///
573 ///
574 /// #### `popup`
575 /// The ::popup signal is a
576 /// [keybinding signal][GtkBindingSignal]
577 /// which gets emitted to popup the combo box list.
578 ///
579 /// The default binding for this signal is Alt+Down.
580 ///
581 /// Action
582 /// </details>
583 /// <details><summary><h4>Container</h4></summary>
584 ///
585 ///
586 /// #### `add`
587 ///
588 ///
589 ///
590 /// #### `check-resize`
591 ///
592 ///
593 ///
594 /// #### `remove`
595 ///
596 ///
597 ///
598 /// #### `set-focus-child`
599 ///
600 /// </details>
601 /// <details><summary><h4>Widget</h4></summary>
602 ///
603 ///
604 /// #### `accel-closures-changed`
605 ///
606 ///
607 ///
608 /// #### `button-press-event`
609 /// The ::button-press-event signal will be emitted when a button
610 /// (typically from a mouse) is pressed.
611 ///
612 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
613 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
614 ///
615 /// This signal will be sent to the grab widget if there is one.
616 ///
617 ///
618 ///
619 ///
620 /// #### `button-release-event`
621 /// The ::button-release-event signal will be emitted when a button
622 /// (typically from a mouse) is released.
623 ///
624 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
625 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
626 ///
627 /// This signal will be sent to the grab widget if there is one.
628 ///
629 ///
630 ///
631 ///
632 /// #### `can-activate-accel`
633 /// Determines whether an accelerator that activates the signal
634 /// identified by `signal_id` can currently be activated.
635 /// This signal is present to allow applications and derived
636 /// widgets to override the default [`Widget`][crate::Widget] handling
637 /// for determining whether an accelerator can be activated.
638 ///
639 ///
640 ///
641 ///
642 /// #### `child-notify`
643 /// The ::child-notify signal is emitted for each
644 /// [child property][child-properties] that has
645 /// changed on an object. The signal's detail holds the property name.
646 ///
647 /// Detailed
648 ///
649 ///
650 /// #### `composited-changed`
651 /// The ::composited-changed signal is emitted when the composited
652 /// status of `widgets` screen changes.
653 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
654 ///
655 /// Action
656 ///
657 ///
658 /// #### `configure-event`
659 /// The ::configure-event signal will be emitted when the size, position or
660 /// stacking of the `widget`'s window has changed.
661 ///
662 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
663 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
664 /// automatically for all new windows.
665 ///
666 ///
667 ///
668 ///
669 /// #### `damage-event`
670 /// Emitted when a redirected window belonging to `widget` gets drawn into.
671 /// The region/area members of the event shows what area of the redirected
672 /// drawable was drawn into.
673 ///
674 ///
675 ///
676 ///
677 /// #### `delete-event`
678 /// The ::delete-event signal is emitted if a user requests that
679 /// a toplevel window is closed. The default handler for this signal
680 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
681 /// this signal will cause the window to be hidden instead, so that
682 /// it can later be shown again without reconstructing it.
683 ///
684 ///
685 ///
686 ///
687 /// #### `destroy`
688 /// Signals that all holders of a reference to the widget should release
689 /// the reference that they hold. May result in finalization of the widget
690 /// if all references are released.
691 ///
692 /// This signal is not suitable for saving widget state.
693 ///
694 ///
695 ///
696 ///
697 /// #### `destroy-event`
698 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
699 /// You rarely get this signal, because most widgets disconnect themselves
700 /// from their window before they destroy it, so no widget owns the
701 /// window at destroy time.
702 ///
703 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
704 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
705 /// automatically for all new windows.
706 ///
707 ///
708 ///
709 ///
710 /// #### `direction-changed`
711 /// The ::direction-changed signal is emitted when the text direction
712 /// of a widget changes.
713 ///
714 ///
715 ///
716 ///
717 /// #### `drag-begin`
718 /// The ::drag-begin signal is emitted on the drag source when a drag is
719 /// started. A typical reason to connect to this signal is to set up a
720 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
721 ///
722 /// Note that some widgets set up a drag icon in the default handler of
723 /// this signal, so you may have to use `g_signal_connect_after()` to
724 /// override what the default handler did.
725 ///
726 ///
727 ///
728 ///
729 /// #### `drag-data-delete`
730 /// The ::drag-data-delete signal is emitted on the drag source when a drag
731 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
732 /// handler is responsible for deleting the data that has been dropped. What
733 /// "delete" means depends on the context of the drag operation.
734 ///
735 ///
736 ///
737 ///
738 /// #### `drag-data-get`
739 /// The ::drag-data-get signal is emitted on the drag source when the drop
740 /// site requests the data which is dragged. It is the responsibility of
741 /// the signal handler to fill `data` with the data in the format which
742 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
743 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
744 ///
745 ///
746 ///
747 ///
748 /// #### `drag-data-received`
749 /// The ::drag-data-received signal is emitted on the drop site when the
750 /// dragged data has been received. If the data was received in order to
751 /// determine whether the drop will be accepted, the handler is expected
752 /// to call `gdk_drag_status()` and not finish the drag.
753 /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
754 /// (and this is the last target to be received), the handler for this
755 /// signal is expected to process the received data and then call
756 /// `gtk_drag_finish()`, setting the `success` parameter depending on
757 /// whether the data was processed successfully.
758 ///
759 /// Applications must create some means to determine why the signal was emitted
760 /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
761 ///
762 /// The handler may inspect the selected action with
763 /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
764 /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
765 /// shown in the following example:
766 ///
767 ///
768 /// **⚠️ The following code is in C ⚠️**
769 ///
770 /// ```C
771 /// void
772 /// drag_data_received (GtkWidget *widget,
773 /// GdkDragContext *context,
774 /// gint x,
775 /// gint y,
776 /// GtkSelectionData *data,
777 /// guint info,
778 /// guint time)
779 /// {
780 /// if ((data->length >= 0) && (data->format == 8))
781 /// {
782 /// GdkDragAction action;
783 ///
784 /// // handle data here
785 ///
786 /// action = gdk_drag_context_get_selected_action (context);
787 /// if (action == GDK_ACTION_ASK)
788 /// {
789 /// GtkWidget *dialog;
790 /// gint response;
791 ///
792 /// dialog = gtk_message_dialog_new (NULL,
793 /// GTK_DIALOG_MODAL |
794 /// GTK_DIALOG_DESTROY_WITH_PARENT,
795 /// GTK_MESSAGE_INFO,
796 /// GTK_BUTTONS_YES_NO,
797 /// "Move the data ?\n");
798 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
799 /// gtk_widget_destroy (dialog);
800 ///
801 /// if (response == GTK_RESPONSE_YES)
802 /// action = GDK_ACTION_MOVE;
803 /// else
804 /// action = GDK_ACTION_COPY;
805 /// }
806 ///
807 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
808 /// }
809 /// else
810 /// gtk_drag_finish (context, FALSE, FALSE, time);
811 /// }
812 /// ```
813 ///
814 ///
815 ///
816 ///
817 /// #### `drag-drop`
818 /// The ::drag-drop signal is emitted on the drop site when the user drops
819 /// the data onto the widget. The signal handler must determine whether
820 /// the cursor position is in a drop zone or not. If it is not in a drop
821 /// zone, it returns [`false`] and no further processing is necessary.
822 /// Otherwise, the handler returns [`true`]. In this case, the handler must
823 /// ensure that `gtk_drag_finish()` is called to let the source know that
824 /// the drop is done. The call to `gtk_drag_finish()` can be done either
825 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
826 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
827 /// or more of the supported targets.
828 ///
829 ///
830 ///
831 ///
832 /// #### `drag-end`
833 /// The ::drag-end signal is emitted on the drag source when a drag is
834 /// finished. A typical reason to connect to this signal is to undo
835 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
836 ///
837 ///
838 ///
839 ///
840 /// #### `drag-failed`
841 /// The ::drag-failed signal is emitted on the drag source when a drag has
842 /// failed. The signal handler may hook custom code to handle a failed DnD
843 /// operation based on the type of error, it returns [`true`] is the failure has
844 /// been already handled (not showing the default "drag operation failed"
845 /// animation), otherwise it returns [`false`].
846 ///
847 ///
848 ///
849 ///
850 /// #### `drag-leave`
851 /// The ::drag-leave signal is emitted on the drop site when the cursor
852 /// leaves the widget. A typical reason to connect to this signal is to
853 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
854 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
855 ///
856 ///
857 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
858 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
859 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
860 ///
861 ///
862 ///
863 ///
864 /// #### `drag-motion`
865 /// The ::drag-motion signal is emitted on the drop site when the user
866 /// moves the cursor over the widget during a drag. The signal handler
867 /// must determine whether the cursor position is in a drop zone or not.
868 /// If it is not in a drop zone, it returns [`false`] and no further processing
869 /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
870 /// handler is responsible for providing the necessary information for
871 /// displaying feedback to the user, by calling `gdk_drag_status()`.
872 ///
873 /// If the decision whether the drop will be accepted or rejected can't be
874 /// made based solely on the cursor position and the type of the data, the
875 /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
876 /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
877 /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
878 /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
879 /// when using the drag-motion signal that way.
880 ///
881 /// Also note that there is no drag-enter signal. The drag receiver has to
882 /// keep track of whether he has received any drag-motion signals since the
883 /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
884 /// an "enter" signal. Upon an "enter", the handler will typically highlight
885 /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
886 ///
887 ///
888 /// **⚠️ The following code is in C ⚠️**
889 ///
890 /// ```C
891 /// static void
892 /// drag_motion (GtkWidget *widget,
893 /// GdkDragContext *context,
894 /// gint x,
895 /// gint y,
896 /// guint time)
897 /// {
898 /// GdkAtom target;
899 ///
900 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
901 ///
902 /// if (!private_data->drag_highlight)
903 /// {
904 /// private_data->drag_highlight = 1;
905 /// gtk_drag_highlight (widget);
906 /// }
907 ///
908 /// target = gtk_drag_dest_find_target (widget, context, NULL);
909 /// if (target == GDK_NONE)
910 /// gdk_drag_status (context, 0, time);
911 /// else
912 /// {
913 /// private_data->pending_status
914 /// = gdk_drag_context_get_suggested_action (context);
915 /// gtk_drag_get_data (widget, context, target, time);
916 /// }
917 ///
918 /// return TRUE;
919 /// }
920 ///
921 /// static void
922 /// drag_data_received (GtkWidget *widget,
923 /// GdkDragContext *context,
924 /// gint x,
925 /// gint y,
926 /// GtkSelectionData *selection_data,
927 /// guint info,
928 /// guint time)
929 /// {
930 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
931 ///
932 /// if (private_data->suggested_action)
933 /// {
934 /// private_data->suggested_action = 0;
935 ///
936 /// // We are getting this data due to a request in drag_motion,
937 /// // rather than due to a request in drag_drop, so we are just
938 /// // supposed to call gdk_drag_status(), not actually paste in
939 /// // the data.
940 ///
941 /// str = gtk_selection_data_get_text (selection_data);
942 /// if (!data_is_acceptable (str))
943 /// gdk_drag_status (context, 0, time);
944 /// else
945 /// gdk_drag_status (context,
946 /// private_data->suggested_action,
947 /// time);
948 /// }
949 /// else
950 /// {
951 /// // accept the drop
952 /// }
953 /// }
954 /// ```
955 ///
956 ///
957 ///
958 ///
959 /// #### `draw`
960 /// This signal is emitted when a widget is supposed to render itself.
961 /// The `widget`'s top left corner must be painted at the origin of
962 /// the passed in context and be sized to the values returned by
963 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
964 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
965 ///
966 /// Signal handlers connected to this signal can modify the cairo
967 /// context passed as `cr` in any way they like and don't need to
968 /// restore it. The signal emission takes care of calling `cairo_save()`
969 /// before and `cairo_restore()` after invoking the handler.
970 ///
971 /// The signal handler will get a `cr` with a clip region already set to the
972 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
973 /// widgets that want to avoid redrawing themselves completely can get the full
974 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
975 /// get a finer-grained representation of the dirty region with
976 /// `cairo_copy_clip_rectangle_list()`.
977 ///
978 ///
979 ///
980 ///
981 /// #### `enter-notify-event`
982 /// The ::enter-notify-event will be emitted when the pointer enters
983 /// the `widget`'s window.
984 ///
985 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
986 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
987 ///
988 /// This signal will be sent to the grab widget if there is one.
989 ///
990 ///
991 ///
992 ///
993 /// #### `event`
994 /// The GTK+ main loop will emit three signals for each GDK event delivered
995 /// to a widget: one generic ::event signal, another, more specific,
996 /// signal that matches the type of event delivered (e.g.
997 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
998 /// [`event-after`][struct@crate::Widget#event-after] signal.
999 ///
1000 ///
1001 ///
1002 ///
1003 /// #### `event-after`
1004 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
1005 /// the second more specific signal, ::event-after will be emitted
1006 /// regardless of the previous two signals handlers return values.
1007 ///
1008 ///
1009 ///
1010 ///
1011 /// #### `focus`
1012 ///
1013 ///
1014 ///
1015 /// #### `focus-in-event`
1016 /// The ::focus-in-event signal will be emitted when the keyboard focus
1017 /// enters the `widget`'s window.
1018 ///
1019 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1020 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1021 ///
1022 ///
1023 ///
1024 ///
1025 /// #### `focus-out-event`
1026 /// The ::focus-out-event signal will be emitted when the keyboard focus
1027 /// leaves the `widget`'s window.
1028 ///
1029 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1030 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1031 ///
1032 ///
1033 ///
1034 ///
1035 /// #### `grab-broken-event`
1036 /// Emitted when a pointer or keyboard grab on a window belonging
1037 /// to `widget` gets broken.
1038 ///
1039 /// On X11, this happens when the grab window becomes unviewable
1040 /// (i.e. it or one of its ancestors is unmapped), or if the same
1041 /// application grabs the pointer or keyboard again.
1042 ///
1043 ///
1044 ///
1045 ///
1046 /// #### `grab-focus`
1047 /// Action
1048 ///
1049 ///
1050 /// #### `grab-notify`
1051 /// The ::grab-notify signal is emitted when a widget becomes
1052 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
1053 /// another widget, or when it becomes unshadowed due to a grab
1054 /// being removed.
1055 ///
1056 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
1057 /// grab widget in the grab stack of its window group is not
1058 /// its ancestor.
1059 ///
1060 ///
1061 ///
1062 ///
1063 /// #### `hide`
1064 /// The ::hide signal is emitted when `widget` is hidden, for example with
1065 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
1066 ///
1067 ///
1068 ///
1069 ///
1070 /// #### `hierarchy-changed`
1071 /// The ::hierarchy-changed signal is emitted when the
1072 /// anchored state of a widget changes. A widget is
1073 /// “anchored” when its toplevel
1074 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
1075 /// a widget changes from un-anchored to anchored or vice-versa.
1076 ///
1077 ///
1078 ///
1079 ///
1080 /// #### `key-press-event`
1081 /// The ::key-press-event signal is emitted when a key is pressed. The signal
1082 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
1083 ///
1084 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1085 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
1086 ///
1087 /// This signal will be sent to the grab widget if there is one.
1088 ///
1089 ///
1090 ///
1091 ///
1092 /// #### `key-release-event`
1093 /// The ::key-release-event signal is emitted when a key is released.
1094 ///
1095 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1096 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
1097 ///
1098 /// This signal will be sent to the grab widget if there is one.
1099 ///
1100 ///
1101 ///
1102 ///
1103 /// #### `keynav-failed`
1104 /// Gets emitted if keyboard navigation fails.
1105 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
1106 ///
1107 ///
1108 ///
1109 ///
1110 /// #### `leave-notify-event`
1111 /// The ::leave-notify-event will be emitted when the pointer leaves
1112 /// the `widget`'s window.
1113 ///
1114 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1115 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
1116 ///
1117 /// This signal will be sent to the grab widget if there is one.
1118 ///
1119 ///
1120 ///
1121 ///
1122 /// #### `map`
1123 /// The ::map signal is emitted when `widget` is going to be mapped, that is
1124 /// when the widget is visible (which is controlled with
1125 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
1126 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
1127 /// be emitted.
1128 ///
1129 /// The ::map signal can be used to determine whether a widget will be drawn,
1130 /// for instance it can resume an animation that was stopped during the
1131 /// emission of [`unmap`][struct@crate::Widget#unmap].
1132 ///
1133 ///
1134 ///
1135 ///
1136 /// #### `map-event`
1137 /// The ::map-event signal will be emitted when the `widget`'s window is
1138 /// mapped. A window is mapped when it becomes visible on the screen.
1139 ///
1140 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1141 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1142 /// automatically for all new windows.
1143 ///
1144 ///
1145 ///
1146 ///
1147 /// #### `mnemonic-activate`
1148 /// The default handler for this signal activates `widget` if `group_cycling`
1149 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1150 ///
1151 ///
1152 ///
1153 ///
1154 /// #### `motion-notify-event`
1155 /// The ::motion-notify-event signal is emitted when the pointer moves
1156 /// over the widget's [`gdk::Window`][crate::gdk::Window].
1157 ///
1158 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1159 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1160 ///
1161 /// This signal will be sent to the grab widget if there is one.
1162 ///
1163 ///
1164 ///
1165 ///
1166 /// #### `move-focus`
1167 /// Action
1168 ///
1169 ///
1170 /// #### `parent-set`
1171 /// The ::parent-set signal is emitted when a new parent
1172 /// has been set on a widget.
1173 ///
1174 ///
1175 ///
1176 ///
1177 /// #### `popup-menu`
1178 /// This signal gets emitted whenever a widget should pop up a context
1179 /// menu. This usually happens through the standard key binding mechanism;
1180 /// by pressing a certain key while a widget is focused, the user can cause
1181 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1182 /// a menu with clipboard commands. See the
1183 /// [Popup Menu Migration Checklist][checklist-popup-menu]
1184 /// for an example of how to use this signal.
1185 ///
1186 /// Action
1187 ///
1188 ///
1189 /// #### `property-notify-event`
1190 /// The ::property-notify-event signal will be emitted when a property on
1191 /// the `widget`'s window has been changed or deleted.
1192 ///
1193 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1194 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1195 ///
1196 ///
1197 ///
1198 ///
1199 /// #### `proximity-in-event`
1200 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1201 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1202 ///
1203 /// This signal will be sent to the grab widget if there is one.
1204 ///
1205 ///
1206 ///
1207 ///
1208 /// #### `proximity-out-event`
1209 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1210 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1211 ///
1212 /// This signal will be sent to the grab widget if there is one.
1213 ///
1214 ///
1215 ///
1216 ///
1217 /// #### `query-tooltip`
1218 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1219 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1220 /// focus in keyboard mode.
1221 ///
1222 /// Using the given coordinates, the signal handler should determine
1223 /// whether a tooltip should be shown for `widget`. If this is the case
1224 /// [`true`] should be returned, [`false`] otherwise. Note that if
1225 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1226 /// should not be used.
1227 ///
1228 /// The signal handler is free to manipulate `tooltip` with the therefore
1229 /// destined function calls.
1230 ///
1231 ///
1232 ///
1233 ///
1234 /// #### `realize`
1235 /// The ::realize signal is emitted when `widget` is associated with a
1236 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1237 /// widget has been mapped (that is, it is going to be drawn).
1238 ///
1239 ///
1240 ///
1241 ///
1242 /// #### `screen-changed`
1243 /// The ::screen-changed signal gets emitted when the
1244 /// screen of a widget has changed.
1245 ///
1246 ///
1247 ///
1248 ///
1249 /// #### `scroll-event`
1250 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1251 /// range is pressed. Wheel mice are usually configured to generate
1252 /// button press events for buttons 4 and 5 when the wheel is turned.
1253 ///
1254 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1255 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1256 ///
1257 /// This signal will be sent to the grab widget if there is one.
1258 ///
1259 ///
1260 ///
1261 ///
1262 /// #### `selection-clear-event`
1263 /// The ::selection-clear-event signal will be emitted when the
1264 /// the `widget`'s window has lost ownership of a selection.
1265 ///
1266 ///
1267 ///
1268 ///
1269 /// #### `selection-get`
1270 ///
1271 ///
1272 ///
1273 /// #### `selection-notify-event`
1274 ///
1275 ///
1276 ///
1277 /// #### `selection-received`
1278 ///
1279 ///
1280 ///
1281 /// #### `selection-request-event`
1282 /// The ::selection-request-event signal will be emitted when
1283 /// another client requests ownership of the selection owned by
1284 /// the `widget`'s window.
1285 ///
1286 ///
1287 ///
1288 ///
1289 /// #### `show`
1290 /// The ::show signal is emitted when `widget` is shown, for example with
1291 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1292 ///
1293 ///
1294 ///
1295 ///
1296 /// #### `show-help`
1297 /// Action
1298 ///
1299 ///
1300 /// #### `size-allocate`
1301 ///
1302 ///
1303 ///
1304 /// #### `state-changed`
1305 /// The ::state-changed signal is emitted when the widget state changes.
1306 /// See `gtk_widget_get_state()`.
1307 ///
1308 ///
1309 ///
1310 ///
1311 /// #### `state-flags-changed`
1312 /// The ::state-flags-changed signal is emitted when the widget state
1313 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1314 ///
1315 ///
1316 ///
1317 ///
1318 /// #### `style-set`
1319 /// The ::style-set signal is emitted when a new style has been set
1320 /// on a widget. Note that style-modifying functions like
1321 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1322 ///
1323 /// Note that this signal is emitted for changes to the deprecated
1324 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1325 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1326 ///
1327 ///
1328 ///
1329 ///
1330 /// #### `style-updated`
1331 /// The ::style-updated signal is a convenience signal that is emitted when the
1332 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1333 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1334 ///
1335 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1336 /// cause this signal to be emitted.
1337 ///
1338 ///
1339 ///
1340 ///
1341 /// #### `touch-event`
1342 ///
1343 ///
1344 ///
1345 /// #### `unmap`
1346 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1347 /// means that either it or any of its parents up to the toplevel widget have
1348 /// been set as hidden.
1349 ///
1350 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1351 /// used to, for example, stop an animation on the widget.
1352 ///
1353 ///
1354 ///
1355 ///
1356 /// #### `unmap-event`
1357 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1358 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1359 ///
1360 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1361 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1362 /// automatically for all new windows.
1363 ///
1364 ///
1365 ///
1366 ///
1367 /// #### `unrealize`
1368 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1369 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1370 /// called or the widget has been unmapped (that is, it is going to be
1371 /// hidden).
1372 ///
1373 ///
1374 ///
1375 ///
1376 /// #### `visibility-notify-event`
1377 /// The ::visibility-notify-event will be emitted when the `widget`'s
1378 /// window is obscured or unobscured.
1379 ///
1380 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1381 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1382 ///
1383 ///
1384 ///
1385 ///
1386 /// #### `window-state-event`
1387 /// The ::window-state-event will be emitted when the state of the
1388 /// toplevel window associated to the `widget` changes.
1389 ///
1390 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1391 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1392 /// this mask automatically for all new windows.
1393 ///
1394 ///
1395 /// </details>
1396 /// <details><summary><h4>CellEditable</h4></summary>
1397 ///
1398 ///
1399 /// #### `editing-done`
1400 /// This signal is a sign for the cell renderer to update its
1401 /// value from the `cell_editable`.
1402 ///
1403 /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
1404 /// emitting this signal when they are done editing, e.g.
1405 /// [`Entry`][crate::Entry] emits this signal when the user presses Enter. Typical things to
1406 /// do in a handler for ::editing-done are to capture the edited value,
1407 /// disconnect the `cell_editable` from signals on the [`CellRenderer`][crate::CellRenderer], etc.
1408 ///
1409 /// [`CellEditableExt::editing_done()`][crate::prelude::CellEditableExt::editing_done()] is a convenience method
1410 /// for emitting [`editing-done`][struct@crate::CellEditable#editing-done].
1411 ///
1412 ///
1413 ///
1414 ///
1415 /// #### `remove-widget`
1416 /// This signal is meant to indicate that the cell is finished
1417 /// editing, and the `cell_editable` widget is being removed and may
1418 /// subsequently be destroyed.
1419 ///
1420 /// Implementations of [`CellEditable`][crate::CellEditable] are responsible for
1421 /// emitting this signal when they are done editing. It must
1422 /// be emitted after the [`editing-done`][struct@crate::CellEditable#editing-done] signal,
1423 /// to give the cell renderer a chance to update the cell's value
1424 /// before the widget is removed.
1425 ///
1426 /// [`CellEditableExt::remove_widget()`][crate::prelude::CellEditableExt::remove_widget()] is a convenience method
1427 /// for emitting [`remove-widget`][struct@crate::CellEditable#remove-widget].
1428 ///
1429 ///
1430 /// </details>
1431 ///
1432 /// # Implements
1433 ///
1434 /// [`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]
1435 #[doc(alias = "GtkAppChooserButton")]
1436 pub struct AppChooserButton(Object<ffi::GtkAppChooserButton, ffi::GtkAppChooserButtonClass>) @extends ComboBox, Bin, Container, Widget, @implements Buildable, CellEditable, CellLayout, AppChooser;
1437
1438 match fn {
1439 type_ => || ffi::gtk_app_chooser_button_get_type(),
1440 }
1441}
1442
1443impl AppChooserButton {
1444 pub const NONE: Option<&'static AppChooserButton> = None;
1445
1446 /// Creates a new [`AppChooserButton`][crate::AppChooserButton] for applications
1447 /// that can handle content of the given type.
1448 /// ## `content_type`
1449 /// the content type to show applications for
1450 ///
1451 /// # Returns
1452 ///
1453 /// a newly created [`AppChooserButton`][crate::AppChooserButton]
1454 #[doc(alias = "gtk_app_chooser_button_new")]
1455 pub fn new(content_type: &str) -> AppChooserButton {
1456 assert_initialized_main_thread!();
1457 unsafe {
1458 Widget::from_glib_none(ffi::gtk_app_chooser_button_new(
1459 content_type.to_glib_none().0,
1460 ))
1461 .unsafe_cast()
1462 }
1463 }
1464
1465 // rustdoc-stripper-ignore-next
1466 /// Creates a new builder-pattern struct instance to construct [`AppChooserButton`] objects.
1467 ///
1468 /// This method returns an instance of [`AppChooserButtonBuilder`](crate::builders::AppChooserButtonBuilder) which can be used to create [`AppChooserButton`] objects.
1469 pub fn builder() -> AppChooserButtonBuilder {
1470 AppChooserButtonBuilder::new()
1471 }
1472}
1473
1474impl Default for AppChooserButton {
1475 fn default() -> Self {
1476 glib::object::Object::new::<Self>()
1477 }
1478}
1479
1480// rustdoc-stripper-ignore-next
1481/// A [builder-pattern] type to construct [`AppChooserButton`] objects.
1482///
1483/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1484#[must_use = "The builder must be built to be used"]
1485pub struct AppChooserButtonBuilder {
1486 builder: glib::object::ObjectBuilder<'static, AppChooserButton>,
1487}
1488
1489impl AppChooserButtonBuilder {
1490 fn new() -> Self {
1491 Self {
1492 builder: glib::object::Object::builder(),
1493 }
1494 }
1495
1496 /// The text to show at the top of the dialog that can be
1497 /// opened from the button. The string may contain Pango markup.
1498 pub fn heading(self, heading: impl Into<glib::GString>) -> Self {
1499 Self {
1500 builder: self.builder.property("heading", heading.into()),
1501 }
1502 }
1503
1504 /// The [`show-default-item`][struct@crate::AppChooserButton#show-default-item] property determines
1505 /// whether the dropdown menu should show the default application
1506 /// on top for the provided content type.
1507 pub fn show_default_item(self, show_default_item: bool) -> Self {
1508 Self {
1509 builder: self
1510 .builder
1511 .property("show-default-item", show_default_item),
1512 }
1513 }
1514
1515 /// The [`show-dialog-item`][struct@crate::AppChooserButton#show-dialog-item] property determines
1516 /// whether the dropdown menu should show an item that triggers
1517 /// a [`AppChooserDialog`][crate::AppChooserDialog] when clicked.
1518 pub fn show_dialog_item(self, show_dialog_item: bool) -> Self {
1519 Self {
1520 builder: self.builder.property("show-dialog-item", show_dialog_item),
1521 }
1522 }
1523
1524 /// The item which is currently active. If the model is a non-flat treemodel,
1525 /// and the active item is not an immediate child of the root of the tree,
1526 /// this property has the value
1527 /// `gtk_tree_path_get_indices (path)[0]`,
1528 /// where `path` is the [`TreePath`][crate::TreePath] of the active item.
1529 pub fn active(self, active: i32) -> Self {
1530 Self {
1531 builder: self.builder.property("active", active),
1532 }
1533 }
1534
1535 /// The value of the ID column of the active row.
1536 pub fn active_id(self, active_id: impl Into<glib::GString>) -> Self {
1537 Self {
1538 builder: self.builder.property("active-id", active_id.into()),
1539 }
1540 }
1541
1542 /// Whether the dropdown button is sensitive when
1543 /// the model is empty.
1544 pub fn button_sensitivity(self, button_sensitivity: SensitivityType) -> Self {
1545 Self {
1546 builder: self
1547 .builder
1548 .property("button-sensitivity", button_sensitivity),
1549 }
1550 }
1551
1552 /// The [`CellArea`][crate::CellArea] used to layout cell renderers for this combo box.
1553 ///
1554 /// If no area is specified when creating the combo box with [`ComboBox::with_area()`][crate::ComboBox::with_area()]
1555 /// a horizontally oriented [`CellAreaBox`][crate::CellAreaBox] will be used.
1556 pub fn cell_area(self, cell_area: &impl IsA<CellArea>) -> Self {
1557 Self {
1558 builder: self
1559 .builder
1560 .property("cell-area", cell_area.clone().upcast()),
1561 }
1562 }
1563
1564 /// If this is set to a non-negative value, it must be the index of a column
1565 /// of type `G_TYPE_INT` in the model. The value in that column for each item
1566 /// will determine how many columns that item will span in the popup.
1567 /// Therefore, values in this column must be greater than zero, and the sum of
1568 /// an item’s column position + span should not exceed [`wrap-width`][struct@crate::ComboBox#wrap-width].
1569 pub fn column_span_column(self, column_span_column: i32) -> Self {
1570 Self {
1571 builder: self
1572 .builder
1573 .property("column-span-column", column_span_column),
1574 }
1575 }
1576
1577 /// The column in the combo box's model to associate with strings from the entry
1578 /// if the combo was created with [`has-entry`][struct@crate::ComboBox#has-entry] = [`true`].
1579 pub fn entry_text_column(self, entry_text_column: i32) -> Self {
1580 Self {
1581 builder: self
1582 .builder
1583 .property("entry-text-column", entry_text_column),
1584 }
1585 }
1586
1587 /// Whether the combo box has an entry.
1588 pub fn has_entry(self, has_entry: bool) -> Self {
1589 Self {
1590 builder: self.builder.property("has-entry", has_entry),
1591 }
1592 }
1593
1594 /// The has-frame property controls whether a frame
1595 /// is drawn around the entry.
1596 pub fn has_frame(self, has_frame: bool) -> Self {
1597 Self {
1598 builder: self.builder.property("has-frame", has_frame),
1599 }
1600 }
1601
1602 /// The column in the combo box's model that provides string
1603 /// IDs for the values in the model, if != -1.
1604 pub fn id_column(self, id_column: i32) -> Self {
1605 Self {
1606 builder: self.builder.property("id-column", id_column),
1607 }
1608 }
1609
1610 /// The model from which the combo box takes the values shown
1611 /// in the list.
1612 pub fn model(self, model: &impl IsA<TreeModel>) -> Self {
1613 Self {
1614 builder: self.builder.property("model", model.clone().upcast()),
1615 }
1616 }
1617
1618 /// Whether the popup's width should be a fixed width matching the
1619 /// allocated width of the combo box.
1620 pub fn popup_fixed_width(self, popup_fixed_width: bool) -> Self {
1621 Self {
1622 builder: self
1623 .builder
1624 .property("popup-fixed-width", popup_fixed_width),
1625 }
1626 }
1627
1628 /// If this is set to a non-negative value, it must be the index of a column
1629 /// of type `G_TYPE_INT` in the model. The value in that column for each item
1630 /// will determine how many rows that item will span in the popup. Therefore,
1631 /// values in this column must be greater than zero.
1632 pub fn row_span_column(self, row_span_column: i32) -> Self {
1633 Self {
1634 builder: self.builder.property("row-span-column", row_span_column),
1635 }
1636 }
1637
1638 /// If wrap-width is set to a positive value, items in the popup will be laid
1639 /// out along multiple columns, starting a new row on reaching the wrap width.
1640 pub fn wrap_width(self, wrap_width: i32) -> Self {
1641 Self {
1642 builder: self.builder.property("wrap-width", wrap_width),
1643 }
1644 }
1645
1646 pub fn border_width(self, border_width: u32) -> Self {
1647 Self {
1648 builder: self.builder.property("border-width", border_width),
1649 }
1650 }
1651
1652 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1653 Self {
1654 builder: self.builder.property("child", child.clone().upcast()),
1655 }
1656 }
1657
1658 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1659 Self {
1660 builder: self.builder.property("resize-mode", resize_mode),
1661 }
1662 }
1663
1664 pub fn app_paintable(self, app_paintable: bool) -> Self {
1665 Self {
1666 builder: self.builder.property("app-paintable", app_paintable),
1667 }
1668 }
1669
1670 pub fn can_default(self, can_default: bool) -> Self {
1671 Self {
1672 builder: self.builder.property("can-default", can_default),
1673 }
1674 }
1675
1676 pub fn can_focus(self, can_focus: bool) -> Self {
1677 Self {
1678 builder: self.builder.property("can-focus", can_focus),
1679 }
1680 }
1681
1682 pub fn events(self, events: gdk::EventMask) -> Self {
1683 Self {
1684 builder: self.builder.property("events", events),
1685 }
1686 }
1687
1688 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1689 pub fn expand(self, expand: bool) -> Self {
1690 Self {
1691 builder: self.builder.property("expand", expand),
1692 }
1693 }
1694
1695 /// Whether the widget should grab focus when it is clicked with the mouse.
1696 ///
1697 /// This property is only relevant for widgets that can take focus.
1698 ///
1699 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1700 /// GtkComboBox) implemented this property individually.
1701 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1702 Self {
1703 builder: self.builder.property("focus-on-click", focus_on_click),
1704 }
1705 }
1706
1707 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1708 pub fn halign(self, halign: Align) -> Self {
1709 Self {
1710 builder: self.builder.property("halign", halign),
1711 }
1712 }
1713
1714 pub fn has_default(self, has_default: bool) -> Self {
1715 Self {
1716 builder: self.builder.property("has-default", has_default),
1717 }
1718 }
1719
1720 pub fn has_focus(self, has_focus: bool) -> Self {
1721 Self {
1722 builder: self.builder.property("has-focus", has_focus),
1723 }
1724 }
1725
1726 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1727 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1728 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1729 /// whether it will provide a tooltip or not.
1730 ///
1731 /// Note that setting this property to [`true`] for the first time will change
1732 /// the event masks of the GdkWindows of this widget to include leave-notify
1733 /// and motion-notify events. This cannot and will not be undone when the
1734 /// property is set to [`false`] again.
1735 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1736 Self {
1737 builder: self.builder.property("has-tooltip", has_tooltip),
1738 }
1739 }
1740
1741 pub fn height_request(self, height_request: i32) -> Self {
1742 Self {
1743 builder: self.builder.property("height-request", height_request),
1744 }
1745 }
1746
1747 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1748 pub fn hexpand(self, hexpand: bool) -> Self {
1749 Self {
1750 builder: self.builder.property("hexpand", hexpand),
1751 }
1752 }
1753
1754 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1755 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1756 Self {
1757 builder: self.builder.property("hexpand-set", hexpand_set),
1758 }
1759 }
1760
1761 pub fn is_focus(self, is_focus: bool) -> Self {
1762 Self {
1763 builder: self.builder.property("is-focus", is_focus),
1764 }
1765 }
1766
1767 /// Sets all four sides' margin at once. If read, returns max
1768 /// margin on any side.
1769 pub fn margin(self, margin: i32) -> Self {
1770 Self {
1771 builder: self.builder.property("margin", margin),
1772 }
1773 }
1774
1775 /// Margin on bottom side of widget.
1776 ///
1777 /// This property adds margin outside of the widget's normal size
1778 /// request, the margin will be added in addition to the size from
1779 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1780 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1781 Self {
1782 builder: self.builder.property("margin-bottom", margin_bottom),
1783 }
1784 }
1785
1786 /// Margin on end of widget, horizontally. This property supports
1787 /// left-to-right and right-to-left text directions.
1788 ///
1789 /// This property adds margin outside of the widget's normal size
1790 /// request, the margin will be added in addition to the size from
1791 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1792 pub fn margin_end(self, margin_end: i32) -> Self {
1793 Self {
1794 builder: self.builder.property("margin-end", margin_end),
1795 }
1796 }
1797
1798 /// Margin on start of widget, horizontally. This property supports
1799 /// left-to-right and right-to-left text directions.
1800 ///
1801 /// This property adds margin outside of the widget's normal size
1802 /// request, the margin will be added in addition to the size from
1803 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1804 pub fn margin_start(self, margin_start: i32) -> Self {
1805 Self {
1806 builder: self.builder.property("margin-start", margin_start),
1807 }
1808 }
1809
1810 /// Margin on top side of widget.
1811 ///
1812 /// This property adds margin outside of the widget's normal size
1813 /// request, the margin will be added in addition to the size from
1814 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1815 pub fn margin_top(self, margin_top: i32) -> Self {
1816 Self {
1817 builder: self.builder.property("margin-top", margin_top),
1818 }
1819 }
1820
1821 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1822 Self {
1823 builder: self.builder.property("name", name.into()),
1824 }
1825 }
1826
1827 pub fn no_show_all(self, no_show_all: bool) -> Self {
1828 Self {
1829 builder: self.builder.property("no-show-all", no_show_all),
1830 }
1831 }
1832
1833 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1834 /// more details about window opacity.
1835 ///
1836 /// Before 3.8 this was only available in GtkWindow
1837 pub fn opacity(self, opacity: f64) -> Self {
1838 Self {
1839 builder: self.builder.property("opacity", opacity),
1840 }
1841 }
1842
1843 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1844 Self {
1845 builder: self.builder.property("parent", parent.clone().upcast()),
1846 }
1847 }
1848
1849 pub fn receives_default(self, receives_default: bool) -> Self {
1850 Self {
1851 builder: self.builder.property("receives-default", receives_default),
1852 }
1853 }
1854
1855 pub fn sensitive(self, sensitive: bool) -> Self {
1856 Self {
1857 builder: self.builder.property("sensitive", sensitive),
1858 }
1859 }
1860
1861 /// Sets the text of tooltip to be the given string, which is marked up
1862 /// with the [Pango text markup language][PangoMarkupFormat].
1863 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1864 ///
1865 /// This is a convenience property which will take care of getting the
1866 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1867 /// will automatically be set to [`true`] and there will be taken care of
1868 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1869 ///
1870 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1871 /// are set, the last one wins.
1872 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1873 Self {
1874 builder: self
1875 .builder
1876 .property("tooltip-markup", tooltip_markup.into()),
1877 }
1878 }
1879
1880 /// Sets the text of tooltip to be the given string.
1881 ///
1882 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1883 ///
1884 /// This is a convenience property which will take care of getting the
1885 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1886 /// will automatically be set to [`true`] and there will be taken care of
1887 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1888 ///
1889 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1890 /// are set, the last one wins.
1891 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1892 Self {
1893 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1894 }
1895 }
1896
1897 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1898 pub fn valign(self, valign: Align) -> Self {
1899 Self {
1900 builder: self.builder.property("valign", valign),
1901 }
1902 }
1903
1904 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1905 pub fn vexpand(self, vexpand: bool) -> Self {
1906 Self {
1907 builder: self.builder.property("vexpand", vexpand),
1908 }
1909 }
1910
1911 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1912 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1913 Self {
1914 builder: self.builder.property("vexpand-set", vexpand_set),
1915 }
1916 }
1917
1918 pub fn visible(self, visible: bool) -> Self {
1919 Self {
1920 builder: self.builder.property("visible", visible),
1921 }
1922 }
1923
1924 pub fn width_request(self, width_request: i32) -> Self {
1925 Self {
1926 builder: self.builder.property("width-request", width_request),
1927 }
1928 }
1929
1930 /// Indicates whether editing on the cell has been canceled.
1931 pub fn editing_canceled(self, editing_canceled: bool) -> Self {
1932 Self {
1933 builder: self.builder.property("editing-canceled", editing_canceled),
1934 }
1935 }
1936
1937 /// The content type of the [`AppChooser`][crate::AppChooser] object.
1938 ///
1939 /// See [GContentType][gio-GContentType]
1940 /// for more information about content types.
1941 pub fn content_type(self, content_type: impl Into<glib::GString>) -> Self {
1942 Self {
1943 builder: self.builder.property("content-type", content_type.into()),
1944 }
1945 }
1946
1947 // rustdoc-stripper-ignore-next
1948 /// Build the [`AppChooserButton`].
1949 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1950 pub fn build(self) -> AppChooserButton {
1951 assert_initialized_main_thread!();
1952 self.builder.build()
1953 }
1954}
1955
1956/// Trait containing all [`struct@AppChooserButton`] methods.
1957///
1958/// # Implementors
1959///
1960/// [`AppChooserButton`][struct@crate::AppChooserButton]
1961pub trait AppChooserButtonExt: IsA<AppChooserButton> + 'static {
1962 /// Appends a custom item to the list of applications that is shown
1963 /// in the popup; the item name must be unique per-widget.
1964 /// Clients can use the provided name as a detail for the
1965 /// [`custom-item-activated`][struct@crate::AppChooserButton#custom-item-activated] signal, to add a
1966 /// callback for the activation of a particular custom item in the list.
1967 /// See also [`append_separator()`][Self::append_separator()].
1968 /// ## `name`
1969 /// the name of the custom item
1970 /// ## `label`
1971 /// the label for the custom item
1972 /// ## `icon`
1973 /// the icon for the custom item
1974 #[doc(alias = "gtk_app_chooser_button_append_custom_item")]
1975 fn append_custom_item(&self, name: &str, label: &str, icon: &impl IsA<gio::Icon>) {
1976 unsafe {
1977 ffi::gtk_app_chooser_button_append_custom_item(
1978 self.as_ref().to_glib_none().0,
1979 name.to_glib_none().0,
1980 label.to_glib_none().0,
1981 icon.as_ref().to_glib_none().0,
1982 );
1983 }
1984 }
1985
1986 /// Appends a separator to the list of applications that is shown
1987 /// in the popup.
1988 #[doc(alias = "gtk_app_chooser_button_append_separator")]
1989 fn append_separator(&self) {
1990 unsafe {
1991 ffi::gtk_app_chooser_button_append_separator(self.as_ref().to_glib_none().0);
1992 }
1993 }
1994
1995 /// Returns the text to display at the top of the dialog.
1996 ///
1997 /// # Returns
1998 ///
1999 /// the text to display at the top of the dialog,
2000 /// or [`None`], in which case a default text is displayed
2001 #[doc(alias = "gtk_app_chooser_button_get_heading")]
2002 #[doc(alias = "get_heading")]
2003 fn heading(&self) -> Option<glib::GString> {
2004 unsafe {
2005 from_glib_none(ffi::gtk_app_chooser_button_get_heading(
2006 self.as_ref().to_glib_none().0,
2007 ))
2008 }
2009 }
2010
2011 /// Returns the current value of the [`show-default-item`][struct@crate::AppChooserButton#show-default-item]
2012 /// property.
2013 ///
2014 /// # Returns
2015 ///
2016 /// the value of [`show-default-item`][struct@crate::AppChooserButton#show-default-item]
2017 #[doc(alias = "gtk_app_chooser_button_get_show_default_item")]
2018 #[doc(alias = "get_show_default_item")]
2019 #[doc(alias = "show-default-item")]
2020 fn shows_default_item(&self) -> bool {
2021 unsafe {
2022 from_glib(ffi::gtk_app_chooser_button_get_show_default_item(
2023 self.as_ref().to_glib_none().0,
2024 ))
2025 }
2026 }
2027
2028 /// Returns the current value of the [`show-dialog-item`][struct@crate::AppChooserButton#show-dialog-item]
2029 /// property.
2030 ///
2031 /// # Returns
2032 ///
2033 /// the value of [`show-dialog-item`][struct@crate::AppChooserButton#show-dialog-item]
2034 #[doc(alias = "gtk_app_chooser_button_get_show_dialog_item")]
2035 #[doc(alias = "get_show_dialog_item")]
2036 #[doc(alias = "show-dialog-item")]
2037 fn shows_dialog_item(&self) -> bool {
2038 unsafe {
2039 from_glib(ffi::gtk_app_chooser_button_get_show_dialog_item(
2040 self.as_ref().to_glib_none().0,
2041 ))
2042 }
2043 }
2044
2045 /// Selects a custom item previously added with
2046 /// [`append_custom_item()`][Self::append_custom_item()].
2047 ///
2048 /// Use [`AppChooserExtManual::refresh()`][crate::prelude::AppChooserExtManual::refresh()] to bring the selection
2049 /// to its initial state.
2050 /// ## `name`
2051 /// the name of the custom item
2052 #[doc(alias = "gtk_app_chooser_button_set_active_custom_item")]
2053 fn set_active_custom_item(&self, name: &str) {
2054 unsafe {
2055 ffi::gtk_app_chooser_button_set_active_custom_item(
2056 self.as_ref().to_glib_none().0,
2057 name.to_glib_none().0,
2058 );
2059 }
2060 }
2061
2062 /// Sets the text to display at the top of the dialog.
2063 /// If the heading is not set, the dialog displays a default text.
2064 /// ## `heading`
2065 /// a string containing Pango markup
2066 #[doc(alias = "gtk_app_chooser_button_set_heading")]
2067 #[doc(alias = "heading")]
2068 fn set_heading(&self, heading: &str) {
2069 unsafe {
2070 ffi::gtk_app_chooser_button_set_heading(
2071 self.as_ref().to_glib_none().0,
2072 heading.to_glib_none().0,
2073 );
2074 }
2075 }
2076
2077 /// Sets whether the dropdown menu of this button should show the
2078 /// default application for the given content type at top.
2079 /// ## `setting`
2080 /// the new value for [`show-default-item`][struct@crate::AppChooserButton#show-default-item]
2081 #[doc(alias = "gtk_app_chooser_button_set_show_default_item")]
2082 #[doc(alias = "show-default-item")]
2083 fn set_show_default_item(&self, setting: bool) {
2084 unsafe {
2085 ffi::gtk_app_chooser_button_set_show_default_item(
2086 self.as_ref().to_glib_none().0,
2087 setting.into_glib(),
2088 );
2089 }
2090 }
2091
2092 /// Sets whether the dropdown menu of this button should show an
2093 /// entry to trigger a [`AppChooserDialog`][crate::AppChooserDialog].
2094 /// ## `setting`
2095 /// the new value for [`show-dialog-item`][struct@crate::AppChooserButton#show-dialog-item]
2096 #[doc(alias = "gtk_app_chooser_button_set_show_dialog_item")]
2097 #[doc(alias = "show-dialog-item")]
2098 fn set_show_dialog_item(&self, setting: bool) {
2099 unsafe {
2100 ffi::gtk_app_chooser_button_set_show_dialog_item(
2101 self.as_ref().to_glib_none().0,
2102 setting.into_glib(),
2103 );
2104 }
2105 }
2106
2107 /// Emitted when a custom item, previously added with
2108 /// [`append_custom_item()`][Self::append_custom_item()], is activated from the
2109 /// dropdown menu.
2110 /// ## `item_name`
2111 /// the name of the activated item
2112 #[doc(alias = "custom-item-activated")]
2113 fn connect_custom_item_activated<F: Fn(&Self, &str) + 'static>(
2114 &self,
2115 detail: Option<&str>,
2116 f: F,
2117 ) -> SignalHandlerId {
2118 unsafe extern "C" fn custom_item_activated_trampoline<
2119 P: IsA<AppChooserButton>,
2120 F: Fn(&P, &str) + 'static,
2121 >(
2122 this: *mut ffi::GtkAppChooserButton,
2123 item_name: *mut std::ffi::c_char,
2124 f: glib::ffi::gpointer,
2125 ) {
2126 unsafe {
2127 let f: &F = &*(f as *const F);
2128 f(
2129 AppChooserButton::from_glib_borrow(this).unsafe_cast_ref(),
2130 &glib::GString::from_glib_borrow(item_name),
2131 )
2132 }
2133 }
2134 unsafe {
2135 let f: Box_<F> = Box_::new(f);
2136 let detailed_signal_name =
2137 detail.map(|name| format!("custom-item-activated::{name}\0"));
2138 let signal_name = detailed_signal_name
2139 .as_ref()
2140 .map_or(c"custom-item-activated", |n| {
2141 std::ffi::CStr::from_bytes_with_nul_unchecked(n.as_bytes())
2142 });
2143 connect_raw(
2144 self.as_ptr() as *mut _,
2145 signal_name.as_ptr(),
2146 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2147 custom_item_activated_trampoline::<Self, F> as *const (),
2148 )),
2149 Box_::into_raw(f),
2150 )
2151 }
2152 }
2153
2154 #[doc(alias = "heading")]
2155 fn connect_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2156 unsafe extern "C" fn notify_heading_trampoline<
2157 P: IsA<AppChooserButton>,
2158 F: Fn(&P) + 'static,
2159 >(
2160 this: *mut ffi::GtkAppChooserButton,
2161 _param_spec: glib::ffi::gpointer,
2162 f: glib::ffi::gpointer,
2163 ) {
2164 unsafe {
2165 let f: &F = &*(f as *const F);
2166 f(AppChooserButton::from_glib_borrow(this).unsafe_cast_ref())
2167 }
2168 }
2169 unsafe {
2170 let f: Box_<F> = Box_::new(f);
2171 connect_raw(
2172 self.as_ptr() as *mut _,
2173 c"notify::heading".as_ptr(),
2174 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2175 notify_heading_trampoline::<Self, F> as *const (),
2176 )),
2177 Box_::into_raw(f),
2178 )
2179 }
2180 }
2181
2182 #[doc(alias = "show-default-item")]
2183 fn connect_show_default_item_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2184 unsafe extern "C" fn notify_show_default_item_trampoline<
2185 P: IsA<AppChooserButton>,
2186 F: Fn(&P) + 'static,
2187 >(
2188 this: *mut ffi::GtkAppChooserButton,
2189 _param_spec: glib::ffi::gpointer,
2190 f: glib::ffi::gpointer,
2191 ) {
2192 unsafe {
2193 let f: &F = &*(f as *const F);
2194 f(AppChooserButton::from_glib_borrow(this).unsafe_cast_ref())
2195 }
2196 }
2197 unsafe {
2198 let f: Box_<F> = Box_::new(f);
2199 connect_raw(
2200 self.as_ptr() as *mut _,
2201 c"notify::show-default-item".as_ptr(),
2202 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2203 notify_show_default_item_trampoline::<Self, F> as *const (),
2204 )),
2205 Box_::into_raw(f),
2206 )
2207 }
2208 }
2209
2210 #[doc(alias = "show-dialog-item")]
2211 fn connect_show_dialog_item_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2212 unsafe extern "C" fn notify_show_dialog_item_trampoline<
2213 P: IsA<AppChooserButton>,
2214 F: Fn(&P) + 'static,
2215 >(
2216 this: *mut ffi::GtkAppChooserButton,
2217 _param_spec: glib::ffi::gpointer,
2218 f: glib::ffi::gpointer,
2219 ) {
2220 unsafe {
2221 let f: &F = &*(f as *const F);
2222 f(AppChooserButton::from_glib_borrow(this).unsafe_cast_ref())
2223 }
2224 }
2225 unsafe {
2226 let f: Box_<F> = Box_::new(f);
2227 connect_raw(
2228 self.as_ptr() as *mut _,
2229 c"notify::show-dialog-item".as_ptr(),
2230 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2231 notify_show_dialog_item_trampoline::<Self, F> as *const (),
2232 )),
2233 Box_::into_raw(f),
2234 )
2235 }
2236 }
2237}
2238
2239impl<O: IsA<AppChooserButton>> AppChooserButtonExt for O {}