Classes | Defines | Typedefs | Functions | Variables

go-palette.h File Reference

#include <gtk/gtk.h>
#include <cairo.h>

Go to the source code of this file.

Classes

struct  _GOPalette
struct  _GOPaletteClass

Defines

#define GO_TYPE_PALETTE   (go_palette_get_type ())
#define GO_PALETTE(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GO_TYPE_PALETTE, GOPalette))
#define GO_PALETTE_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GO_TYPE_PALETTE, GOPaletteClass))
#define GO_IS_PALETTE(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GO_TYPE_PALETTE))
#define GO_IS_PALETTE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GO_TYPE_PALETTE))
#define GO_PALETTE_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GO_TYPE_PALETTE, GOPaletteClass))

Typedefs

typedef const char *(* GOPaletteSwatchTooltipCallback )(int index, gpointer data)
typedef struct _GOPalette GOPalette
typedef struct _GOPalettePrivate GOPalettePrivate
typedef struct _GOPaletteClass GOPaletteClass

Functions

GType go_palette_get_type (void) G_GNUC_CONST
GtkWidget * go_palette_new (int n_swatches, double swatch_width, int n_columns, GOPaletteSwatchRenderCallback swatch_render, GOPaletteSwatchTooltipCallback get_tooltip, gpointer data, GDestroyNotify destroy)
 go_palette_new: : number of palette items : swatch width as multiple of swatch height : number of columns for displaying palette items : a user function used for swatch rendering : user data for use by swatch render function : a function to destroy user data on widget finalization
void go_palette_show_automatic (GOPalette *palette, int index, char const *label)
 go_palette_show_automatic: : a GOPalette : index to use on automatic item activation : if not NULL, replace automatic button label
void go_palette_show_custom (GOPalette *palette, char const *label)
 go_palette_show_custom: : a GOPalette : if not NULL, replaces custom button label
gpointer go_palette_get_user_data (GOPalette *palette)
 go_palette_get_user_data: : a GOPalette
GtkWidget * go_palette_swatch_new (GOPalette *palette, int index)
 go_palette_swatch_new: : a GOPalette : default index
int go_palette_get_n_swatches (GOPalette *palette)
 go_palette_get_n_swatches: : a GOPalette

Variables

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

Define Documentation

#define GO_IS_PALETTE (   obj  )     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GO_TYPE_PALETTE))
#define GO_IS_PALETTE_CLASS (   klass  )     (G_TYPE_CHECK_CLASS_TYPE ((klass), GO_TYPE_PALETTE))
#define GO_PALETTE (   obj  )     (G_TYPE_CHECK_INSTANCE_CAST ((obj), GO_TYPE_PALETTE, GOPalette))
#define GO_PALETTE_CLASS (   klass  )     (G_TYPE_CHECK_CLASS_CAST ((klass), GO_TYPE_PALETTE, GOPaletteClass))
#define GO_PALETTE_GET_CLASS (   obj  )     (G_TYPE_INSTANCE_GET_CLASS ((obj), GO_TYPE_PALETTE, GOPaletteClass))
#define GO_TYPE_PALETTE   (go_palette_get_type ())

Referenced by go_palette_init(), and go_palette_new().


Typedef Documentation

typedef struct _GOPalette GOPalette
typedef const char*(* GOPaletteSwatchTooltipCallback)(int index, gpointer data)

Function Documentation

int go_palette_get_n_swatches ( GOPalette palette  ) 

go_palette_get_n_swatches: : a GOPalette

A convenience function.

Returns: the number of palette items.

GType go_palette_get_type ( void   ) 
gpointer go_palette_get_user_data ( GOPalette palette  ) 

go_palette_get_user_data: : a GOPalette

Returns: a pointer to user data given to go_palette_new function.

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

go_palette_new: : number of palette items : swatch width as multiple of swatch height : number of columns for displaying palette items : a user function used for swatch rendering : user data for use by swatch render function : a function to destroy user data on widget finalization

Returns: a new GOPalette object.

References _GOPalettePrivate::data, _GOPalettePrivate::destroy, _GOPalettePrivate::get_tooltip, GO_PALETTE, GO_TYPE_PALETTE, _GOPalettePrivate::n_columns, _GOPalettePrivate::n_swatches, _GOPalettePrivate::swatch_height, _GOPalettePrivate::swatch_render, and _GOPalettePrivate::swatch_width.

Referenced by go_color_selector_new().

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

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

Adds an automatic button to .

void go_palette_show_custom ( GOPalette palette,
char const *  label 
)

go_palette_show_custom: : a GOPalette : if not NULL, replaces custom button label

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

GtkWidget* go_palette_swatch_new ( GOPalette palette,
int  index 
)

go_palette_swatch_new: : a GOPalette : default index

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


Variable Documentation

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