aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2001-01-18 16:53:42 +0800
committerChris Lahey <clahey@src.gnome.org>2001-01-18 16:53:42 +0800
commit4f70ba02f8cfa250ebbf8a71103600db162dce13 (patch)
treef373ac7395718b7cc53e0a639403b425479d4f2c
parent4d018f0cee29b58508270d65bced167052afc380 (diff)
downloadgsoc2013-evolution-4f70ba02f8cfa250ebbf8a71103600db162dce13.tar
gsoc2013-evolution-4f70ba02f8cfa250ebbf8a71103600db162dce13.tar.gz
gsoc2013-evolution-4f70ba02f8cfa250ebbf8a71103600db162dce13.tar.bz2
gsoc2013-evolution-4f70ba02f8cfa250ebbf8a71103600db162dce13.tar.lz
gsoc2013-evolution-4f70ba02f8cfa250ebbf8a71103600db162dce13.tar.xz
gsoc2013-evolution-4f70ba02f8cfa250ebbf8a71103600db162dce13.tar.zst
gsoc2013-evolution-4f70ba02f8cfa250ebbf8a71103600db162dce13.zip
Center text vertically.
2001-01-18 Christopher James Lahey <clahey@helixcode.com> * gal/e-text/e-entry.c (canvas_size_allocate, et_set_arg): Center text vertically. svn path=/trunk/; revision=7619
-rw-r--r--widgets/text/e-entry.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/widgets/text/e-entry.c b/widgets/text/e-entry.c
index d1b34f8aa5..96c78bcef2 100644
--- a/widgets/text/e-entry.c
+++ b/widgets/text/e-entry.c
@@ -79,14 +79,16 @@ canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc,
"clip_width", (double) alloc->width,
"clip_height", (double) alloc->height,
NULL);
+
switch (e_entry->justification) {
case GTK_JUSTIFY_RIGHT:
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(e_entry->item), alloc->width, 0);
+ e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(e_entry->item), alloc->width, alloc->height / 2);
break;
case GTK_JUSTIFY_CENTER:
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(e_entry->item), alloc->width / 2, 0);
+ e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(e_entry->item), alloc->width / 2, alloc->height / 2);
break;
default:
+ e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(e_entry->item), 0, alloc->height / 2);
break;
}
}
@@ -152,7 +154,7 @@ e_entry_init (GtkObject *object)
e_text_get_type(),
"clip", TRUE,
"fill_clip_rectangle", TRUE,
- "anchor", GTK_ANCHOR_NW,
+ "anchor", GTK_ANCHOR_W,
"draw_borders", TRUE,
"draw_background", TRUE,
NULL));
@@ -331,7 +333,7 @@ et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
EEntry *ee = E_ENTRY (o);
GtkObject *item = GTK_OBJECT (ee->item);
GtkAnchorType anchor;
- int width;
+ double width, height;
switch (arg_id){
case ARG_MODEL:
@@ -374,19 +376,20 @@ et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
ee->justification = GTK_VALUE_ENUM (*arg);
gtk_object_get(item,
"clip_width", &width,
+ "clip_height", &height,
NULL);
switch (ee->justification) {
case GTK_JUSTIFY_CENTER:
- anchor = GTK_ANCHOR_N;
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(ee->item), width / 2, 0);
+ anchor = GTK_ANCHOR_CENTER;
+ e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(ee->item), width / 2, height / 2);
break;
case GTK_JUSTIFY_RIGHT:
- anchor = GTK_ANCHOR_NE;
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(ee->item), width, 0);
+ anchor = GTK_ANCHOR_E;
+ e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(ee->item), width, height / 2);
break;
default:
- anchor = GTK_ANCHOR_NW;
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(ee->item), 0, 0);
+ anchor = GTK_ANCHOR_W;
+ e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(ee->item), 0, height / 2);
break;
}
gtk_object_set(item,