![]() |
![]() |
![]() |
Gwyddion Widgets Library Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <libgwydgets/gwydgets.h> GSList * gwy_radio_buttons_create (const GwyEnum *entries
,gint nentries
,GCallback callback
,gpointer cbdata
,gint current
); GSList * gwy_radio_buttons_createl (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
);
Groups of button 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.
|
Radio button group items. |
|
The number of items. Since 2.18 negative value means that
entries is terminated with a NULL -named item. |
|
A callback called when a menu item is activated (or NULL for
no callback). |
|
User data passed to the callback. |
|
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. |
GSList * gwy_radio_buttons_createl (GCallback callback
,gpointer cbdata
,gint current
,...
);
Creates a radio button group from a list of label/value pairs.
|
A callback called when a menu item is activated (or NULL for
no callback). |
|
User data passed to the callback. |
|
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 NULL . |
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. |
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.
|
A radio button group. Not necessarily created by
gwy_radio_buttons_create() . |
|
A table. |
|
The number of columns the radio buttons should span across. |
|
Table row to start attaching at. |
Returns : |
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()
).
|
A radio button group created by gwy_radio_buttons_create() . |
|
Value to be shown as currently selected. |
Returns : |
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.
|
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. |
GtkWidget * gwy_radio_buttons_find (GSList *group
,gint value
);
Finds a radio button by its associated integer value.
|
A radio button group created by gwy_radio_buttons_create() . |
|
The value associated with the button to find. |
Returns : |
The radio button corresponding to value , or NULL on failure. |
gint gwy_radio_button_get_value (GtkWidget *button
);
Gets the integer value associated with a radio button.
|
A radio button belonging to a group created by
gwy_radio_buttons_create() . |
Returns : |
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()
.
|
A radio button to set associated value of. |
|
Value to associate. |