ApprenticeHacker
ApprenticeHacker

Reputation: 22031

How do you make a Syntax Highlight Text Editor in Gtk Sharp?

I would like to make a custom Text Editor for Gtk# (maybe inherited from Gtk.TextView) which supports Syntax Highlighting , and maybe line numbers at the side. (Something like Scintilla/SciTE?) Anyway, I have tried a few things like putting all the words in an array etc. But so far have not succeeded in making anything that works. Any help, explanation, resource or Sample Code?

NOTE: You may give the answer in another language with a similar syntax for which Gtk has a binding, like Gtkmm or Gtk+.

NOTE2: I am using Gtk 2

Upvotes: 3

Views: 4316

Answers (2)

Mikayla Hutchinson
Mikayla Hutchinson

Reputation: 16153

Use the Mono.TextEditor assembly from MonoDevelop. It's a source editor widget for GTK# written in C#, and has no dependencies on the rest of MD.

MonoDevelop used to use GtkSourceView, but switched to Mono.TextEditor about 3 years ago, because it was more portable, and gave us more flexibility to change and improve things.

Upvotes: 7

ptomato
ptomato

Reputation: 57900

Take a look at the source code of GtkSourceView, then copy it exactly.

;-)

Upvotes: 1

Related Questions