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