World Library  
Flag as Inappropriate
Email this Article

Gtk

Article Id: WHEBN0023534314
Reproduction Date:

Title: Gtk  
Author: World Heritage Encyclopedia
Language: English
Subject: Proof assistant, Comparison of text editors, Perl Object Environment, Comparison of privilege authorization features, Griffon (framework), Pigment (software), Marionnet
Collection:
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Gtk

"GTK" redirects here. For other uses, see GTK (disambiguation).

Original author(s) Spencer Kimball, Peter Mattis, eXperimental Computing Facility (XCF)
Developer(s) GNOME Foundation
Initial release April 14, 1998 (1998-04-14)
Development status Active
Written in C[1]
Operating system Cross-platform
Platform Cross-platform
Available in Multilingual
Type Widget toolkit
License GNU LGPL version 2.1
Website

GTK+ (GIMP 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.[2]

The name GTK+ originates from GTK; the plus was added to distinguish an enhanced version.[3] 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. On the X11 display server, GTK+ uses Xlib to draw widgets. Using Xlib provides flexibility and allows GTK+ to run on platforms where the X Window System is unavailable. 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

Main article: List of language bindings for GTK+

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.[4]

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

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.[5] Other ports include DirectFB (used by the Debian installer, for example) and ncurses.[6]

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 
 
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

initially
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.[8] 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.0
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+ 3.0
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.

Future developments

Project Ridley[9] 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.[10][11]

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

See also

Free software portal
  • 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

  • GTK+ 3 Reference Manual
  • List of GTK+ applications
  • GTK+ for Windows (MinGW)
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 



Copyright © World Library Foundation. All rights reserved. eBooks from Hawaii eBook Library are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.