Gtk2::C...MenuItem(3)
π 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::AtkImplementorIfaceGtk2::BuildableGtk2::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 toundef, 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 setinconsistent, 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 thetoggledsignal. 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 number13. β
π 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 π
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
- 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