Re: Setting background colour
- From: Billy O'Connor <billyoc gnuyork org>
- To: "Thomas Keaney" <se40319 cs may ie>
- Cc: <gtk-app-devel-list gnome org>
- Subject: Re: Setting background colour
- Date: Thu, 19 Feb 2004 12:06:41 -0500
"Thomas Keaney" <se40319 cs may ie> writes:
How would I change the background colour and button colours within my interface?
#include <gtk/gtk.h>
int main(void)
{
    GtkWidget *window;
    GtkWidget *button;
    gtk_init (&argc, &argv);
    
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    button = gtk_button_new_with_label ("Hello World");
    gtk_container_add (GTK_CONTAINER (window), button);
    GdkColor color;
    color.red = 65535;
    color.blue = 0;
    color.green = 65535;
    gtk_widget_modify_bg ( button, GTK_STATE_NORMAL, &color );
    GtkWidget *child_label;
    child_label = gtk_bin_get_child (GTK_BIN (button) );
    color.red = 0;
    color.blue = 65535;
    color.green = 0;
    gtk_widget_modify_fg ( child_label, GTK_STATE_NORMAL, &color );
    /* reuse text foreground color for window background */
    gtk_widget_modify_bg ( window, GTK_STATE_NORMAL, &color );    
    gtk_widget_show (button);
    gtk_widget_show (window);
    gtk_main ();
    
    return 0;
}
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]