GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Oct 24, 2014 2:41 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: GtkIconView Background Image?
PostPosted: Sat Jul 07, 2007 7:57 pm 
Offline
GTK+ Guru

Joined: Thu Jun 21, 2007 1:52 pm
Posts: 198
Location: Wilkes Barre Pa
Question can iconview have a background image like nautilus?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 08, 2007 2:35 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
GtkIconView is derived from GtkWidget. GtkWidget can have a background color or GdkPixmap through its style. Therefore, yes, GtkIconView can.

GtkWidget has a member called "GtkStyle *style". You should use that and its bg_pixmap[] property at 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: Sun Jul 08, 2007 11:22 pm 
Offline
GTK+ Guru

Joined: Thu Jun 21, 2007 1:52 pm
Posts: 198
Location: Wilkes Barre Pa
Am i doing something wrong?

Code:
#include <gtk/gtk.h>

int main( int   argc,
          char *argv[] )
{
    GtkWidget *window;
    GdkColor color;
    GtkWidget *iconview;

    gtk_init (&argc, &argv);
   
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    iconview = gtk_icon_view_new();
    gtk_container_add (GTK_CONTAINER (window), iconview);
    gtk_icon_view_set_selection_mode(GTK_ICON_VIEW (iconview), GTK_SELECTION_MULTIPLE);
    
    gdk_color_parse ("red", &color);
    gtk_widget_modify_bg (iconview, GTK_STATE_NORMAL, &color);

    gtk_widget_show  (iconview);
    gtk_widget_show  (window);
   
    gtk_main ();
   
    return 0;
}


This code should set the iconview background to red but it doesn't


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 09, 2007 12:45 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 3:07 am
Posts: 384
Location: Fairfax, Virginia
I believe you want to use the base color: http://developer.gnome.org/doc/API/2.0/ ... odify-base

_________________
Andrew Krause

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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 09, 2007 3:07 pm 
Offline
GTK+ Guru

Joined: Thu Jun 21, 2007 1:52 pm
Posts: 198
Location: Wilkes Barre Pa
:) Thanks


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