Sign in Join
Wiki copytemporary

gtk1: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: gtk1

OldNewLine
1+The package GTK1 is a header to the GTK 1.x libraries.
2+
3+## Introduction
4+
5+The [GTK+](http://www.gtk.org/) toolkit and its companion GDK (nowadays included into GTK) are quickly becoming (next to the [Qt toolkit](http://www.qtsoftware.com/products/)) a very popular X-windows programming toolkit. This makes it suitable as a base for the Lazarsu Component Library (LCL, the Lazarus equivalent of the Delphi VCL).
6+
7+The GTK1 widgetset is not actively maintained anymore. The default widgetset on *nix currently is GTK2.
8+
9+## Windows
10+
11+Note that while GTK(1) is mostly used on Unix, it is known to work on Windows too, though to our knowledge not tested regularly. Reportedly ([bug 12359](http://bugs.freepascal.org/view.php?id=12359)) the following libraries are required for windows:
12+
13+- libintl-1.dll
14+- libgdk-0.dll
15+- libgtk-0.dll
16+- libglib-2.0-0.dll
17+
18+- gtkgl.dll ( required only if gtkgl is used like the gtkgldemo.pp example )
19+
20+## Downloading
21+
22+The gtk units are part of the Free Pascal packages, and are shipped with the official distrubution.
23+
24+The GTK libraries must be downloaded from the original [GTK+](http://www.gtk.org/) site.
25+
26+## Using the units:
27+
28+There is an article on programming GTK by Florian Klaempfl and Michael Van Canneyt, written for the German Toolbox magazine. The original English version (in PDF format) can be viewed [here](http://www.freepascal.org/packages/gtk/gtk-1.pdf). The example programs source code can also be [downloaded](http://www.freepascal.org/packages/gtk/gtkex-1.zip).
29+
30+**Note that these examples haven't been tested with recent for a while, when you have problems, ask on the maillist**
31+
32+The following is a (very) short explanation of how to use the GTK units. Most of what can be found here is already described in the articles on GTK.
33+
34+1. In C, you only need to input gtk.h. Here you need to put gtk, and separately glib or gdk if you need them, in your uses clause.
35+2. Names :
36+
37+- `Pascal reserved words in types, record element names etc. have been prepended with the word 'the'. so 'label' has become 'thelabel'`
38+- functions have been kept with the same names.
39+- for types : gdk names have been kept. Pointers to a type are defined as the type name, prepended with P. So 'GtkWidget *' becomes 'PGtkWidget'. In gtkobject, names also have been kept. In all other files, types have been prepended with T, that is, the C type 'GtkWidget' has become 'TGtkWidget'.\
40+ This is annoying, but C is case sensitive, and Pascal is not, so there you have it...\
41+ When translating, I've tried to stick to this scheme as closely as I could. One day, however, all will be done in a uniform manner...
42+
43+Macros. Many C macros have not been translated. The typecasting macros have been dropped, since they're useless under pascal. Macros to access record members have been translated, BUT they are to be considered as READ-ONLY. So they can be used to retrieve a value, but not to store one. e.g.\
44+
45+`function GTK WIDGET FLAGS(wid : pgtkwidget) : longint;`\
46+
47+can be used to retrieve the widget flags, but not to set them. so things like\
48+
49+`GTK WIDGET FLAGS(wid):=GTK WIDGET FLAGS(wid) and someflag;`\
50+
51+will not work, since this is a function, and NOT a macro as in C.
52+
53+Packed records. GCC allows you to specify members of a record in bit format. Since this is impossible in pascal, functions and procedures to get/set these elements have been made. e.g.\
54+
55+`function width set(var a : TGtkCListColumn) : gint;`\
56+`procedure set width set(var a : TGtkCListColumn; width set : gint);`\
57+
58+`     can be used to get or set the width in a TGtkCListColumn... in general, it's the name with ' set' appended for getting a value (set from 'a set') , and 'set ' prepended (from 'to set') and again ' set' appended. `
59+
60+There is also an article on programming GTK by Florian Klaempfl and Michael Van Canneyt, written for the German Toolbox magazine. The original English version (in PDF format) can be viewed [here](http://www.freepascal.org/packages/gtk/gtk-1.pdf). The example programs source code can also be [downloaded](http://www.freepascal.org/packages/gtk/gtkex-1.zip).
61+
62+More information about programming GTK is available in the following documents:
63+
64+- There are also some articles on programming GTK by Florian Klaempfl and Michael Van Canneyt, written for the German Toolbox magazine. The original English version (in PDF format) of these articles can be viewed here:
65+
66+*# [Article 1](http://www.freepascal.org/packages/gtk/gtk-1.pdf) and the sources of the examples can be found [here](http://www.freepascal.org/packages/gtk/gtkex-1.zip).
67+
68+*# [Article 2](http://www.freepascal.org/packages/gtk/gtk-2.pdf) and the sources of the examples can be found [here](http://www.freepascal.org/packages/gtk/gtkex-2.zip).
69+
70+*# [Article 3](http://www.freepascal.org/packages/gtk/gtk-3.pdf) and the sources of the examples can be found [here](http://www.freepascal.org/packages/gtk/gtkex-3.zip).
71+
72+*# [Article 4](http://www.freepascal.org/packages/gtk/gtk-4.pdf) and the sources of the examples can be found [here](http://www.freepascal.org/packages/gtk/gtkex-4.zip).
73+
74+*# [Article 5](http://www.freepascal.org/packages/gtk/gtk-5.pdf) and the sources of the examples can be found [here](http://www.freepascal.org/packages/gtk/gtkex-5.zip).
75+
76+- Mark Howe kindly donated a translation to pascal of the GTK tutorials. The result can be viewed [here](http://www.freepascal.org/packages/gtk/tutorial/pgtk-contents.html). The examples can be downloaded [here](http://www.freepascal.org/packages/gtk/pgtk-examples.tar.gz). If you want you can download the whole tutorial [Here](http://www.freepascal.org/packages/gtk/pgtk-html.tar.gz).
77+
78+---
79+*From the Free Pascal wiki, page "gtk1", as it stood on 2019-05-08 after a change by Bart, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
80+Category: Headers and Bindings
81+Category: Packages

Back to history