diff options
author | Christopher James Lahey <clahey@ximian.com> | 2002-03-14 06:10:23 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2002-03-14 06:10:23 +0800 |
commit | 6db275314597504560f91526e0026b3dbef99cfc (patch) | |
tree | c8135b45dab57a07ff866fa57f4b1fd570d0860b /widgets/table | |
parent | 7e221fcca97b3afa44c67b45df905c61654d7b8c (diff) | |
download | gsoc2013-evolution-6db275314597504560f91526e0026b3dbef99cfc.tar gsoc2013-evolution-6db275314597504560f91526e0026b3dbef99cfc.tar.gz gsoc2013-evolution-6db275314597504560f91526e0026b3dbef99cfc.tar.bz2 gsoc2013-evolution-6db275314597504560f91526e0026b3dbef99cfc.tar.lz gsoc2013-evolution-6db275314597504560f91526e0026b3dbef99cfc.tar.xz gsoc2013-evolution-6db275314597504560f91526e0026b3dbef99cfc.tar.zst gsoc2013-evolution-6db275314597504560f91526e0026b3dbef99cfc.zip |
Added selected_column, focused_column, and unselected_column.
2002-03-13 Christopher James Lahey <clahey@ximian.com>
* e-cell-pixbuf.c, e-cell-pixbuf.h (pixbuf_draw): Added
selected_column, focused_column, and unselected_column.
svn path=/trunk/; revision=16149
Diffstat (limited to 'widgets/table')
-rw-r--r-- | widgets/table/e-cell-pixbuf.c | 131 | ||||
-rw-r--r-- | widgets/table/e-cell-pixbuf.h | 4 |
2 files changed, 118 insertions, 17 deletions
diff --git a/widgets/table/e-cell-pixbuf.c b/widgets/table/e-cell-pixbuf.c index cbc6b2bb5d..9294e4a703 100644 --- a/widgets/table/e-cell-pixbuf.c +++ b/widgets/table/e-cell-pixbuf.c @@ -1,3 +1,4 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * e-cell-pixbuf.c - An ECell that displays a GdkPixbuf * Copyright 2001, Ximian, Inc. @@ -29,8 +30,17 @@ static ECellClass *parent_class; typedef struct _ECellPixbufView ECellPixbufView; struct _ECellPixbufView { - ECellView cell_view; - GnomeCanvas *canvas; + ECellView cell_view; + GnomeCanvas *canvas; +}; + +/* Object argument IDs */ +enum { + ARG_0, + + ARG_SELECTED_COLUMN, + ARG_FOCUSED_COLUMN, + ARG_UNSELECTED_COLUMN }; /* @@ -90,9 +100,31 @@ pixbuf_draw (ECellView *ecell_view, GdkDrawable *drawable, GdkPixbuf *cell_pixbuf; int real_x, real_y, real_w, real_h; int pix_w, pix_h; + ECellPixbuf *ecp; + + cell_pixbuf = NULL; + + ecp = E_CELL_PIXBUF (ecell_view->ecell); - cell_pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, - model_col, row); + if (flags & E_CELL_SELECTED) { + if (GTK_WIDGET_HAS_FOCUS (GNOME_CANVAS_ITEM (ecell_view->e_table_item_view)->canvas)) { + if (ecp->focused_column != -1) + cell_pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, + ecp->focused_column, row); + } else { + if (ecp->selected_column != -1) + cell_pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, + ecp->selected_column, row); + } + } else { + if (ecp->unselected_column != -1) + cell_pixbuf = e_table_model_value_at (ecell_view->e_table_model, + ecp->unselected_column, row); + } + + if (cell_pixbuf == NULL) + cell_pixbuf = e_table_model_value_at (ecell_view->e_table_model, + model_col, row); /* we can't make sure we really got a pixbuf since, well, it's a Gdk thing */ if (x2 - x1 == 0) @@ -129,7 +161,7 @@ pixbuf_draw (ECellView *ecell_view, GdkDrawable *drawable, 0, 0, real_x, real_y, real_w, real_h, - GDK_PIXBUF_ALPHA_BILEVEL, + GDK_PIXBUF_ALPHA_FULL, 127, GDK_RGB_DITHER_NORMAL, 0, 0); @@ -201,26 +233,91 @@ pixbuf_destroy (GtkObject *object) } static void -e_cell_pixbuf_init (GtkObject *object) +pixbuf_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) { - /* ... */ + ECellPixbuf *pixbuf; + + pixbuf = E_CELL_PIXBUF (object); + + switch (arg_id) { + case ARG_SELECTED_COLUMN: + pixbuf->selected_column = GTK_VALUE_INT (*arg); + break; + + case ARG_FOCUSED_COLUMN: + pixbuf->focused_column = GTK_VALUE_INT (*arg); + break; + + case ARG_UNSELECTED_COLUMN: + pixbuf->unselected_column = GTK_VALUE_INT (*arg); + break; + + default: + return; + } } +/* Get_arg handler for the pixbuf item */ static void -e_cell_pixbuf_class_init (GtkObjectClass *object_class) +pixbuf_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) { - ECellClass *ecc = (ECellClass *) object_class; + ECellPixbuf *pixbuf; + + pixbuf = E_CELL_PIXBUF (object); + + switch (arg_id) { + case ARG_SELECTED_COLUMN: + GTK_VALUE_INT (*arg) = pixbuf->selected_column; + break; + + case ARG_FOCUSED_COLUMN: + GTK_VALUE_INT (*arg) = pixbuf->focused_column; + break; + + case ARG_UNSELECTED_COLUMN: + GTK_VALUE_INT (*arg) = pixbuf->unselected_column; + break; + + default: + arg->type = GTK_TYPE_INVALID; + break; + } +} - object_class->destroy = pixbuf_destroy; +static void +e_cell_pixbuf_init (GtkObject *object) +{ + ECellPixbuf *ecp = E_CELL_PIXBUF (object); - ecc->new_view = pixbuf_new_view; - ecc->kill_view = pixbuf_kill_view; - ecc->draw = pixbuf_draw; - ecc->event = pixbuf_event; - ecc->height = pixbuf_height; - ecc->max_width = pixbuf_max_width; + ecp->selected_column = -1; + ecp->focused_column = -1; + ecp->unselected_column = -1; +} - parent_class = gtk_type_class (E_CELL_TYPE); +static void +e_cell_pixbuf_class_init (GtkObjectClass *object_class) +{ + ECellClass *ecc = (ECellClass *) object_class; + + object_class->destroy = pixbuf_destroy; + object_class->set_arg = pixbuf_set_arg; + object_class->get_arg = pixbuf_get_arg; + + ecc->new_view = pixbuf_new_view; + ecc->kill_view = pixbuf_kill_view; + ecc->draw = pixbuf_draw; + ecc->event = pixbuf_event; + ecc->height = pixbuf_height; + ecc->max_width = pixbuf_max_width; + + parent_class = gtk_type_class (E_CELL_TYPE); + + gtk_object_add_arg_type ("ECellPixbuf::selected_column", + GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_SELECTED_COLUMN); + gtk_object_add_arg_type ("ECellPixbuf::focused_column", + GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_FOCUSED_COLUMN); + gtk_object_add_arg_type ("ECellPixbuf::unselected_column", + GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_UNSELECTED_COLUMN); } guint diff --git a/widgets/table/e-cell-pixbuf.h b/widgets/table/e-cell-pixbuf.h index f89dfc1d1b..938cb84bb4 100644 --- a/widgets/table/e-cell-pixbuf.h +++ b/widgets/table/e-cell-pixbuf.h @@ -36,6 +36,10 @@ typedef struct _ECellPixbufClass ECellPixbufClass; struct _ECellPixbuf { ECell parent; + + int selected_column; + int focused_column; + int unselected_column; }; struct _ECellPixbufClass { |