Re: color of gtk widget

On 8/3/07, Prasanna Kumar K <prasanna tataelxsi co in> wrote:
>  I have a GtkWidget "Button. I want the color of the button should be complete red.

You can do it with a gtkrc. For example, set this resource file:

style "red_style" = "default"
        bg[NORMAL] = "#C1665A"
        bg[PRELIGHT] = "#E0B6AF"
        bg[ACTIVE] = "#C1665A"
        bg[SELECTED] = "#C1665A"
        bg[INSENSITIVE] = "#884631"
widget "*red_widget" style "red_style"

Now in your code do:

set_name( GtkWidget *widget, const char *name )
        gtk_widget_set_name( widget, name );
        if( GTK_IS_CONTAINER( widget ) )
                gtk_container_foreach( GTK_CONTAINER( widget ),
                           (GtkCallback) set_name, (char *) name );

set_name( button, "red_widget" );

And the button (and any widgets inside the button) should turn red.

No doubt there's a better technique :-(


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