CheckMenuItem
Object Hierarchy:
Description:
[ CCode ( type_id = "gtk_check_menu_item_get_type ()" ) ]
public class CheckMenuItem : MenuItem, Implementor, Actionable, Activatable, Buildable
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.MenuItem
All known members inherited from class Gtk.Bin
All known members inherited from class Gtk.Container
All known members inherited from class Gtk.Widget
All known members inherited from class GLib.Object
All known members inherited from interface Atk.Implementor
All known members inherited from interface Gtk.Actionable
All known members inherited from interface Gtk.Activatable
All known members inherited from interface Gtk.Buildable