Gtk2::ToggleButton(3)
π Gtk2::ToggleButton π
okay so bestie, this is Gtk2::ToggleButton β it's the Perl wrapper for GtkToggleButton, which is literally just a button that stays pressed in when you click it. like a light switch but make it β¨fashionβ¨. it's from the gtk2-perl docs (User Contributed Perl Documentation, if we're being official about it). periodt. π
πΈ HIERARCHY πΈ
so here's the family tree, and yes she comes from a long line of icons. every ancestor listed here is a real class she inherits from, don't skip a single one:
Glib::Object
+----Glib::InitiallyUnowned
+----Gtk2::Object
+----Gtk2::Widget
+----Gtk2::Container
+----Gtk2::Bin
+----Gtk2::Button
+----Gtk2::ToggleButton
π¦ INTERFACES π¦
she also implements these, no big deal:
Glib::Object::_Unregistered::AtkImplementorIfaceGtk2::BuildableGtk2::Activatable
β¨ METHODS β¨
π making one (constructors)
widget = Gtk2::ToggleButton->new ($label=undef)β makes you a brand new toggle button.$labelis a string, and it defaults toundef.$label(string)
widget = Gtk2::ToggleButton->new_with_label ($label=undef)β same vibe, but she's built with a label from the jump.$labelis a string, defaults toundef.$label(string)
widget = Gtk2::ToggleButton->new_with_mnemonic ($label=undef)β label with a mnemonic (you know, the little underscore keyboard shortcut thing, iykyk).$labelis a string, defaults toundef.$label(string)
π«Ά the getters and setters
boolean = $toggle_button->get_activeβ tells you if she's currently pressed in or not.$toggle_button->set_active ($is_active)β sets whether she's pressed in or not.$is_active(boolean)
boolean = $toggle_button->get_inconsistentβ asks if she's in that weird "in between" state.$toggle_button->set_inconsistent ($setting)β puts her in (or out of) that in-between state.$setting(boolean)
boolean = $toggle_button->get_modeβ tells you whether she's drawing the toggle indicator part.$toggle_button->set_mode ($draw_indicator)β sets whether the toggle part gets drawn.$draw_indicator(boolean)
π the signal-ish one
$toggle_button->toggledβ yeah, this one's here in METHODS. it's a thing you call, that's all we're told, don't come for me.
π PROPERTIES π
all three of these are boolean, all three default to false, and all three are readable / writable / private / static-nick / static-blurb. iconic consistency honestly:
'active'(boolean : default false : readable / writable / private / static-nick / static-blurb) β If the toggle button should be pressed in or not'draw-indicator'(boolean : default false : readable / writable / private / static-nick / static-blurb) β If the toggle part of the button is displayed'inconsistent'(boolean : default false : readable / writable / private / static-nick / static-blurb) β If the toggle button is in an "in between" state
π SIGNALS π
toggled(Gtk2::ToggleButton) β the glow-up moment when the state flips. main character energy fr fr.
π₯ SEE ALSO π₯
go read these next, bestie, they're all part of the family:
Gtk2Glib::ObjectGlib::InitiallyUnownedGtk2::ObjectGtk2::WidgetGtk2::ContainerGtk2::BinGtk2::Button
π COPYRIGHT π
Copyright (C) 2003-2011 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.
ngl, that's the whole page. every option, every default, every flag β all accounted for. no cap. π
and that's a wrap, my love π this little beauty came to you courtesy of perl v5.42.0, dated 2025-07-25, and the page name is Gtk2::ToggleButton(3). go toggle something and slay π
β¨π§
π¦ 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