gwycombobox

gwycombobox —

Synopsis




GtkWidget*  gwy_enum_combo_box_new          (const GwyEnum *entries,
                                             gint nentries,
                                             GCallback callback,
                                             gpointer cbdata,
                                             gint active,
                                             gboolean translate);
GtkWidget*  gwy_combo_box_metric_unit_new   (GCallback callback,
                                             gpointer cbdata,
                                             gint from,
                                             gint to,
                                             GwySIUnit *unit,
                                             gint active);
void        gwy_enum_combo_box_set_active   (GtkComboBox *combo,
                                             gint active);
gint        gwy_enum_combo_box_get_active   (GtkComboBox *combo);
void        gwy_enum_combo_box_update_int   (GtkComboBox *combo,
                                             gint *integer);

Description

Details

gwy_enum_combo_box_new ()

GtkWidget*  gwy_enum_combo_box_new          (const GwyEnum *entries,
                                             gint nentries,
                                             GCallback callback,
                                             gpointer cbdata,
                                             gint active,
                                             gboolean translate);

Creates a combo box with choices from a enum.

entries : An enum with choices.
nentries : The number of items in entries, may be -1 when entries is terminated with NULL enum name.
callback : A callback called when a new choice is selected (may be NULL). If you want to just update an integer, you can use gwy_enum_combo_box_update_int() here.
cbdata : User data passed to the callback.
active : The enum value to show as currently selected. If it isn't equal to any entries value, first item is selected.
translate : Whether to apply translation function (gwy_sgettext()) to item names.
Returns : A newly created combo box as GtkWidget.

gwy_combo_box_metric_unit_new ()

GtkWidget*  gwy_combo_box_metric_unit_new   (GCallback callback,
                                             gpointer cbdata,
                                             gint from,
                                             gint to,
                                             GwySIUnit *unit,
                                             gint active);

Creates an enum combo box with SI power of 10 multiplies.

The integer value is the power of 10.

callback : A callback called when a menu item is activated (or NULL for
cbdata : User data passed to the callback.
from : The exponent of 10 the menu should start at (a multiple of 3, will be rounded towards zero if isn't).
to : The exponent of 10 the menu should end at (a multiple of 3, will be rounded towards zero if isn't).
unit : The unit to be prefixed.
active : The power of 10 to show as currently selected (a multiple of 3).
Returns : The newly created combo box as GtkWidget.

gwy_enum_combo_box_set_active ()

void        gwy_enum_combo_box_set_active   (GtkComboBox *combo,
                                             gint active);

Sets the active combo box item by corresponding enum value.

combo : A combo box which was created with gwy_enum_combo_box_new().
active : The enum value to show as currently selected.

gwy_enum_combo_box_get_active ()

gint        gwy_enum_combo_box_get_active   (GtkComboBox *combo);

Gets the enum value corresponding to currently active combo box item.

combo : A combo box which was created with gwy_enum_combo_box_new().
Returns : The selected enum value.

gwy_enum_combo_box_update_int ()

void        gwy_enum_combo_box_update_int   (GtkComboBox *combo,
                                             gint *integer);

Convenience callback keeping an integer synchronized with selected enum combo box value.

combo : A combo box which was created with gwy_enum_combo_box_new().
integer : Pointer to an integer to update to selected enum value.