## GwyColorButton

GwyColorButton — A color displaying button

## Synopsis

    #include <libgwydgets/gwydgets.h>

                        GwyColorButton;
                        GwyColorButtonClass;
    GtkWidget*          gwy_color_button_new                (void);
    GtkWidget*          gwy_color_button_new_with_color     (GwyRGBA *color);
    void                gwy_color_button_set_color          (GwyColorButton *color_button,
                                                             GwyRGBA *color);
    void                gwy_color_button_get_color          (GwyColorButton *color_button,
                                                             GwyRGBA *color);
    void                gwy_color_button_set_use_alpha      (GwyColorButton *color_button,
                                                             gboolean use_alpha);
    gboolean            gwy_color_button_get_use_alpha      (GwyColorButton *color_button);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GtkContainer
                               +----GtkBin
                                     +----GtkButton
                                           +----GwyColorButton

## Implemented Interfaces

GwyColorButton implements AtkImplementorIface and GtkBuildable.

## Properties

      "color"                    GwyRGBA*              : Read / Write
      "use-alpha"                gboolean              : Read / Write

## Description

This widget is somewhat similar to GtkColorButton, or more likely GimpColorButton.

It does not have its own color selection dialog however, it's just an ordinary button displaying a color. You have to connect some callback to its "clicked" signal. Also it uses GwyRGBA instead of GdkColor.

## Details

### GwyColorButton

    typedef struct _GwyColorButton GwyColorButton;

### GwyColorButtonClass

    typedef struct {
        GtkButtonClass parent_class;

        void (*reserved1)(void);
        void (*reserved2)(void);
    } GwyColorButtonClass;

### gwy_color_button_new ()

    GtkWidget*          gwy_color_button_new                (void);

Creates a new color button. This returns a widget in the form of a small button containing a swatch representing the current selected color. When the button is clicked, a color-selection dialog will open, allowing the user to select a color. The swatch will be updated to reflect the new color when the user finishes.

Returns : | a new color button.

### gwy_color_button_new_with_color ()

    GtkWidget*          gwy_color_button_new_with_color     (GwyRGBA *color);

Creates a new color button.

`color` : | A GwyRGBA to set the current color with.
Returns : | a new color button.

### gwy_color_button_set_color ()

    void                gwy_color_button_set_color          (GwyColorButton *color_button,
                                                             GwyRGBA *color);

Sets the current color to be `color`.

`color_button` : | a GwyColorButton.
`color` : | A GwyRGBA to set the current color with.

### gwy_color_button_get_color ()

    void                gwy_color_button_get_color          (GwyColorButton *color_button,
                                                             GwyRGBA *color);

Sets `color` to be the current color in the GwyColorButton widget.

`color_button` : | a GwyColorButton.
`color` : | a GwyRGBA to fill in with the current color.

### gwy_color_button_set_use_alpha ()

    void                gwy_color_button_set_use_alpha      (GwyColorButton *color_button,
                                                             gboolean use_alpha);

Sets whether or not the color button should use the alpha channel.

`color_button` : | a GwyColorButton.
`use_alpha` : | `TRUE` if color button should use alpha channel, `FALSE` if not.

### gwy_color_button_get_use_alpha ()

    gboolean            gwy_color_button_get_use_alpha      (GwyColorButton *color_button);

Does the color selection dialog use the alpha channel?

`color_button` : | a GwyColorButton.
Returns : | `TRUE` if the color sample uses alpha channel, `FALSE` if not.

## Property Details

### The `"color"` property

      "color"                    GwyRGBA*              : Read / Write

The selected color.

### The `"use-alpha"` property

      "use-alpha"                gboolean              : Read / Write

If this property is set to `TRUE`, the color swatch on the button is rendered against a checkerboard background to show its opacity and the opacity slider is displayed in the color selection dialog.

Default value: FALSE