Reputation: 922
I would like to change the default label color of a GtkCheckButton. I surely need to access its GtkContainer or GtkBin and iterate through its children. However, I have not found any code to do this.
I have:
GtkWidget* myCheckbox = gtk_check_button_new_with_label("Hello");
GdkColor color;
gdk_color_parse ("#FF0000", &color);
gtk_widget_modify_fg (myCheckbox, GTK_STATE_NORMAL, &color);
But it modifies just the border's color.
Any ideas?
Upvotes: 2
Views: 823
Reputation: 922
OK, this code works:
if(GTK_IS_BIN(myCheckbox)) {
GtkWidget *child = gtk_bin_get_child(GTK_BIN(myCheckbox));
GdkColor color;
gdk_color_parse ("#FF0000", &color);
gtk_widget_modify_fg (child, GTK_STATE_NORMAL, &color);
}
The idea came from Finding children of a GtkWidget.
HTH
Upvotes: 1