I'm looking to set a GtkTextView cursor-color. I know I can do it through the gtk_rc_parse command or开发者_Python百科 something similar, but the documentation says that those commands are depreciated, and I don't think GtkCssProvider supports cursor-color. Is it possible to set it some other way?
This can be done in gtk3 with CSS. GtkTextView itself doesn't have a "cursor-color" property. You must go up in hierarchy to GtkWidget which does have that property and since GtkTextView is a type of GtkWidget you can style the GtkTextView through GtkWidget. So you use: -GtkWidget-cursor-color
This is true for other properties as well. For instance, "focus-line-width". This property is shared by several widgets including GtkButton and the rows of a GtkTreeView. The style property listed for a specific widget in the documentation must be preceded by: -widgetname-
For instance, the only style property listed for GtkTextView is "error-underline-color" So in the CSS you would use: -GtkTextView-error-underline-color
Here's an example of changing "cursor-color" and other properties in a GtkTextView:
http://www.gtkforums.com/viewtopic.php?f=988&p=195276=Styling+a+GtkTextView+with+Gtk3+and+Css%3A#p195276
This is probably what you are looking for: http://developer.gnome.org/gtk3/3.0/GtkWidget.html#gtk-widget-override-cursor
Actually, there seem to be cursor-color style property: http://developer.gnome.org/gtk3/3.0/GtkWidget.html#GtkWidget--s-cursor-color
精彩评论