Gtk2::InfoBar(3)
π Gtk2::InfoBar π
okay bestie, gather round, because this is Gtk2::InfoBar β the Perl wrapper for GtkInfoBar, aka the little strip of "hey, something happened!" that slides into your window and hands you buttons to deal with it. It's giving notification-bar realness. No cap.
π¦ HIERARCHY
so here's the family tree, and yes it's a whole lineage:
Glib::Object
+----Glib::InitiallyUnowned
+----Gtk2::Object
+----Gtk2::Widget
+----Gtk2::Container
+----Gtk2::Box
+----Gtk2::HBox
+----Gtk2::InfoBar
look at all those ancestors. main character energy inherited from literally every single one of them. π
β¨ INTERFACES
these are the interfaces it implements, and yes you need to know them:
Glib::Object::_Unregistered::AtkImplementorIfaceGtk2::BuildableGtk2::Orientable
π METHODS
$widget = Gtk2::InfoBar->new;
$widget = Gtk2::InfoBar->new (...)
...(list) of button-text => response-id pairs.
the multi-argument form takes the exact same list of text => response-id pairs as $infobar->add_buttons. do NOT pack widgets directly into the infobar β put them in $infobar->get_content_area () instead, bestie, I am begging. π
here's a simple example, and yes you can copy it:
$infobar = Gtk2::InfoBar->new ('gtk-ok' => 'accept',
'gtk-cancel' => 'reject');
$widget = Gtk2::InfoBar->new_with_buttons (...)
...(list) of button-text => response-id pairs.
this is just an alias for the multi-argument version of Gtk2::InfoBar->new. same vibe, different name. β¨
widget = $info_bar->get_action_area
grabs you the action area. that's it, that's the method.
$info_bar->add_action_widget ($child, $response_id)
$child(Gtk2::Widget)$response_id(Gtk2::ResponseType)
widget = $info_bar->add_button ($button_text, $response_id)
$button_text(string)$response_id(scalar)
$info_bar->add_buttons (...)
...(list) of button-text => response-id pairs
it's like calling $infobar->add_button over and over, except you don't get the created widgets back. the buttons go left to right, so the first button you add is the left-most one. order matters, bestie. π
widget = $info_bar->get_content_area
yep, this is the one you're supposed to put your actual widgets into. get_content_area supremacy. π«Ά
$info_bar->set_default_response ($response_id)
$response_id(Gtk2::ResponseType)
messagetype = $info_bar->get_message_type
$info_bar->set_message_type ($type)
$type(Gtk2::MessageType)
$info_bar->response ($response_id)
$response_id(Gtk2::ResponseType)
$info_bar->set_response_sensitive ($response_id, $setting)
$response_id(Gtk2::ResponseType)$setting(boolean)
enable or disable an action button by its $response_id. greyed out and unclickable, iconic behaviour honestly.
πΈ PROPERTIES
'message-type'(Gtk2::MessageType: default"info": readable / writable / construct / private / static-nick / static-blurb) β the type of message
π§ STYLE PROPERTIES
'action-area-border'(integer : default5: readable / private / static-nick / static-blurb) β width of border around the action area'button-spacing'(integer : default6: readable / private / static-nick / static-blurb) β spacing between buttons'content-area-border'(integer : default8: readable / private / static-nick / static-blurb) β width of border around the content area'content-area-spacing'(integer : default16: readable / private / static-nick / static-blurb) β spacing between elements of the area
π SIGNALS
close(Gtk2::InfoBar)response(Gtk2::InfoBar, integer)
okay now pay attention because this part is lowkey important. currently, in a Perl subclass of Gtk2::InfoBar, a class closure β meaning a class default signal handler β for the response signal will be called with the response ID just as an integer. it is NOT turned into an enum string like "ok" the way a handler you set up with signal_connect receives it. π
hopefully this will change in the future, so don't count on it. in the interim, the easiest thing to do is install your default handler in INIT_INSTANCE with a signal_connect. (the subtleties of what order handlers are called in will differ, but often that doesn't matter.) π«Ά
π ENUMS AND FLAGS
enum Gtk2::MessageType
'info'/GTK_MESSAGE_INFO'warning'/GTK_MESSAGE_WARNING'question'/GTK_MESSAGE_QUESTION'error'/GTK_MESSAGE_ERROR'other'/GTK_MESSAGE_OTHER
enum Gtk2::ResponseType
okay so the response type is somewhat abnormal as far as gtk2-perl enums go, and I need you to hear me on this. in C, this enum lists named, predefined integer values for a field that is otherwise composed of whatever integer values you like. in Perl, we allow this to be either one of the string constants listed here or any positive integer value. for example, 'ok', 'cancel', 4, and 42 are all valid response ids. you cannot use arbitrary string values β they must be integers. be careful, because unknown string values tend to be mapped to 0. π
'none'/GTK_RESPONSE_NONE'reject'/GTK_RESPONSE_REJECT'accept'/GTK_RESPONSE_ACCEPT'delete-event'/GTK_RESPONSE_DELETE_EVENT'ok'/GTK_RESPONSE_OK'cancel'/GTK_RESPONSE_CANCEL'close'/GTK_RESPONSE_CLOSE'yes'/GTK_RESPONSE_YES'no'/GTK_RESPONSE_NO'apply'/GTK_RESPONSE_APPLY'help'/GTK_RESPONSE_HELP
π SEE ALSO
go read these next, they're all part of the lore:
Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container, Gtk2::Box, Gtk2::HBox
π COPYRIGHT
Copyright (C) 2003-2011 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.
and that's the whole page, bestie, you ate that. this was Gtk2::InfoBar(3) from the User Contributed Perl Documentation, perl v5.42.0, dated 2025-07-25 β periodt. πβ¨π
π¦ where this page comes from
- fedora 43: perl-Gtk2 1.24993-23.fc43 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms