GimpColorButton: GIMP Widgets Library Reference Manual

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

## Functions

GtkWidget * | gimp_color_button_new ()
void | gimp_color_button_set_title ()
const gchar * | gimp_color_button_get_title ()
void | gimp_color_button_set_color ()
void | gimp_color_button_get_color ()
void | gimp_color_button_set_update ()
gboolean | gimp_color_button_get_update ()
gboolean | gimp_color_button_has_alpha ()
void | gimp_color_button_set_type ()
void | gimp_color_button_set_color_config ()
GtkUIManager * | gimp_color_button_get_ui_manager ()

## Properties

int | area-height | Write / Construct
int | area-width | Write / Construct
GimpRGB * | color | Read / Write / Construct
GimpColorConfig * | color-config | Read / Write
gboolean | continuous-update | Read / Write / Construct
char * | title | Read / Write / Construct
GimpColorAreaType | type | Read / Write / Construct

## Signals

void | color-changed | Run First

## Types and Values

| GimpColorButton

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkObject
                ╰── GtkWidget
                    ╰── GtkContainer
                        ╰── GtkBin
                            ╰── GtkButton
                                ╰── GimpButton
                                    ╰── GimpColorButton

## Implemented Interfaces

GimpColorButton implements AtkImplementorIface, GtkBuildable and GtkActivatable.

## 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 one to choose the color from the current FG or BG color. If the user changes the color, the "color-changed" signal is emitted.

## Functions

### 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.

#### Parameters

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_title ()

    void
    gimp_color_button_set_title (GimpColorButton *button,
                                 const gchar *title);

Sets the `button` dialog's title.

#### Parameters

button | a GimpColorButton. |
title | the new title. |

Since: 2.10

### gimp_color_button_get_title ()

    const gchar *
    gimp_color_button_get_title (GimpColorButton *button);

#### Parameters

button | a GimpColorButton. |

#### Returns

The `button` dialog's title.

Since: 2.10

### gimp_color_button_set_color ()

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

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

#### Parameters

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` .

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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()`.

#### Parameters

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

### gimp_color_button_set_color_config ()

    void
    gimp_color_button_set_color_config (GimpColorButton *button,
                                        GimpColorConfig *config);

Sets the color management configuration to use with this color button's GimpColorArea.

#### Parameters

button | a GimpColorButton widget. |
config | a GimpColorConfig object. |

Since: 2.10

### gimp_color_button_get_ui_manager ()

    GtkUIManager *
    gimp_color_button_get_ui_manager (GimpColorButton *button);

#### Parameters

button | a GimpColorButton. |

#### Returns

The `button` 's GtkUIManager.

Since: 2.10

## Types and Values

### GimpColorButton

    typedef struct _GimpColorButton GimpColorButton;

## Property Details

### The `“area-height”` property

      “area-height”              int

The minimum height of the button's GimpColorArea.

Owner: GimpColorButton

Flags: Write / Construct

Allowed values: >= 1

Default value: 16

Since: 2.8

### The `“area-width”` property

      “area-width”               int

The minimum width of the button's GimpColorArea.

Owner: GimpColorButton

Flags: Write / Construct

Allowed values: >= 1

Default value: 16

Since: 2.8

### The `“color”` property

      “color”                    GimpRGB *

The color displayed in the button's color area.

Owner: GimpColorButton

Flags: Read / Write / Construct

Since: 2.4

### The `“color-config”` property

      “color-config”             GimpColorConfig *

The GimpColorConfig object used for the button's GimpColorArea and GimpColorSelection.

Owner: GimpColorButton

Flags: Read / Write

Since: 2.10

### The `“continuous-update”` property

      “continuous-update”        gboolean

The update policy of the color button.

Owner: GimpColorButton

Flags: Read / Write / Construct

Default value: FALSE

Since: 2.4

### The `“title”` property

      “title”                    char *

The title to be used for the color selection dialog.

Owner: GimpColorButton

Flags: Read / Write / Construct

Default value: NULL

Since: 2.4

### The `“type”` property

      “type”                     GimpColorAreaType

The type of the button's color area.

Owner: GimpColorButton

Flags: Read / Write / Construct

Default value: GIMP_COLOR_AREA_FLAT

Since: 2.4

## Signal Details

### The `“color-changed”` signal

    void
    user_function (GimpColorButton *gimpcolorbutton,
                   gpointer         user_data)

Flags: Run First

## See Also

libgimpcolor-gimpcolorspace