diff options
author | Owen Taylor <otaylor@redhat.com> | 2000-07-21 19:30:22 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2000-07-21 19:30:22 +0000 |
commit | e6be8f3f6a8152416b66e406382c6b6f805fa23d (patch) | |
tree | 162931bcd0d1606e39b5b5b51bb3a851482472de /gtk/gtktextlayout.c | |
parent | fa5d7c7709785ffddca4681d51ebf7b21f208165 (diff) | |
download | gdk-pixbuf-e6be8f3f6a8152416b66e406382c6b6f805fa23d.tar.gz |
Use new PangoAttrShape to reserve space for pixmaps, add GSList *pixmaps
Fri Jul 21 15:28:13 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextlayout.[ch], gtk/gtktextdisplay.c: Use new
PangoAttrShape to reserve space for pixmaps, add
GSList *pixmaps to GtkTextLineDisplay, draw the pixmaps
in the display functions.
* gtk/testgtk.c (create_layout): Set some more exotic
scrolled window options
* gtk/gtkscrolledwindow.[ch] (gtk_scrolled_window_set_shadow_type):
Add function to set the shadow type of a window, to allow
putting a shadow around widgets such as GtkLayout or GnomeCanvas
which don't draw their own frame.
Diffstat (limited to 'gtk/gtktextlayout.c')
-rw-r--r-- | gtk/gtktextlayout.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index 03f419c37..737a83e3b 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -55,6 +55,7 @@ #include "gtktextiterprivate.h" #include <stdlib.h> +#include <string.h> static GtkTextLineData *gtk_text_line_data_new (GtkTextLayout *layout, GtkTextLine *line); @@ -1090,17 +1091,35 @@ add_text_attrs (GtkTextLayout *layout, attr->start_index = start; attr->end_index = start + byte_count; - pango_attr_list_insert (attrs, attr); + pango_attr_list_insert (attrs, attr); } } static void add_pixmap_attrs (GtkTextLayout *layout, + GtkTextLineDisplay *display, GtkTextStyleValues *style, GtkTextLineSegment *seg, PangoAttrList *attrs, gint start) { + PangoAttribute *attr; + PangoRectangle logical_rect; + GtkTextPixmap *pixmap = &seg->body.pixmap; + gint width, height; + + gdk_drawable_get_size (pixmap->pixmap, &width, &height); + logical_rect.x = 0; + logical_rect.y = -height * PANGO_SCALE; + logical_rect.width = width * PANGO_SCALE; + logical_rect.height = height * PANGO_SCALE; + + attr = pango_attr_shape_new (&logical_rect, &logical_rect); + attr->start_index = start; + attr->end_index = start + seg->byte_count; + pango_attr_list_insert (attrs, attr); + + display->pixmaps = g_slist_append (display->pixmaps, pixmap); } static void @@ -1271,7 +1290,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout, } else { - add_pixmap_attrs (layout, style, seg, attrs, byte_offset); + add_pixmap_attrs (layout, display, style, seg, attrs, byte_offset); memcpy (text + byte_offset, gtk_text_unknown_char_utf8, seg->byte_count); byte_offset += seg->byte_count; } @@ -1365,6 +1384,7 @@ gtk_text_layout_free_line_display (GtkTextLayout *layout, { g_slist_foreach (display->cursors, (GFunc)g_free, NULL); g_slist_free (display->cursors); + g_slist_free (display->pixmaps); } g_free (display); |