开发者

Setting Cursor-Color in GTK+ 3

开发者 https://www.devze.com 2023-03-06 14:08 出处:网络
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 depreciate

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号