diff options
author | Matthias Clasen <mclasen@redhat.com> | 2005-06-10 20:05:08 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2005-06-10 20:05:08 +0000 |
commit | 43f263a03166e9219c0ec07fadfef9f880811968 (patch) | |
tree | cce99ef85815f769e42b6b557f36860fc41b24a6 /gtk/gtktextdisplay.c | |
parent | 3003d2edc4d6af95f0aaae1f93b9b6d66779eb47 (diff) | |
download | gtk+-43f263a03166e9219c0ec07fadfef9f880811968.tar.gz |
Allow setting paragraph background. (#81045, Gustavo Carneiro, patch by
2005-06-10 Matthias Clasen <mclasen@redhat.com>
Allow setting paragraph background. (#81045, Gustavo
Carneiro, patch by Jeroen Zwartepoorte)
* gtk/gtktextlayout.c (set_para_values): Propagate
pg_bg_color to the display struct.
(gtk_text_layout_free_line_display): Free it here.
* gtk/gtktextdisplay.c (render_para): If pg_bg_color
is set, draw a rectangle in that color behind
the paragraph.
* gtk/gtktexttag.c (gtk_text_tag_class_init): Add
paragraph-background, paragraph-background-gdk and
paragraph-background-set properties.
(set_pg_bg_color): A setter for paragraph-background.
* gtk/gtktextlayout.h (struct _GtkTextLineDisplay): Add
pg_bg_color.
* gtk/gtktexttag.h (struct _GtkTextAttributes): Add
pg_bg_color.
(struct _GtkTextTag): Add pg_bg_color_set.
Diffstat (limited to 'gtk/gtktextdisplay.c')
-rw-r--r-- | gtk/gtktextdisplay.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c index 94f7a1a8cc..6c0f6c0634 100644 --- a/gtk/gtktextdisplay.c +++ b/gtk/gtktextdisplay.c @@ -532,6 +532,25 @@ render_para (GtkTextRenderer *text_renderer, } else { + if (line_display->pg_bg_color) + { + GdkGC *bg_gc; + + bg_gc = gdk_gc_new (text_renderer->drawable); + gdk_gc_set_fill (bg_gc, GDK_SOLID); + gdk_gc_set_rgb_fg_color (bg_gc, line_display->pg_bg_color); + + gdk_draw_rectangle (text_renderer->drawable, + bg_gc, + TRUE, + x + line_display->left_margin, + selection_y, + screen_width, + selection_height); + + gdk_gc_unref (bg_gc); + } + text_renderer_set_selected (text_renderer, FALSE); pango_renderer_draw_layout_line (PANGO_RENDERER (text_renderer), line, |