aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/text
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-01-31 08:00:27 +0800
committerChris Lahey <clahey@src.gnome.org>2001-01-31 08:00:27 +0800
commit1a2f7014e85604838f2f369f446156b4b7af27d6 (patch)
treef3222d357dfc9d6fbc7f8d8ecdbb3e867131b62b /widgets/text
parent80697cc5ad12ff9397875c479eef65265f2f7215 (diff)
downloadgsoc2013-evolution-1a2f7014e85604838f2f369f446156b4b7af27d6.tar.gz
gsoc2013-evolution-1a2f7014e85604838f2f369f446156b4b7af27d6.tar.zst
gsoc2013-evolution-1a2f7014e85604838f2f369f446156b4b7af27d6.zip
Fixed allocation and placement of text window.
2001-01-30 Christopher James Lahey <clahey@ximian.com> * gal/e-text/e-entry.c (canvas_size_allocate, et_set_arg): Fixed allocation and placement of text window. * gal/e-text/e-text.c (e_text_draw): Fixed display of the text. svn path=/trunk/; revision=7920
Diffstat (limited to 'widgets/text')
-rw-r--r--widgets/text/e-entry.c17
-rw-r--r--widgets/text/e-text.c42
2 files changed, 34 insertions, 25 deletions
diff --git a/widgets/text/e-entry.c b/widgets/text/e-entry.c
index 6af6c24f2f..18a958c8f5 100644
--- a/widgets/text/e-entry.c
+++ b/widgets/text/e-entry.c
@@ -76,19 +76,19 @@ canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc,
e_entry->canvas,
0, 0, alloc->width, alloc->height);
gtk_object_set (GTK_OBJECT (e_entry->item),
- "clip_width", (double) alloc->width,
- "clip_height", (double) alloc->height,
+ "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, widget->style->klass->xthickness);
+ e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(e_entry->item), alloc->width, 0);
break;
case GTK_JUSTIFY_CENTER:
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(e_entry->item), alloc->width / 2, widget->style->klass->xthickness);
+ e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(e_entry->item), alloc->width / 2, 0);
break;
default:
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(e_entry->item), 0, widget->style->klass->xthickness);
+ e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(e_entry->item), 0, 0);
break;
}
}
@@ -334,7 +334,6 @@ et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
GtkObject *item = GTK_OBJECT (ee->item);
GtkAnchorType anchor;
double width, height;
- GtkWidget *canvas = GTK_WIDGET(ee->canvas);
switch (arg_id){
case ARG_MODEL:
@@ -383,15 +382,15 @@ et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
switch (ee->justification) {
case GTK_JUSTIFY_CENTER:
anchor = GTK_ANCHOR_N;
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(ee->item), width / 2, canvas->style->klass->xthickness);
+ e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(ee->item), width / 2, 0);
break;
case GTK_JUSTIFY_RIGHT:
anchor = GTK_ANCHOR_NE;
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(ee->item), width, canvas->style->klass->xthickness);
+ e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(ee->item), width, 0);
break;
default:
anchor = GTK_ANCHOR_NW;
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(ee->item), 0, canvas->style->klass->xthickness);
+ e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(ee->item), 0, 0);
break;
}
gtk_object_set(item,
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index fbbe77dc0d..263b84b99b 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -1943,11 +1943,13 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
GdkRectangle sel_rect;
GdkGC *fg_gc;
GnomeCanvas *canvas;
+ GtkWidget *widget;
text = E_TEXT (item);
canvas = GNOME_CANVAS_ITEM(text)->canvas;
+ widget = GTK_WIDGET(canvas);
- fg_gc = GTK_WIDGET(canvas)->style->fg_gc[text->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE];
+ fg_gc = widget->style->fg_gc[text->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE];
if (text->draw_borders || text->draw_background) {
gdouble thisx = item->x1 - x;
@@ -1959,28 +1961,26 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
"width", &thiswidth,
"height", &thisheight,
NULL);
-
- if (text->draw_background){
- gtk_paint_flat_box (widget->style, drawable,
- GTK_WIDGET_STATE(widget), GTK_SHADOW_NONE,
- NULL, widget, "entry_bg",
- thisx, thisy, thiswidth, thisheight);
- }
- if (text->editing) {
- thisx += 1;
- thisy += 1;
- thiswidth -= 2;
- thisheight -= 2;
- }
-
if (text->draw_borders){
+
+ if (text->editing) {
+ thisx += 1;
+ thisy += 1;
+ thiswidth -= 2;
+ thisheight -= 2;
+ }
+
gtk_paint_shadow (widget->style, drawable,
GTK_STATE_NORMAL, GTK_SHADOW_IN,
NULL, widget, "entry",
thisx, thisy, thiswidth, thisheight);
if (text->editing) {
+ thisx -= 1;
+ thisy -= 1;
+ thiswidth += 2;
+ thisheight += 2;
/*
* Chris: I am here "filling in" for the additions
* and substractions done in the previous if (text->editing).
@@ -1990,9 +1990,19 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
*/
gtk_paint_focus (widget->style, drawable,
NULL, widget, "entry",
- thisx - 1, thisy - 1, thiswidth + 1, thisheight + 1);
+ thisx, thisy, thiswidth - 1, thisheight - 1);
}
}
+
+ if (text->draw_background) {
+ gtk_paint_flat_box (widget->style, drawable,
+ GTK_WIDGET_STATE(widget), GTK_SHADOW_NONE,
+ NULL, widget, "entry_bg",
+ thisx + widget->style->klass->xthickness,
+ thisy + widget->style->klass->ythickness,
+ thiswidth - widget->style->klass->xthickness * 2,
+ thisheight - widget->style->klass->ythickness * 2);
+ }
}
if (!text->text || !text->font)