## 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
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GtkContainer
                               +----GtkBin
                                     +----GtkButton
                                           +----GimpButton
                                                 +----GimpColorButton

## Implemented Interfaces

GimpColorButton implements AtkImplementorIface, GtkBuildable and GtkActivatable.

## Properties

      "area-height"              gint                  : Write / Construct
      "area-width"               gint                  : Write / Construct
      "color"                    GimpRGB*              : Read / Write / Construct
      "continuous-update"        gboolean              : Read / Write / Construct
      "title"                    gchar*                : Read / Write / Construct Only
      "type"                     GimpColorAreaType     : Read / Write / Construct

## Signals

      "color-changed"                                  : Run First

## Description

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

On click a color selection dialog 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` : | The type of transparency to be displayed.
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

## Property Details

### The `"area-height"` property

      "area-height"              gint                  : Write / Construct

The minimum height of the button's GimpColorArea.

Allowed values: >= 1

Default value: 16

Since GIMP 2.8

### The `"area-width"` property

      "area-width"               gint                  : Write / Construct

The minimum width of the button's GimpColorArea.

Allowed values: >= 1

Default value: 16

Since GIMP 2.8

### The `"color"` property

      "color"                    GimpRGB*              : Read / Write / Construct

The color displayed in the button's color area.

Since GIMP 2.4

### The `"continuous-update"` property

      "continuous-update"        gboolean              : Read / Write / Construct

The update policy of the color button.

Default value: FALSE

Since GIMP 2.4

### The `"title"` property

      "title"                    gchar*                : Read / Write / Construct Only

The title to be used for the color selection dialog.

Default value: NULL

Since GIMP 2.4

### The `"type"` property

      "type"                     GimpColorAreaType     : Read / Write / Construct

The type of the button's color area.

Default value: GIMP_COLOR_AREA_FLAT

Since GIMP 2.4

## Signal Details

### The `"color-changed"` signal

    void                user_function                      (GimpColorButton *gimpcolorbutton,
                                                            gpointer         user_data)            : Run First

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

## See Also

libgimpcolor-gimpcolorspace