Gtk2::ToggleButton(3)

πŸ“¦
version 1.24993 Β· 2 versions
, in fedora 43

πŸ’– 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::AtkImplementorIface
  • Gtk2::Buildable
  • Gtk2::Activatable

✨ METHODS ✨

πŸŽ€ making one (constructors)

  • widget = Gtk2::ToggleButton->new ($label=undef) β€” makes you a brand new toggle button. $label is a string, and it defaults to undef.
    • $label (string)
  • widget = Gtk2::ToggleButton->new_with_label ($label=undef) β€” same vibe, but she's built with a label from the jump. $label is a string, defaults to undef.
    • $label (string)
  • widget = Gtk2::ToggleButton->new_with_mnemonic ($label=undef) β€” label with a mnemonic (you know, the little underscore keyboard shortcut thing, iykyk). $label is a string, defaults to undef.
    • $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:

  • Gtk2
  • Glib::Object
  • Glib::InitiallyUnowned
  • Gtk2::Object
  • Gtk2::Widget
  • Gtk2::Container
  • Gtk2::Bin
  • Gtk2::Button

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