## GtkCheckButton GtkCheckButton — Create widgets with a discrete toggle button |

## Functions

GtkWidget * | gtk_check_button_new ()
GtkWidget * | gtk_check_button_new_with_label ()
GtkWidget * | gtk_check_button_new_with_mnemonic ()
gboolean | gtk_check_button_get_draw_indicator ()
void | gtk_check_button_set_draw_indicator ()
gboolean | gtk_check_button_get_inconsistent ()
void | gtk_check_button_set_inconsistent ()

## Properties

gboolean | draw-indicator | Read / Write
gboolean | inconsistent | Read / Write

## Types and Values

struct | GtkCheckButton

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkButton
                    ╰── GtkToggleButton
                        ╰── GtkCheckButton
                            ╰── GtkRadioButton

## Implemented Interfaces

GtkCheckButton implements AtkImplementorIface, GtkBuildable, GtkConstraintTarget and GtkActionable.

## Includes

    #include <gtk/gtk.h>

## Description

A GtkCheckButton places a discrete GtkToggleButton next to a widget, (usually a GtkLabel). See the section on GtkToggleButton widgets for more information about toggle/check buttons.

The important signal ( “toggled” ) is also inherited from GtkToggleButton.

### CSS nodes

    1
    2
    3
    checkbutton
    ├── check
    ╰── <child>

A GtkCheckButton with indicator (see `gtk_check_button_set_draw_indicator()`) has a main CSS node with name checkbutton and a subnode with name check.

    1
    2
    3
    button.check
    ├── check
    ╰── <child>

A GtkCheckButton 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.

## Functions

### gtk_check_button_new ()

    GtkWidget *
    gtk_check_button_new (void);

Creates a new GtkCheckButton.

#### Returns

a GtkWidget.

### gtk_check_button_new_with_label ()

    GtkWidget *
    gtk_check_button_new_with_label (const gchar *label);

Creates a new GtkCheckButton with a GtkLabel to the right of it.

#### Parameters

label | the text for the check button. |

#### Returns

a GtkWidget.

### gtk_check_button_new_with_mnemonic ()

    GtkWidget *
    gtk_check_button_new_with_mnemonic (const gchar *label);

Creates a new GtkCheckButton containing a label. The label will be created using `gtk_label_new_with_mnemonic()`, so underscores in `label` indicate the mnemonic for the check button.

#### Parameters

label | The text of the button, with an underscore in front of the mnemonic character |

#### Returns

a new GtkCheckButton

### gtk_check_button_get_draw_indicator ()

    gboolean
    gtk_check_button_get_draw_indicator (GtkCheckButton *check_button);

Returns Whether or not the indicator part of the button gets drawn.

#### Parameters

check_button | a GtkCheckButton |

#### Returns

The value of the GtkCheckButton:draw-indicator property.

### gtk_check_button_set_draw_indicator ()

    void
    gtk_check_button_set_draw_indicator (GtkCheckButton *check_button,
                                         gboolean draw_indicator);

Sets whether the indicator part of the button is drawn. This is important for cases where the check button should have the functinality of a check button, but the visuals of a regular button, like in a GtkStackSwitcher.

#### Parameters

check_button | a GtkCheckButton |
draw_indicator | Whether or not to draw the indicator part of the button |

### gtk_check_button_get_inconsistent ()

    gboolean
    gtk_check_button_get_inconsistent (GtkCheckButton *check_button);

Returns whether the check button is in an inconsistent state.

#### Parameters

check_button | a GtkCheckButton |

#### Returns

`TRUE` if `check_button` is currently in an 'in between' state, `FALSE` otherwise.

### gtk_check_button_set_inconsistent ()

    void
    gtk_check_button_set_inconsistent (GtkCheckButton *check_button,
                                       gboolean inconsistent);

If the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a check button, and the current values in that range are inconsistent, you may want to display the toggle in an "in between" state. Normally you would turn off the inconsistent state again if the user checks the check button. This has to be done manually, gtk_check_button_set_inconsistent only affects visual appearance, not the semantics of the button.

#### Parameters

check_button | a GtkCheckButton |
inconsistent | `TRUE` if state is inconsistent |

## Types and Values

### struct GtkCheckButton

    struct GtkCheckButton;

## Property Details

### The `“draw-indicator”` property

      “draw-indicator”           gboolean

If the indicator part of the button is displayed.

Owner: GtkCheckButton

Flags: Read / Write

Default value: TRUE

### The `“inconsistent”` property

      “inconsistent”             gboolean

If the check button is in an “in between” state.

Owner: GtkCheckButton

Flags: Read / Write

Default value: FALSE

## See Also

GtkCheckMenuItem, GtkButton, GtkToggleButton, GtkRadioButton