Classes | Defines | Typedefs | Enumerations | Functions | Variables

go-color-palette.c File Reference

#include <goffice/goffice-config.h>
#include "go-color-palette.h"
#include "goffice-gtk.h"
#include <goffice/utils/go-marshalers.h>
#include <goffice/utils/go-color.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkcolor.h>
#include <glib/gi18n-lib.h>
#include <gsf/gsf-impl-utils.h>
#include <string.h>

Classes

struct  _GOColorPalette
struct  GOColorPaletteClass
struct  _ColorNamePair
struct  GOMenuColor
struct  GOMenuColorClass

Defines

#define COLOR_PREVIEW_WIDTH   12
#define COLOR_PREVIEW_HEIGHT   12

Typedefs

typedef struct _ColorNamePair ColorNamePair

Enumerations

enum  { COLOR_CHANGED, DISPLAY_CUSTOM_DIALOG, LAST_SIGNAL }

Functions

static GtkWidget * create_color_sel (GObject *action_proxy, GOColor c, GCallback handler, gboolean allow_alpha)
static gboolean handle_color_sel (GtkColorSelectionDialog *dialog, gint response_id, GOColor *res)
static void go_color_palette_finalize (GObject *object)
static void go_color_palette_class_init (GObjectClass *gobject_class)
 GSF_CLASS (GOColorPalette, go_color_palette, go_color_palette_class_init, NULL, GTK_TYPE_VBOX)
static void set_color (GOColorPalette *pal, GOColor color, gboolean is_custom, gboolean by_user, gboolean is_default)
static void cb_history_changed (GOColorPalette *pal)
static gboolean cb_default_release_event (G_GNUC_UNUSED GtkWidget *button, G_GNUC_UNUSED GdkEventButton *event, GOColorPalette *pal)
static void swatch_activated (GOColorPalette *pal, GtkBin *button)
static gboolean cb_swatch_release_event (GtkBin *button, G_GNUC_UNUSED GdkEventButton *event, GOColorPalette *pal)
static gboolean cb_swatch_key_press (GtkBin *button, GdkEventKey *event, GOColorPalette *pal)
static GtkWidget * go_color_palette_button_new (GOColorPalette *pal, GtkTable *table, GtkTooltips *tip, ColorNamePair const *color_name, gint col, gint row)
static void cb_combo_custom_response (GtkColorSelectionDialog *dialog, gint response_id, GOColorPalette *pal)
static void cb_combo_custom_clicked (G_GNUC_UNUSED GtkWidget *button, GOColorPalette *pal)
void go_color_palette_set_title (GOColorPalette *pal, char const *title)
void go_color_palette_set_group (GOColorPalette *pal, GOColorGroup *cg)
 go_color_palette_set_group : : GOColorGroup
static GtkWidget * go_color_palette_setup (GOColorPalette *pal, char const *no_color_label, int cols, int rows, ColorNamePair const *color_names)
void go_color_palette_set_color_to_default (GOColorPalette *pal)
void go_color_palette_set_current_color (GOColorPalette *pal, GOColor color)
GOColor go_color_palette_get_current_color (GOColorPalette *pal, gboolean *is_default, gboolean *is_custom)
void go_color_palette_set_allow_alpha (GOColorPalette *pal, gboolean allow_alpha)
GtkWidget * go_color_palette_new (char const *no_color_label, GOColor default_color, GOColorGroup *cg)
 go_color_palette_new: : color label : GOColor : GOColorGroup
static void go_menu_color_class_init (GObjectClass *gobject_class)
static GSF_CLASS (GOMenuColor, go_menu_color, go_menu_color_class_init, NULL, GTK_TYPE_MENU)
static void cb_menu_default_activate (G_GNUC_UNUSED GtkWidget *button, GOMenuColor *menu)
static void cb_menu_color_activate (GtkWidget *button, GOMenuColor *menu)
static void cb_menu_custom_response (GtkColorSelectionDialog *dialog, gint response_id, GOMenuColor *menu)
static void cb_menu_custom_activate (G_GNUC_UNUSED GtkWidget *button, GOMenuColor *menu)
GtkWidget * go_color_palette_make_menu (char const *no_color_label, GOColor default_color, GOColorGroup *cg, char const *custom_dialog_title, GOColor current_color)
 go_color_palette_make_menu: : default_color: GOColor : GOColorGroup : : GOColor

Variables

static ColorNamePair const default_color_set []
static guint go_color_palette_signals [LAST_SIGNAL] = { 0, }
static GObjectClass * go_color_palette_parent_class
static guint go_menu_color_signals [LAST_SIGNAL] = { 0, }

Define Documentation

#define COLOR_PREVIEW_HEIGHT   12
#define COLOR_PREVIEW_WIDTH   12

Typedef Documentation

typedef struct _ColorNamePair ColorNamePair

Enumeration Type Documentation

anonymous enum
Enumerator:
COLOR_CHANGED 
DISPLAY_CUSTOM_DIALOG 
LAST_SIGNAL 

Function Documentation

