1

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?

shilovk
  • 11,718
  • 17
  • 75
  • 74
aloplop85
  • 892
  • 3
  • 16
  • 40

1 Answers1

1

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

Community
  • 1
  • 1
aloplop85
  • 892
  • 3
  • 16
  • 40