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