gwyradiobuttons

gwyradiobuttons — Radio button constructors for enums

Synopsis




GSList*             gwy_radio_buttons_create            (const GwyEnum *entries,
                                                         gint nentries,
                                                         GCallback callback,
                                                         gpointer cbdata,
                                                         gint current);
gint                gwy_radio_buttons_attach_to_table   (GSList *group,
                                                         GtkTable *table,
                                                         gint colspan,
                                                         gint row);
gboolean            gwy_radio_buttons_set_current       (GSList *group,
                                                         gint current);
gint                gwy_radio_buttons_get_current       (GSList *group);
GtkWidget*          gwy_radio_buttons_find              (GSList *group,
                                                         gint value);
gint                gwy_radio_button_get_value          (GtkWidget *button);
void                gwy_radio_button_set_value          (GtkWidget *button,
                                                         gint value);

Description

Groups of button associated with some integers can be easily constructed from GwyEnum's with gwy_radio_buttons_create().

Details

gwy_radio_buttons_create ()

GSList*             gwy_radio_buttons_create            (const GwyEnum *entries,
                                                         gint nentries,
                                                         GCallback callback,
                                                         gpointer cbdata,
                                                         gint current);

Creates a radio button group for an enum.

Try to avoid -1 as an enum value.

entries : Radio button group items.
nentries : The number of items.
callback : A callback called when a menu item is activated (or NULL for no callback).
cbdata : User data passed to the callback.
current : Value to be shown as currently selected (-1 to use what happens to be first).
Returns : The newly created radio button group (a GSList). Iterate over the list and pack the widgets (the order is the same as in entries). The group is owned by the buttons and must not be freed.

gwy_radio_buttons_attach_to_table ()

gint                gwy_radio_buttons_attach_to_table   (GSList *group,
                                                         GtkTable *table,
                                                         gint colspan,
                                                         gint row);

Attaches a group of radio buttons to table rows.

group : A radio button group. Not necessarily created by gwy_radio_buttons_create().
table : A table.
colspan : The number of columns the radio buttons should span across.
row : Table row to start attaching at.
Returns : The row after the last attached radio button.

Since 2.1


gwy_radio_buttons_set_current ()

gboolean            gwy_radio_buttons_set_current       (GSList *group,
                                                         gint current);

Sets currently selected radio button in group based on integer item object data (as set by gwy_radio_buttons_create()).

group : A radio button group created by gwy_radio_buttons_create().
current : Value to be shown as currently selected.
Returns : TRUE if current button was set, FALSE if current was not found.

gwy_radio_buttons_get_current ()

gint                gwy_radio_buttons_get_current       (GSList *group);

Gets the integer enum value corresponding to currently selected item.

group : A radio button group created by gwy_radio_buttons_create().
Returns : The enum value corresponding to currently selected item. In case of failure -1 is returned.

gwy_radio_buttons_find ()

GtkWidget*          gwy_radio_buttons_find              (GSList *group,
                                                         gint value);

Finds a radio button by its associated integer value.

group : A radio button group created by gwy_radio_buttons_create().
value : The value associated with the button to find.
Returns : The radio button corresponding to value, or NULL on failure.

gwy_radio_button_get_value ()

gint                gwy_radio_button_get_value          (GtkWidget *button);

Gets the integer value associated with a radio button.

button : A radio button belonging to a group created by gwy_radio_buttons_create().
Returns : The integer value corresponding to button.

gwy_radio_button_set_value ()

void                gwy_radio_button_set_value          (GtkWidget *button,
                                                         gint value);

Sets the integer value associated with a radio button.

This function allow to change associated radio button values after creation or even construct a radio button group with associated integers without the help of gwy_radio_buttons_create().

button : A radio button to set associated value of.
value : Value to associate.

See Also

gwycombobox -- combo box constructors