aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/text
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-07-08 02:39:43 +0800
committerChris Lahey <clahey@src.gnome.org>2000-07-08 02:39:43 +0800
commit053cdfdbc36a8100ac5e7dfe33e05f82a7e50ea2 (patch)
tree86d5177a13563363bbe4bfb3eb4d68789c8b88b8 /widgets/text
parentcf61f7c4dd6f445be551bea4b55e7902edf4a816 (diff)
downloadgsoc2013-evolution-053cdfdbc36a8100ac5e7dfe33e05f82a7e50ea2.tar
gsoc2013-evolution-053cdfdbc36a8100ac5e7dfe33e05f82a7e50ea2.tar.gz
gsoc2013-evolution-053cdfdbc36a8100ac5e7dfe33e05f82a7e50ea2.tar.bz2
gsoc2013-evolution-053cdfdbc36a8100ac5e7dfe33e05f82a7e50ea2.tar.lz
gsoc2013-evolution-053cdfdbc36a8100ac5e7dfe33e05f82a7e50ea2.tar.xz
gsoc2013-evolution-053cdfdbc36a8100ac5e7dfe33e05f82a7e50ea2.tar.zst
gsoc2013-evolution-053cdfdbc36a8100ac5e7dfe33e05f82a7e50ea2.zip
Set "anchor" and "fill_clip_rectangle" arguments.
2000-07-07 Christopher James Lahey <clahey@helixcode.com> * widgets/e-text/e-entry.c: Set "anchor" and "fill_clip_rectangle" arguments. * widgets/e-text/e-text.c, widgets/e-text/e-text.h: Added "fill_clip_rectangle" argument which describes whether to accept clicks throughout the clipping rectangle. svn path=/trunk/; revision=3956
Diffstat (limited to 'widgets/text')
-rw-r--r--widgets/text/e-entry.c2
-rw-r--r--widgets/text/e-text.c41
-rw-r--r--widgets/text/e-text.h2
3 files changed, 45 insertions, 0 deletions
diff --git a/widgets/text/e-entry.c b/widgets/text/e-entry.c
index 9e089a635a..588d5358d7 100644
--- a/widgets/text/e-entry.c
+++ b/widgets/text/e-entry.c
@@ -108,6 +108,8 @@ e_entry_init (GtkObject *object)
e_entry->item = E_TEXT(gnome_canvas_item_new(gnome_canvas_root(e_entry->canvas),
e_text_get_type(),
"clip", TRUE,
+ "fill_clip_rectangle", TRUE,
+ "anchor", GTK_ANCHOR_NW,
NULL));
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(e_entry->item),
INNER_BORDER,
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index 41e8a1eeb1..e87cec59c8 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -64,6 +64,7 @@ enum {
ARG_CLIP_WIDTH,
ARG_CLIP_HEIGHT,
ARG_CLIP,
+ ARG_FILL_CLIP_RECTANGLE,
ARG_X_OFFSET,
ARG_Y_OFFSET,
ARG_FILL_COLOR,
@@ -234,6 +235,8 @@ e_text_class_init (ETextClass *klass)
GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_CLIP_HEIGHT);
gtk_object_add_arg_type ("EText::clip",
GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_CLIP);
+ gtk_object_add_arg_type ("EText::fill_clip_rectangle",
+ GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_FILL_CLIP_RECTANGLE);
gtk_object_add_arg_type ("EText::x_offset",
GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_X_OFFSET);
gtk_object_add_arg_type ("EText::y_offset",
@@ -1095,6 +1098,11 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
needs_reflow = 1;
break;
+ case ARG_FILL_CLIP_RECTANGLE:
+ text->fill_clip_rectangle = GTK_VALUE_BOOL (*arg);
+ needs_update = 1;
+ break;
+
case ARG_X_OFFSET:
text->xofs = GTK_VALUE_DOUBLE (*arg);
text->needs_recalc_bounds = 1;
@@ -1273,6 +1281,10 @@ e_text_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
GTK_VALUE_BOOL (*arg) = text->clip;
break;
+ case ARG_FILL_CLIP_RECTANGLE:
+ GTK_VALUE_BOOL (*arg) = text->fill_clip_rectangle;
+ break;
+
case ARG_X_OFFSET:
GTK_VALUE_DOUBLE (*arg) = text->xofs;
break;
@@ -1885,6 +1897,35 @@ e_text_point (GnomeCanvasItem *item, double x, double y,
lines = text->lines;
+ if (text->fill_clip_rectangle) {
+ double clip_width;
+ double clip_height;
+
+ /* Calculate the width and heights */
+ calc_height (text);
+ calc_line_widths (text);
+
+ if (text->clip_width < 0)
+ clip_width = text->max_width;
+ else
+ clip_width = text->clip_width;
+
+ /* Get canvas pixel coordinates for clip rectangle position */
+ clip_width = clip_width * item->canvas->pixels_per_unit;
+ if ( text->clip_height >= 0 )
+ clip_height = text->clip_height * item->canvas->pixels_per_unit;
+ else
+ clip_height = text->height * item->canvas->pixels_per_unit;
+
+ if (cx >= text->clip_cx &&
+ cx <= text->clip_cx + clip_width &&
+ cy >= text->clip_cy &&
+ cy <= text->clip_cy + clip_height)
+ return 0;
+ else
+ return 1;
+ }
+
for (i = 0; i < text->num_lines; i++) {
/* Compute the coordinates of rectangle for the current line,
* clipping if appropriate.
diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h
index cde023fb08..a233501293 100644
--- a/widgets/text/e-text.h
+++ b/widgets/text/e-text.h
@@ -53,6 +53,7 @@ BEGIN_GNOME_DECLS
* clip_width double RW Width of clip rectangle
* clip_height double RW Height of clip rectangle
* clip boolean RW Use clipping rectangle?
+ * fill_clip_rect boolean RW Whether the text item represents itself as being the size of the clipping rectangle.
* x_offset double RW Horizontal offset distance from anchor position
* y_offset double RW Vertical offset distance from anchor position
* text_width double R Used to query the width of the rendered text
@@ -129,6 +130,7 @@ struct _EText {
int height; /* Rendered text height in pixels */
guint clip : 1; /* Use clip rectangle? */
+ guint fill_clip_rectangle : 1; /* Fill the clipping rectangle. */
/* Antialiased specific stuff follows */
ETextSuckFont *suckfont; /* Sucked font */