CheckMenuItem


Object Hierarchy:

Gtk.CheckMenuItem Gtk.CheckMenuItem Gtk.CheckMenuItem Gtk.MenuItem Gtk.MenuItem Gtk.MenuItem->Gtk.CheckMenuItem Gtk.Bin Gtk.Bin Gtk.Bin->Gtk.MenuItem Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.Widget Gtk.Widget Gtk.Widget->Gtk.Container GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Atk.Implementor Atk.Implementor Atk.Implementor->Gtk.CheckMenuItem Atk.Implementor->Gtk.MenuItem Atk.Implementor->Gtk.Bin Atk.Implementor->Gtk.Container Atk.Implementor->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.CheckMenuItem Gtk.Buildable->Gtk.MenuItem Gtk.Buildable->Gtk.Bin Gtk.Buildable->Gtk.Container Gtk.Buildable->Gtk.Widget Gtk.Actionable Gtk.Actionable Gtk.Actionable->Gtk.CheckMenuItem Gtk.Actionable->Gtk.MenuItem Gtk.Activatable Gtk.Activatable Gtk.Activatable->Gtk.CheckMenuItem Gtk.Activatable->Gtk.MenuItem

Description:

[ CCode ( type_id = "gtk_check_menu_item_get_type ()" ) ]
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

menuitem
├── 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", item_option.active.to_string ());
});
}

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

Content:

Properties:

Creation methods:

Methods:

Signals:

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