English 中文(简体)
Setting Cursor-Color in GTK+ 3
原标题:
  • 时间:2011-05-16 22:26:37
  •  标签:
  • gtk
  • gtk3

I m looking to set a GtkTextView cursor-color. I know I can do it through the gtk_rc_parse command or 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

Actually, there seem to be cursor-color style property: http://developer.gnome.org/gtk3/3.0/GtkWidget.html#GtkWidget--s-cursor-color





相关问题
Pointers in Lisp?

I ve started learning Lisp recently and wanted to write a program which uses gtk interface. I ve installed lambda-gtk bindings (on CMUCL). I want to have putpixel/getpixel ability on a pixbuf. But I ...

In Gtk, how do I make a Button with just a stock icon?

I want to create a button with the stock "Remove" icon on it, but without the text "Remove". If I use Button button = new Button(Stock.Remove);, I get the opposite: just the text, and no icon. I will ...

Using GtkMenu in Gtk+-2.14.0

I am building an application which has GtkMenu widget. I am using Glade RAD tool to develop UI and while creating project in Glade I have specified version of GTK as 2.16 which supports GtkMenu and ...

Can you set the FileFilters for a Gtk Dialog in Glade?

In my code, I have lines like this: Builder builder = new Builder(); builder.AddFromFile(gladefile); FileChooserDialog dialog = (FileChooserDialog) builder.GetObject("dialog"); FileFilter[] ...

热门标签