aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-04-24 04:18:35 +0800
committerChris Lahey <clahey@src.gnome.org>2001-04-24 04:18:35 +0800
commitc4f279f48009b2176eff5f981b728766d82f10da (patch)
treef9e0a5dcc33afac76bf69d29ad2a29738120f721 /widgets/table
parent70353ea6c6e991f8dc2696ccef1cc351e85a675e (diff)
downloadgsoc2013-evolution-c4f279f48009b2176eff5f981b728766d82f10da.tar
gsoc2013-evolution-c4f279f48009b2176eff5f981b728766d82f10da.tar.gz
gsoc2013-evolution-c4f279f48009b2176eff5f981b728766d82f10da.tar.bz2
gsoc2013-evolution-c4f279f48009b2176eff5f981b728766d82f10da.tar.lz
gsoc2013-evolution-c4f279f48009b2176eff5f981b728766d82f10da.tar.xz
gsoc2013-evolution-c4f279f48009b2176eff5f981b728766d82f10da.tar.zst
gsoc2013-evolution-c4f279f48009b2176eff5f981b728766d82f10da.zip
Make pixbuf columns show their title if there is space.
2001-04-23 Christopher James Lahey <clahey@ximian.com> * e-table-header-utils.c (e_table_header_draw_button): Make pixbuf columns show their title if there is space. svn path=/trunk/; revision=9517
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-table-header-utils.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c
index 6d73d1f763..0933359206 100644
--- a/widgets/table/e-table-header-utils.c
+++ b/widgets/table/e-table-header-utils.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* ETable widget - utilities for drawing table header buttons
*
* Copyright (C) 2000 Ximian, Inc.
@@ -288,6 +289,7 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
if (ecol->is_pixbuf) {
int pwidth, pheight;
int clip_width, clip_height;
+ int xpos;
GdkPixmap *pixmap;
g_assert (ecol->pixbuf != NULL);
@@ -298,15 +300,34 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
clip_width = MIN (pwidth, inner_width);
clip_height = MIN (pheight, inner_height);
+ xpos = inner_x;
+
+ if (inner_width - pwidth > 11) {
+ int rbearing;
+ int width;
+ int ypos;
+
+ gdk_string_extents (font, ecol->text, NULL, &rbearing, &width, NULL, NULL);
+ if (rbearing < inner_width - (pwidth + 1)) {
+ xpos = inner_x + (inner_width - width - (pwidth + 1)) / 2;
+ }
+
+ ypos = inner_y + (inner_height - font->ascent - font->descent) / 2 + font->ascent;
+
+ e_table_draw_elided_string (drawable, font, gc,
+ xpos + pwidth + 1, ypos,
+ ecol->text, inner_width - (xpos - inner_x), FALSE);
+ }
+
pixmap = make_composite_pixmap (drawable, gc,
ecol->pixbuf, &style->bg[state],
clip_width, clip_height,
- inner_x,
+ xpos,
inner_y + (inner_height - clip_height) / 2);
if (pixmap) {
gdk_draw_pixmap (drawable, gc, pixmap,
0, 0,
- inner_x,
+ xpos,
inner_y + (inner_height - clip_height) / 2,
clip_width, clip_height);
gdk_pixmap_unref (pixmap);