Thursday, July 02, 2009

Background image on GtkTextView

I have answer a question in the GTK+ mailing list regarding setting a custom background image on a GtkTextView widget, i already done this in the past, just trying to refresh my memory here a important piece of that code:

...
gtk_widget_show_all (window);
/* Windows are nonexistent before the widget has been realized. */
textv_window = gtk_text_view_get_window (GTK_TEXT_VIEW (textv), GTK_TEXT_WINDOW_TEXT);
pixmap = gdk_pixmap_create_from_xpm ((GdkDrawable *) textv_window, NULL, &color, "back-gimp.xpm");
gdk_window_set_back_pixmap (textv_window, pixmap, FALSE);
...