## GoPalette GoPalette — Palette widget for GoSelector |

## Synopsis

    void                (*GOPaletteSwatchRenderCallback)    (cairo_t *cr,
                                                             GdkRectangle const *area,
                                                             int index,
                                                             gpointer data);
    const char*         (*GOPaletteSwatchTooltipCallback)   (int index,
                                                             gpointer data);
                        GOPalettePrivate;
                        GOPalette;
    GtkWidget*          go_palette_new                      (int n_swatches,
                                                             double swatch_width,
                                                             int n_columns,
                                                             GOPaletteSwatchRenderCallback swatch_render,
                                                             GOPaletteSwatchTooltipCallback get_tooltip,
                                                             gpointer data,
                                                             GDestroyNotify destroy);
    void                go_palette_show_automatic           (GOPalette *palette,
                                                             int index,
                                                             char const *label);
    void                go_palette_show_custom              (GOPalette *palette,
                                                             char const *label);
    gpointer            go_palette_get_user_data            (GOPalette *palette);
    GtkWidget*          go_palette_swatch_new               (GOPalette *palette,
                                                             int index);
    int                 go_palette_get_n_swatches           (GOPalette *palette);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GtkContainer
                               +----GtkMenuShell
                                     +----GtkMenu
                                           +----GOPalette

## Implemented Interfaces

GOPalette implements AtkImplementorIface and GtkBuildable.

## Signals

      "activate"                                       : Run Last
      "automatic-activate"                             : Run Last
      "custom-activate"                                : Run Last

## Description

## Details

### GOPaletteSwatchRenderCallback ()

    void                (*GOPaletteSwatchRenderCallback)    (cairo_t *cr,
                                                             GdkRectangle const *area,
                                                             int index,
                                                             gpointer data);

`cr` : |
`area` : |
`index` : |
`data` : |

### GOPaletteSwatchTooltipCallback ()

    const char*         (*GOPaletteSwatchTooltipCallback)   (int index,
                                                             gpointer data);

`index` : |
`data` : |
Returns : |

### GOPalettePrivate

    typedef struct _GOPalettePrivate GOPalettePrivate;

### GOPalette

    typedef struct _GOPalette GOPalette;

### go_palette_new ()

    GtkWidget*          go_palette_new                      (int n_swatches,
                                                             double swatch_width,
                                                             int n_columns,
                                                             GOPaletteSwatchRenderCallback swatch_render,
                                                             GOPaletteSwatchTooltipCallback get_tooltip,
                                                             gpointer data,
                                                             GDestroyNotify destroy);

`n_swatches` : | number of palette items
`swatch_width` : | swatch width as multiple of swatch height
`n_columns` : | number of columns for displaying palette items
`swatch_render` : | a user function used for swatch rendering
`get_tooltip` : |
`data` : | user data for use by swatch render function
`destroy` : | a function to destroy user data on widget finalization
Returns : | a new GOPalette object.

### go_palette_show_automatic ()

    void                go_palette_show_automatic           (GOPalette *palette,
                                                             int index,
                                                             char const *label);

Adds an automatic button to `palette`.

`palette` : | a GOPalette
`index` : | index to use on automatic item activation
`label` : | if not NULL, replace automatic button label

### go_palette_show_custom ()

    void                go_palette_show_custom              (GOPalette *palette,
                                                             char const *label);

Adds a custom button to bottom of `palette`. An activation of custom button will cause an emition of "custom_activate" signal.

`palette` : | a GOPalette
`label` : | if not NULL, replaces custom button label

### go_palette_get_user_data ()

    gpointer            go_palette_get_user_data            (GOPalette *palette);

`palette` : | a GOPalette
Returns : | a pointer to user data given to go_palette_new function.

### go_palette_swatch_new ()

    GtkWidget*          go_palette_swatch_new               (GOPalette *palette,
                                                             int index);

`palette` : | a GOPalette
`index` : | default index
Returns : | a new GtkDrawingArea which will be rendered like a `palette` swatch. `index` can be changed later by changing swatch "index" data.

### go_palette_get_n_swatches ()

    int                 go_palette_get_n_swatches           (GOPalette *palette);

A convenience function.

`palette` : | a GOPalette
Returns : | the number of palette items.

## Signal Details

### The `"activate"` signal

    void                user_function                      (GOPalette *gopalette,
                                                            gint       arg1,
                                                            gpointer   user_data)      : Run Last

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

### The `"automatic-activate"` signal

    void                user_function                      (GOPalette *gopalette,
                                                            gint       arg1,
                                                            gpointer   user_data)      : Run Last

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

### The `"custom-activate"` signal

    void                user_function                      (GOPalette *gopalette,
                                                            gpointer   user_data)      : Run Last

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