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