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