]>
Commit | Line | Data |
---|---|---|
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> | |
2 | <HTML> | |
3 | <HEAD> | |
4 | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-15"> | |
5 | <TITLE></TITLE> | |
6 | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.0 (Linux)"> | |
7 | <META NAME="CREATED" CONTENT="20041114;15091400"> | |
8 | <META NAME="CHANGED" CONTENT="20041114;22531000"> | |
9 | </HEAD> | |
10 | <BODY LANG="de-DE" DIR="LTR"> | |
11 | <H1 ALIGN=CENTER>Whitepaper: wxWidgets on the GNOME desktop</H1> | |
12 | <P STYLE="margin-top: 0.42cm; page-break-after: avoid"><FONT FACE="Albany, sans-serif"><FONT SIZE=4>Introduction</FONT></FONT></P> | |
13 | <P>wxWidgets<A HREF="http://www.wxwidgets.org/"><SUP>[1]</SUP></A> | |
14 | (formely known as wxWindows) is a C++ cross-platform GUI library, | |
15 | whose distintive feature is the use of native calls and native | |
16 | widgets on the respective platform, i.e. an application compiled for | |
17 | the Linux platform will use the GTK+<A HREF="http://www.gtk.org/"><SUP>[2]</SUP></A> | |
18 | library for displaying the various widgets. There is also a version | |
19 | („port“) of wxWidgets which uses the Motif toolkit for | |
20 | displaying its widgets (this port is commonly referred to as wxMotif) | |
21 | and another one, which only uses X11 calls and which draws its | |
22 | widgets entirely itself, without using any outside library. This port | |
23 | is called wxX11 or sometimes more generally wxUniv (short for | |
24 | wxUniversal), since this widget set (implemented entirely within | |
25 | wxWidgets) is available whereever wxWidgets is available. Since this | |
26 | short overview is mainly about how to write wxWidgets applications | |
27 | for the GNOME<A HREF="http://www.gnome.org/"><SUP>[3]</SUP></A> | |
28 | desktop, I will focus on the GTK+ port, which is generally referred | |
29 | to as wxGTK. | |
30 | </P> | |
31 | <P>wxGTK still supports the old version GTK+ 1.2, but it now defaults | |
32 | to the uptodate version GTK+ 2.X, which is the basis for the current | |
33 | GNOME desktop. By way of using GTK+ 2.X and its underlying text | |
34 | rendering library Pango<A HREF="http://www.pango.org/"><SUP>[4]</SUP></A>, | |
35 | wxGTK fully supports the Unicode character set and it can render text | |
36 | in any language and script, that is supported by Pango.</P> | |
37 | <P STYLE="margin-top: 0.42cm; page-break-after: avoid"><FONT FACE="Albany, sans-serif"><FONT SIZE=4>wxWidgets' | |
38 | design principles sofar</FONT></FONT></P> | |
39 | <P>The three main design goals of the wxWidgets library are | |
40 | portability across the supported platforms, complete integration with | |
41 | the supported platforms and a broad range of functionality covering | |
42 | most aspects of GUI and non-GUI application programming. Sometimes, | |
43 | various aspects of these design goals contradict each other and this | |
44 | holds true especially for the Linux platform which – from the | |
45 | point of view of the desktop environment integration – is | |
46 | lagging behind the other two major desktops (Windows and MacOS X) | |
47 | mostly because of the schism between the GTK+ based GNOME desktop and | |
48 | the Qt<A HREF="http://www.trolltech.com/"><SUP>[5]</SUP></A> based | |
49 | KDE<A HREF="http://www.kde.org/"><SUP>[6]</SUP></A> desktop. So far, | |
50 | the typical wxWidgets user targeted Windows, maybe MacOS X and Linux | |
51 | <I>in general</I>, so the aim was to make wxGTK applications run as | |
52 | well as possible on as many versions of Linux as possible, including | |
53 | those using the KDE environment. Luckily, most of these distributions | |
54 | included the GTK+ library (for running applications like the GIMP, | |
55 | GAIM, Evolution or Mozilla) whereas the GNOME libraries were not | |
56 | always installed by default. Also, the GNOME libraries didn't really | |
57 | offer substantial value so that the hassle of installing them was | |
58 | hardly justified. Therefore, much effort was spent on making wxGTK | |
59 | fully functional without relying on the GNOME libraries, mostly by | |
60 | reimplementing as much as sensible of the missing functionality. This | |
61 | included a usable file selection dialog, a printing system for | |
62 | PostScript output, code for querying MIME-types and file-icon | |
63 | associations, classes for storing application preferences and | |
64 | configurations, the possibility to display mini-apps in the taskbar, | |
65 | a full-featured HTML based help system etc. With all that in place | |
66 | you can write a pretty fully featured wxWidgets application on an | |
67 | old Linux system with little more installed than X11 and GTK+.</P> | |
68 | <P STYLE="margin-top: 0.42cm; page-break-after: avoid"><FONT FACE="Albany, sans-serif"><FONT SIZE=4>Recent | |
69 | developments</FONT></FONT></P> | |
70 | <P>Recently, several key issues have been addressed by the GNOME | |
71 | project. Sometimes integrated into the newest GTK+ releases (such as | |
72 | the file selecter), sometimes as part of the GNOME libraries (such as | |
73 | the new printing system with Pango integration or the mime-types | |
74 | handling in gnome-vfs), sometimes as outside projects (such as the | |
75 | media/video backend based on the Gstreamer<A HREF="http://gstreamer.freedesktop.org/"><SUP>[7]</SUP></A> | |
76 | project). Also, care has been taken to unify the look and feel of | |
77 | GNOME applications by writing down a number of rules (modestly called | |
78 | „Human Interface Guidelines“<A HREF="http://developer.gnome.org/projects/gup/hig"><SUP>[8]</SUP></A>) | |
79 | and more and more decisions are taken in a desktop neutral way (for | |
80 | both GNOME and KDE), mostly as part of the FreeDesktop<A HREF="http://www.freedesktop.org/"><SUP>[9]</SUP></A> | |
81 | initiative. This development together with the rising number of | |
82 | OpenSource projects using wxWidgets mainly for the Linux and more | |
83 | specifically GNOME desktop has led to a change of direction within | |
84 | the wxWidgets project, now working on making more use of GNOME | |
85 | features when present. The general idea is to call the various GNOME | |
86 | libraries if they are present and to offer a reasonable fallback if | |
87 | not. I'll detail on the various methods chosen below:</P> | |
88 | <P STYLE="margin-top: 0.42cm; page-break-after: avoid"><FONT FACE="Albany, sans-serif"><FONT SIZE=4>Printing | |
89 | system</FONT></FONT></P> | |
90 | <P>The old printing system ....</P> | |
91 | <P STYLE="margin-top: 0.42cm; page-break-after: avoid"><FONT FACE="Albany, sans-serif"><FONT SIZE=4>MIME-type | |
92 | handling</FONT></FONT></P> | |
93 | <P>The old mime-type system used to simply query some files stored in | |
94 | „typical“ locations for the respective desktop | |
95 | environment. Since both the format and the location of these files | |
96 | changed rather frequently, this system was never fully working as | |
97 | desired for reading the MIME-types and it never worked at all for | |
98 | writing MIME-types or icon/file associations. ...</P> | |
99 | <P STYLE="margin-top: 0.42cm; page-break-after: avoid"><FONT FACE="Albany, sans-serif"><FONT SIZE=4>The | |
100 | new file dialog</FONT></FONT></P> | |
101 | <P>Previously, wxGTK application made use of a file dialog written in | |
102 | wxWidgets itself, since the default GTK+ file dialog was simplistic | |
103 | to say the least. This has changed with version GTK+ 2.4, where a | |
104 | nice and powerful dialog has been added. We now query the GTK+ | |
105 | library, if the new file dialog functions are available and wxGTK | |
106 | applications will show and use them if that is the case, otherwise, | |
107 | they will fall back to the old generic one.</P> | |
108 | <P STYLE="margin-top: 0.42cm; page-break-after: avoid"><FONT FACE="Albany, sans-serif"><FONT SIZE=4>File | |
109 | configuration and preferences</FONT></FONT></P> | |
110 | <P>The usual Unix way of saving file configuration and preferences is | |
111 | to write and read a so called „dot-file“, basically a | |
112 | text file in a user's home directory starting with a dot. This was | |
113 | deemed insufficient by the GNOME desktop project and therefore they | |
114 | introduced the so called GConf system, for storing and retrieving | |
115 | application and sessions information....</P> | |
116 | <P STYLE="margin-top: 0.42cm; page-break-after: avoid"><FONT FACE="Albany, sans-serif"><FONT SIZE=4>Results | |
117 | and discussion</FONT></FONT></P> | |
118 | <P>One of wxWidgets' greatest merits is the ability to write an | |
119 | application that not only runs on different operating systems but | |
120 | especially under Linux even on rather old systems with only a minimal | |
121 | set of libraries installed – using a single application binary. | |
122 | This was possible since most of the relevant functionality was either | |
123 | located in the only required library (GTK+) or was implemented within | |
124 | wxWidgets. Recent development outside the actual GTK+ project has | |
125 | made it necessary to rethink this design and make use of other | |
126 | projects' features in order to stay uptodate with current | |
127 | techological trends. Therefore, a system was implemented within | |
128 | wxWidgets that queries the system at runtime about various libraries | |
129 | and makes use of their features whenever possible, but falls back to | |
130 | a reasonable solution if not. The result is that you can create and | |
131 | distribute application binaries that run on old Linux systems and | |
132 | integrate fully with modern desktops, if they are available. This is | |
133 | not currently possible with any other software.</P> | |
134 | <P>Copyright 2004 © Robert Roebling, MD. No reprint permitted | |
135 | without written prior authorisation.<BR>Last modified 14/11/04</P> | |
136 | <P STYLE="margin-top: 0.42cm; page-break-after: avoid"><FONT FACE="Albany, sans-serif"><FONT SIZE=4>About | |
137 | the author</FONT></FONT></P> | |
138 | <P>Robert Roebling works as a medical doctor in the Department of | |
139 | Neurology at the University clinic of Ulm in Germany. He has studied | |
140 | Computer Sciences for a few semesters and is involved in the | |
141 | wxWidgets projects since about 1996. He has started and written most | |
142 | of wxGTK port (beginning with GTK+ around 0.9) and has contributed to | |
143 | quite a number projects within wxWidgets, ranging from the image | |
144 | classes to Unicode support to making both the Windows and the GTK+ | |
145 | ports work on embedded platform (mostly PDAs). He is happily married, | |
146 | has two children and never has time.</P> | |
147 | <P STYLE="margin-top: 0.42cm; page-break-after: avoid"><FONT FACE="Albany, sans-serif"><FONT SIZE=4>Links | |
148 | and citations</FONT></FONT></P> | |
149 | <P>[1] See the wxWidgets homepage at <A HREF="http://www.wxwidgets.org/">www.wxwidgets.org</A>.<BR>[2] | |
150 | See the GTK+ homepage at <A HREF="http://www.gtk.org/">www.gtk.org</A>.<BR>[3] | |
151 | See more about GNOME at <A HREF="http://www.gnome.org/">www.gnome.org</A>, | |
152 | <A HREF="http://www.gnomedesktop.org/">www.gnomedesktop.org</A>, | |
153 | <A HREF="http://www.gnomejournal.org/">www.gnomejournal.org</A>, | |
154 | <A HREF="http://www.gnomefiles.org/">www.gnomefiles.org</A>.<BR>[4] | |
155 | See the Pango homepage at <A HREF="http://www.pango.org/">www.pango.org</A>.<BR>[5] | |
156 | See the Qt homepage at <A HREF="http://www.trolltech.com/">www.trolltech.com</A>.<BR>[6] | |
157 | See the KDE homepage at <A HREF="http://www.kde.org/">www.kde.org</A>.<BR>[7] | |
158 | See Gstreamer homepage at <A HREF="http://gstreamer.freedesktop.org/">gstreamer.freedesktop.org</A>.<BR>[8] | |
159 | See GNOME's Human Interface Guidelines at | |
160 | <A HREF="http://developer.gnome.org/projects/gup/hig">developer.gnome.org/projects/gup/hig</A>.<BR>[9] | |
161 | See FreeDesktop's homepage at <A HREF="http://www.freedesktop.org/">www.freedesktop.org</A>.<BR><BR><BR> | |
162 | </P> | |
163 | </BODY> | |
164 | </HTML> |