How to set/get Gtk “Style Properties”

2019-01-26 12:27发布

问题:

How to set gtk "Style Properties" listed in gtk documentation?
like for GtkWidget there are Style Properties:

  "separator-height"         gint                  : Read
  "separator-width"          gint                  : Read

So how to get and set them? using GTK+ and C.

Thanks, PP.

回答1:

For example:

gint height, width;
gtk_widget_style_get(widget, "separator-height", &height, "separator-width", &width, NULL);

It works like g_object_get(). There is no corresponding gtk_widget_style_set() though, you have to set them through a RC file, which you load using gtk_rc_parse(). Here is the documentation on RC files.

Just to be clear though, users generally don't like it when you mess with their themes.



标签: gtk