GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sat Aug 23, 2014 3:21 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: background image for gtktreeview
PostPosted: Thu Apr 05, 2007 8:36 am 
Offline
GTK+ Geek

Joined: Fri Oct 06, 2006 6:37 am
Posts: 57
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 11:08 am 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
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/ ... yle-struct

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 06, 2007 7:58 am 
Offline
GTK+ Geek

Joined: Fri Oct 06, 2006 6:37 am
Posts: 57
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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 06, 2007 10:10 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
You don't need a function ... just edit the variable.

_________________
Andrew Krause

Foundations of GTK+ Development: Buy now for only $31.49!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 14, 2007 11:54 am 
Offline
GTK+ Geek

Joined: Fri Oct 06, 2006 6:37 am
Posts: 57
plzz can u show we how can i edit tht variable .
thank u
sree


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group