diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-02-12 08:27:22 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-02-12 08:27:22 +0800 |
commit | 04bb0a4fb01448394533a80850370448a2f3aadf (patch) | |
tree | 847a8b541f2597a80e2bfdc73b3401a288368128 /widgets/table/e-table-header-item.c | |
parent | 07d9ddab8e2b6759bbe1b2364371bf5c7b6fe6de (diff) | |
download | gsoc2013-evolution-04bb0a4fb01448394533a80850370448a2f3aadf.tar.gz gsoc2013-evolution-04bb0a4fb01448394533a80850370448a2f3aadf.tar.zst gsoc2013-evolution-04bb0a4fb01448394533a80850370448a2f3aadf.zip |
Test column header image.
2000-02-11 Christopher James Lahey <clahey@helixcode.com>
* clip.png: Test column header image.
* test-check.c: Test pixbuf column headers.
* e-table-col.h, e-table-col.c: Added pixbufs for column headers.
* e-table-header-item.c (draw_button): Draw pixbuf column headers properly.
svn path=/trunk/; revision=1739
Diffstat (limited to 'widgets/table/e-table-header-item.c')
-rw-r--r-- | widgets/table/e-table-header-item.c | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index 72f78453d9..bd78d8ef71 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -14,6 +14,7 @@ #include <libgnomeui/gnome-canvas-util.h> #include <libgnomeui/gnome-canvas-polygon.h> #include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <gdk-pixbuf/gdk-pixbuf.h> #include "e-util/e-cursors.h" #include "e-table-header.h" #include "e-table-header-item.h" @@ -36,6 +37,9 @@ static GnomeCanvasItemClass *ethi_parent_class; +static void ethi_request_redraw (ETableHeaderItem *ethi); + + /* * DnD icons */ @@ -60,8 +64,7 @@ static GtkTargetEntry ethi_drop_types [] = { }; static void -ethi_destroy (GtkObject *object) -{ +ethi_destroy (GtkObject *object){ ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (object); gtk_object_unref (GTK_OBJECT (ethi->eth)); @@ -482,19 +485,34 @@ draw_button (ETableHeaderItem *ethi, ETableCol *col, gdk_gc_set_clip_rectangle (ethi->gc, &clip); - /* Center the thing */ - xtra = (clip.width - gdk_string_measure (ethi->font, col->text))/2; + if ( col->is_pixbuf ) { + xtra = (clip.width - gdk_pixbuf_get_width(col->pixbuf))/2; + + x += xtra + PADDING / 2; + + gdk_pixbuf_render_to_drawable_alpha(col->pixbuf, + drawable, + 0, 0, + x, y + (clip.height - gdk_pixbuf_get_height(col->pixbuf)) / 2, + gdk_pixbuf_get_width(col->pixbuf), gdk_pixbuf_get_height(col->pixbuf), + GDK_PIXBUF_ALPHA_FULL, 128, + GDK_RGB_DITHER_NORMAL, + 0, 0); + } else { + /* Center the thing */ + xtra = (clip.width - gdk_string_measure (ethi->font, col->text))/2; + + /* Skip over border */ + if (xtra < 0) + xtra = 0; - if (xtra < 0) - xtra = 0; - - /* Skip over border */ - x += xtra + 2; + x += xtra + PADDING / 2; - gdk_draw_text ( - drawable, ethi->font, - ethi->gc, x, y + ethi->height - PADDING, - col->text, strlen (col->text)); + gdk_draw_text ( + drawable, ethi->font, + ethi->gc, x, y + ethi->height - ethi->font->descent - PADDING / 2, + col->text, strlen (col->text)); + } } static void @@ -707,12 +725,12 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e) } new_width = x - ethi->resize_start_pos; + if (new_width <= 0) - break; + new_width = 1; if (new_width < ethi->resize_min_width) - break; - + new_width = ethi->resize_min_width; ethi_request_redraw (ethi); ethi->resize_width = new_width; |