Classes | Enumerations | Functions | Variables

go-palette.c File Reference

#include <goffice/goffice-config.h>
#include <goffice/goffice.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdkkeysyms.h>
#include <math.h>

Classes

struct  _GOPalettePrivate

Enumerations

enum  { GO_PALETTE_ACTIVATE, GO_PALETTE_AUTOMATIC_ACTIVATE, GO_PALETTE_CUSTOM_ACTIVATE, GO_PALETTE_LAST_SIGNAL }

Functions

static void go_palette_finalize (GObject *object)
static GtkWidget * go_palette_menu_item_new (GOPalette *palette, int index)
static void cb_automatic_activate (GtkWidget *item, GOPalette *palette)
static void cb_custom_activate (GtkWidget *item, GOPalette *palette)
static void go_palette_init (GOPalette *palette)
static void go_palette_realize (GtkWidget *widget)
static void go_palette_class_init (GOPaletteClass *class)
static gboolean cb_swatch_draw (GtkWidget *swatch, cairo_t *cr, GOPalette *palette)
static void cb_menu_item_activate (GtkWidget *item, GOPalette *palette)
static void cb_menu_item_toggle_size_request (GtkWidget *item, gint *requitision)
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

static guint go_palette_signals [GO_PALETTE_LAST_SIGNAL] = {0,}

Enumeration Type Documentation

anonymous enum
Enumerator:
GO_PALETTE_ACTIVATE 
GO_PALETTE_AUTOMATIC_ACTIVATE 
GO_PALETTE_CUSTOM_ACTIVATE 
GO_PALETTE_LAST_SIGNAL 

Function Documentation

static void cb_automatic_activate ( GtkWidget *  item,
GOPalette palette 
) [static]
static void cb_custom_activate ( GtkWidget *  item,
GOPalette palette 
) [static]
static void cb_menu_item_activate ( GtkWidget *  item,
GOPalette palette 
) [static]
static void cb_menu_item_toggle_size_request ( GtkWidget *  item,
gint *  requitision 
) [static]
static gboolean cb_swatch_draw ( GtkWidget *  swatch,
cairo_t *  cr,
GOPalette palette 
) [static]
static void go_palette_class_init ( GOPaletteClass class  )  [static]

References go_palette_signals.

static void go_palette_finalize ( GObject *  object  )  [static]
int go_palette_get_n_swatches ( GOPalette palette  ) 

go_palette_get_n_swatches: : a GOPalette

A convenience function.

Returns: the number of palette items.

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.

static void go_palette_init ( GOPalette palette  )  [static]
static GtkWidget * go_palette_menu_item_new ( GOPalette palette,
int  index 
) [static]
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().

static void go_palette_realize ( GtkWidget *  widget  )  [static]
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 .

Referenced by go_color_selector_new().

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.

Referenced by go_color_selector_new().

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.

Referenced by go_palette_menu_item_new().


Variable Documentation

guint go_palette_signals[GO_PALETTE_LAST_SIGNAL] = {0,} [static]