GTK+

From Wikipedia, the free encyclopedia
GTK+
Original author(s) Spencer Kimball, Peter Mattis, eXperimental Computing Facility (XCF)
Developer(s) GNOME Foundation
Initial release April 14, 1998 (1998-04-14)
Stable release 3.10.6 (December 5, 2013 (2013-12-05)[1]) [±]
Preview release 3.11.4 (January 14, 2014 (2014-01-14)[2]) [±]
Development status Active
Written in C[3]
Operating system Cross-platform
Platform Cross-platform
Available in Multilingual
Type Widget toolkit
License GNU LGPL version 2.1
Website www.gtk.org

GTK+ (GIMP Toolkit, sometimes incorrectly referred to as the GNOME Toolkit) is a cross-platform widget toolkit for creating graphical user interfaces. It is licensed under the terms of the GNU LGPL, allowing both free and proprietary software to use it. It is one of the most popular toolkits for the X Window System, along with Qt.[4]

The name GTK+ originates from GTK; the plus was added to distinguish an enhanced version.[5] It was originally created for the GNU Image Manipulation Program (GIMP), a free software raster graphics editor, in 1997 by Spencer Kimball and Peter Mattis, members of eXperimental Computing Facility (XCF) at the University of California, Berkeley. It is now maintained by members of the GNOME Foundation.

Software architecture

GTK+ is an object-oriented widget toolkit written in the C programming language; it uses the GLib object system for the object orientation. While GTK+ is primarily targeted at the X Window System, it works on other platforms, including Microsoft Windows (interfaced with the Windows API), and Mac OS X (interfaced with Quartz). HTML5 and Wayland backends are in development.

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.

Programming language bindings

A library written in one programming language may be used in another language if bindings are written; GTK+ has a range of bindings for various languages.[6]

GUI designers

There are several GUI designers for GTK+. The following projects are active as of July 2011:

  • Glade, supports GtkBuilder, which is a GTK+ built-in GUI description format.
  • Gazpacho, GUI builder for the GTK+ toolkit written in Python
  • Crow Designer, relies on its own GuiXml format and GuiLoader library.
  • Stetic, part of MonoDevelop, oriented towards Gtk#.

Uses

Screenshot of GIMP 2.4. GTK+ is responsible for managing the interface components of the program, including the menus, buttons, and input fields.

A couple of desktop environments for the X Window System/Wayland (display server protocol) utilize GTK+ as widget toolkit.

Desktop Environments that use GTK+
  • GNOME is based on GTK+, meaning that programs native to GNOME use GTK+
  • Consort, the GNOME 3.4 Fallback Mode - Fork, from SolusOS
  • Cinnamon, which is a fork of GNOME 3, uses GTK+ version 3
  • MATE (desktop environment), a fork made of GNOME version 2 after the release of GNOME version 3
  • Xfce is currently based on GTK+ version 2 with support for and eventual plans for a migration to GTK+ version 3
  • LXDE (Lightweight X11 Desktop Environment) is based on GTK+ version 2
  • Sugar is a desktop environment oriented towards children's education, which uses GTK+, especially PyGTK
  • ROX Desktop is a lightweight desktop, with features from the GUI of RISC OS
  • GPE Palmtop Environment
  • Access Linux Platform (successor of the Palm OS PDA platform)
  • KDE, though based on Qt, has integration with GTK+-based programs and themes (since version 4.2).

GTK+ programs do not require a desktop environment made with GTK+. If the required libraries are installed, a GTK+ program can run on top of other X11-based desktop environments or window managers; this includes Mac OS X if X11.app is installed. GTK+ can also run under Microsoft Windows, where it is used by some popular cross-platform applications like Pidgin and GIMP. wxWidgets, a cross-platform GUI toolkit, uses GTK+ for GNU/Linux operating systems.[7] Other ports include DirectFB (used by the Debian installer, for example) and ncurses.[8]

Window managers

The following window managers use GTK+:

Applications

Some notable applications that use GTK+ as a widget toolkit include:

GTK+ "hello, world"

The following code presents a graphical GTK+ hello-world program in the C programming language. 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!");
 
    /*
    ** Map 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 by returning 0
    */
    g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
 
    /*
    ** Assign the variable "label" to a new GTK label,
    ** with the text "Hello, world!"
    */
    label = gtk_label_new("Hello, world!");
 
    /* Plot the label onto 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 do nothing (block) until
    ** the application is closed
    */
    gtk_main();
 
    return 0;
}

Using pkg-config in a Unix shell, this code can be compiled with the following command (assume above source has file name "helloworld.c"):

$ cc -Wall helloworld.c -o helloworld $(pkg-config --cflags --libs gtk+-3.0)

History

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.[10] Finally GTK was re-written to be object-oriented and was renamed GTK+. This was first used in the 0.99 release of GIMP.

The GTK+ 2.0.0 release series introduced new features which 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. Starting with version 2.8, GTK+ 2 depends on the Cairo graphics library for rendering vector graphics.

