Re: Can I set background image for GtkTextView



Hi,
I already wrote a simple demo in the past when working on my project, this may help you, feel free to explore 
the codes because this is a really simple one:

#include <gtk/gtk.h>

int 
main (int    argc,
      char **argv)
{
  GtkWidget *window;
  GtkWidget *textv;
  GdkWindow *textv_window;
  GdkPixmap *pixmap;
  GdkColor color;

  
  gtk_init (&argc, &argv);
  
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size (GTK_WINDOW (window), 400, 600);
  g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
  
  textv = gtk_text_view_new ();
  gtk_container_add (GTK_CONTAINER (window), textv);
  
  gtk_widget_show_all (window);
  
  /* Windows are are nonexistent before the widget has been realized. */
  textv_window = gtk_text_view_get_window (GTK_TEXT_VIEW (textv), 
                                           GTK_TEXT_WINDOW_TEXT);
  gdk_color_parse ("#68604d", &color);
  pixmap = gdk_pixmap_create_from_xpm ((GdkDrawable *) textv_window, NULL, 
                                       &color, "back-gimp.xpm");
  gdk_window_set_back_pixmap (textv_window, pixmap, FALSE);
  
  gtk_main ();
  
  return 0;
}





--- amolgkulkarni gmail com wrote:

From: Amol <amolgkulkarni gmail com>
To: winsty <winsty 126 com>
Cc: gtk-app-devel-list <gtk-app-devel-list gnome org>
Subject: Re: Can I set background image for GtkTextView
Date: Wed, 01 Jul 2009 10:48:18 +0530

Try setting background to textwindow of GtkTextView.
you can get text_window through gtk_text_view_get_window
(textview,window_type);
I don't remember exact syntax though.

Regards,
Amol
On Tue, 2009-06-30 at 15:54 +0800, winsty wrote:
Hi, All
 
    I want to set a background image for GtkTextView in my program, but i don't know how to do it. And i 
also can't find something useful about 
this question, that's why I'm sending it here. 
 
Best Regards
winsty
 
    

_______________________________________________
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




_____________________________________________________________
Listen to KNAC, Hit the Home page and Tune In Live! ---> http://www.knac.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]