Gtk2::C...MenuItem(3)

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

πŸ’– Gtk2::CheckMenuItem β€” okay bestie, let's talk checkboxes in your menus πŸ’–

So this is a page from the User Contributed Perl Documentation set β€” it's the manual for Gtk2::CheckMenuItem, which is literally just a wrapper for GtkCheckMenuItem. You know those little menu entries with a lil checkmark next to them? Yeah. That's her. πŸ‘‘


🌸 NAME 🌸

Gtk2::CheckMenuItem β€” a wrapper for GtkCheckMenuItem. That's the whole vibe. A menu item that can be checked, unchecked, and sometimes goes through an existential crisis and picks the third option (we'll get to that, it's called "inconsistent" and honestly same).


πŸ¦‹ HIERARCHY πŸ¦‹

Here's her family tree, her lineage, her ancestry.com results. She did NOT come from nothing:

Glib::Object
+----Glib::InitiallyUnowned
     +----Gtk2::Object
          +----Gtk2::Widget
               +----Gtk2::Container
                    +----Gtk2::Bin
                         +----Gtk2::Item
                              +----Gtk2::MenuItem
                                   +----Gtk2::CheckMenuItem

Six generations deep and still serving looks. The audacity. πŸ’…


✨ INTERFACES ✨

These are the roles she plays, the hats she wears, the extracurriculars on her college app:

  • Glib::Object::_Unregistered::AtkImplementorIface
  • Gtk2::Buildable
  • Gtk2::Activatable

πŸŽ€ METHODS πŸŽ€

Okay here's the good part, the actual buttons you get to press. Sit down, hydrate, let's go. πŸ“


🌟 Making a whole new one

  • widget = Gtk2::CheckMenuItem->new ($label=undef) β€” builds you a fresh check menu item from scratch, no cap.
    • $label (string) β€” the text that shows up on it. It's optional, defaults to undef, so you can be mysterious and label-less if that's your era.
  • widget = Gtk2::CheckMenuItem->new_with_label ($label=undef) β€” same deal, but the label is explicitly a label. You're being clear about your intentions, we love that for you.
    • $label (string)
  • widget = Gtk2::CheckMenuItem->new_with_mnemonic ($label=undef) β€” same, except the label can have a mnemonic in it (you know, the underscore thing that gives you a keyboard shortcut). Keyboard girlies rise up. ⌨️
    • $label (string)

🌈 Is she checked or not

  • boolean = $check_menu_item->get_active β€” tells you if the item is currently checked. Returns a boolean, so true or false, no in-between (unless you set inconsistent, in which case, chaos).
  • $check_menu_item->set_active ($is_active) β€” checks or unchecks the thing.
    • $is_active (boolean)

πŸ¦„ The radio cosplay

  • boolean = $check_menu_item->get_draw_as_radio β€” tells you whether she's dressed like a radio menu item.
Since: gtk+ 2.4
  • $check_menu_item->set_draw_as_radio ($draw_as_radio) β€” makes her look like a radio menu item even though she's fundamentally a check item. It's giving costume party. It's giving method acting.
    • $draw_as_radio (boolean)
Since: gtk+ 2.4

πŸ’€ The inconsistent era

  • boolean = $check_menu_item->get_inconsistent β€” reads back that third state, the "not checked, not unchecked, we simply don't know" state.
  • $check_menu_item->set_inconsistent ($setting) β€” turns that undefined middle-ground state on or off. It's for when your checkboxes are going through it. 😭
    • $setting (boolean)

🫢 Showing the toggle

  • $menu_item->set_show_toggle ($always) β€” controls whether the toggle indicator is shown.
    • $always (boolean)
Heads up bestie β€” this one is called on $menu_item, not $check_menu_item. Copy the call exactly, don't freestyle. πŸ’…

πŸ”₯ The signal-y one

  • $check_menu_item->toggled β€” fires off the toggled signal. See the SIGNALS section below, she gets her own spotlight.

πŸ‘‘ PROPERTIES πŸ‘‘

Properties, aka the settings panel of her soul:

  • 'active' (boolean : default false : readable / writable / private / static-nick / static-blurb) β€” Whether the menu item is checked.
  • 'draw-as-radio' (boolean : default false : readable / writable / private / static-nick / static-blurb) β€” Whether the menu item looks like a radio menu item.
  • 'inconsistent' (boolean : default false : readable / writable / private / static-nick / static-blurb) β€” Whether to display an "inconsistent" state.

🧚 STYLE PROPERTIES 🧚

The glam squad. The fitting room. The styling details:

  • 'indicator-size' (integer : default 13 : readable / private / static-nick / static-blurb) β€” Size of check or radio indicator. Thirteen. That's the default. Remember the number 13. ⭐

πŸ’œ SIGNALS πŸ’œ

  • toggled (Gtk2::CheckMenuItem) β€” the signal that goes off when she gets toggled. This is her main character moment, fr fr.

🎯 SEE ALSO 🎯

Go read these too, they're all in her orbit:

Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container, Gtk2::Bin, Gtk2::Item, Gtk2::MenuItem


Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Gtk2 for a full notice.


okay that's the whole page bestie, you ate that πŸ’…βœ¨

This one's from perl v5.42.0, dated 2025-07-25, and it lives at Gtk2::C...MenuItem(3) β€” go forth and check those menu items, you've got this 🫢🌸

πŸ“¦ where this page comes from