Fork me on GitHub

GtkScintilla

A GTK+ based source code editing Widget.

GtkScintilla is a GTK+ widget which enables easily adding a powerful source code editor to your applications. Harnessing the abilities of the Scintilla editing component, GtkScintilla adds a familiar GTK+/GObject API, making the widget comfortable to use in these programs, using all the typical GObject conventions.

Some of the current and future features (beyond those of Scintilla itself) include:

Screenshot


Screenshot of GtkScintilla in Glade 3.

Example Code

This is the simplest possible use of GtkScintilla:

#include <gtk/gtk.h>
#include <gtkscintilla.h>

int main(int argc, char *argv[])
{
	GtkWidget *win, *sci;
	
	gtk_init(&argc, &argv);
	
	win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_default_size(GTK_WINDOW(win), 640, 480);
	gtk_window_set_title(GTK_WINDOW(win), "GtkScintilla Basic Demo");
	g_signal_connect(win, "destroy", gtk_main_quit, NULL);
	
	sci = gtk_scintilla_new();
	
	g_object_set(G_OBJECT(sci),
		"text", "Hello World",
		NULL);
	
	gtk_container_add(GTK_CONTAINER(win), sci);
	gtk_widget_show_all(win);
	
	gtk_main();
	
	return 0;	
}

Compile with:

gcc `pkg-config --cflags --libs gtk+-2.0 gtkscintilla-1.0` demo.c

Dependencies

Install

$ ./autogen.sh
$ ./configure
$ make
$ make install

License

GNU Lesser General Public License v3.0

Author

Matthew Brush <matthewbrush(at)gmail(dot)com>

Download

You can download this project in either zip or tar formats.

You can also clone the project with Git by running:

$ git clone git://github.com/codebrainz/GtkScintilla

Alternatives