## GwyColorEditor

GwyColorEditor — Colour editor with HSV wheel and component sliders

## Functions

GtkWidget * | gwy_color_editor_new ()
void | gwy_color_editor_get_color ()
void | gwy_color_editor_set_color ()
void | gwy_color_editor_get_previous_color ()
void | gwy_color_editor_set_previous_color ()
gboolean | gwy_color_editor_get_use_alpha ()
void | gwy_color_editor_set_use_alpha ()

## Properties

GwyRGBA * | color | Read / Write
GwyRGBA * | previous-color | Read / Write
gboolean | use-alpha | Read / Write

## Signals

void | color-changed | Run First

## Types and Values

struct | GwyColorEditor
struct | GwyColorEditorClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── GtkBox
                        ╰── GwyColorEditor

## Implemented Interfaces

GwyColorEditor implements AtkImplementorIface, GtkBuildable and GtkOrientable.

## Includes

    #include <libgwyui/gwyui.h>

## Description

GwyColorEditor is a standard colour editor with a hue/saturation/value wheel and colour component sliders. It shows the previous (or original) colour set `gwy_color_editor_set_previous_color()` (or simply the first `gwy_color_editor_set_color()`) for comparison.

Frequently the editor is used via GwyColorDialog to adjust a colour. However, it can also be used on its own.

## Functions

### gwy_color_editor_new()

    GtkWidget *
    gwy_color_editor_new (void);

Creates a new scientific text entry.

#### Returns

A newly created scientific text entry.

### gwy_color_editor_get_color()

    void
    gwy_color_editor_get_color (GwyColorEditor *editor,
                                GwyRGBA *color);

Obtains the current colour of a colour editor.

#### Parameters

editor | A colour editor. |
color | Location to fill in with the current colour. |

### gwy_color_editor_set_color()

    void
    gwy_color_editor_set_color (GwyColorEditor *editor,
                                const GwyRGBA *color);

Sets the current colour of a colour editor.

The first time this function is called it also sets the previous colour (if it has not been set yet).

#### Parameters

editor | A colour editor. |
color | The colour to edit. |

### gwy_color_editor_get_previous_color()

    void
    gwy_color_editor_get_previous_color (GwyColorEditor *editor,
                                         GwyRGBA *color);

Obtains the previous colour of a colour editor.

#### Parameters

editor | A colour editor. |
color | Location to fill in with the previous colour. |

### gwy_color_editor_set_previous_color()

    void
    gwy_color_editor_set_previous_color (GwyColorEditor *editor,
                                         const GwyRGBA *color);

Sets the previous colour of a colour editor.

#### Parameters

editor | A colour editor. |
color | The colour to display as the previous colour. |

### gwy_color_editor_get_use_alpha()

    gboolean
    gwy_color_editor_get_use_alpha (GwyColorEditor *editor);

Reports whether the colour editor uses the alpha channel.

#### Parameters

editor | A colour editor. |

#### Returns

`TRUE` if the colour editor visualises alpha channel, `FALSE` if it ignores it.

### gwy_color_editor_set_use_alpha()

    void
    gwy_color_editor_set_use_alpha (GwyColorEditor *editor,
                                    gboolean use_alpha);

Sets whether the colour editor should include the alpha channel.

If the editor includes the alpha channel, it has an alpha slider, the current and previous colour swatches use a visualisation suitable for partially transparent colours, and the hex colour entry has an 8digit format (as opposed to 6digit).

If the editor does not include the alpha channel the user cannot modify it. So the alpha values of colours passed to the editor with `gwy_color_editor_set_color()` are preserved.

#### Parameters

editor | A colour editor. |
use_alpha | `TRUE` if colour editor should include the alpha channel, `FALSE` to ignore it. |

## Types and Values

### struct GwyColorEditor

    struct GwyColorEditor;

### struct GwyColorEditorClass

    struct GwyColorEditorClass {
        GtkBoxClass parent_class;

        /* Signals */
        void (*color_changed)(GwyColorEditor *editor);
    };

## Property Details

### The `“color”` property

      “color”                    GwyRGBA *

Current color.

Owner: GwyColorEditor

Flags: Read / Write

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

      “previous-color”           GwyRGBA *

Previous color shown for comparison.

Owner: GwyColorEditor

Flags: Read / Write

### The `“use-alpha”` property

      “use-alpha”                gboolean

Whether to edit the color including the alpha value.

Owner: GwyColorEditor

Flags: Read / Write

Default value: FALSE

## Signal Details

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

    void
    user_function (GwyColorEditor *gwyeditor,
                   gpointer        user_data)

The ::color-changed signal is emitted whenever the color is edited.

#### Parameters

gwyeditor | The GwyColorEditor which received the signal. |
user_data | user data set when the signal handler was connected. |

Flags: Run First