| Developer(s) | GNOME Foundation |
|---|---|
| Stable release | 2.16.4 / 2009-07-02; 2 days ago |
| Written in | C |
| Operating system | Cross-platform |
| Type | Widget toolkit |
| License | GNU Lesser General Public License |
| Website | www.gtk.org |
GTK+ (GIMP Toolkit) is a cross-platform widget toolkit for creating graphical user interfaces. It is one of the most popular toolkits for the X Window System, along with Qt.
GTK+ was initially created for the GNU Image Manipulation Program (GIMP), a raster graphics editor, in 1997 by Spencer Kimball and Peter Mattis, members of eXperimental Computing Facility (XCF) at University of California, Berkeley.
Licensed under the LGPL, GTK+ is free software and is part of the GNU Project.
Contents |
GTK+ is an object oriented widget toolkit written in the c programming language; object orientation is achieved by using the Glib object system (GObject). On the X11 display server GTK+ uses xlib to draw widgets, an alternative choice that could have been made is to use Xt; using xlib provides flexibility and allows GTK+ to be used on platforms where the X Window System is unavailable. While GTK+ is primarily targeted at the X Window System, other platforms are supported Microsoft Windows, DirectFB, and Quartz on Mac OS X.
GTK+ can be configured to change the look of the widgets drawn, this is done using different display engines; several display engines exist which try to emulate the look of the native widgets on the platform in use.
A library written in one programming language may be used in another programming language if bindings are written, GTK+ has bindings in many languages.[1][2][3] See the table below:
| Language | Name | Oficially supported |
|---|---|---|
| C | GTK+ | (not a binding) |
| C++ | gtkmm | yes |
| Ruby | ruby-gtk2 | yes |
| Python | PyGTK | yes |
| Java | java-gnome | yes (not available for Microsoft Windows) |
| C# | Gtk# | yes |
| PHP | PHP-GTK | yes |
| Ada | no | |
| D | no | |
| Haskell | no | |
| Lua | no | |
| Ocaml | no | |
| Pascal | no | |
| Pike | no | |
| Javascript | no | |
| Tcl | no | |
| Euphoria | no | |
| .NET programming languages | no | |
| Vala and GOB | languages written for the GObject system. |
GTK+ was originally designed and used in the GNU Image Manipulation Program (GIMP) as a replacement of the Motif toolkit; at some point Peter Mattis became disenchanted with Motif and began to write his own GUI toolkit called the GIMP toolkit and had successfully replaced Motif by the 0.60 release of GIMP.[4] Finally GTK was re-written to be object oriented and was renamed GTK+, this was first used in the 0.99 release of GIMP.
GTK+ 2 has succeeded GTK+ 1. Its new features include improved text rendering using Pango, a new theme engine, improved accessibility using the Accessibility Toolkit, complete transition to Unicode using UTF-8 strings and a more flexible API. However, GTK+ 2 lacks compatibility with GTK+ 1, and programmers must port applications to it.
Starting with version 2.8, GTK+ 2 depends on the Cairo library for rendering with vector graphics in GTK+ 2.
| Release series | Initial release date | Major enhancements | Latest minor version |
|---|---|---|---|
| 1.0 | 14 April 1998 | First stable version | 1.0.6 |
| 1.2 | 27 February 1999 | New widgets (GtkFontSelector, GtkPacker, GtkItemFactory, GtkCTree, GtkInvisible, GtkCalendar, GtkLayout, GtkPlug, GtkSocket) |
1.2.10 |
| 2.0 | 11 March 2002 | GObject, Universal Unicode UTF-8 | 2.0.9 |
| 2.2 | 22 December 2002 | Multihead support | 2.2.4 |
| 2.4 | 16 March 2004 | New widgets (GtkFileChooser, GtkComboBox, GtkComboBoxEntry, GtkExpander, GtkFontButton, GtkColorButton) |
2.4.14 |
| 2.6 | 16 December 2004 | New widgets (GtkIconView, GtkAboutDialog, GtkCellView). The last to support Windows 98/ME. |
2.6.10 |
| 2.8 | 13 August 2005 | Cairo integration | 2.8.20 |
| 2.10 | 3 July 2006 | New widgets (GtkStatusIcon, GtkAssistant, GtkLinkButton, GtkRecentChooser) and print support (GtkPrintOperation) |
2.10.14 |
| 2.12 | 14 September 2007 | GtkBuilder | 2.12.12 |
| 2.14 | 4 September 2008 | Jpeg2000 load support | 2.14.7 |
| 2.16 | 13 March 2009 | New GtkOrientable, Caps Lock warning in password Entry. Improvement on GtkScale, GtkStatusIcon, GtkFileChooser. |
2.16.2 |
Project Ridley is an attempt to consolidate several libraries that are currently external to GTK+, including: libgnome, libgnomeui, libgnomeprint22, libgnomeprintui22, libglade, libgnomecanvas, libegg, libeel and gtkglext.[5]
Developers are also considering new directions for the library, including breaking ABI, removing deprecated API components, and adding an integrated scene graph system, similar to the Clutter graphics library, effectively integrating GTK+ with OpenGL.[6][7]
Development and design of the next GTK+ 3 release of the toolkit started in February 2009 during the GTK+ Theming Hackfest held in Dublin [8]. A first draft of the development roadmap has been released on April 9th, 2009 [9].
GTK+ hello world in C, this program has a window with the title "Hello, World" and a label with similar text.
#include <gtk/gtk.h> int main (int argc, char *argv[]) { GtkWidget *window; GtkWidget *label; gtk_init (&argc, &argv); /* create the main, top level, window */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); /* give it the title */ gtk_window_set_title (GTK_WINDOW (window), "Hello World"); /* Connect the destroy signal of the window to gtk_main_quit * When the window is about to be destroyed we get a notification and * stop the main GTK+ loop */ g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); /* Create the "Hello, World" label */ label = gtk_label_new ("Hello, World"); /* and insert it into the main window */ gtk_container_add (GTK_CONTAINER (window), label); /* make sure that everything, window and label, are visible */ gtk_widget_show_all (window); /* start the main loop, and let it rest there until the application is closed */ gtk_main (); return 0; }
Those desktop environments are not required to run GTK+ programs. If the libraries the program requires are installed, a GTK+ program can run on top of other X11-based environments such as KDE or an X11-plus-window manager environment; this includes Mac OS X if X11.app is installed. (default since Leopard) GTK+ can also run under Microsoft Windows, used by some popular cross-platform applications like Pidgin and GIMP. wxWidgets, a cross-platform GUI toolkit, uses GTK+ for Unix systems.[10] Other ports include DirectFB (used by the Debian installer, for example) and ncurses[11].
Some notable applications that use GTK+ as a widget toolkit include:
| The Wikibook X Window Programming has a page on the topic of |
|
|||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||
stock | retire | vm
Why are we here?
All text is available under the terms of the GNU Free Documentation License
This page is cache of Wikipedia. History