CheckButton


Object Hierarchy:

Gtk.CheckButton Gtk.CheckButton Gtk.CheckButton Gtk.ToggleButton Gtk.ToggleButton Gtk.ToggleButton->Gtk.CheckButton Gtk.Button Gtk.Button Gtk.Button->Gtk.ToggleButton Gtk.Bin Gtk.Bin Gtk.Bin->Gtk.Button 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.CheckButton Atk.Implementor->Gtk.ToggleButton Atk.Implementor->Gtk.Button Atk.Implementor->Gtk.Bin Atk.Implementor->Gtk.Container Atk.Implementor->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.CheckButton Gtk.Buildable->Gtk.ToggleButton Gtk.Buildable->Gtk.Button Gtk.Buildable->Gtk.Bin Gtk.Buildable->Gtk.Container Gtk.Buildable->Gtk.Widget Gtk.Actionable Gtk.Actionable Gtk.Actionable->Gtk.CheckButton Gtk.Actionable->Gtk.ToggleButton Gtk.Actionable->Gtk.Button Gtk.Activatable Gtk.Activatable Gtk.Activatable->Gtk.CheckButton Gtk.Activatable->Gtk.ToggleButton Gtk.Activatable->Gtk.Button

Description:

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

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