wxGNOME.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. (&bdquo;port&ldquo;) 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 wherever 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 &ndash; from the
  45. point of view of the desktop environment integration &ndash; is
  46. lagging behind the other two major desktops (Windows and OS 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 OS 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. &bdquo;Human Interface Guidelines&ldquo;<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. &bdquo;typical&ldquo; 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. wxGTK is using it now.</P>
  105. <P STYLE="margin-top: 0.42cm; page-break-after: avoid"><FONT FACE="Albany, sans-serif"><FONT SIZE=4>File
  106. configuration and preferences</FONT></FONT></P>
  107. <P>The usual Unix way of saving file configuration and preferences is
  108. to write and read a so called &bdquo;dot-file&ldquo;, basically a
  109. text file in a user's home directory starting with a dot. This was
  110. deemed insufficient by the GNOME desktop project and therefore they
  111. introduced the so called GConf system, for storing and retrieving
  112. application and sessions information....</P>
  113. <P STYLE="margin-top: 0.42cm; page-break-after: avoid"><FONT FACE="Albany, sans-serif"><FONT SIZE=4>Results
  114. and discussion</FONT></FONT></P>
  115. <P>One of wxWidgets' greatest merits is the ability to write an
  116. application that not only runs on different operating systems but
  117. especially under Linux even on rather old systems with only a minimal
  118. set of libraries installed &ndash; using a single application binary.
  119. This was possible since most of the relevant functionality was either
  120. located in the only required library (GTK+) or was implemented within
  121. wxWidgets. Recent development outside the actual GTK+ project has
  122. made it necessary to rethink this design and make use of other
  123. projects' features in order to stay uptodate with current
  124. techological trends. Therefore, a system was implemented within
  125. wxWidgets that queries the system at runtime about various libraries
  126. and makes use of their features whenever possible, but falls back to
  127. a reasonable solution if not. The result is that you can create and
  128. distribute application binaries that run on old Linux systems and
  129. integrate fully with modern desktops, if they are available. This is
  130. not currently possible with any other software.</P>
  131. <P>Copyright 2004 &copy; Robert Roebling, MD. No reprint permitted
  132. without written prior authorisation.<BR>Last modified 14/11/04</P>
  133. <P STYLE="margin-top: 0.42cm; page-break-after: avoid"><FONT FACE="Albany, sans-serif"><FONT SIZE=4>About
  134. the author</FONT></FONT></P>
  135. <P>Robert Roebling works as a medical doctor in the Department of
  136. Neurology at the University clinic of Ulm in Germany. He has studied
  137. Computer Sciences for a few semesters and is involved in the
  138. wxWidgets projects since about 1996. He has started and written most
  139. of wxGTK port (beginning with GTK+ around 0.9) and has contributed to
  140. quite a number projects within wxWidgets, ranging from the image
  141. classes to Unicode support to making both the Windows and the GTK+
  142. ports work on embedded platform (mostly PDAs). He is happily married,
  143. has two children and never has time.</P>
  144. <P STYLE="margin-top: 0.42cm; page-break-after: avoid"><FONT FACE="Albany, sans-serif"><FONT SIZE=4>Links
  145. and citations</FONT></FONT></P>
  146. <P>[1] See the wxWidgets homepage at <A HREF="http://www.wxwidgets.org/">www.wxwidgets.org</A>.<BR>[2]
  147. See the GTK+ homepage at <A HREF="http://www.gtk.org/">www.gtk.org</A>.<BR>[3]
  148. See more about GNOME at <A HREF="http://www.gnome.org/">www.gnome.org</A>,
  149. <A HREF="http://www.gnomedesktop.org/">www.gnomedesktop.org</A>,
  150. <A HREF="http://www.gnomejournal.org/">www.gnomejournal.org</A>,
  151. <A HREF="http://www.gnomefiles.org/">www.gnomefiles.org</A>.<BR>[4]
  152. See the Pango homepage at <A HREF="http://www.pango.org/">www.pango.org</A>.<BR>[5]
  153. See the Qt homepage at <A HREF="http://www.trolltech.com/">www.trolltech.com</A>.<BR>[6]
  154. See the KDE homepage at <A HREF="http://www.kde.org/">www.kde.org</A>.<BR>[7]
  155. See Gstreamer homepage at <A HREF="http://gstreamer.freedesktop.org/">gstreamer.freedesktop.org</A>.<BR>[8]
  156. See GNOME's Human Interface Guidelines at
  157. <A HREF="http://developer.gnome.org/projects/gup/hig">developer.gnome.org/projects/gup/hig</A>.<BR>[9]
  158. See FreeDesktop's homepage at <A HREF="http://www.freedesktop.org/">www.freedesktop.org</A>.<BR><BR><BR>
  159. </P>
  160. </BODY>
  161. </HTML>