aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-10-09 10:09:30 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-30 01:49:58 +0800
commit5245a810b23c1d2ca0a15cbf65f1e00e7da5c4a2 (patch)
tree1a83d6cc9ccbc37ee12c9c12271d356ec67be270 /widgets/table
parent4a95827168bb9ed9b91d8b903363cf5b9dd712f1 (diff)
downloadgsoc2013-evolution-5245a810b23c1d2ca0a15cbf65f1e00e7da5c4a2.tar
gsoc2013-evolution-5245a810b23c1d2ca0a15cbf65f1e00e7da5c4a2.tar.gz
gsoc2013-evolution-5245a810b23c1d2ca0a15cbf65f1e00e7da5c4a2.tar.bz2
gsoc2013-evolution-5245a810b23c1d2ca0a15cbf65f1e00e7da5c4a2.tar.lz
gsoc2013-evolution-5245a810b23c1d2ca0a15cbf65f1e00e7da5c4a2.tar.xz
gsoc2013-evolution-5245a810b23c1d2ca0a15cbf65f1e00e7da5c4a2.tar.zst
gsoc2013-evolution-5245a810b23c1d2ca0a15cbf65f1e00e7da5c4a2.zip
e-table: Draw focus with Cairo
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-table-item.c27
-rw-r--r--widgets/table/e-table-item.h2
2 files changed, 13 insertions, 16 deletions
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 390c207727..7bd0ed4427 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -1669,13 +1669,6 @@ eti_realize (GnomeCanvasItem *item)
eti->grid_gc = gdk_gc_new (window);
gdk_gc_set_foreground (eti->grid_gc, &style->dark[GTK_STATE_NORMAL]);
- eti->focus_gc = gdk_gc_new (window);
- gdk_gc_set_foreground (eti->focus_gc, &style->bg[GTK_STATE_NORMAL]);
- gdk_gc_set_background (eti->focus_gc, &style->fg[GTK_STATE_NORMAL]);
- eti->stipple = gdk_bitmap_create_from_data (NULL, gray50_bits, gray50_width, gray50_height);
- gdk_gc_set_ts_origin (eti->focus_gc, 0, 0);
- gdk_gc_set_stipple (eti->focus_gc, eti->stipple);
- gdk_gc_set_fill (eti->focus_gc, GDK_OPAQUE_STIPPLED);
g_signal_connect (GTK_LAYOUT(item->canvas), "scroll_event", G_CALLBACK (eti_tree_unfreeze), eti);
@@ -1732,10 +1725,6 @@ eti_unrealize (GnomeCanvasItem *item)
eti->fill_gc = NULL;
g_object_unref (eti->grid_gc);
eti->grid_gc = NULL;
- g_object_unref (eti->focus_gc);
- eti->focus_gc = NULL;
- g_object_unref (eti->stipple);
- eti->stipple = NULL;
eti_unrealize_cell_views (eti);
@@ -1760,6 +1749,7 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gint x, gint y, gint wid
gdouble i2c[6];
ArtPoint eti_base, eti_base_item, lower_right;
GtkWidget *canvas = GTK_WIDGET (item->canvas);
+ GtkStyle *style = gtk_widget_get_style (canvas);
gint height_extra = eti->horizontal_draw_grid ? 1 : 0;
cairo_t *cr;
@@ -2034,9 +2024,18 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gint x, gint y, gint wid
* Draw focus
*/
if (eti->draw_focus && f_found) {
- gdk_gc_set_ts_origin (eti->focus_gc, f_x1, f_y1);
- gdk_draw_rectangle (drawable, eti->focus_gc, FALSE,
- f_x1, f_y1, f_x2 - f_x1 - 1, f_y2 - f_y1);
+ static const double dash[] = { 1.0, 1.0 };
+ cairo_set_line_width (cr, 1.0);
+ cairo_rectangle (cr,
+ f_x1 + 0.5, f_x2 + 0.5,
+ f_x2 - f_x1 - 1, f_y2 - f_y1);
+
+ gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
+ cairo_stroke_preserve (cr);
+
+ cairo_set_dash (cr, dash, G_N_ELEMENTS (dash), 0.0);
+ gdk_cairo_set_source_color (cr, &style->fg[GTK_STATE_NORMAL]);
+ cairo_stroke (cr);
}
exit:
diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h
index e99fa29194..4f0e7bbc4e 100644
--- a/widgets/table/e-table-item.h
+++ b/widgets/table/e-table-item.h
@@ -81,8 +81,6 @@ typedef struct {
GdkGC *fill_gc;
GdkGC *grid_gc;
- GdkGC *focus_gc;
- GdkBitmap *stipple;
guint alternating_row_colors:1;
guint horizontal_draw_grid:1;