CheckButton


Object Hierarchy:

Object hierarchy for CheckButton

Description:

public class CheckButton : ToggleButton, Implementor, Actionable, Activatable, Buildable

A CheckButton places a discrete ToggleButton next to a widget, (usually a Label).

See the section on ToggleButton widgets for more information about toggle/check buttons.

The important signal ( toggled ) is also inherited from ToggleButton.

CSS nodes

checkbutton
├── check
╰── <child>
Button with indicator (see set_mode) has a main CSS node with name checkbutton and a subnode with name check.

button.check
├── check
╰── <child>
Button without indicator changes the name of its main node to button and adds a .check style class to it. The subnode is invisible in this case.

GtkCheckButton

Example: CheckButton:

public class Application : Gtk.Window {
private int click_counter = 0;

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

// The CheckButton:
Gtk.CheckButton button = new Gtk.CheckButton.with_label ("Click me (0)");
this.add (button);

button.toggled.connect (() => {
// Emitted when the button has been clicked:
if (button.active) {
// Button is checked
this.click_counter++;
} else {
// Button is not checked
this.click_counter--;
}
button.label = "Click me (%d)".printf (this.click_counter);
});
}

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.CheckButton.vala

All known sub-classes:

Namespace: Gtk
Package: gtk+-3.0

Content:

Creation methods:

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