summaryrefslogtreecommitdiff
path: root/gtk/gtkaccellabel.c
diff options
context:
space:
mode:
authorMatthias Clasen <maclas@gmx.de>2004-09-01 06:39:59 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-09-01 06:39:59 +0000
commit7fdd482866a98df90831dacaddf765c68118c623 (patch)
tree8e549b16049ab93f5e3a540718b513935fca74d0 /gtk/gtkaccellabel.c
parent018c353d0ba15fb01880d09725295adddd56cbdd (diff)
downloadgtk+-7fdd482866a98df90831dacaddf765c68118c623.tar.gz
Make accel labels ellipsize correctly. (#151559, Christian Persch)
Wed Sep 1 02:38:48 2004 Matthias Clasen <maclas@gmx.de> * gtk/gtkaccellabel.c (gtk_accel_label_expose_event): Make accel labels ellipsize correctly. (#151559, Christian Persch)
Diffstat (limited to 'gtk/gtkaccellabel.c')
-rw-r--r--gtk/gtkaccellabel.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c
index 3fd72f7396..8392552b73 100644
--- a/gtk/gtkaccellabel.c
+++ b/gtk/gtkaccellabel.c
@@ -320,6 +320,7 @@ gtk_accel_label_expose_event (GtkWidget *widget,
{
PangoLayout *label_layout;
PangoLayout *accel_layout;
+ GtkLabel *label = GTK_LABEL (widget);
gint x;
gint y;
@@ -327,11 +328,20 @@ gtk_accel_label_expose_event (GtkWidget *widget,
if (direction == GTK_TEXT_DIR_RTL)
widget->allocation.x += ac_width;
widget->allocation.width -= ac_width;
+ if (gtk_label_get_ellipsize (label))
+ pango_layout_set_width (label->layout,
+ pango_layout_get_width (label->layout)
+ - ac_width * PANGO_SCALE);
+
if (GTK_WIDGET_CLASS (parent_class)->expose_event)
GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
if (direction == GTK_TEXT_DIR_RTL)
widget->allocation.x -= ac_width;
widget->allocation.width += ac_width;
+ if (gtk_label_get_ellipsize (label))
+ pango_layout_set_width (label->layout,
+ pango_layout_get_width (label->layout)
+ + ac_width * PANGO_SCALE);
if (direction == GTK_TEXT_DIR_RTL)
x = widget->allocation.x + misc->xpad;