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 

GtkIconView Background Image?

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


Joined: 21 Jun 2007
Posts: 91
Location: Wilkes Barre Pa

PostPosted: Sat Jul 07, 2007 7:57 pm    Post subject: GtkIconView Background Image? Reply with quote

Question can iconview have a background image like nautilus?
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 387
Location: Fairfax, Virginia

PostPosted: Sun Jul 08, 2007 2:35 pm    Post subject: Reply with quote

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/gtk/GtkStyle.html#GtkStyle-struct
Back to top
caracal
GTK+ Geek


Joined: 21 Jun 2007
Posts: 91
Location: Wilkes Barre Pa

PostPosted: Sun Jul 08, 2007 11:22 pm    Post subject: Reply with quote

Am i doing something wrong?

Code: (Plaintext)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#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
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 387
Location: Fairfax, Virginia

PostPosted: Mon Jul 09, 2007 12:45 pm    Post subject: Reply with quote

I believe you want to use the base color: http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-modify-base
Back to top
caracal
GTK+ Geek


Joined: 21 Jun 2007
Posts: 91
Location: Wilkes Barre Pa

PostPosted: Mon Jul 09, 2007 3:07 pm    Post subject: Reply with quote

:) Thanks
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