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