Gwyddion – Free SPM (AFM, SNOM/NSOM, STM, MFM, …) data analysis software

gwyradiobuttons (HEAD)

gwyradiobuttons — Radio button constructors for enums

Functions

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 ()

Includes

#include <libgwydgets/gwydgets.h>

Description

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

Functions

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.

Parameters

entries

Radio button group items.

 

nentries

The number of items. Since 2.18 negative value means that entries is terminated with a NULL-named item.

 

callback

A callback called when a button is selected (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_createl ()

GSList *
gwy_radio_buttons_createl (GCallback callback,
                           gpointer cbdata,
                           gint current,
                           ...);

Creates a radio button group from a list of label/value pairs.

Parameters

callback

A callback called when a button is selected (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).

 

...

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

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.

Parameters

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()).

Parameters

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.

Parameters

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.

Parameters

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_buttons_set_sensitive ()

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.

Parameters

group

A radio button group. Not necessarily created by gwy_radio_buttons_create().

 

sensitive

TRUE to make all choices sensitive, FALSE to make all insensitive.

 

Since: 2.51

gwy_radio_button_get_value ()

gint
gwy_radio_button_get_value (GtkWidget *button);

Gets the integer value associated with a radio button.

Parameters

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().

Parameters

button

A radio button to set associated value of.

 

value

Value to associate.

 

See Also

gwycombobox

-- combo box constructors;

gwycheckboxes

-- check box constructors

© David Nečas and Petr Klapetek

Home Download News Features Screenshots Documentation Communicate Participate Resources Publications Applications Site Map

Valid XHTML 1.0 Valid CSS