]>
Commit | Line | Data |
---|---|---|
397f14ce JS |
1 | \chapter{Introducing wxWindows}\label{chapintro} |
2 | \pagenumbering{arabic}% | |
3 | \setheader{{\it CHAPTER \thechapter: INTRODUCING wxWINDOWS}}{}{}{}{}{{\it CHAPTER \thechapter: INTRODUCING wxWINDOWS}}% | |
4 | \setfooter{\thepage}{}{}{}{}{\thepage}% | |
5 | ||
c49edcd0 JS |
6 | \section{The need for portability} |
7 | ||
8 | Not so long ago, it seemed as though Microsoft was on course to | |
9 | take over the desktop for good with the Windows range of | |
10 | operating systems. Unix was retreating to server territory and | |
11 | had all but given up the fight against NT. Apple was sickening | |
45961fa0 JS |
12 | (in the non-derogatory sense of the word!) and it seemed almost |
13 | common sense that the quirky Mac had had its day. | |
c49edcd0 JS |
14 | |
15 | At the start of the new century, the picture has changed quite | |
16 | dramatically. Linux is advancing from its position of strength | |
17 | in the server market and is poised to make inroads on the | |
18 | desktop, where the high price of Windows gives it an advantage. | |
19 | Apple has made an impressive comeback and is revamping its own | |
20 | operating system. The embedded market continues to explode and | |
21 | has given rise to new niches for specialist operating systems. | |
22 | The keyword bow is diversity, when the best guess of a few years | |
23 | was that Microsoft would conquer all. More than ever, | |
24 | application developers need to keep their options open and | |
25 | targeting one platform only can be a recipe for commercial (or | |
26 | open source) disaster. | |
27 | ||
28 | In the light of this change in the computing landscape, | |
29 | cross-platform development (or multiplatform development as we | |
30 | call it in this book) has become quite a hot and sometimes | |
31 | bitterly controversial topic. There are a number of ways to | |
32 | achieve the goal of portability, and many tools and languages to choose from. | |
33 | However, it is still generally agreed wisdom that C++ is the | |
34 | language of choice for desktop applications that depend on | |
35 | speed, ease of delivery and compatibility with billions of lines | |
36 | of existing code. Plus, there are many hundreds of thousands of | |
37 | developers now experienced in C++ programming. | |
38 | ||
39 | The purpose of this book is to give you (the developer or | |
40 | interested manager) a solid grounding in one increasingly | |
41 | popular multiplatform solution: wxWindows. wxWindows is an open | |
42 | source GUI toolkit that has been on the scene since 1993 and has | |
43 | reached a high degree of stability and functionality. It is | |
44 | available for Linux (and most other Unix variants), all desktop | |
45 | versions of Microsoft Windows, and Mac. Other ports are in | |
46 | progress. | |
47 | ||
48 | \section{Why wxWindows?} | |
49 | ||
50 | While wxWindows is labelled a GUI development toolkit, it is in | |
51 | fact much more than that and has many features that are useful | |
52 | for many aspects of application development. This has to | |
53 | be the case, since the whole of a wxWindows application needs to | |
54 | be portable to different platforms, and not just the GUI | |
55 | component. So wxWindows provides classes for working with files | |
56 | and streams, multithreading, management of application settings, | |
57 | interprocess communication, and much else. | |
58 | ||
59 | wxWindows is open source, with a vibrant developer and user | |
60 | community, and may be used in any proprietary or non-proprietary | |
61 | project. wxWindows encompasses the whole spectrum of users from | |
62 | one-man software outfits to big-name companies such as Xerox, | |
63 | Lockheed-Martin, Pratt and Whitney, and Motorola; from computer | |
64 | science departments to medical research groups; from ecological | |
65 | research, to the telecommunications industry, and in a myriad of | |
66 | open source projects. | |
67 | ||
68 | When you use wxWindows you tap into an astonishing talent pool, | |
69 | with contributors from a wide range of backgrounds. Many aspects | |
70 | of application development that you might otherwise have to | |
71 | laboriously code yourself have been encapsulated by these | |
72 | developers in easy-to-use classes that you can plug into your | |
73 | code. Since there are a lot of people subscribed to the mailing | |
74 | lists, you'll enjoy discussions not only about wxWindows but | |
75 | often other matters close to the hearts of both experienced and | |
76 | inexperienced developers. And hopefully, one day you'll join in the | |
77 | success of wxWindows and become a contributor yourself! | |
78 | ||
79 | \section{The history of wxWindows} | |
80 | ||
81 | wxWindows was started in 1992 at the Artificial Intelligence | |
82 | Applications Institute, University of Edinburgh, by Julian | |
83 | Smart. Julian was designing a kind of meta-CASE tool called | |
84 | Hardy which needed to run on Windows as well as X-based Unix | |
85 | workstations. The existing commercial cross-platform tools were | |
86 | deemed too expensive for an in-house experimental project, so | |
87 | the only alternative was to build one. wxWindows (w for Microsoft | |
45961fa0 JS |
88 | Windows, x for the X Windowing System) started off with support for Sun's XView |
89 | and Microsoft's MFC 1.0, and | |
c49edcd0 JS |
90 | AIAI allowed it to be released to the Internet. As it became |
91 | clear that XView was doomed, a Motif port was written. Borland | |
92 | C++ users began to request a version that was not dependent on | |
93 | MFC, so the Windows port was rewritten to use the native Windows | |
94 | API. Over time, a small but enthusiastic community of wxWindows | |
45961fa0 JS |
95 | users was established and a mailing list set up. Many contributions |
96 | and fixes were sent in. wxWindows gradually picked up more and more users | |
97 | from all over the world: academic, government, and corporate users | |
98 | who found that wxWindows offered a better product, and better support, than the | |
c49edcd0 JS |
99 | commercial products they had looked at or used. |
100 | ||
101 | During 1995, Markus Holzem released his port of wxWindows to Xt, | |
102 | the X toolkit. This meant that software could be written that | |
45961fa0 JS |
103 | would work on X-based systems without the need for installing Motif, |
104 | then still a commercial product. | |
c49edcd0 JS |
105 | |
106 | In 1996, Julian left AIAI to pursue freelance consultancy, and | |
107 | there were few new releases. The seemingly unstoppable advance | |
108 | of Java was throwing some doubt on the future of C++ libraries. | |
109 | After many contributions, the wxWindows code was looking rather | |
110 | tired and in need of a serious rethink. At the start of 1997 it | |
111 | was make or break time - call it a day and move onto other | |
112 | things, or commit to re-engineering wxWindows with an API that | |
113 | was flexible enough for current and future user interface | |
45961fa0 JS |
114 | trends, with more sophisticated widgets, and making better use of C++. |
115 | After a short debate, the effort was relaunched | |
116 | with Julian concentrating on the Windows port, and Markus on the combined Motif/Xt port, | |
117 | with both contributing to the common and generic parts. wxWindows 2 API | |
c49edcd0 JS |
118 | ideas and code started to take shape. |
119 | ||
120 | During 1997 an effort to produce a standard Linux desktop | |
121 | environment was underway - GNOME. Its widget set was GTK+, built | |
122 | on top of X11 and it looked as though GTK+-based apps were to | |
45961fa0 JS |
123 | become the standard in the Linux universe. Its one major problem: |
124 | GTK+ was C-based, and only a thin (and unportable) C++ wrapper | |
c49edcd0 JS |
125 | existed for it. In August 1997, Wolfram Gloger made a suggestion |
126 | that wxWindows 2 should be ported to GTK+ - Robert Roebling had | |
127 | initial reservations, but in general supported the idea. He | |
128 | became the prime mover for wxGTK and alphas were made available | |
129 | at the beginning of 1998. In May 1998 the Windows and GTK+ ports | |
130 | were merged and put into a CVS repository made available to all | |
45961fa0 JS |
131 | contributors to wxWindows: a decision that has accelerated the development |
132 | effort tremendously. At this point Vadim Zeitlin became a prime | |
133 | mover on the Windows port and revamped much of the container | |
134 | and collection support. | |
c49edcd0 JS |
135 | |
136 | Markus Holzem had to drop out of the wxWindows 2 effort in early | |
137 | 1998, but Julian Smart started a new wxMotif port. The idea of | |
138 | an Xt port was dropped, since there remain two possibilities for | |
45961fa0 | 139 | free Unix programming with wxWindows: wxGTK, and wxMotif using |
c49edcd0 JS |
140 | the Motif clone Lesstif. |
141 | ||
142 | In September 1998, Stefan Csomor started a new version of the | |
143 | wxMac 2 port based in part on Greg Whitehead's initial work. | |
45961fa0 JS |
144 | In 1999 wxMac became ready for prime-time and Stefan has |
145 | made it ready for MacOS X. | |
146 | ||
147 | Also in 1998, Vaclav Slavik burst onto the wxWindows scene with his | |
148 | exciting wxHTML module that can now provide applications with (to name but a few) HTML help, superb | |
149 | About boxes, and report viewing and printing facilities. Vaclav has | |
150 | also written an enhanced resource system for wxWindows based on XML, | |
151 | that supports many more wxWindows features than the old WXR-based system. | |
152 | ||
153 | Since 1998 Robin Dunn has been completely rewriting the old Python/wxWindows | |
154 | marriage and now wxPython is another force to be reckoned with in the | |
155 | development community. | |
156 | ||
157 | %David Webster and Stefan Neis have been working on an OS/2 port, and | |
158 | %interest has been expressed in ports to other systems, such as | |
159 | %BeOS. | |
160 | % | |
161 | Development on wxWindows is concentrating on achieving more modularity, | |
162 | additional sophisticated GUI components, and compatibility with | |
163 | a wider range platforms. The wxStudio IDE project promises to | |
164 | make wxWindows development much easier and introduce wxWindows to people | |
165 | used to rapid application development environments under Microsoft Windows. | |
c49edcd0 JS |
166 | |
167 | \section{How to use this book} | |
168 | ||
169 | The chapters in this book are meant to be fairly independent, but | |
170 | as usual, the ordering reflects a progression from basic concepts | |
171 | to more advanced ones, so the first few chapters at least | |
172 | should be read consecutively for best effect. | |
397f14ce | 173 | |
45961fa0 JS |
174 | Complete programs illustrating concepts in many of the chapters can be |
175 | found in the accompanying CD-ROM, along with wxWindows itself and lots | |
176 | of extra, cool stuff. | |
177 | ||
178 | We all hope that you enjoy reading this book and, most importantly, | |
179 | have fun using wxWindows to build great-looking, multiplatform applications! | |
180 |