## GimpColorButton GimpColorButton — Widget for selecting a color from a simple button. |

## Synopsis

                GimpColorButton;
    GtkWidget*  gimp_color_button_new           (const gchar *title,
                                                 gint width,
                                                 gint height,
                                                 const GimpRGB *color,
                                                 GimpColorAreaType type);
    void        gimp_color_button_set_color     (GimpColorButton *button,
                                                 const GimpRGB *color);
    void        gimp_color_button_get_color     (GimpColorButton *button,
                                                 GimpRGB *color);
    void        gimp_color_button_set_update    (GimpColorButton *button,
                                                 gboolean continuous);
    gboolean    gimp_color_button_get_update    (GimpColorButton *button);
    gboolean    gimp_color_button_has_alpha     (GimpColorButton *button);
    void        gimp_color_button_set_type      (GimpColorButton *button,
                                                 GimpColorAreaType type);

## Object Hierarchy

      GObject
       +----GtkObject
             +----GtkWidget
                   +----GtkContainer
                         +----GtkBin
                               +----GtkButton
                                     +----GimpButton
                                           +----GimpColorButton

## Implemented Interfaces

GimpColorButton implements AtkImplementorIface.

## Signal Prototypes

    "color-changed"
                void        user_function      (GimpColorButton *gimpcolorbutton,
                                                gpointer user_data);

## Description

This widget provides a simple button with a preview showing the color.

On click a GtkColorSelectionDialog is opened. Additionally the button supports Drag and Drop and has a right-click menu that allows to choose the color from the current FG or BG color. If the user changes the color, the "color_changed" signal is emitted.

## Details

### GimpColorButton

    typedef struct _GimpColorButton GimpColorButton;

### gimp_color_button_new ()

    GtkWidget*  gimp_color_button_new           (const gchar *title,
                                                 gint width,
                                                 gint height,
                                                 const GimpRGB *color,
                                                 GimpColorAreaType type);

Creates a new GimpColorButton widget.

This returns a button with a preview showing the color. When the button is clicked a GtkColorSelectionDialog is opened. If the user changes the color the new color is written into the array that was used to pass the initial color and the "color_changed" signal is emitted.

`title` : | String that will be used as title for the color_selector.
`width` : | Width of the colorpreview in pixels.
`height` : | Height of the colorpreview in pixels.
`color` : | A pointer to a GimpRGB color.
`type` : |
Returns : | Pointer to the new GimpColorButton widget.

### gimp_color_button_set_color ()

    void        gimp_color_button_set_color     (GimpColorButton *button,
                                                 const GimpRGB *color);

Sets the `button` to the given `color`.

`button` : | Pointer to a GimpColorButton.
`color` : | Pointer to the new GimpRGB color.

### gimp_color_button_get_color ()

    void        gimp_color_button_get_color     (GimpColorButton *button,
                                                 GimpRGB *color);

Retrieves the currently set color from the `button`.

`button` : | Pointer to a GimpColorButton.
`color` : | Pointer to a GimpRGB struct used to return the color.

### gimp_color_button_set_update ()

    void        gimp_color_button_set_update    (GimpColorButton *button,
                                                 gboolean continuous);

When set to TRUE, the `button` will emit the "color_changed" continuously while the color is changed in the color selection dialog.

`button` : | A GimpColorButton widget.
`continuous` : | The new setting of the `continuous_update` property.

### gimp_color_button_get_update ()

    gboolean    gimp_color_button_get_update    (GimpColorButton *button);

Returns the color button's `continuous_update` property.

`button` : | A GimpColorButton widget.
Returns : | the `continuous_update` property.

### gimp_color_button_has_alpha ()

    gboolean    gimp_color_button_has_alpha     (GimpColorButton *button);

Checks whether the `buttons` shows transparency information.

`button` : | Pointer to a GimpColorButton.
Returns : | `TRUE` if the `button` shows transparency information, `FALSE` otherwise.

### gimp_color_button_set_type ()

    void        gimp_color_button_set_type      (GimpColorButton *button,
                                                 GimpColorAreaType type);

Sets the `button` to the given `type`. See also `gimp_color_area_set_type()`.

`button` : | Pointer to a GimpColorButton.
`type` : | the new GimpColorAreaType

## Signals

### The "color-changed" signal

    void        user_function                  (GimpColorButton *gimpcolorbutton,
                                                gpointer user_data);

`gimpcolorbutton` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

## See Also

libgimpcolor-gimpcolorspace