Re: drawing to textview's gdk_window
- From: Luka Napotnik <luka napotnik gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: drawing to textview's gdk_window
- Date: Fri, 08 Jun 2007 19:31:02 +0200
Thanks it works now.
Greets,
Luka
Dne 08.06.2007 (pet) ob 19:14 +0200 je Jonathan Winterflood zapisal(a):
Hi,
Using g_signal_connect(), make your callback return false, so that
the original callback (that obviously
renders the text) will then be called also.
Jonathan
On 6/8/07, Luka Napotnik <luka napotnik gmail com> wrote:
I now connected the expose-event signal to a callback function
that
draws a rectangle to the widget. The problem is that the font
is under
the rect. if I call g_signal_connect_after() and no text
appears if I
call g_signal_connect() but the rect is visible.
I get the GdkWindow of the textview using:
win = gtk_text_view_get_window(GTK_TEXT_VIEW(widget),
GTK_TEXT_WINDOW_TEXT);
I want the rect to be in the background of the textview. Is
there any
way to do that?
Greets,
Luka
Dne 08.06.2007 (pet) ob 08:32 -0700 je Chris Sparks
zapisal(a):
> Luka,
>
> Sounds like an expose event needs to be signaled. I use GDK
only and
> not GTK so I am not sure
> how much of GTK is doing event processing.
>
> Chris
> > Hello. I'm trying to draw a rectangle of a textview's
background
> > GdkWindow. First I get the gdk_window of the textview and
and then try
> > ot draw on it. But it doesn't work. Why?
> >
> > -----------------
> > #include <gtk/gtk.h>
> >
> > int main(int argc, char **argv)
> > {
> >
> > GtkWidget *window;
> > GtkWidget *text;
> > GdkGC *gc;
> > GdkColor color1, color2;
> > GdkWindow *win;
> > gtk_init(&argc, &argv);
> >
> > window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
> > text = gtk_text_view_new();
> > gtk_widget_show(text);
> > gtk_container_add(window, text);
> > gtk_widget_show_all(window);
> > gtk_widget_realize(text);
> >
> > win = gtk_text_view_get_window(text,
GTK_TEXT_WINDOW_WIDGET);
> > gc = gdk_gc_new(win);
> > gdk_color_parse("red", &color1);
> > gdk_gc_set_foreground(gc, &color1);
> > gdk_color_parse("black", &color2);
> > gdk_gc_set_background(gc, &color2);
> > gdk_gc_set_fill(gc, GDK_SOLID);
> >
> > gdk_draw_rectangle(win, gc, TRUE, 1, 1, 20, 20);
> >
> > gtk_widget_set_size_request(window, 500, 400);
> > gtk_main();
> > return 0;
> > }
> > -------------------
> >
> >
> > Greets,
> > Luka
> >
> >
------------------------------------------------------------------------
> >
> > _______________________________________________
> > gtk-app-devel-list mailing list
> > gtk-app-devel-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]