aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-header-item.c
diff options
context:
space:
mode:
authorIain Holmes <iain@helixcode.com>2000-09-27 07:38:22 +0800
committerIain Holmes <iain@src.gnome.org>2000-09-27 07:38:22 +0800
commitdac353c09740029c071c0949a49de2eeae471732 (patch)
treecf34851acb60515136ab378544b0478fc67f1bac /widgets/table/e-table-header-item.c
parentd71561a2ae3b1cfbc3542940c7087584045f2b2e (diff)
downloadgsoc2013-evolution-dac353c09740029c071c0949a49de2eeae471732.tar
gsoc2013-evolution-dac353c09740029c071c0949a49de2eeae471732.tar.gz
gsoc2013-evolution-dac353c09740029c071c0949a49de2eeae471732.tar.bz2
gsoc2013-evolution-dac353c09740029c071c0949a49de2eeae471732.tar.lz
gsoc2013-evolution-dac353c09740029c071c0949a49de2eeae471732.tar.xz
gsoc2013-evolution-dac353c09740029c071c0949a49de2eeae471732.tar.zst
gsoc2013-evolution-dac353c09740029c071c0949a49de2eeae471732.zip
Fudge the location of a click in the tooltip, so that it selects the
2000-09-27 Iain Holmes <iain@helixcode.com> * e-cell-text.c: Fudge the location of a click in the tooltip, so that it selects the current cell. Pass keyboard events to the e-table. * e-table-item.c: Don't show the tooltip if the cell is being editted. Also don't destroy the tooltip until the button release event (other wise the e-table-item starts a select) 2000-09-25 Iain Holmes <iain@helixcode.com> * e-table-header-item.c (draw_button): Calculate the vertical offset correctly to centre text. 2000-09-25 Iain Holmes <iain@helixcode.com> * e-table-header-item.c (ethi_popup_best_fit): Fill this out to call the "request_width" signal and set the new size. svn path=/trunk/; revision=5599
Diffstat (limited to 'widgets/table/e-table-header-item.c')
-rw-r--r--widgets/table/e-table-header-item.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index 9335c5fc89..c728baa747 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -780,6 +780,7 @@ draw_button (ETableHeaderItem *ethi, ETableCol *col,
0, 0);
} else {
int str_width, ellipsis_width, text_len;
+ int font_height, y_xtra;
text_len = strlen (col->text);
ellipsis_width = gdk_text_width (ethi->font, "...", 3);
@@ -787,6 +788,10 @@ draw_button (ETableHeaderItem *ethi, ETableCol *col,
str_width = gdk_text_width (ethi->font, col->text, text_len);
if (str_width < clip.width) {
+ font_height = gdk_text_height (ethi->font, col->text,
+ text_len);
+ y_xtra = (clip.height - font_height) / 2;
+
/* Center the thing */
xtra = (clip.width - gdk_string_measure (ethi->font, col->text))/2;
@@ -796,9 +801,8 @@ draw_button (ETableHeaderItem *ethi, ETableCol *col,
xtra += HEADER_PADDING / 2;
- gdk_draw_text (
- drawable, ethi->font,
- ethi->gc, x + xtra, y + ethi->height - ethi->font->descent - HEADER_PADDING / 2,
+ gdk_draw_text (drawable, ethi->font,
+ ethi->gc, clip.x + xtra, y + (ethi->height - y_xtra - HEADER_PADDING),
col->text, text_len);
} else {
/* Need ellipsis */
@@ -819,14 +823,18 @@ draw_button (ETableHeaderItem *ethi, ETableCol *col,
xtra += HEADER_PADDING / 2;
+ font_height = gdk_text_height (ethi->font, col->text,
+ ellipsis_length);
+ y_xtra = (clip.height - font_height) / 2;
+
gdk_draw_text (drawable, ethi->font, ethi->gc,
- x + xtra, y + ethi->height - ethi->font->descent - HEADER_PADDING / 2,
+ x + xtra, y + (ethi->height - y_xtra - HEADER_PADDING),
col->text, ellipsis_length);
gdk_draw_string (drawable, ethi->font, ethi->gc,
x + xtra + gdk_text_width (ethi->font,
col->text,
ellipsis_length),
- y + ethi->height - ethi->font->descent - HEADER_PADDING / 2,
+ y + (ethi->height - y_xtra - HEADER_PADDING),
"...");
}
}
@@ -1231,6 +1239,17 @@ ethi_popup_alignment(GtkWidget *widget, EthiHeaderInfo *info)
static void
ethi_popup_best_fit(GtkWidget *widget, EthiHeaderInfo *info)
{
+ ETableHeaderItem *ethi = info->ethi;
+ int width;
+
+ gtk_signal_emit_by_name (GTK_OBJECT (ethi->eth),
+ "request_width",
+ info->col, &width);
+ /* Add 10 to stop it from "..."ing */
+ e_table_header_set_size (ethi->eth, info->col, width + 10);
+
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi));
+
}
static void
@@ -1257,7 +1276,7 @@ static EPopupMenu ethi_context_menu [] = {
{ N_("Field Chooser"), NULL, GTK_SIGNAL_FUNC(ethi_popup_field_chooser), 0},
{ "", NULL, GTK_SIGNAL_FUNC(NULL), 1},
{ N_("Alignment"), NULL, GTK_SIGNAL_FUNC(ethi_popup_alignment), 1},
- { N_("Best Fit"), NULL, GTK_SIGNAL_FUNC(ethi_popup_best_fit), 1},
+ { N_("Best Fit"), NULL, GTK_SIGNAL_FUNC(ethi_popup_best_fit), 2},
{ N_("Format Columns..."), NULL, GTK_SIGNAL_FUNC(ethi_popup_format_columns), 1},
{ "", NULL, GTK_SIGNAL_FUNC(NULL), 1},
{ N_("Customize Current View..."), NULL, GTK_SIGNAL_FUNC(ethi_popup_customize_view), 1},