Object Hierarchy:

Object hierarchy for CheckMenuItem


public class CheckMenuItem : MenuItem, Implementor, Actionable, Activatable, Buildable

A CheckMenuItem is a menu item that maintains the state of a boolean value in addition to a MenuItem usual role in activating application code.

A check box indicating the state of the boolean value is displayed at the left side of the MenuItem. Activating the MenuItem toggles the value.

CSS nodes

├── check.left
╰── <child>
nuItem has a main CSS node with name menuitem, and a subnode with name check, which gets the .left or .right style class.

Example: CheckMenuItem:

public class Application : Gtk.Window {
public Application () {
// Prepare Gtk.Window:
this.title = "My Gtk.CheckMenuItem";
this.window_position = Gtk.WindowPosition.CENTER;
this.destroy.connect (Gtk.main_quit);

// MenuBar:
Gtk.MenuBar bar = new Gtk.MenuBar ();
this.add (bar);

// File:
Gtk.MenuItem item_file = new Gtk.MenuItem.with_label ("File");
bar.add (item_file);

Gtk.Menu filemenu = new Gtk.Menu ();
item_file.set_submenu (filemenu);

Gtk.CheckMenuItem item_option = new Gtk.CheckMenuItem.with_label ("My Option");
item_option.set_active (true);
filemenu.add (item_option);

item_option.toggled.connect (() => {
print ("%s\n", ());

public static int main (string[] args) {
Gtk.init (ref args);

Application app = new Application ();
app.show_all ();
Gtk.main ();
return 0;

valac --pkg gtk+-3.0 Gtk.CheckMenuItem.vala

All known sub-classes:

Namespace: Gtk
Package: gtk+-3.0



Creation methods:



Inherited Members:

All known members inherited from class Gtk.Bin
All known members inherited from class Gtk.Widget
All known members inherited from interface Atk.Implementor