GTK+ version 3.0.0 included revised input device handling, support for themes written with CSS-like syntax, and the ability to receive information about other opened GTK+ applications.

Releases

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
GTK+ 2
2.0 11 March 2002 GObject, Universal support for 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 majority of the Widgets are rendered by Cairo 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.6
2.18 23 September 2009 New GtkInfoBar. Improvement on file chooser, printing.
GDK has been rewritten to use 'client-side windows'
2.18.9
2.20 23 March 2010 New GtkSpinner and GtkToolPalette, GtkOffscreenWindow. Improvement on file chooser,
keyboard handling, GDK.Introspection data is now included in GTK+
2.20.1
2.22 23 September 2010 gdk-pixbuf moved to separate module, most GDK drawing are based on Cairo,
many internal data are now private and can be sealed in preparation to GTK+3
2.22.1
2.24 30 January 2011 New simple combo box widget (GtkComboBoxText) added, the cups print backend can send print jobs as PDF,
GtkBuilder has gained support for text tags and menu toolbuttons and many introspection annotation fixes were added
2.24.22
GTK+ 3
3.0 10 February 2011 all the rendering is done using Cairo, this deprecates GDK; more X11 agnostic, XInput2, (slow) theme API based upon Cascading Style Sheets 3.0.12
3.2 25 September 2011 Introduction of two new experimental backends, one for Wayland and one for HTML5 (called Broadway); New Font Chooser dialog; New widgets: GtkLockButton and GtkOverlay 3.2.4
3.4 26 March 2012 Menu support in GtkApplication, A new color chooser, Add support for touch devices, Add support for smooth scrolling, GtkScrolledWindow will do kinetic scrolling with touch devices, OS X support has been improved, This is the first version of GTK+ 3 that works well on Windows, The Wayland backend has been updated to the current Wayland API, and the backend is much more complete now, Spin buttons have received a new look, Accessibility: the treeview accessible support has been rewritten and works much better now, More complete CSS Theming support.renamed 3.4.4
3.6 24 September 2012 GtkSearchEntry, GtkMenuButton, GtkLevelBar. Vertical spin buttons. CSS animations, blur shadows. Support for cross-fading and transitions in themes. 3.6.4
3.8 13 May 2013 Wayland 1.0 stable support, support for the broadwayd server, improved theming, better geometry management, touch improvements, support with the window manager for the frame synchronization protocol 3.8.8
3.10 23 September 2013 Added: Client-side decorations, scaled output support on high-dpi screens, fine-adjustment mode for scrolling. New widgets: GtkHeaderBar, GtkPlacesSidebar, GtkStack, GtkStackSwitcher, GtkRevealer, GtkSearchBar, GtkListBox. Wayland 1.2 compatibility with support for maximization, animated cursors, multiple monitors, settings, custom surfaces and frame synchronization.

Removed: support for the Motif DND protocol, support for multiple screens per display, gdk_window_get_display, gtk_widget_push_composite_child, Tear-off menuitems, plus a number of GTK+ settings.

3.10.6
3.12 TBA
3.14 TBA
GTK+ 4
4.0 End 2014/Beginning of 2015 https://wiki.gnome.org/Projects/GTK%2B/Roadmap
Port of GTK+ to Clutter / Merging of GTK+ with Clutter (the replacement of GTK+ with Clutter is not considered feasible)

Future developments

Project Ridley[11] is an attempt to consolidate several libraries that are currently external to GTK+, including libgnome, libgnomeui, libgnomeprint22, libgnomeprintui22, libglade, libgnomecanvas, libegg, libeel, gtkglext, and libsexy.

Developers are also considering new directions for the library, including removing deprecated API components and adding an integrated scene graph system, similar to the Clutter graphics library, effectively integrating GTK+ with OpenGL.[12][13]

Development and design of the GTK+ 3 release of the toolkit started in February 2009 during the GTK+ Theming Hackfest held in Dublin.[14] The first draft of the development roadmap was released on 9 April 2009.[15]

See also

  • GDK – the GIMP Drawing Kit lies between the X server and the GTK+ library, handling basic rendering such as drawing primitives, raster graphics (bitmaps), cursors, fonts, as well as window events and drag-and-drop functionality
  • gtkmm – C++ bindings for GTK+
  • Qt - cross platform framework and toolkit
  • Enlightenment Foundation Libraries (EFL) – widget toolkit written for the Enlightenment window manager
  • FLTK – A light, cross-platform, non-native widget toolkit
  • FOX toolkit – A fast, open source, cross-platform widget toolkit
  • IUP – a multi-platform toolkit for building native graphical user interfaces
  • Object Windows Library (OWL)
  • Ultimate++
  • Visual Component Library (VCL)
  • Windows Forms – the system for creating graphical user interfaces and elements in the Microsoft family of products
  • Windows Presentation Foundation – the system created by Microsoft to replace Windows Forms in GUI development
  • List of widget toolkits

References

Bibliography

External links

This article is issued from Wikipedia. The text is available under the Creative Commons Attribution/Share Alike; additional terms may apply for the media files.