## gtk_colorComboBoxWidget

gtk_colorComboBoxWidget —

## Synopsis

    struct      ColorComboBox_struct;
    typedef     ColorComboBox;
    GtkWidget*  colorComboBox_new               (gboolean hasAlphaChannel);
    GtkWidget*  colorComboBox_newWithRanges     (gboolean hasAlphaChannel);
    GdkPixbuf*  colorComboBoxBuild_colorStamp   (Color *color,
                                                 gboolean alpha);
    GdkPixbuf*  colorComboBoxGet_selectedPixbuf (ColorComboBox *colorComboBox);
    Color*      colorComboBoxGet_selectedColor  (ColorComboBox *colorComboBox);
    GdkPixbuf*  colorComboBoxGet_pixbufFromColor
                                                (ColorComboBox *colorComboBox,
                                                 Color *color);
    float*      colorComboBoxGet_material       (ColorComboBox *colorComboBox);
    float*      colorComboBoxGet_color          (ColorComboBox *colorComboBox);
    GtkWidget*  colorComboBoxGet_rangesWidgets  (ColorComboBox *colorComboBox);
    gboolean    colorComboBoxSet_selectionByColor
                                                (ColorComboBox *colorComboBox,
                                                 Color *color);
    void        colorComboBoxSet_expanded       (ColorComboBox *colorComboBox,
                                                 gboolean value);
    void        colorComboBoxSet_color          (ColorComboBox *colorComboBox,
                                                 float rgba[4],
                                                 gboolean raiseSignal);
    void        colorComboBoxSet_material       (ColorComboBox *colorComboBox,
                                                 float material[nb_material],
                                                 gboolean raiseSignal);

## Description

## Details

### struct ColorComboBox_struct

    struct ColorComboBox_struct;

Private structure to store informations of a ColorComboBox object.

### ColorComboBox

    typedef struct ColorComboBox_struct        ColorComboBox;

Short form for a ColorComboBox_struct structure.

### colorComboBox_new ()

    GtkWidget*  colorComboBox_new               (gboolean hasAlphaChannel);

A ColorComboBox widget is like a GtkComboBox widget, but it is already filled with the colors stores in the structures adhoc in visu_tools.h. Using this widget is a convienient way to share colors between all part of V_Sim and to give a consistent look of all color selection. If the argument `hasAlphaChannel` is FALSE, the widget display all colors but without their alpha channel, assuming it to be fully opaque.

`hasAlphaChannel` : | a boolean.
Returns : | a newly created ColorComboBox widget.

### colorComboBox_newWithRanges ()

    GtkWidget*  colorComboBox_newWithRanges     (gboolean hasAlphaChannel);

Create a color combo and several ranges.

`hasAlphaChannel` : | a boolean.
Returns : | a newly created ColorComboBox widget.

### colorComboBoxBuild_colorStamp ()

    GdkPixbuf*  colorComboBoxBuild_colorStamp   (Color *color,
                                                 gboolean alpha);

This method is used by ColorComboBox object to create little stamps representing the color. If the pixbuf of such stamps are needed, use `colorComboBoxGet_pixbufFromColor()` if the color is registered in an already existing ColorComboBox object or use this method to create a new stamp.

`color` : | a Color object ;
`alpha` : | a boolean.
Returns : | a pixbuf pointer corresponding to the little image as shown on a `colorComboBox` (use `g_object_unref()` to free this pixbuf).

### colorComboBoxGet_selectedPixbuf ()

    GdkPixbuf*  colorComboBoxGet_selectedPixbuf (ColorComboBox *colorComboBox);

The `colorComboBox` has little pixbufs to represent the color. User methods can use these pixbufs but should considered them read-only.

`colorComboBox` : | a ColorComboBox widget.
Returns : | a pixbuf pointer corresponding to the little image shown on the `colorComboBox`.

### colorComboBoxGet_selectedColor ()

    Color*      colorComboBoxGet_selectedColor  (ColorComboBox *colorComboBox);

The user can access to the selected Color object using this method.

`colorComboBox` : | a ColorComboBox widget.
Returns : | a pointer to the selected Color object (or NULL). This object is read-only.

### colorComboBoxGet_pixbufFromColor ()

    GdkPixbuf*  colorComboBoxGet_pixbufFromColor
                                                (ColorComboBox *colorComboBox,
                                                 Color *color);

The `colorComboBox` has little pixbufs to represent the color. User methods can use these pixbufs but should considered them read-only.

`colorComboBox` : | a ColorComboBox widget ;
`color` : | a Color object.
Returns : | a pixbuf pointer corresponding to the little image shown on the `colorComboBox`.

### colorComboBoxGet_material ()

    float*      colorComboBoxGet_material       (ColorComboBox *colorComboBox);

If the `colorComboBox` uses ranges (see `colorComboBox_newWithRanges()`), this method is used to get the values from the material ranges.

`colorComboBox` : | a ColorComboBox widget.
Returns : | a newly created array of size nb_material (see Material). Use `g_free()` to delete it.

### colorComboBoxGet_color ()

    float*      colorComboBoxGet_color          (ColorComboBox *colorComboBox);

If the `colorComboBox` uses ranges (see `colorComboBox_newWithRanges()`), this method is used to get the values from the color ranges.

`colorComboBox` : | a ColorComboBox widget.
Returns : | a newly created array of size 4. Use `g_free()` to delete it.

### colorComboBoxGet_rangesWidgets ()

    GtkWidget*  colorComboBoxGet_rangesWidgets  (ColorComboBox *colorComboBox);

Retrieve the wiodget using to represent the ranges, or NULL if the object has no ranges.

`colorComboBox` : | a Color object.
Returns : | a widget owned by `color`.

### colorComboBoxSet_selectionByColor ()

    gboolean    colorComboBoxSet_selectionByColor
                                                (ColorComboBox *colorComboBox,
                                                 Color *color);

Use this method to set the ComboBox on the given color. This emits a 'color-channel' signal if the color is changed, which means, a previous color has been modified, or a new color is selected.

`colorComboBox` : | a ColorComboBox widget ;
`color` : | a Color object.
Returns : | TRUE if the `color` already exists in the model.

### colorComboBoxSet_expanded ()

    void        colorComboBoxSet_expanded       (ColorComboBox *colorComboBox,
                                                 gboolean value);

Set the expanded state of the ranges. This is usable only if the colorComboBox has been created with ranges.

`colorComboBox` : | a Color object ;
`value` : | a boolean value.

### colorComboBoxSet_color ()

    void        colorComboBoxSet_color          (ColorComboBox *colorComboBox,
                                                 float rgba[4],
                                                 gboolean raiseSignal);

`colorComboBox` : |
`rgba` : |
`raiseSignal` : |

### colorComboBoxSet_material ()

    void        colorComboBoxSet_material       (ColorComboBox *colorComboBox,
                                                 float material[nb_material],
                                                 gboolean raiseSignal);

Change the values for the ranges that control the light (emission, diffuse...). This is possible only if the `colorComboBox` has been created with `colorComboBox_newWithRanges()`.

`colorComboBox` : | a ColorComboBox widget ;
`material` : | nb_material (see Material) floating point values ;
`raiseSignal` : | if TRUE a material-value-changed can be raised.