GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

background image for gtktreeview

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
cnu_sree
GTK+ Geek


Joined: 06 Oct 2006
Posts: 57

PostPosted: Thu Apr 05, 2007 8:36 am    Post subject: background image for gtktreeview Reply with quote

i added background image to gtktreeview using
g_signal_connect (G_OBJECT (G_ContactList), "realize",
G_CALLBACK (contactlist_background_cb), NULL);
void contactlist_background_cb (GtkWidget *treeview, gpointer user_data)
{

GdkWindow *window = gtk_tree_view_get_bin_window (view);
gchar *image="background.bmp";
if (!image) {
gdk_window_clear (window);
return;
}

GError *error = 0;
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (image, &error);
if (!pixbuf) {
g_warning ("could not open background image: '%s'"
" - %s", image, error->message);
return;
}

GdkPixmap *pixmap;
gdk_pixbuf_render_pixmap_and_mask_for_colormap (pixbuf,
gdk_drawable_get_colormap (GDK_DRAWABLE (window)), &pixmap, NULL, 0);
g_object_unref (G_OBJECT (pixbuf));

gdk_window_set_back_pixmap (window, pixmap, FALSE);

}
but my problem is when i add item to treeview the background image is not displaying
how can i display the image and also treeview items
thank u
sree
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 372
Location: State College, Pennsylvania

PostPosted: Thu Apr 05, 2007 11:08 am    Post subject: Reply with quote

Every widget has a GtkStyle member called style. Use widget->style->bg_pixmap[] to specify a background pixmap. You can specify a background pixmap for any of the five widget states. Check it out here:

http://developer.gnome.org/doc/API/2.0/gtk/GtkStyle.html#GtkStyle-struct
Back to top
cnu_sree
GTK+ Geek


Joined: 06 Oct 2006
Posts: 57

PostPosted: Fri Apr 06, 2007 7:58 am    Post subject: Reply with quote

thank u
but i didnot find any function in gtkstyle like bg_pixamp.
can u tell the function which we can apply the all states to gtktreeview for background image.
thank u
sree
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 372
Location: State College, Pennsylvania

PostPosted: Fri Apr 06, 2007 10:10 pm    Post subject: Reply with quote

You don't need a function ... just edit the variable.
Back to top
cnu_sree
GTK+ Geek


Joined: 06 Oct 2006
Posts: 57

PostPosted: Sat Apr 14, 2007 11:54 am    Post subject: Reply with quote

plzz can u show we how can i edit tht variable .
thank u
sree
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP