Gnome::Gtk4::Statusbar
Description
A Gnome::Gtk4::Statusbar widget is usually placed along the bottom of an application's main Gnome::Gtk4::Window.
A GtkStatusBar may provide a regular commentary of the application's status (as is usually the case in a web browser, for example), or may be used to simply output a message when the status changes, (when an upload is complete in an FTP client, for example).
Status bars in GTK maintain a stack of messages. The message at the top of the each bar’s stack is the one that will currently be displayed.
Any messages added to a statusbar’s stack must specify a context id that is used to uniquely identify the source of a message. This context id can be generated by .get-context-id()
, given a message and the statusbar that it will be added to. Note that messages are stored in a stack, and when choosing which message to display, the stack structure is adhered to, regardless of the context identifier of a message.
One could say that a statusbar maintains one stack of messages for display purposes, but allows multiple message producers to maintain sub-stacks of the messages they produced (via context ids).
Status bars are created using .newstatusbar()
.
Messages are added to the bar’s stack with .push()
.
The message at the top of the stack can be removed using .pop()
. A message can be removed from anywhere in the stack if its message id was recorded at the time it was added. This is done using .remove()
.
CSS node
Gnome::Gtk4::Statusbar has a single CSS node with name statusbar.
Class initialization
Note: The native version of this class is deprecated in gtk4-lib() since version 4.10
new
:native-object
Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.
multi method new ( N-Object :$native-object! )
new-statusbar
Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10
Creates a new Gnome::Gtk4::Statusbar ready for messages.
method new-statusbar ( --> Gnome::Gtk4::Statusbar \)
Methods
get-context-id
Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10
Returns a new context identifier, given a description of the actual context.
Note that the description is not shown in the UI.
method get-context-id ( Str $context-description --> UInt )
$context-description; textual description of what context the new message is being used in.
Return value; an integer id.
pop
Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10
Removes the first message in the Gnome::Gtk4::Statusbar’s stack with the given context id.
Note that this may not change the displayed message, if the message at the top of the stack has a different context id.
method pop ( UInt() $context-id )
$context-id; a context identifier.
push
Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10
Pushes a new message onto a statusbar’s stack.
method push ( UInt() $context-id, Str $text --> UInt )
$context-id; the message’s context id, as returned by
.get-context-id()
.$text; the message to add to the statusbar.
Return value; a message id that can be used with .remove()
..
remove
Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10
Forces the removal of a message from a statusbar’s stack. The exact $context-id
and $message-id
must be specified.
method remove ( UInt() $context-id, UInt() $message-id )
$context-id; a context identifier.
$message-id; a message identifier, as returned by
.push()
.
remove-all
Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10
Forces the removal of all messages from a statusbar's stack with the exact $context-id
.
method remove-all ( UInt() $context-id )
$context-id; a context identifier.
Signals
text-popped
Emitted whenever a new message is popped off a statusbar's stack.
method handler ( guint $context-id, Str $text, Int :$_handle_id, N-GObject :$_native-object, Gnome::Gtk4::Statusbar :$_widget, *C<user>-options )
$context-id; the context id of the relevant message/statusbar.
$text; the message that was just popped.
$_handle_id; The registered event handler id.
$_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::Statusbar object.
$_widget; The object which registered the signal. User code may have left the object going out of scope.
user
-options; A list of named arguments provided at the.register-signal()
method from Gnome::GObject::Object.
text-pushed
Emitted whenever a new message gets pushed onto a statusbar's stack.
method handler ( guint $context-id, Str $text, Int :$_handle_id, N-GObject :$_native-object, Gnome::Gtk4::Statusbar :$_widget, *C<user>-options )
$context-id; the context id of the relevant message/statusbar.
$text; the message that was pushed.
$_handle_id; The registered event handler id.
$_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::Statusbar object.
$_widget; The object which registered the signal. User code may have left the object going out of scope.
user
-options; A list of named arguments provided at the.register-signal()
method from Gnome::GObject::Object.