Introduction GTK (GIMP Toolkit) is a set of toolkits for creating a graphical user interface. It follows the LGPL license, so you can use it to develop open source software, free software, and even the commercial software of the enclosed source code, without spending any money to purchase licenses and rights.
GTK is known as the GIMP toolkit because the initial write it is used to develop GIMP (GNU image handler), but it has now been used for many software items, including GNOME (GNU network object model environment). GTK is established based on GDK (GIMP DRAWING KIT) and GDK-PIXBUF, GDK is basically a layer of encapsulation for the underlying function of the access window (XLIB in the X window system), GDK-PIXBUF is one Library for client image processing.
GTK's creator is:
Peter Mattis Petm@xcf.berkeley.edu
Spencer kimball spencer@xcf.berkeley.edu
Josh Macdonald Jmacd@xcf.berkeley.edu
The current maintainer of GTK is:
Owen taylor otaylor@redhat.com
Tim Janik Timj@gtk.org
GTK is essentially an object-oriented application interface (API). Although it is written completely with C, it is implemented based on the idea of class and callback functions (pointers pointing to functions).
There is also a third component named GLIB, contains a substitute function of some standard functions, as well as a function of some data structures such as handling linies. These alternative functions are used to enhance the portability of GTK because some of their functions do not implement or do not meet standards on other UNIX systems, such as g_strerror (). Some is an enhancement of the corresponding function of libc, such as G_malloc () has enhanced debugging.
In version 2.0, Glib adds some new content: Type System, which constitutes the GTK class hierarchy, a widely used signal system in GTK, a thread that is abstracting a thread API of various platforms. API, and a tool for loading modules.
As the last component, GTK uses the PANGO library to handle international text output.
This tutorial tells the C interface of GTK. There are also many other languages GTK bindings such as C , Perl, Python, Tom, ADA95, Objective C, Free Pascal, Eiffel, Java, and C #. If you want to use the bindings of your GTK, first check the binding document. Sometimes these documents speak some important concepts, then you will refer to this tutorial. There are also some cross-platform APIs (such as wxwindows and v), which use GTK as a supported platform. Similarly, refer to their documents.
If you use C to develop GTK applications, you need to pay attention. There is a GTK C binding called GTK - (Translator Note: Now called gtkmm), provide an interface that is more conforming to C specification, you can look at this interface first. If you don't like this method due to various reasons, there are two ways to use GTK. First, you can call GTK only using the C subset in C so that you can use the C interface described in this tutorial. Second, you can use the following methods to use GTK and C : define the callback functions used as the static member function in the C class, and then use the C interface to call GTK. If you choose the latter method, you can point the pointer to the object you want to operate (ie so-called "this" as the Data parameter of the callback function. Which method chooses to be a personal preference problem, because no matter which method is used, you will get C and GTK. They don't need special pre-processes, so you can use standard C and GTK at the same time. This tutorial is trying to describe GTK as much as possible, but it must not face it. This tutorial assumes that you can better understand the C language and learn how to write a C program. There is X programming experience that will be helpful, but it is not necessary. If gtk is the first component kit you learn, please tell us how you find this tutorial and what is difficult in learning. There are other languages, such as C , Objective C, Ada, Guile, etc., but I don't know this.
This tutorial is still in constant improvement. Please visit http://www.gtk.org/ to view the update.
I am very happy to hear the difficulties you have encountered when using this tutorial to learn GTK, and welcome to improve this document to make recommendations. For more information, please refer to this chapter.