static void cb_combo_custom_clicked ( G_GNUC_UNUSED GtkWidget *  button,
GOColorPalette pal 
) [static]
static void cb_combo_custom_response ( GtkColorSelectionDialog *  dialog,
gint  response_id,
GOColorPalette pal 
) [static]
static gboolean cb_default_release_event ( G_GNUC_UNUSED GtkWidget *  button,
G_GNUC_UNUSED GdkEventButton *  event,
GOColorPalette pal 
) [static]

References set_color().

Referenced by go_color_palette_setup().

static void cb_history_changed ( GOColorPalette pal  )  [static]
static void cb_menu_color_activate ( GtkWidget *  button,
GOMenuColor menu 
) [static]
static void cb_menu_custom_activate ( G_GNUC_UNUSED GtkWidget *  button,
GOMenuColor menu 
) [static]
static void cb_menu_custom_response ( GtkColorSelectionDialog *  dialog,
gint  response_id,
GOMenuColor menu 
) [static]
static void cb_menu_default_activate ( G_GNUC_UNUSED GtkWidget *  button,
GOMenuColor menu 
) [static]
static gboolean cb_swatch_key_press ( GtkBin *  button,
GdkEventKey *  event,
GOColorPalette pal 
) [static]
static gboolean cb_swatch_release_event ( GtkBin *  button,
G_GNUC_UNUSED GdkEventButton *  event,
GOColorPalette pal 
) [static]
static GtkWidget* create_color_sel ( GObject *  action_proxy,
GOColor  c,
GCallback  handler,
gboolean  allow_alpha 
) [static]
static GtkWidget* go_color_palette_button_new ( GOColorPalette pal,
GtkTable *  table,
GtkTooltips *  tip,
ColorNamePair const *  color_name,
gint  col,
gint  row 
) [static]
static void go_color_palette_class_init ( GObjectClass *  gobject_class  )  [static]
static void go_color_palette_finalize ( GObject *  object  )  [static]
GOColor go_color_palette_get_current_color ( GOColorPalette pal,
gboolean *  is_default,
gboolean *  is_custom 
)
GtkWidget* go_color_palette_make_menu ( char const *  no_color_label,
GOColor  default_color,
GOColorGroup cg,
char const *  custom_dialog_title,
GOColor  current_color 
)

go_color_palette_make_menu: : default_color: GOColor : GOColorGroup : : GOColor

go_color_palette_make_menu: : color label : GOColor : GOColorGroup : optional string : GOColor

Create a submenu with a palette of colours. Caller is responsible for creating an item to point to the submenu.

References _, cb_menu_color_activate(), cb_menu_custom_activate(), cb_menu_default_activate(), GOColorGroup::history, make_colored_menu_item(), and rows.

GtkWidget* go_color_palette_new ( char const *  no_color_label,
GOColor  default_color,
GOColorGroup cg 
)

go_color_palette_new: : color label : GOColor : GOColorGroup

Returns: A new palette

References go_color_palette_set_group(), go_color_palette_setup(), GO_COLOR_PALETTE_TYPE, GO_TYPE_COLOR_PALETTE, and rows.

void go_color_palette_set_allow_alpha ( GOColorPalette pal,
gboolean  allow_alpha 
)
void go_color_palette_set_color_to_default ( GOColorPalette pal  ) 

References set_color().

void go_color_palette_set_current_color ( GOColorPalette pal,
GOColor  color 
)

References set_color().

void go_color_palette_set_group ( GOColorPalette pal,
GOColorGroup cg 
)

go_color_palette_set_group : : GOColorGroup

go_color_palette_set_group : : GOColorPalette : GOColorGroup

Absorb the reference to the group

References cb_history_changed().

void go_color_palette_set_title ( GOColorPalette pal,
char const *  title 
)
static GtkWidget* go_color_palette_setup ( GOColorPalette pal,
char const *  no_color_label,
int  cols,
int  rows,
ColorNamePair const *  color_names 
) [static]
static void go_menu_color_class_init ( GObjectClass *  gobject_class  )  [static]
static GSF_CLASS ( GOMenuColor  ,
go_menu_color  ,
go_menu_color_class_init  ,
NULL  ,
GTK_TYPE_MENU   
) [static]
GSF_CLASS ( GOColorPalette  ,
go_color_palette  ,
go_color_palette_class_init  ,
NULL  ,
GTK_TYPE_VBOX   
)
static gboolean handle_color_sel ( GtkColorSelectionDialog *  dialog,
gint  response_id,
GOColor res 
) [static]
static void set_color ( GOColorPalette pal,
GOColor  color,
gboolean  is_custom,
gboolean  by_user,
gboolean  is_default 
) [static]
static void swatch_activated ( GOColorPalette pal,
GtkBin *  button 
) [static]

Variable Documentation

ColorNamePair const default_color_set[] [static]
GObjectClass* go_color_palette_parent_class [static]
guint go_color_palette_signals[LAST_SIGNAL] = { 0, } [static]
guint go_menu_color_signals[LAST_SIGNAL] = { 0, } [static]