gwyradiobuttons — Radio button constructors for enums
GSList * | gwy_radio_buttons_create () |
GSList * | gwy_radio_buttons_createl () |
gint | gwy_radio_buttons_attach_to_table () |
gboolean | gwy_radio_buttons_set_current () |
gint | gwy_radio_buttons_get_current () |
GtkWidget * | gwy_radio_buttons_find () |
void | gwy_radio_buttons_set_sensitive () |
gint | gwy_radio_button_get_value () |
void | gwy_radio_button_set_value () |
#include <libgwydgets/gwydgets.h>
Groups of buttons associated with some integers can be easily constructed
from GwyEnum's with 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 from an enum.
Try to avoid -1 as an enum value.
entries |
Radio button group items. |
|
nentries |
The number of items. Since 2.18 negative value means that
|
|
callback |
A callback called when a button is selected (or |
|
cbdata |
User data passed to the callback. |
|
current |
Value to be shown as currently selected (-1 to use what happens to be first). |
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.
GSList * gwy_radio_buttons_createl (GCallback callback
,gpointer cbdata
,gint current
,...
);
Creates a radio button group from a list of label/value pairs.
callback |
A callback called when a button is selected (or |
|
cbdata |
User data passed to the callback. |
|
current |
Value to be shown as currently selected (-1 to use what happens to be first). |
|
... |
First item label, first item value, second item label, second item
value, etc. Terminated with |
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.
Since: 2.5
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
|
|
table |
A table. |
|
colspan |
The number of columns the radio buttons should span across. |
|
row |
Table row to start attaching at. |
The row after the last attached radio button.
Since: 2.1
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 |
|
current |
Value to be shown as currently selected. |
TRUE
if current button was set, FALSE
if current
was not found.
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 |
The enum value corresponding to currently selected item. In case of failure -1 is returned.
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 |
|
value |
The value associated with the button to find. |
The radio button corresponding to value
, or NULL
on failure.
void gwy_radio_buttons_set_sensitive (GSList *group
,gboolean sensitive
);
Sets the sensitivity of all radio buttons in a group.
This function is useful to make the choice as a whole available/unavailable.
Use gwy_radio_buttons_find()
combined with gtk_widget_set_sensitive()
to
manage sensitivity of individual options.
group |
A radio button group. Not necessarily created by
|
|
sensitive |
|
Since: 2.51
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
|
The integer value corresponding to button
.
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. |
-- combo box constructors;
gwycheckboxes-- check box constructors