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/gtktextdisplay.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/gtktextdisplay.c')
-rw-r--r-- | gtk/gtktextdisplay.c | 52 |
1 files changed, 45 insertions, 7 deletions
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c index a6c1ac261..8826c7775 100644 --- a/gtk/gtktextdisplay.c +++ b/gtk/gtktextdisplay.c @@ -159,6 +159,7 @@ static void render_layout_line (GdkDrawable *drawable, GtkTextRenderState *render_state, PangoLayoutLine *line, + GSList **pixmap_pointer, int x, int y, gboolean selected) @@ -245,6 +246,39 @@ render_layout_line (GdkDrawable *drawable, x_off += logical_rect.width; } + else /* Pixmap segment */ + { + GtkTextPixmap *pixmap = (*pixmap_pointer)->data; + gint width, height; + GdkRectangle pixmap_rect, draw_rect; + + *pixmap_pointer = (*pixmap_pointer)->next; + + gdk_drawable_get_size (pixmap->pixmap, &width, &height); + + pixmap_rect.x = x + x_off / PANGO_SCALE; + pixmap_rect.y = y - height; + pixmap_rect.width = width; + pixmap_rect.height = height; + + gdk_rectangle_intersect (&pixmap_rect, &render_state->clip_rect, &draw_rect); + + if (pixmap->mask) + { + gdk_gc_set_clip_mask (render_state->fg_gc, pixmap->mask); + gdk_gc_set_clip_origin (render_state->fg_gc, + pixmap_rect.x, pixmap_rect.y); + } + + gdk_draw_drawable (drawable, render_state->fg_gc, pixmap->pixmap, + draw_rect.x - pixmap_rect.x, draw_rect.y - pixmap_rect.y, + draw_rect.x, draw_rect.y, draw_rect.width, draw_rect.height); + + if (pixmap->mask) + gdk_gc_set_clip_rectangle (render_state->fg_gc, &render_state->clip_rect); + + x_off += width * PANGO_SCALE; + } } } @@ -258,6 +292,7 @@ render_para (GdkDrawable *drawable, int selection_end_index) { PangoRectangle logical_rect; + GSList *pixmap_pointer = line_display->pixmaps; GSList *tmp_list; PangoAlignment align; PangoLayout *layout = line_display->layout; @@ -340,14 +375,16 @@ render_para (GdkDrawable *drawable, TRUE, x + line_display->left_margin, selection_y, total_width / PANGO_SCALE, selection_height); - render_layout_line (drawable, render_state, - line, x + x_offset / PANGO_SCALE, y + (y_offset - logical_rect.y) / PANGO_SCALE, + render_layout_line (drawable, render_state, line, &pixmap_pointer, + x + x_offset / PANGO_SCALE, y + (y_offset - logical_rect.y) / PANGO_SCALE, TRUE); } else { - render_layout_line (drawable, render_state, - line, x + x_offset / PANGO_SCALE, y + (y_offset - logical_rect.y) / PANGO_SCALE, + GSList *pixmap_pointer_tmp = pixmap_pointer; + + render_layout_line (drawable, render_state, line, &pixmap_pointer, + x + x_offset / PANGO_SCALE, y + (y_offset - logical_rect.y) / PANGO_SCALE, FALSE); if (selection_start_index < byte_offset + line->length && @@ -368,8 +405,8 @@ render_para (GdkDrawable *drawable, logical_rect.width / PANGO_SCALE, selection_height); - render_layout_line (drawable, render_state, - line, x + x_offset / PANGO_SCALE, y + (y_offset - logical_rect.y) / PANGO_SCALE, + render_layout_line (drawable, render_state, line, &pixmap_pointer_tmp, + x + x_offset / PANGO_SCALE, y + (y_offset - logical_rect.y) / PANGO_SCALE, TRUE); gdk_gc_set_clip_region (render_state->widget->style->fg_gc [GTK_STATE_SELECTED], NULL); @@ -467,8 +504,9 @@ get_item_properties (PangoItem *item, if (attr->klass->type == gtk_text_attr_appearance_type) { *appearance = &((GtkTextAttrAppearance *)attr)->appearance; - return; } + + tmp_list = tmp_list->next; } } |