How to modify a button's fg color?
- From: "Bing Lin" <solarsea gmail com>
- To: gtk-app-devel-list gnome org
- Subject: How to modify a button's fg color?
- Date: Sun, 18 Jun 2006 11:52:24 +0800
I set some values of GtkRcStyle, but the color still not changed, how can I
do?
The code is like this:
#include <gtk/gtk.h>
int main( int argc, char *argv[] )
{
GtkWidget *window;
GtkWidget *button;
GdkColor color;
GtkRcStyle *rc_style;
gtk_init (&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "test");
gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE);
button = gtk_button_new_with_label(" ");
gtk_container_add(GTK_CONTAINER(window), button);
gdk_color_parse("red", &color);
rc_style = gtk_rc_style_new();
rc_style->fg[GTK_STATE_NORMAL] = color;
rc_style->color_flags[GTK_STATE_NORMAL] |= GTK_RC_FG;
gtk_widget_modify_style(GTK_WIDGET(button), rc_style);
gtk_rc_style_unref(rc_style);
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]