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