GTK+ Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
#include <gtk/gtk.h> struct GtkCellRendererToggle; GtkCellRenderer* gtk_cell_renderer_toggle_new (void); void gtk_cell_renderer_toggle_set_radio (GtkCellRendererToggle *toggle, gboolean radio); gboolean gtk_cell_renderer_toggle_get_active (GtkCellRendererToggle *toggle); void gtk_cell_renderer_toggle_set_active (GtkCellRendererToggle *toggle, gboolean setting); |
struct GtkCellRendererToggle { GtkCellRenderer parent; /*< private >*/ guint active : 1; guint activatable : 1; guint radio : 1; }; |
GtkCellRenderer* gtk_cell_renderer_toggle_new (void); |
Creates a new GtkCellRendererToggle. Adjust rendering parameters using object properties. Object properties can be set globally (with g_object_set()). Also, with GtkTreeViewColumn, you can bind a property to a value in a GtkTreeModel. 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.
void gtk_cell_renderer_toggle_set_radio (GtkCellRendererToggle *toggle, gboolean radio); |
If radio is TRUE, the cell renderer renders a radio toggle (i.e. a toggle in a group of mutually-exclusive toggles). If FALSE, 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 GtkTreeView, you set up a per-row setting using GtkTreeViewColumn to associate model columns with cell renderer properties).
toggle : | a GtkCellRendererToggle |
radio : | TRUE to make the toggle look like a radio button |
gboolean gtk_cell_renderer_toggle_get_active (GtkCellRendererToggle *toggle); |
void gtk_cell_renderer_toggle_set_active (GtkCellRendererToggle *toggle, gboolean setting); |