gwycheckboxes — Check box group constructors for flags
#include <libgwydgets/gwydgets.h>
Groups of check boxes associated with integer flags can be easily
constructed from GwyEnum's with gwy_check_boxes_create()
.
GSList * gwy_check_boxes_create (const GwyEnum *entries
,gint nentries
,GCallback callback
,gpointer cbdata
,guint selected
);
Creates a check box group from a set of flags.
All the enum values must be distinct flags, i.e. positive integers with non-overlapping bits (binary AND of any two values must be zero).
The group GSList returned by this function is analogous to GtkRadioButton groups. However, GTK+ does not know anything about it and it cannot be used with any functions expecting a GtkRadioButton group.
entries |
Radio button group items. |
|
nentries |
The number of items. Negative value means that |
|
callback |
A callback called when a button is selected (or |
|
cbdata |
User data passed to the callback. |
|
selected |
Combination of flags corresponding to selected items. |
The newly created check box 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.51
GSList * gwy_check_boxes_createl (GCallback callback
,gpointer cbdata
,guint selected
,...
);
Creates a check box group from a list of label/value pairs.
All the enum values must be distinct flags, i.e. positive integers with non-overlapping bits (binary AND of any two values must be zero).
The group GSList returned by this function is analogous to GtkRadioButton groups. However, GTK+ does not know anything about it and it cannot be used with any functions expecting a GtkRadioButton group.
callback |
A callback called when a button is selected (or |
|
cbdata |
User data passed to the callback. |
|
selected |
Combination of flags corresponding to selected items. |
|
... |
First item label, first item value, second item label, second item
value, etc. Terminated with |
The newly created check box 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.51
gint gwy_check_boxes_attach_to_table (GSList *group
,GtkTable *table
,gint colspan
,gint row
);
Attaches a group of check boxes to table rows.
group |
A check box group created by |
|
table |
A table. |
|
colspan |
The number of columns the check boxes should span across. |
|
row |
Table row to start attaching at. |
The row after the last attached check box.
Since: 2.51
void gwy_check_boxes_set_selected (GSList *group
,guint selected
);
Sets the state of all check boxes in group
to given flag combination.
If selected
differs significantly from the currently selected flags, lots
of check buttons will change state, resulting in lots of callbacks. You
might want to avoid reacting to each invidivually.
The callback passed upon construction will be called only after all the
state of all check boxes is updated so it will see the check boxes already
correspond to selected
. However, any additional signal handlers you set up
will be called during the update unless you block them yourself.
group |
A check box group created by |
|
selected |
Flags to be shown as currently selected. |
Since: 2.51
guint
gwy_check_boxes_get_selected (GSList *group
);
Gets the flag combination corresponding to currently selected items.
group |
A check box group created by |
The combination of flags corresponding to currently selected items.
Since: 2.51
GSList *
gwy_check_box_get_group (GtkWidget *checkbox
);
Gets the group a check box belongs to.
checkbox |
A check box belonging to a group created by
|
The group checkbox
belongs to.
Since: 2.51
GtkWidget * gwy_check_boxes_find (GSList *group
,guint value
);
Finds a check box by its associated flag value.
The value must corresponding exactly to the single flag. Otherwise the check box is not considered a match.
group |
A check box group created by |
|
value |
The value associated with the check box to find. |
The check box corresponding to value
, or NULL
on failure.
Since: 2.51
void gwy_check_boxes_set_sensitive (GSList *group
,gboolean sensitive
);
Sets the sensitivity of all check box in a group.
This function is useful to make the choice as a whole available/unavailable.
Use gwy_check_boxes_find()
combined with gtk_widget_set_sensitive()
to
manage sensitivity of individual options.
group |
A check box group created by |
|
sensitive |
|
Since: 2.51
guint
gwy_check_box_get_value (GtkWidget *checkbox
);
Gets the flag value associated with a check box.
checkbox |
A check box belonging to a group created by
|
The flag value corresponding to button
.
Since: 2.51
-- combo box constructors;
gwyradiobuttons-- radio button constructors