Next: , Previous: GtkCellRendererText, Up: Top

51 GtkCellRendererToggle

Renders a toggle button in a cell

51.1 Overview

<gtk-cell-renderer-toggle> renders a toggle button in a cell. The button is drawn as a radio- or checkbutton, depending on the radio property. When activated, it emits the toggled signal.

51.2 Usage

— Class: <gtk-cell-renderer-toggle>

Derives from <gtk-cell-renderer>.

This class defines the following slots:

The toggle button can be activated
The toggle state of the button
Draw the toggle button as a radio button
The inconsistent state of the button
Size of check or radio indicator
— Signal on <gtk-cell-renderer-toggle>: toggled (arg0 <gchararray>)

The ::toggled signal is emitted when the cell is toggled.

— Function: gtk-cell-renderer-toggle-new ⇒  (ret <gtk-cell-renderer>)

Creates a new <gtk-cell-renderer-toggle>. Adjust rendering parameters using object properties. Object properties can be set globally (with g-object-set). Also, with <gtk-tree-view-column>, you can bind a property to a value in a <gtk-tree-model>. For example, you can bind the "active" property on the cell renderer to a boolean value in the model, thus causing the check button to reflect the state of the model.

the new cell renderer
— Function: gtk-cell-renderer-toggle-get-radio (self <gtk-cell-renderer-toggle>) ⇒  (ret bool)
— Method: get-radio

Returns whether we're rendering radio toggles rather than checkboxes.

a <gtk-cell-renderer-toggle>
#t’ if we're rendering radio toggles rather than checkboxes
— Function: gtk-cell-renderer-toggle-set-radio (self <gtk-cell-renderer-toggle>) (radio bool)
— Method: set-radio

If radio is ‘#t’, the cell renderer renders a radio toggle (i.e. a toggle in a group of mutually-exclusive toggles). If ‘#f’, it renders a check toggle (a standalone boolean option). This can be set globally for the cell renderer, or changed just before rendering each cell in the model (for <gtk-tree-view>, you set up a per-row setting using <gtk-tree-view-column> to associate model columns with cell renderer properties).

a <gtk-cell-renderer-toggle>
#t’ to make the toggle look like a radio button
— Function: gtk-cell-renderer-toggle-get-active (self <gtk-cell-renderer-toggle>) ⇒  (ret bool)
— Method: get-active

Returns whether the cell renderer is active. See gtk-cell-renderer-toggle-set-active.

a <gtk-cell-renderer-toggle>
#t’ if the cell renderer is active.
— Function: gtk-cell-renderer-toggle-set-active (self <gtk-cell-renderer-toggle>) (setting bool)
— Method: set-active

Activates or deactivates a cell renderer.

a <gtk-cell-renderer-toggle>.
the value to set.