gtk/auto/statusbar.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, Container, Orientable, Orientation, ResizeMode, Widget,
7};
8use glib::{
9 prelude::*,
10 signal::{connect_raw, SignalHandlerId},
11 translate::*,
12};
13use std::{boxed::Box as Box_, fmt, mem::transmute};
14
15glib::wrapper! {
16 /// A [`Statusbar`][crate::Statusbar] is usually placed along the bottom of an application's
17 /// main [`Window`][crate::Window]. It may provide a regular commentary of the application's
18 /// status (as is usually the case in a web browser, for example), or may be
19 /// used to simply output a message when the status changes, (when an upload
20 /// is complete in an FTP client, for example).
21 ///
22 /// Status bars in GTK+ maintain a stack of messages. The message at
23 /// the top of the each bar’s stack is the one that will currently be displayed.
24 ///
25 /// Any messages added to a statusbar’s stack must specify a
26 /// context id that is used to uniquely identify
27 /// the source of a message. This context id can be generated by
28 /// [`StatusbarExt::context_id()`][crate::prelude::StatusbarExt::context_id()], given a message and the statusbar that
29 /// it will be added to. Note that messages are stored in a stack, and when
30 /// choosing which message to display, the stack structure is adhered to,
31 /// regardless of the context identifier of a message.
32 ///
33 /// One could say that a statusbar maintains one stack of messages for
34 /// display purposes, but allows multiple message producers to maintain
35 /// sub-stacks of the messages they produced (via context ids).
36 ///
37 /// Status bars are created using [`new()`][Self::new()].
38 ///
39 /// Messages are added to the bar’s stack with [`StatusbarExt::push()`][crate::prelude::StatusbarExt::push()].
40 ///
41 /// The message at the top of the stack can be removed using
42 /// [`StatusbarExt::pop()`][crate::prelude::StatusbarExt::pop()]. A message can be removed from anywhere in the
43 /// stack if its message id was recorded at the time it was added. This
44 /// is done using [`StatusbarExt::remove()`][crate::prelude::StatusbarExt::remove()].
45 ///
46 /// # CSS node
47 ///
48 /// GtkStatusbar has a single CSS node with name statusbar.
49 ///
50 /// ## Signals
51 ///
52 ///
53 /// #### `text-popped`
54 /// Is emitted whenever a new message is popped off a statusbar's stack.
55 ///
56 ///
57 ///
58 ///
59 /// #### `text-pushed`
60 /// Is emitted whenever a new message gets pushed onto a statusbar's stack.
61 ///
62 ///
63 /// <details><summary><h4>Container</h4></summary>
64 ///
65 ///
66 /// #### `add`
67 ///
68 ///
69 ///
70 /// #### `check-resize`
71 ///
72 ///
73 ///
74 /// #### `remove`
75 ///
76 ///
77 ///
78 /// #### `set-focus-child`
79 ///
80 /// </details>
81 /// <details><summary><h4>Widget</h4></summary>
82 ///
83 ///
84 /// #### `accel-closures-changed`
85 ///
86 ///
87 ///
88 /// #### `button-press-event`
89 /// The ::button-press-event signal will be emitted when a button
90 /// (typically from a mouse) is pressed.
91 ///
92 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
93 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
94 ///
95 /// This signal will be sent to the grab widget if there is one.
96 ///
97 ///
98 ///
99 ///
100 /// #### `button-release-event`
101 /// The ::button-release-event signal will be emitted when a button
102 /// (typically from a mouse) is released.
103 ///
104 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
105 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
106 ///
107 /// This signal will be sent to the grab widget if there is one.
108 ///
109 ///
110 ///
111 ///
112 /// #### `can-activate-accel`
113 /// Determines whether an accelerator that activates the signal
114 /// identified by `signal_id` can currently be activated.
115 /// This signal is present to allow applications and derived
116 /// widgets to override the default [`Widget`][crate::Widget] handling
117 /// for determining whether an accelerator can be activated.
118 ///
119 ///
120 ///
121 ///
122 /// #### `child-notify`
123 /// The ::child-notify signal is emitted for each
124 /// [child property][child-properties] that has
125 /// changed on an object. The signal's detail holds the property name.
126 ///
127 /// Detailed
128 ///
129 ///
130 /// #### `composited-changed`
131 /// The ::composited-changed signal is emitted when the composited
132 /// status of `widgets` screen changes.
133 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
134 ///
135 /// Action
136 ///
137 ///
138 /// #### `configure-event`
139 /// The ::configure-event signal will be emitted when the size, position or
140 /// stacking of the `widget`'s window has changed.
141 ///
142 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
143 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
144 /// automatically for all new windows.
145 ///
146 ///
147 ///
148 ///
149 /// #### `damage-event`
150 /// Emitted when a redirected window belonging to `widget` gets drawn into.
151 /// The region/area members of the event shows what area of the redirected
152 /// drawable was drawn into.
153 ///
154 ///
155 ///
156 ///
157 /// #### `delete-event`
158 /// The ::delete-event signal is emitted if a user requests that
159 /// a toplevel window is closed. The default handler for this signal
160 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
161 /// this signal will cause the window to be hidden instead, so that
162 /// it can later be shown again without reconstructing it.
163 ///
164 ///
165 ///
166 ///
167 /// #### `destroy`
168 /// Signals that all holders of a reference to the widget should release
169 /// the reference that they hold. May result in finalization of the widget
170 /// if all references are released.
171 ///
172 /// This signal is not suitable for saving widget state.
173 ///
174 ///
175 ///
176 ///
177 /// #### `destroy-event`
178 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
179 /// You rarely get this signal, because most widgets disconnect themselves
180 /// from their window before they destroy it, so no widget owns the
181 /// window at destroy time.
182 ///
183 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
184 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
185 /// automatically for all new windows.
186 ///
187 ///
188 ///
189 ///
190 /// #### `direction-changed`
191 /// The ::direction-changed signal is emitted when the text direction
192 /// of a widget changes.
193 ///
194 ///
195 ///
196 ///
197 /// #### `drag-begin`
198 /// The ::drag-begin signal is emitted on the drag source when a drag is
199 /// started. A typical reason to connect to this signal is to set up a
200 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
201 ///
202 /// Note that some widgets set up a drag icon in the default handler of
203 /// this signal, so you may have to use `g_signal_connect_after()` to
204 /// override what the default handler did.
205 ///
206 ///
207 ///
208 ///
209 /// #### `drag-data-delete`
210 /// The ::drag-data-delete signal is emitted on the drag source when a drag
211 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
212 /// handler is responsible for deleting the data that has been dropped. What
213 /// "delete" means depends on the context of the drag operation.
214 ///
215 ///
216 ///
217 ///
218 /// #### `drag-data-get`
219 /// The ::drag-data-get signal is emitted on the drag source when the drop
220 /// site requests the data which is dragged. It is the responsibility of
221 /// the signal handler to fill `data` with the data in the format which
222 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
223 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
224 ///
225 ///
226 ///
227 ///
228 /// #### `drag-data-received`
229 /// The ::drag-data-received signal is emitted on the drop site when the
230 /// dragged data has been received. If the data was received in order to
231 /// determine whether the drop will be accepted, the handler is expected
232 /// to call `gdk_drag_status()` and not finish the drag.
233 /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
234 /// (and this is the last target to be received), the handler for this
235 /// signal is expected to process the received data and then call
236 /// `gtk_drag_finish()`, setting the `success` parameter depending on
237 /// whether the data was processed successfully.
238 ///
239 /// Applications must create some means to determine why the signal was emitted
240 /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
241 ///
242 /// The handler may inspect the selected action with
243 /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
244 /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
245 /// shown in the following example:
246 ///
247 ///
248 /// **⚠️ The following code is in C ⚠️**
249 ///
250 /// ```C
251 /// void
252 /// drag_data_received (GtkWidget *widget,
253 /// GdkDragContext *context,
254 /// gint x,
255 /// gint y,
256 /// GtkSelectionData *data,
257 /// guint info,
258 /// guint time)
259 /// {
260 /// if ((data->length >= 0) && (data->format == 8))
261 /// {
262 /// GdkDragAction action;
263 ///
264 /// // handle data here
265 ///
266 /// action = gdk_drag_context_get_selected_action (context);
267 /// if (action == GDK_ACTION_ASK)
268 /// {
269 /// GtkWidget *dialog;
270 /// gint response;
271 ///
272 /// dialog = gtk_message_dialog_new (NULL,
273 /// GTK_DIALOG_MODAL |
274 /// GTK_DIALOG_DESTROY_WITH_PARENT,
275 /// GTK_MESSAGE_INFO,
276 /// GTK_BUTTONS_YES_NO,
277 /// "Move the data ?\n");
278 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
279 /// gtk_widget_destroy (dialog);
280 ///
281 /// if (response == GTK_RESPONSE_YES)
282 /// action = GDK_ACTION_MOVE;
283 /// else
284 /// action = GDK_ACTION_COPY;
285 /// }
286 ///
287 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
288 /// }
289 /// else
290 /// gtk_drag_finish (context, FALSE, FALSE, time);
291 /// }
292 /// ```
293 ///
294 ///
295 ///
296 ///
297 /// #### `drag-drop`
298 /// The ::drag-drop signal is emitted on the drop site when the user drops
299 /// the data onto the widget. The signal handler must determine whether
300 /// the cursor position is in a drop zone or not. If it is not in a drop
301 /// zone, it returns [`false`] and no further processing is necessary.
302 /// Otherwise, the handler returns [`true`]. In this case, the handler must
303 /// ensure that `gtk_drag_finish()` is called to let the source know that
304 /// the drop is done. The call to `gtk_drag_finish()` can be done either
305 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
306 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
307 /// or more of the supported targets.
308 ///
309 ///
310 ///
311 ///
312 /// #### `drag-end`
313 /// The ::drag-end signal is emitted on the drag source when a drag is
314 /// finished. A typical reason to connect to this signal is to undo
315 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
316 ///
317 ///
318 ///
319 ///
320 /// #### `drag-failed`
321 /// The ::drag-failed signal is emitted on the drag source when a drag has
322 /// failed. The signal handler may hook custom code to handle a failed DnD
323 /// operation based on the type of error, it returns [`true`] is the failure has
324 /// been already handled (not showing the default "drag operation failed"
325 /// animation), otherwise it returns [`false`].
326 ///
327 ///
328 ///
329 ///
330 /// #### `drag-leave`
331 /// The ::drag-leave signal is emitted on the drop site when the cursor
332 /// leaves the widget. A typical reason to connect to this signal is to
333 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
334 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
335 ///
336 ///
337 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
338 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
339 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
340 ///
341 ///
342 ///
343 ///
344 /// #### `drag-motion`
345 /// The ::drag-motion signal is emitted on the drop site when the user
346 /// moves the cursor over the widget during a drag. The signal handler
347 /// must determine whether the cursor position is in a drop zone or not.
348 /// If it is not in a drop zone, it returns [`false`] and no further processing
349 /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
350 /// handler is responsible for providing the necessary information for
351 /// displaying feedback to the user, by calling `gdk_drag_status()`.
352 ///
353 /// If the decision whether the drop will be accepted or rejected can't be
354 /// made based solely on the cursor position and the type of the data, the
355 /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
356 /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
357 /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
358 /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
359 /// when using the drag-motion signal that way.
360 ///
361 /// Also note that there is no drag-enter signal. The drag receiver has to
362 /// keep track of whether he has received any drag-motion signals since the
363 /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
364 /// an "enter" signal. Upon an "enter", the handler will typically highlight
365 /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
366 ///
367 ///
368 /// **⚠️ The following code is in C ⚠️**
369 ///
370 /// ```C
371 /// static void
372 /// drag_motion (GtkWidget *widget,
373 /// GdkDragContext *context,
374 /// gint x,
375 /// gint y,
376 /// guint time)
377 /// {
378 /// GdkAtom target;
379 ///
380 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
381 ///
382 /// if (!private_data->drag_highlight)
383 /// {
384 /// private_data->drag_highlight = 1;
385 /// gtk_drag_highlight (widget);
386 /// }
387 ///
388 /// target = gtk_drag_dest_find_target (widget, context, NULL);
389 /// if (target == GDK_NONE)
390 /// gdk_drag_status (context, 0, time);
391 /// else
392 /// {
393 /// private_data->pending_status
394 /// = gdk_drag_context_get_suggested_action (context);
395 /// gtk_drag_get_data (widget, context, target, time);
396 /// }
397 ///
398 /// return TRUE;
399 /// }
400 ///
401 /// static void
402 /// drag_data_received (GtkWidget *widget,
403 /// GdkDragContext *context,
404 /// gint x,
405 /// gint y,
406 /// GtkSelectionData *selection_data,
407 /// guint info,
408 /// guint time)
409 /// {
410 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
411 ///
412 /// if (private_data->suggested_action)
413 /// {
414 /// private_data->suggested_action = 0;
415 ///
416 /// // We are getting this data due to a request in drag_motion,
417 /// // rather than due to a request in drag_drop, so we are just
418 /// // supposed to call gdk_drag_status(), not actually paste in
419 /// // the data.
420 ///
421 /// str = gtk_selection_data_get_text (selection_data);
422 /// if (!data_is_acceptable (str))
423 /// gdk_drag_status (context, 0, time);
424 /// else
425 /// gdk_drag_status (context,
426 /// private_data->suggested_action,
427 /// time);
428 /// }
429 /// else
430 /// {
431 /// // accept the drop
432 /// }
433 /// }
434 /// ```
435 ///
436 ///
437 ///
438 ///
439 /// #### `draw`
440 /// This signal is emitted when a widget is supposed to render itself.
441 /// The `widget`'s top left corner must be painted at the origin of
442 /// the passed in context and be sized to the values returned by
443 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
444 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
445 ///
446 /// Signal handlers connected to this signal can modify the cairo
447 /// context passed as `cr` in any way they like and don't need to
448 /// restore it. The signal emission takes care of calling `cairo_save()`
449 /// before and `cairo_restore()` after invoking the handler.
450 ///
451 /// The signal handler will get a `cr` with a clip region already set to the
452 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
453 /// widgets that want to avoid redrawing themselves completely can get the full
454 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
455 /// get a finer-grained representation of the dirty region with
456 /// `cairo_copy_clip_rectangle_list()`.
457 ///
458 ///
459 ///
460 ///
461 /// #### `enter-notify-event`
462 /// The ::enter-notify-event will be emitted when the pointer enters
463 /// the `widget`'s window.
464 ///
465 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
466 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
467 ///
468 /// This signal will be sent to the grab widget if there is one.
469 ///
470 ///
471 ///
472 ///
473 /// #### `event`
474 /// The GTK+ main loop will emit three signals for each GDK event delivered
475 /// to a widget: one generic ::event signal, another, more specific,
476 /// signal that matches the type of event delivered (e.g.
477 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
478 /// [`event-after`][struct@crate::Widget#event-after] signal.
479 ///
480 ///
481 ///
482 ///
483 /// #### `event-after`
484 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
485 /// the second more specific signal, ::event-after will be emitted
486 /// regardless of the previous two signals handlers return values.
487 ///
488 ///
489 ///
490 ///
491 /// #### `focus`
492 ///
493 ///
494 ///
495 /// #### `focus-in-event`
496 /// The ::focus-in-event signal will be emitted when the keyboard focus
497 /// enters the `widget`'s window.
498 ///
499 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
500 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
501 ///
502 ///
503 ///
504 ///
505 /// #### `focus-out-event`
506 /// The ::focus-out-event signal will be emitted when the keyboard focus
507 /// leaves the `widget`'s window.
508 ///
509 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
510 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
511 ///
512 ///
513 ///
514 ///
515 /// #### `grab-broken-event`
516 /// Emitted when a pointer or keyboard grab on a window belonging
517 /// to `widget` gets broken.
518 ///
519 /// On X11, this happens when the grab window becomes unviewable
520 /// (i.e. it or one of its ancestors is unmapped), or if the same
521 /// application grabs the pointer or keyboard again.
522 ///
523 ///
524 ///
525 ///
526 /// #### `grab-focus`
527 /// Action
528 ///
529 ///
530 /// #### `grab-notify`
531 /// The ::grab-notify signal is emitted when a widget becomes
532 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
533 /// another widget, or when it becomes unshadowed due to a grab
534 /// being removed.
535 ///
536 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
537 /// grab widget in the grab stack of its window group is not
538 /// its ancestor.
539 ///
540 ///
541 ///
542 ///
543 /// #### `hide`
544 /// The ::hide signal is emitted when `widget` is hidden, for example with
545 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
546 ///
547 ///
548 ///
549 ///
550 /// #### `hierarchy-changed`
551 /// The ::hierarchy-changed signal is emitted when the
552 /// anchored state of a widget changes. A widget is
553 /// “anchored” when its toplevel
554 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
555 /// a widget changes from un-anchored to anchored or vice-versa.
556 ///
557 ///
558 ///
559 ///
560 /// #### `key-press-event`
561 /// The ::key-press-event signal is emitted when a key is pressed. The signal
562 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
563 ///
564 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
565 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
566 ///
567 /// This signal will be sent to the grab widget if there is one.
568 ///
569 ///
570 ///
571 ///
572 /// #### `key-release-event`
573 /// The ::key-release-event signal is emitted when a key is released.
574 ///
575 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
576 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
577 ///
578 /// This signal will be sent to the grab widget if there is one.
579 ///
580 ///
581 ///
582 ///
583 /// #### `keynav-failed`
584 /// Gets emitted if keyboard navigation fails.
585 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
586 ///
587 ///
588 ///
589 ///
590 /// #### `leave-notify-event`
591 /// The ::leave-notify-event will be emitted when the pointer leaves
592 /// the `widget`'s window.
593 ///
594 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
595 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
596 ///
597 /// This signal will be sent to the grab widget if there is one.
598 ///
599 ///
600 ///
601 ///
602 /// #### `map`
603 /// The ::map signal is emitted when `widget` is going to be mapped, that is
604 /// when the widget is visible (which is controlled with
605 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
606 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
607 /// be emitted.
608 ///
609 /// The ::map signal can be used to determine whether a widget will be drawn,
610 /// for instance it can resume an animation that was stopped during the
611 /// emission of [`unmap`][struct@crate::Widget#unmap].
612 ///
613 ///
614 ///
615 ///
616 /// #### `map-event`
617 /// The ::map-event signal will be emitted when the `widget`'s window is
618 /// mapped. A window is mapped when it becomes visible on the screen.
619 ///
620 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
621 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
622 /// automatically for all new windows.
623 ///
624 ///
625 ///
626 ///
627 /// #### `mnemonic-activate`
628 /// The default handler for this signal activates `widget` if `group_cycling`
629 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
630 ///
631 ///
632 ///
633 ///
634 /// #### `motion-notify-event`
635 /// The ::motion-notify-event signal is emitted when the pointer moves
636 /// over the widget's [`gdk::Window`][crate::gdk::Window].
637 ///
638 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
639 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
640 ///
641 /// This signal will be sent to the grab widget if there is one.
642 ///
643 ///
644 ///
645 ///
646 /// #### `move-focus`
647 /// Action
648 ///
649 ///
650 /// #### `parent-set`
651 /// The ::parent-set signal is emitted when a new parent
652 /// has been set on a widget.
653 ///
654 ///
655 ///
656 ///
657 /// #### `popup-menu`
658 /// This signal gets emitted whenever a widget should pop up a context
659 /// menu. This usually happens through the standard key binding mechanism;
660 /// by pressing a certain key while a widget is focused, the user can cause
661 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
662 /// a menu with clipboard commands. See the
663 /// [Popup Menu Migration Checklist][checklist-popup-menu]
664 /// for an example of how to use this signal.
665 ///
666 /// Action
667 ///
668 ///
669 /// #### `property-notify-event`
670 /// The ::property-notify-event signal will be emitted when a property on
671 /// the `widget`'s window has been changed or deleted.
672 ///
673 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
674 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
675 ///
676 ///
677 ///
678 ///
679 /// #### `proximity-in-event`
680 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
681 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
682 ///
683 /// This signal will be sent to the grab widget if there is one.
684 ///
685 ///
686 ///
687 ///
688 /// #### `proximity-out-event`
689 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
690 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
691 ///
692 /// This signal will be sent to the grab widget if there is one.
693 ///
694 ///
695 ///
696 ///
697 /// #### `query-tooltip`
698 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
699 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
700 /// focus in keyboard mode.
701 ///
702 /// Using the given coordinates, the signal handler should determine
703 /// whether a tooltip should be shown for `widget`. If this is the case
704 /// [`true`] should be returned, [`false`] otherwise. Note that if
705 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
706 /// should not be used.
707 ///
708 /// The signal handler is free to manipulate `tooltip` with the therefore
709 /// destined function calls.
710 ///
711 ///
712 ///
713 ///
714 /// #### `realize`
715 /// The ::realize signal is emitted when `widget` is associated with a
716 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
717 /// widget has been mapped (that is, it is going to be drawn).
718 ///
719 ///
720 ///
721 ///
722 /// #### `screen-changed`
723 /// The ::screen-changed signal gets emitted when the
724 /// screen of a widget has changed.
725 ///
726 ///
727 ///
728 ///
729 /// #### `scroll-event`
730 /// The ::scroll-event signal is emitted when a button in the 4 to 7
731 /// range is pressed. Wheel mice are usually configured to generate
732 /// button press events for buttons 4 and 5 when the wheel is turned.
733 ///
734 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
735 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
736 ///
737 /// This signal will be sent to the grab widget if there is one.
738 ///
739 ///
740 ///
741 ///
742 /// #### `selection-clear-event`
743 /// The ::selection-clear-event signal will be emitted when the
744 /// the `widget`'s window has lost ownership of a selection.
745 ///
746 ///
747 ///
748 ///
749 /// #### `selection-get`
750 ///
751 ///
752 ///
753 /// #### `selection-notify-event`
754 ///
755 ///
756 ///
757 /// #### `selection-received`
758 ///
759 ///
760 ///
761 /// #### `selection-request-event`
762 /// The ::selection-request-event signal will be emitted when
763 /// another client requests ownership of the selection owned by
764 /// the `widget`'s window.
765 ///
766 ///
767 ///
768 ///
769 /// #### `show`
770 /// The ::show signal is emitted when `widget` is shown, for example with
771 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
772 ///
773 ///
774 ///
775 ///
776 /// #### `show-help`
777 /// Action
778 ///
779 ///
780 /// #### `size-allocate`
781 ///
782 ///
783 ///
784 /// #### `state-changed`
785 /// The ::state-changed signal is emitted when the widget state changes.
786 /// See `gtk_widget_get_state()`.
787 ///
788 ///
789 ///
790 ///
791 /// #### `state-flags-changed`
792 /// The ::state-flags-changed signal is emitted when the widget state
793 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
794 ///
795 ///
796 ///
797 ///
798 /// #### `style-set`
799 /// The ::style-set signal is emitted when a new style has been set
800 /// on a widget. Note that style-modifying functions like
801 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
802 ///
803 /// Note that this signal is emitted for changes to the deprecated
804 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
805 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
806 ///
807 ///
808 ///
809 ///
810 /// #### `style-updated`
811 /// The ::style-updated signal is a convenience signal that is emitted when the
812 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
813 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
814 ///
815 /// Note that style-modifying functions like `gtk_widget_override_color()` also
816 /// cause this signal to be emitted.
817 ///
818 ///
819 ///
820 ///
821 /// #### `touch-event`
822 ///
823 ///
824 ///
825 /// #### `unmap`
826 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
827 /// means that either it or any of its parents up to the toplevel widget have
828 /// been set as hidden.
829 ///
830 /// As ::unmap indicates that a widget will not be shown any longer, it can be
831 /// used to, for example, stop an animation on the widget.
832 ///
833 ///
834 ///
835 ///
836 /// #### `unmap-event`
837 /// The ::unmap-event signal will be emitted when the `widget`'s window is
838 /// unmapped. A window is unmapped when it becomes invisible on the screen.
839 ///
840 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
841 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
842 /// automatically for all new windows.
843 ///
844 ///
845 ///
846 ///
847 /// #### `unrealize`
848 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
849 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
850 /// called or the widget has been unmapped (that is, it is going to be
851 /// hidden).
852 ///
853 ///
854 ///
855 ///
856 /// #### `visibility-notify-event`
857 /// The ::visibility-notify-event will be emitted when the `widget`'s
858 /// window is obscured or unobscured.
859 ///
860 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
861 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
862 ///
863 ///
864 ///
865 ///
866 /// #### `window-state-event`
867 /// The ::window-state-event will be emitted when the state of the
868 /// toplevel window associated to the `widget` changes.
869 ///
870 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
871 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
872 /// this mask automatically for all new windows.
873 ///
874 ///
875 /// </details>
876 ///
877 /// # Implements
878 ///
879 /// [`StatusbarExt`][trait@crate::prelude::StatusbarExt], [`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]
880 #[doc(alias = "GtkStatusbar")]
881 pub struct Statusbar(Object<ffi::GtkStatusbar, ffi::GtkStatusbarClass>) @extends Box, Container, Widget, @implements Buildable, Orientable;
882
883 match fn {
884 type_ => || ffi::gtk_statusbar_get_type(),
885 }
886}
887
888impl Statusbar {
889 pub const NONE: Option<&'static Statusbar> = None;
890
891 /// Creates a new [`Statusbar`][crate::Statusbar] ready for messages.
892 ///
893 /// # Returns
894 ///
895 /// the new [`Statusbar`][crate::Statusbar]
896 #[doc(alias = "gtk_statusbar_new")]
897 pub fn new() -> Statusbar {
898 assert_initialized_main_thread!();
899 unsafe { Widget::from_glib_none(ffi::gtk_statusbar_new()).unsafe_cast() }
900 }
901
902 // rustdoc-stripper-ignore-next
903 /// Creates a new builder-pattern struct instance to construct [`Statusbar`] objects.
904 ///
905 /// This method returns an instance of [`StatusbarBuilder`](crate::builders::StatusbarBuilder) which can be used to create [`Statusbar`] objects.
906 pub fn builder() -> StatusbarBuilder {
907 StatusbarBuilder::new()
908 }
909}
910
911impl Default for Statusbar {
912 fn default() -> Self {
913 Self::new()
914 }
915}
916
917// rustdoc-stripper-ignore-next
918/// A [builder-pattern] type to construct [`Statusbar`] objects.
919///
920/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
921#[must_use = "The builder must be built to be used"]
922pub struct StatusbarBuilder {
923 builder: glib::object::ObjectBuilder<'static, Statusbar>,
924}
925
926impl StatusbarBuilder {
927 fn new() -> Self {
928 Self {
929 builder: glib::object::Object::builder(),
930 }
931 }
932
933 pub fn baseline_position(self, baseline_position: BaselinePosition) -> Self {
934 Self {
935 builder: self
936 .builder
937 .property("baseline-position", baseline_position),
938 }
939 }
940
941 pub fn homogeneous(self, homogeneous: bool) -> Self {
942 Self {
943 builder: self.builder.property("homogeneous", homogeneous),
944 }
945 }
946
947 pub fn spacing(self, spacing: i32) -> Self {
948 Self {
949 builder: self.builder.property("spacing", spacing),
950 }
951 }
952
953 pub fn border_width(self, border_width: u32) -> Self {
954 Self {
955 builder: self.builder.property("border-width", border_width),
956 }
957 }
958
959 pub fn child(self, child: &impl IsA<Widget>) -> Self {
960 Self {
961 builder: self.builder.property("child", child.clone().upcast()),
962 }
963 }
964
965 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
966 Self {
967 builder: self.builder.property("resize-mode", resize_mode),
968 }
969 }
970
971 pub fn app_paintable(self, app_paintable: bool) -> Self {
972 Self {
973 builder: self.builder.property("app-paintable", app_paintable),
974 }
975 }
976
977 pub fn can_default(self, can_default: bool) -> Self {
978 Self {
979 builder: self.builder.property("can-default", can_default),
980 }
981 }
982
983 pub fn can_focus(self, can_focus: bool) -> Self {
984 Self {
985 builder: self.builder.property("can-focus", can_focus),
986 }
987 }
988
989 pub fn events(self, events: gdk::EventMask) -> Self {
990 Self {
991 builder: self.builder.property("events", events),
992 }
993 }
994
995 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
996 pub fn expand(self, expand: bool) -> Self {
997 Self {
998 builder: self.builder.property("expand", expand),
999 }
1000 }
1001
1002 /// Whether the widget should grab focus when it is clicked with the mouse.
1003 ///
1004 /// This property is only relevant for widgets that can take focus.
1005 ///
1006 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1007 /// GtkComboBox) implemented this property individually.
1008 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1009 Self {
1010 builder: self.builder.property("focus-on-click", focus_on_click),
1011 }
1012 }
1013
1014 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1015 pub fn halign(self, halign: Align) -> Self {
1016 Self {
1017 builder: self.builder.property("halign", halign),
1018 }
1019 }
1020
1021 pub fn has_default(self, has_default: bool) -> Self {
1022 Self {
1023 builder: self.builder.property("has-default", has_default),
1024 }
1025 }
1026
1027 pub fn has_focus(self, has_focus: bool) -> Self {
1028 Self {
1029 builder: self.builder.property("has-focus", has_focus),
1030 }
1031 }
1032
1033 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1034 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1035 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1036 /// whether it will provide a tooltip or not.
1037 ///
1038 /// Note that setting this property to [`true`] for the first time will change
1039 /// the event masks of the GdkWindows of this widget to include leave-notify
1040 /// and motion-notify events. This cannot and will not be undone when the
1041 /// property is set to [`false`] again.
1042 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1043 Self {
1044 builder: self.builder.property("has-tooltip", has_tooltip),
1045 }
1046 }
1047
1048 pub fn height_request(self, height_request: i32) -> Self {
1049 Self {
1050 builder: self.builder.property("height-request", height_request),
1051 }
1052 }
1053
1054 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1055 pub fn hexpand(self, hexpand: bool) -> Self {
1056 Self {
1057 builder: self.builder.property("hexpand", hexpand),
1058 }
1059 }
1060
1061 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1062 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1063 Self {
1064 builder: self.builder.property("hexpand-set", hexpand_set),
1065 }
1066 }
1067
1068 pub fn is_focus(self, is_focus: bool) -> Self {
1069 Self {
1070 builder: self.builder.property("is-focus", is_focus),
1071 }
1072 }
1073
1074 /// Sets all four sides' margin at once. If read, returns max
1075 /// margin on any side.
1076 pub fn margin(self, margin: i32) -> Self {
1077 Self {
1078 builder: self.builder.property("margin", margin),
1079 }
1080 }
1081
1082 /// Margin on bottom side of widget.
1083 ///
1084 /// This property adds margin outside of the widget's normal size
1085 /// request, the margin will be added in addition to the size from
1086 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1087 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1088 Self {
1089 builder: self.builder.property("margin-bottom", margin_bottom),
1090 }
1091 }
1092
1093 /// Margin on end of widget, horizontally. This property supports
1094 /// left-to-right and right-to-left text directions.
1095 ///
1096 /// This property adds margin outside of the widget's normal size
1097 /// request, the margin will be added in addition to the size from
1098 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1099 pub fn margin_end(self, margin_end: i32) -> Self {
1100 Self {
1101 builder: self.builder.property("margin-end", margin_end),
1102 }
1103 }
1104
1105 /// Margin on start of widget, horizontally. This property supports
1106 /// left-to-right and right-to-left text directions.
1107 ///
1108 /// This property adds margin outside of the widget's normal size
1109 /// request, the margin will be added in addition to the size from
1110 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1111 pub fn margin_start(self, margin_start: i32) -> Self {
1112 Self {
1113 builder: self.builder.property("margin-start", margin_start),
1114 }
1115 }
1116
1117 /// Margin on top side of widget.
1118 ///
1119 /// This property adds margin outside of the widget's normal size
1120 /// request, the margin will be added in addition to the size from
1121 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1122 pub fn margin_top(self, margin_top: i32) -> Self {
1123 Self {
1124 builder: self.builder.property("margin-top", margin_top),
1125 }
1126 }
1127
1128 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1129 Self {
1130 builder: self.builder.property("name", name.into()),
1131 }
1132 }
1133
1134 pub fn no_show_all(self, no_show_all: bool) -> Self {
1135 Self {
1136 builder: self.builder.property("no-show-all", no_show_all),
1137 }
1138 }
1139
1140 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1141 /// more details about window opacity.
1142 ///
1143 /// Before 3.8 this was only available in GtkWindow
1144 pub fn opacity(self, opacity: f64) -> Self {
1145 Self {
1146 builder: self.builder.property("opacity", opacity),
1147 }
1148 }
1149
1150 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1151 Self {
1152 builder: self.builder.property("parent", parent.clone().upcast()),
1153 }
1154 }
1155
1156 pub fn receives_default(self, receives_default: bool) -> Self {
1157 Self {
1158 builder: self.builder.property("receives-default", receives_default),
1159 }
1160 }
1161
1162 pub fn sensitive(self, sensitive: bool) -> Self {
1163 Self {
1164 builder: self.builder.property("sensitive", sensitive),
1165 }
1166 }
1167
1168 /// Sets the text of tooltip to be the given string, which is marked up
1169 /// with the [Pango text markup language][PangoMarkupFormat].
1170 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1171 ///
1172 /// This is a convenience property which will take care of getting the
1173 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1174 /// will automatically be set to [`true`] and there will be taken care of
1175 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1176 ///
1177 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1178 /// are set, the last one wins.
1179 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1180 Self {
1181 builder: self
1182 .builder
1183 .property("tooltip-markup", tooltip_markup.into()),
1184 }
1185 }
1186
1187 /// Sets the text of tooltip to be the given string.
1188 ///
1189 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1190 ///
1191 /// This is a convenience property which will take care of getting the
1192 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1193 /// will automatically be set to [`true`] and there will be taken care of
1194 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1195 ///
1196 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1197 /// are set, the last one wins.
1198 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1199 Self {
1200 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1201 }
1202 }
1203
1204 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1205 pub fn valign(self, valign: Align) -> Self {
1206 Self {
1207 builder: self.builder.property("valign", valign),
1208 }
1209 }
1210
1211 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1212 pub fn vexpand(self, vexpand: bool) -> Self {
1213 Self {
1214 builder: self.builder.property("vexpand", vexpand),
1215 }
1216 }
1217
1218 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1219 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1220 Self {
1221 builder: self.builder.property("vexpand-set", vexpand_set),
1222 }
1223 }
1224
1225 pub fn visible(self, visible: bool) -> Self {
1226 Self {
1227 builder: self.builder.property("visible", visible),
1228 }
1229 }
1230
1231 pub fn width_request(self, width_request: i32) -> Self {
1232 Self {
1233 builder: self.builder.property("width-request", width_request),
1234 }
1235 }
1236
1237 /// The orientation of the orientable.
1238 pub fn orientation(self, orientation: Orientation) -> Self {
1239 Self {
1240 builder: self.builder.property("orientation", orientation),
1241 }
1242 }
1243
1244 // rustdoc-stripper-ignore-next
1245 /// Build the [`Statusbar`].
1246 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1247 pub fn build(self) -> Statusbar {
1248 self.builder.build()
1249 }
1250}
1251
1252mod sealed {
1253 pub trait Sealed {}
1254 impl<T: super::IsA<super::Statusbar>> Sealed for T {}
1255}
1256
1257/// Trait containing all [`struct@Statusbar`] methods.
1258///
1259/// # Implementors
1260///
1261/// [`Statusbar`][struct@crate::Statusbar]
1262pub trait StatusbarExt: IsA<Statusbar> + sealed::Sealed + 'static {
1263 /// Returns a new context identifier, given a description
1264 /// of the actual context. Note that the description is
1265 /// not shown in the UI.
1266 /// ## `context_description`
1267 /// textual description of what context
1268 /// the new message is being used in
1269 ///
1270 /// # Returns
1271 ///
1272 /// an integer id
1273 #[doc(alias = "gtk_statusbar_get_context_id")]
1274 #[doc(alias = "get_context_id")]
1275 fn context_id(&self, context_description: &str) -> u32 {
1276 unsafe {
1277 ffi::gtk_statusbar_get_context_id(
1278 self.as_ref().to_glib_none().0,
1279 context_description.to_glib_none().0,
1280 )
1281 }
1282 }
1283
1284 /// Retrieves the box containing the label widget.
1285 ///
1286 /// # Returns
1287 ///
1288 /// a [`Box`][crate::Box]
1289 #[doc(alias = "gtk_statusbar_get_message_area")]
1290 #[doc(alias = "get_message_area")]
1291 fn message_area(&self) -> Option<Box> {
1292 unsafe {
1293 from_glib_none(ffi::gtk_statusbar_get_message_area(
1294 self.as_ref().to_glib_none().0,
1295 ))
1296 }
1297 }
1298
1299 /// Removes the first message in the [`Statusbar`][crate::Statusbar]’s stack
1300 /// with the given context id.
1301 ///
1302 /// Note that this may not change the displayed message, if
1303 /// the message at the top of the stack has a different
1304 /// context id.
1305 /// ## `context_id`
1306 /// a context identifier
1307 #[doc(alias = "gtk_statusbar_pop")]
1308 fn pop(&self, context_id: u32) {
1309 unsafe {
1310 ffi::gtk_statusbar_pop(self.as_ref().to_glib_none().0, context_id);
1311 }
1312 }
1313
1314 /// Pushes a new message onto a statusbar’s stack.
1315 /// ## `context_id`
1316 /// the message’s context id, as returned by
1317 /// [`context_id()`][Self::context_id()]
1318 /// ## `text`
1319 /// the message to add to the statusbar
1320 ///
1321 /// # Returns
1322 ///
1323 /// a message id that can be used with
1324 /// [`remove()`][Self::remove()].
1325 #[doc(alias = "gtk_statusbar_push")]
1326 fn push(&self, context_id: u32, text: &str) -> u32 {
1327 unsafe {
1328 ffi::gtk_statusbar_push(
1329 self.as_ref().to_glib_none().0,
1330 context_id,
1331 text.to_glib_none().0,
1332 )
1333 }
1334 }
1335
1336 /// Forces the removal of a message from a statusbar’s stack.
1337 /// The exact `context_id` and `message_id` must be specified.
1338 /// ## `context_id`
1339 /// a context identifier
1340 /// ## `message_id`
1341 /// a message identifier, as returned by [`push()`][Self::push()]
1342 #[doc(alias = "gtk_statusbar_remove")]
1343 fn remove(&self, context_id: u32, message_id: u32) {
1344 unsafe {
1345 ffi::gtk_statusbar_remove(self.as_ref().to_glib_none().0, context_id, message_id);
1346 }
1347 }
1348
1349 /// Forces the removal of all messages from a statusbar's
1350 /// stack with the exact `context_id`.
1351 /// ## `context_id`
1352 /// a context identifier
1353 #[doc(alias = "gtk_statusbar_remove_all")]
1354 fn remove_all(&self, context_id: u32) {
1355 unsafe {
1356 ffi::gtk_statusbar_remove_all(self.as_ref().to_glib_none().0, context_id);
1357 }
1358 }
1359
1360 /// Is emitted whenever a new message is popped off a statusbar's stack.
1361 /// ## `context_id`
1362 /// the context id of the relevant message/statusbar
1363 /// ## `text`
1364 /// the message that was just popped
1365 #[doc(alias = "text-popped")]
1366 fn connect_text_popped<F: Fn(&Self, u32, &str) + 'static>(&self, f: F) -> SignalHandlerId {
1367 unsafe extern "C" fn text_popped_trampoline<
1368 P: IsA<Statusbar>,
1369 F: Fn(&P, u32, &str) + 'static,
1370 >(
1371 this: *mut ffi::GtkStatusbar,
1372 context_id: libc::c_uint,
1373 text: *mut libc::c_char,
1374 f: glib::ffi::gpointer,
1375 ) {
1376 let f: &F = &*(f as *const F);
1377 f(
1378 Statusbar::from_glib_borrow(this).unsafe_cast_ref(),
1379 context_id,
1380 &glib::GString::from_glib_borrow(text),
1381 )
1382 }
1383 unsafe {
1384 let f: Box_<F> = Box_::new(f);
1385 connect_raw(
1386 self.as_ptr() as *mut _,
1387 b"text-popped\0".as_ptr() as *const _,
1388 Some(transmute::<_, unsafe extern "C" fn()>(
1389 text_popped_trampoline::<Self, F> as *const (),
1390 )),
1391 Box_::into_raw(f),
1392 )
1393 }
1394 }
1395
1396 /// Is emitted whenever a new message gets pushed onto a statusbar's stack.
1397 /// ## `context_id`
1398 /// the context id of the relevant message/statusbar
1399 /// ## `text`
1400 /// the message that was pushed
1401 #[doc(alias = "text-pushed")]
1402 fn connect_text_pushed<F: Fn(&Self, u32, &str) + 'static>(&self, f: F) -> SignalHandlerId {
1403 unsafe extern "C" fn text_pushed_trampoline<
1404 P: IsA<Statusbar>,
1405 F: Fn(&P, u32, &str) + 'static,
1406 >(
1407 this: *mut ffi::GtkStatusbar,
1408 context_id: libc::c_uint,
1409 text: *mut libc::c_char,
1410 f: glib::ffi::gpointer,
1411 ) {
1412 let f: &F = &*(f as *const F);
1413 f(
1414 Statusbar::from_glib_borrow(this).unsafe_cast_ref(),
1415 context_id,
1416 &glib::GString::from_glib_borrow(text),
1417 )
1418 }
1419 unsafe {
1420 let f: Box_<F> = Box_::new(f);
1421 connect_raw(
1422 self.as_ptr() as *mut _,
1423 b"text-pushed\0".as_ptr() as *const _,
1424 Some(transmute::<_, unsafe extern "C" fn()>(
1425 text_pushed_trampoline::<Self, F> as *const (),
1426 )),
1427 Box_::into_raw(f),
1428 )
1429 }
1430 }
1431}
1432
1433impl<O: IsA<Statusbar>> StatusbarExt for O {}
1434
1435impl fmt::Display for Statusbar {
1436 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1437 f.write_str("Statusbar")
1438 }
1439}