X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6b037754f53cc35e177bf6787bace26c7cecc6e1..fd495ab3ea1282ddb8bb0cd0fb79fc758ae5fcee:/docs/latex/wx/body.tex diff --git a/docs/latex/wx/body.tex b/docs/latex/wx/body.tex index 741e1b61be..f78cce22ce 100644 --- a/docs/latex/wx/body.tex +++ b/docs/latex/wx/body.tex @@ -6,14 +6,15 @@ \section{What is wxWindows?} wxWindows is a C++ framework providing GUI (Graphical User -Interface) and other facilities on more than one platform. Version 2.0 currently -supports subsets MS Windows (16-bit, Windows 95 and Windows NT) and GTK. +Interface) and other facilities on more than one platform. Version 2 currently +supports MS Windows (16-bit, Windows 95 and Windows NT), Unix with GTK+, Unix with Motif, +and Mac. An OS/2 port is in progress. wxWindows was originally developed at the Artificial Intelligence -Applications Institute, University of Edinburgh, for internal use. -wxWindows has been released into the public domain in the hope -that others will also find it useful. Version 2.0 is written and -maintained by Julian Smart, Robert Roebling and others. +Applications Institute, University of Edinburgh, for internal use, +and was first made publicly available in 1993. +Version 2 is a vastly improved version written and maintained by +Julian Smart, Robert Roebling, Vadim Zeitlin and many others. This manual discusses wxWindows in the context of multi-platform development.\helpignore{For more detail on the wxWindows version 2.0 API @@ -28,7 +29,7 @@ variants, unless otherwise stated. All trademarks are acknowledged. wxWindows was developed to provide a cheap and flexible way to maximize investment in GUI application development. While a number of commercial -class libraries already exist for cross-platform development, +class libraries already existed for cross-platform development, none met all of the following criteria: \begin{enumerate}\itemsep=0pt @@ -38,25 +39,24 @@ none met all of the following criteria: \item support for a wide range of compilers. \end{enumerate} -As public domain software and a project open to everyone, wxWindows has +Since wxWindows was started, several other free or almost-free GUI frameworks have +emerged. However, none has the range of features, flexibility, documentation and the +well-established development team that wxWindows has. + +As open source software, wxWindows has benefited from comments, ideas, bug fixes, enhancements and the sheer -enthusiasm of users, especially via the Internet. This gives wxWindows a -certain advantage over its commercial brothers, and a robustness against +enthusiasm of users. This gives wxWindows a +certain advantage over its commercial competitors (and over free libraries +without an independent development team), plus a robustness against the transience of one individual or company. This openness and availability of source code is especially important when the future of thousands of lines of application code may depend upon the longevity of the underlying class library. -In writing wxWindows, completeness has sometimes been traded for -portability and simplicity of programming. Version 2.0 goes much -further than previous versions in terms of generality and features, +Version 2 goes much further than previous versions in terms of generality and features, allowing applications to be produced that are often indistinguishable from those produced using single-platform -toolkits -such as Motif and MFC. - -wxWindows 2.0 currently maps to two native APIs: GTK and -MS Windows. Motif, Xt and Mac ports are also in preparation. +toolkits such as Motif, GTK+ and MFC. The importance of using a platform-independent class library cannot be overstated, since GUI application development is very time-consuming, @@ -64,11 +64,10 @@ and sustained popularity of particular GUIs cannot be guaranteed. Code can very quickly become obsolete if it addresses the wrong platform or audience. wxWindows helps to insulate the programmer from these winds of change. Although wxWindows may not be suitable for -every application, it provides access to most of the functionality a -GUI program normally requires, plus some extras such as form -construction, interprocess communication and PostScript output, and -can of course be extended as needs dictate. As a bonus, it provides -a cleaner programming interface than the native +every application (such as an OLE-intensive program), it provides access to most of the functionality a +GUI program normally requires, plus many extras such as network programming, +PostScript output, and HTML rendering; and it can of course be extended as needs dictate. As a bonus, it provides +a far cleaner and easier programming interface than the native APIs. Programmers may find it worthwhile to use wxWindows even if they are developing on only one platform. @@ -78,24 +77,30 @@ here are some of the benefits: \begin{itemize}\itemsep=0pt \item Low cost (free, in fact!) \item You get the source. -\item Several example programs. -\item Over 700 pages of printable and on-line documentation. +\item Available on a variety of popular platforms. +\item Works with almost all popular C++ compilers and Python. +\item Over 50 example programs. +\item Over 1000 pages of printable and on-line documentation. +\item Includes Tex2RTF, to allow you to produce your own documentation +in Windows Help, HTML and Word RTF formats. \item Simple-to-use, object-oriented API. -\item Graphics calls include splines, polylines, rounded rectangles, etc. -\item Constraint-based layout option. +\item Flexible event system. +\item Graphics calls include lines, rounded rectangles, splines, polylines, etc. +\item Constraint-based and sizer-based layouts. \item Print/preview and document/view architectures. -\item Status line facility, toolbar -\item Easy, object-oriented interprocess comms (DDE subset) under Unix and -MS Windows. -\item Encapsulated PostScript generation under Unix, normal MS Windows printing on the -PC. -\item MDI support under Windows and GTK. -\item Can be used to create DLLs under Windows, dynamic libraries on the Sun. +\item Toolbar, notebook, tree control, advanced list control classes. +\item PostScript generation under Unix, normal MS Windows printing on the PC. +\item MDI (Multiple Document Interface) support. +\item Can be used to create DLLs under Windows, dynamic libraries on Unix. \item Common dialogs for file browsing, printing, colour selection, etc. \item Under MS Windows, support for creating metafiles and copying them to the clipboard. -\item Hypertext help facility, with an API for invocation from applications. +\item An API for invoking help from applications. +\item Ready-to-use HTML window (supporting a subset of HTML). \item Dialog Editor for building dialogs. +\item Network support via a family of socket and protocol classes. +\item Support for platform independent image processing. +\item Built-in support for many file formats (BMP, PNG, JPEG, GIF, XPM, PNM, PCX). \end{itemize} \section{Changes from version 1.xx}\label{versionchanges} @@ -106,9 +111,8 @@ Removals: \begin{itemize}\itemsep=0pt \item XView is no longer supported; -\item Mac is not yet supported; \item all controls (panel items) no longer have labels attached to them; -\item wxForm removed; +\item wxForm has been removed; \item wxCanvasDC, wxPanelDC removed (replaced by wxClientDC, wxWindowDC, wxPaintDC which can be used for any window); \item wxMultiText, wxTextWindow, wxText removed and replaced by wxTextCtrl; @@ -119,7 +123,7 @@ Additions and changes: \begin{itemize}\itemsep=0pt \item class hierarchy changed, and restrictions about subwindow nesting lifted; -\item header files reorganised to conform to normal C++ standards; +\item header files reorganized to conform to normal C++ standards; \item classes less dependent on each another, to reduce executable size; \item wxString used instead of char* wherever possible; \item the number of separate but mandatory utilities reduced; @@ -146,7 +150,7 @@ same API; temporarily with the window as an argument; \item events from sliders and scrollbars can be handled more flexibly; \item the handling of window close events has been changed in line with the new -event system, but backward {\bf OnClose} compatibility has been retained; +event system; \item the concept of {\it validator} has been added to allow much easier coding of the relationship between controls and application data; \item the documentation has been revised, with more cross-referencing. @@ -162,6 +166,36 @@ borders; \item MDI classes brought out of wxFrame into separate classes, and made more flexible. \end{itemize} + +\section{Changes from version 2.0}\label{versionchanges20} + +These are a few of the differences between versions 2.0 and 2.2. + +Removals: + +\begin{itemize}\itemsep=0pt +\item GTK 1.0 no longer supported. +\end{itemize} + +Additions and changes: + +\begin{itemize}\itemsep=0pt +\item Corrected many classes to conform better to documented behaviour. +\item Added handlers for more image formats (Now GIF, JPEG, PCX, BMP, XPM, PNG, PNM). +\item Improved support for socket and network functions. +\item Support for different national font encodings. +\item Sizer based layout system. +\item HTML widget and help system. +\item Added some controls (e.g. wxSpinCtrl) and supplemented many. +\item Many optical improvements to GTK port. +\item Support for menu accelerators in GTK port. +\item Enhanced and improved support for scrolling, including child windows. +\item Complete rewrite of clipboard and drag and drop classes. +\item Improved support for ODBC databases. +\item Improved tab traversal in dialogs. +\end{itemize} + + \section{wxWindows requirements}\label{requirements} To make use of wxWindows, you currently need one or both of the @@ -171,32 +205,41 @@ following setups. \begin{enumerate}\itemsep=0pt \item A 486 or higher PC running MS Windows. -\item One of Microsoft Visual C++ 4.0 or higher, Borland C++, Gnu-Win32. +\item A Windows compiler: most are supported, but please see {\tt install.txt} for +details. Supported compilers include Microsoft Visual C++ 4.0 or higher, Borland C++, Cygwin, +Metrowerks CodeWarrior. \item At least 60 MB of disk space. \end{enumerate} (b) Unix: \begin{enumerate}\itemsep=0pt -\item Almost any C++ compiler, including GNU C++. -\item Almost any Unix workstation, and GTK 1.0 or higher. +\item Almost any C++ compiler, including GNU C++ (EGCS 1.1.1 or above). +\item Almost any Unix workstation, and one of: GTK+ 1.2, Motif 1.2 or higher, Lesstif. \item At least 60 MB of disk space. \end{enumerate} \section{Availability and location of wxWindows} -wxWindows is currently available from the Artificial Intelligence -Applications Institute by anonymous FTP and World Wide Web: +\winhelponly{wxWindows is available by anonymous FTP and World Wide Web +from ftp://www.remstar.com/pub/wxwin and/or http://www.wxwindows.org.} +\winhelpignore{wxWindows is available by anonymous FTP and World Wide Web +from \urlref{ftp://www.remstar.com/pub/wxwin}{ftp://www.remstar.com/pub/wxwin} +and/or \urlref{http://www.wxwindows.org}{http://www.wxwindows.org}.} -\begin{verbatim} - ftp://ftp.aiai.ed.ac.uk/pub/packages/wxwin - http://web.ukonline.co.uk/julian.smart/wxwin -\end{verbatim} +You can also buy a CD-ROM using the form on the Web site, or by contacting: + +Julian Smart\\ +12 North Street West\\ +Uppingham\\ +Rutland\\ +LE15 9SG\\ +julian.smart@ukonline.co.uk \section{Acknowledgments} Thanks are due to AIAI for being willing to release the original version of -wxWindows into the public domain, and to our patient wives Harriet, Tanja and others. +wxWindows into the public domain, and to our patient partners. We would particularly like to thank the following for their contributions to wxWindows, and the many others who have been involved in the project over the years. Apologies for any unintentional omissions from this list. @@ -204,11 +247,11 @@ the project over the years. Apologies for any unintentional omissions from this Yiorgos Adamopoulos, Jamshid Afshar, Alejandro Aguilar-Sierra, AIAI, Patrick Albert, Karsten Ballueder, Michael Bedward, Kai Bendorf, Yura Bidus, Keith Gary Boyce, Chris Breeze, Pete Britton, Ian Brown, C. Buckley, Dmitri Chubraev, Robin Corbet, Cecil Coupe, Andrew Davison, Neil Dudman, Robin Dunn, Hermann Dunkel, Jos van Eijndhoven, Tom Felici, Thomas Fettig, Matthew Flatt, Pasquale Foggia, Josep Fortiana, Todd Fries, Dominic Gallagher, -Wolfram Gloger, Norbert Grotz, Stefan Gunter, Bill Hale, Patrick Halke, Stefan Hammes, Guillaume Helle, Harco de Hilster, Cord Hockemeyer, Markus +Guillermo Rodriguez Garcia, Wolfram Gloger, Norbert Grotz, Stefan Gunter, Bill Hale, Patrick Halke, Stefan Hammes, Guillaume Helle, Harco de Hilster, Cord Hockemeyer, Markus Holzem, Olaf Klein, Leif Jensen, Bart Jourquin, Guilhem Lavaux, Jan Lessner, Nicholas Liebmann, Torsten Liermann, Per Lindqvist, Thomas Runge, Tatu -M\"{a}nnist\"{o}, Scott Maxwell, Thomas Myers, Oliver Niedung, Hernan Otero, Ian Perrigo, Timothy Peters, Giordano Pezzoli, Harri Pasanen, Thomaso Paoletti, -Garrett Potts, Marcel Rasche, Robert Roebling, Dino Scaringella, Jobst Schmalenbach, Arthur Seaton, Paul Shirley, Stein Somers, Petr Smilauer, Neil Smith, -Kari Syst\"{a}, Arthur Tetzlaff-Deas, Jonathan Tonberg, Jyrki Tuomi, Janos Vegh, Andrea Venturoli, Vadim Zeitlin, Xiaokun Zhu, Edward Zimmermann. +M\"{a}nnist\"{o}, Scott Maxwell, Thomas Myers, Oliver Niedung, Stefan Neis, Hernan Otero, Ian Perrigo, Timothy Peters, Giordano Pezzoli, Harri Pasanen, Thomaso Paoletti, +Garrett Potts, Marcel Rasche, Robert Roebling, Dino Scaringella, Jobst Schmalenbach, Arthur Seaton, Paul Shirley, Vaclav Slavik, Stein Somers, Petr Smilauer, Neil Smith, +Kari Syst\"{a}, Arthur Tetzlaff-Deas, Jonathan Tonberg, Jyrki Tuomi, David Webster, Janos Vegh, Andrea Venturoli, Vadim Zeitlin, Xiaokun Zhu, Edward Zimmermann. `Graphplace', the basis for the wxGraphLayout library, is copyright Dr. Jos T.J. van Eijndhoven of Eindhoven University of Technology. The code has @@ -277,95 +320,54 @@ multi-megabyte .pch files. \section{Libraries} -Please the wxGTK documentation for use of the Unix version of wxWindows. -Under Windows, use the library wx.lib for stand-alone Windows -applications, or wxdll.lib for creating DLLs. +The GTK and Motif ports of wxWindow can create either a static library or a shared +library on most Unix or Unix-like systems. The static library is called libwx\_gtk.a +and libwx\_motif.a whereas the name of the shared library is dependent on the +system it is created on and the version you are using. The library name for the +GTK version of wxWindows 2.2 on Linux and Solaris will be libwx\_gtk-2.2.so.0.0.0, +on HP-UX, it will be libwx\_gtk-2.2.sl, on AIX just libwx\_gtk.a etc. + +Under Windows, use the library wx.lib (release) or wxd.lib (debug) for stand-alone Windows +applications, or wxdll.lib (wxdlld.lib) for creating DLLs. \section{Configuration} -The following lists the options configurable in the file -\rtfsp{\tt "wx/msw/setup.h"} and {\tt "wx/gtk/setup.h"} Some settings are a matter -of taste, some help with platform-specific problems, and -others can be set to minimize the size of the library. - -\subsection{General features} - -\begin{twocollist}\itemsep=0pt -\twocolitem{USE\_CLIPBOARD}{If 1, clipboard code is compiled (Windows only).} -\twocolitem{USE\_CONSTRAINTS}{If 1, the constaint-based window layout system is compiled.} -\twocolitem{USE\_DOC\_VIEW\_ARCHITECTURE}{If 1, wxDocument, wxView and related classes are compiled.} -\twocolitem{USE\_DYNAMIC\_CLASSES}{If 1, the run-time class macros and classes are compiled. Recommended, -and necessary for the document/view framework.} -\twocolitem{USE\_HELP}{If 1, interface to help system is compiled.} -\twocolitem{USE\_GAUGE}{If 1, the wxGauge class compiled.} -\twocolitem{USE\_GLOBAL\_MEMORY\_OPERATORS}{If 1, redefines global new and delete operators to be compatible -with the extended arguments of the debugging wxObject new and delete operators. If this causes problems -for your compiler, set to 0.} -\twocolitem{USE\_IPC}{If 1, interprocess communication code is compiled.} -\twocolitem{USE\_MEMORY\_TRACING}{If 1, enables debugging versions of wxObject::new and wxObject::delete -if the value of DEBUG is defined to more than 0.} -\twocolitem{USE\_METAFILE}{If 1, Windows Metafile code is compiled.} -\twocolitem{USE\_POSTSCRIPT}{If 1, PostScript code is compiled.} -\twocolitem{USE\_POSTSCRIPT\_ARCHITECTURE\_IN\_MSW}{Set to 1 to enable the printing architecture -to make use of either native Windows printing facilities, or the wxPostScriptDC class depending -on the wxApp::SetPrintMode setting.} -\twocolitem{USE\_PRINTING\_ARCHITECTURE}{If 1, wxPrinter, wxPrintout and related classes are compiled -for the print/preview framework.} -\twocolitem{USE\_RESOURCES}{If 1, win.ini or .Xdefaults-style resource read/write code is compiled.} -\twocolitem{USE\_WX\_RESOURCES}{If 1, wxWindows resource file (.WXR) code is compiled.} -\end{twocollist} - -\subsection{Windows and NT features} - -\begin{twocollist} -\twocolitem{CTL3D}{CTL3D should only be used for 16-bit Windows programs. -On Windows 95 and NT, native 3D effects are used. If you want to -use it and don't already have CTL3D installed, copy the files in -contrib/ctl3d to appropriate places (ctl3dv2.lib/ctl3d32.lib into your compiler lib -directory, ctl3d.h into an include directory, and ctl3dv2.dll into -windows/system). You may need to find a compiler-specific version of ctl3dv2.lib -or ctl3d32.lib. Define CTL3D to be 1 in wx\_setup.h and link your executables with ctl3dv2.lib -or ctl3d32.lib.} -\twocolitem{USE\_ODBC}{If 1, compiles wxDatabase and wxRecordSet classes for ODBC -access. Requires sql.h, sqlext.h files if set to 1 (see topic on database support).} -\end{twocollist} +Options are configurable in the file +\rtfsp{\tt "wx/XXX/setup.h"} where XXX is the required platform (such as msw, motif, gtk, mac). Some +settings are a matter of taste, some help with platform-specific problems, and +others can be set to minimize the size of the library. Please see the setup.h file +and {\tt install.txt} files for details on configuration. + +Under Unix (GTK and Motif) the corresponding setup.h files are generated automatically +when configuring the wxWindows using the "configure" script. When using the RPM packages +for installing wxWindows on Linux, a correct setup.h is shipped in the package and +this must not be changed. \section{Makefiles} At the moment there is no attempt to make Unix makefiles and PC makefiles compatible, i.e. one makefile is required for -each environment. - -Sample makefiles for Unix (suffix .UNX), MS C++ (suffix .DOS and .NT), Borland -C++ (.BCC) and Symantec C++ (.SC) are included for the library, demos -and utilities. The NT, Borland and Symantec makefiles cannot be -guaranteed to be up-to-date since the author does not have -these compilers. - -The controlling makefile for wxWindows is in the platform-specific -directory, such as {\tt src/msw} or {\tt src/x}. This makefile will -recursively execute the makefile in {\tt src/base}. - -\subsection{Windows makefiles} - -For Microsoft C++, normally it is only necessary to type {\tt nmake -f -makefile.dos} (or an alias or batch file which does this). By default, -binaries are made with debugging information, and no optimization. Use -FINAL=1 on the command line to remove debugging information (this only -really necessary at the link stage), and DLL=1 to make a DLL version of -the library, if building a library. - -\subsection{Unix makefiles} - -TODO. - -Debugging information is included by default; you may add DEBUG= as an -argument to make to compile without it, or use the Unix {\bf strip} -command to remove debugging information from an executable. - -\normalbox{{\it Important note:} Most compiler flags are kept centrally in -src/make.env, which is included by all other makefiles. This is the -file to edit to tailor wxWindows compilation to your environment.} +each environment. The Unix ports use a sophisticated system based +on the GNU autoconf tool and this system will create the +makefiles as required on the respective platform. Although the +makefiles are not identical in Windows, Mac and Unix, care has +been taken to make them relatively similar so that moving from +one platform to another will be painless. + +Sample makefiles for Unix (suffix .unx), MS C++ (suffix .DOS and .NT), Borland +C++ (.BCC and .B32) and Symantec C++ (.SC) are included for the library, demos +and utilities. + +The controlling makefile for wxWindows is in the MS-Windows +directory {\tt src/msw} for the different Windows compiler and +in the build directory when using the Unix ports. The build +directory can be chosen by the user. It is the directory in +which the "configure" script is run. This can be the normal +base directory (by running {\tt ./configure} there) or any other +directory (e.g. {\tt ../configure} after creating a build-directory +in the directory level above the base directory). + +Please see the platform-specific {\tt install.txt} file for further details. \section{Windows-specific files} @@ -414,7 +416,7 @@ STACKSIZE 8192 The only lines which will usually have to be changed per application are NAME and DESCRIPTION. -\subsection{Allocating and deleting wxWindows objects} +\section{Allocating and deleting wxWindows objects} In general, classes derived from wxWindow must dynamically allocated with {\it new} and deleted with {\it delete}. If you delete a window, @@ -444,83 +446,69 @@ make calls like wxDC::SetPen(wxNullPen) or wxDC::SelectObject(wxNullBitmap) befo a drawing object that may be in use. Code that doesn't do this will probably work fine on some platforms, and then fail under Windows. +\section{Architecture dependency} + +A problem which sometimes arises from writing multi-platform programs is that +the basic C types are not defined the same on all platforms. This holds true +for both the length in bits of the standard types (such as int and long) as +well as their byte order, which might be little endian (typically +on Intel computers) or big endian (typically on some Unix workstations). wxWindows +defines types and macros that make it easy to write architecture independent +code. The types are: + +wxInt32, wxInt16, wxInt8, wxUint32, wxUint16 = wxWord, wxUint8 = wxByte + +where wxInt32 stands for a 32-bit signed integer type etc. You can also check +which architecture the program is compiled on using the wxBYTE\_ORDER define +which is either wxBIG\_ENDIAN or wxLITTLE\_ENDIAN (in the future maybe wxPDP\_ENDIAN +as well). + +The macros handling bit-swapping with respect to the applications endianness +are described in the \helpref{Macros}{macros} section. + \section{Conditional compilation} One of the purposes of wxWindows is to reduce the need for conditional compilation in source code, which can be messy and confusing to follow. However, sometimes it is necessary to incorporate platform-specific -features (such as metafile use under MS Windows). The following identifiers -may be used for this purpose, along with any user-supplied ones: +features (such as metafile use under MS Windows). The symbols +listed in the file {\tt symbols.txt} may be used for this purpose, +along with any user-supplied ones. -{\bf GUIs:} +\section{C++ issues} -\begin{verbatim} -__X__ any X, but not GTK -__WXMOTIF__ Motif -__WXGTK__ GTK -__WXMSW__ Any Windows -__MAC__ MacOS -__UNIX__ any Unix -__WIN95__ GUI for Windows 95 and above; NT 4.0 and above. -__WIN32__ WIN32 API -__NT__ Windows NT -__CURSES__ CURSES -\end{verbatim} +The following documents some miscellaneous C++ issues. -{\bf OSes:} +\subsection{Templates} -\begin{verbatim} -__HPUX__ -__SVR4__ -__SYSV__ -__LINUX__ -__SGI__ -__ULTRIX__ -__BSD__ -__VMS__ -__SUN__ Any Sun -__SUNOS__ -__SOLARIS__ -__ALPHA__ -__AIX__ -__DATA_GENERAL__ -__OSF__ -__FREEBSD__ -\end{verbatim} +wxWindows does not use templates since it is a notoriously unportable feature. -{\bf Compilers:} +\subsection{RTTI} -\begin{verbatim} -__GNUWIN32__ Gnu-Win32 compiler -__DJGPP__ DJGPP -__GNUG__ Gnu C++ on any platform -__BORLANDC__ Borland C++ -__WATCOMC__ Watcom C++ -__SYMANTECC__ Symantec C++ -__VISUALC__ VC++ -__SUNCC__ -\end{verbatim} +wxWindows does not use run-time type information since wxWindows provides +its own run-time type information system, implemented using macros. + +\subsection{Type of NULL} -{\bf wxWindows modes:} +Some compilers (e.g. the native IRIX cc) define NULL to be 0L so that +no conversion to pointers is allowed. Because of that, all these +occurrences of NULL in the GTK port use an explicit conversion such +as +{\small \begin{verbatim} -__WXDEBUG__ usage: #ifdef __DEBUG__ (=> debug mode, else => release) + wxWindow *my_window = (wxWindow*) NULL; \end{verbatim} +} - -\section{C++ issues} - -The following documents some miscellaneous C++ issues. - -\subsection{Templates} - -wxWindows does not use templates since it is a notoriously unportable feature. +It is recommended to adhere to this in all code using wxWindows as +this make the code (a bit) more portable. \subsection{Precompiled headers} Some compilers, such as Borland C++ and Microsoft C++, support precompiled headers. This can save a great deal of compiling time. The -recommended approach is to precompile {\tt ``wx.h''}, using this +recommended approach is to precompile {\tt "wx.h"}, using this precompiled header for compiling both wxWindows itself and any wxWindows applications. For Windows compilers, two dummy source files are provided (one for normal applications and one for creating DLLs) @@ -530,8 +518,7 @@ However, there are several downsides to using precompiled headers. One is that to take advantage of the facility, you often need to include more header files than would normally be the case. This means that changing a header file will cause more recompilations (in the case of -wxWindows, everything needs to be recompiled since everything includes -{\tt ``wx.h''}!) +wxWindows, everything needs to be recompiled since everything includes {\tt "wx.h"}!) A related problem is that for compilers that don't have precompiled headers, including a lot of header files slows down compilation @@ -540,7 +527,7 @@ X and Windows parts of the library) conditional compilation that under Unix, includes a minimal set of headers; and when using Visual C++, includes {\tt wx.h}. This should help provide the optimal compilation for each compiler, although it is -biassed towards the precompiled headers facility available +biased towards the precompiled headers facility available in Microsoft C++. \section{File handling} @@ -553,7 +540,7 @@ approach is to store filenames on their own, with no directory information. The application searches through a number of locally defined directories to find the file. To support this, the class {\bf wxPathList} makes adding directories and searching for files easy, and -the global function {\bf FileNameFromPath} allows the application to +the global function {\bf wxFileNameFromPath} allows the application to strip off the filename from the path if the filename must be stored. This has undesirable ramifications for people who have documents of the same name in different directories. @@ -573,6 +560,7 @@ dos2unix). See also the File Functions section of the reference manual for descriptions of miscellaneous file handling functions. +\begin{comment} \chapter{Utilities supplied with wxWindows}\label{utilities} \setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% \setfooter{\thepage}{}{}{}{}{\thepage}% @@ -580,15 +568,16 @@ descriptions of miscellaneous file handling functions. A number of `extras' are supplied with wxWindows, to complement the GUI functionality in the main class library. These are found below the utils directory and usually have their own source, library -and documentation directories. For larger user-contributed packages, -see the directory /pub/packages/wxwin/contrib. +and documentation directories. For other user-contributed packages, +see the directory ftp://www.remstar.com/pub/wxwin/contrib, which is +more easily accessed via the Contributions page on the Web site. \section{wxHelp}\label{wxhelp} wxHelp is a stand-alone program, written using wxWindows, for displaying hypertext help. It is necessary since not all target systems (notably X) supply an adequate -standard for on-line help. wxHelp is modelled on the MS Windows help +standard for on-line help. wxHelp is modeled on the MS Windows help system, with contents, search and browse buttons, but does not reformat text to suit the size of window, as WinHelp does, and its input files are uncompressed ASCII with some embedded font commands and an .xlp @@ -677,6 +666,7 @@ platform. \setfooter{\thepage}{}{}{}{}{\thepage}% To be written. +\end{comment} \chapter{Programming strategies}\label{strategies} \setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% @@ -700,9 +690,9 @@ it can alert you to problems later on. \subsection{Use wxString in preference to character arrays} Using wxString can be much safer and more convenient than using char *. -Again, I haven't practised what I'm preaching, but I'm now trying to use +Again, I haven't practiced what I'm preaching, but I'm now trying to use wxString wherever possible. You can reduce the possibility of memory -leaks substantially, and it's much more convenient to use the overloaded +leaks substantially, and it is much more convenient to use the overloaded operators than functions such as strcmp. wxString won't add a significant overhead to your program; the overhead is compensated for by easier manipulation (which means less code). @@ -715,8 +705,7 @@ The same goes for other data types: use classes wherever possible. Don't use absolute panel item positioning if you can avoid it. Different GUIs have very differently sized panel items. Consider using the constraint system, although this -can be complex to program. If you needs are simple, the default relative positioning -behaviour may be adequate (using default position values and wxPanel::NewLine). +can be complex to program. Alternatively, you could use alternative .wrc (wxWindows resource files) on different platforms, with slightly different dimensions in each. Or space your panel items out @@ -732,7 +721,7 @@ kinds of bitmap depending on platform (see the section on resource files). \subsection{Positive thinking} -It's common to blow up the problem in one's imagination, so that it seems to threaten +It is common to blow up the problem in one's imagination, so that it seems to threaten weeks, months or even years of work. The problem you face may seem insurmountable: but almost never is. Once you have been programming for some time, you will be able to remember similar incidents that threw you into the depths of despair. But @@ -759,8 +748,8 @@ deallocation, this can still give totally spurious results! \subsection{Use a debugger} -This sounds like facetious advice, but it's surprising how often people -don't use a debugger. Often it's an overhead to install or learn how to +This sounds like facetious advice, but it is surprising how often people +don't use a debugger. Often it is an overhead to install or learn how to use a debugger, but it really is essential for anything but the most trivial programs. @@ -789,12 +778,13 @@ See the \helpref{debugging overview}{debuggingoverview} for further information. \subsection{Check Windows debug messages} -Under Windows, it's worth running your program with DBWIN running or -some other program that shows Windows-generated debug messages. It's -possible it'll show invalid handles being used. You may have fun seeing +Under Windows, it is worth running your program with +\urlref{DbgView}{http://www.sysinternals.com} running or +some other program that shows Windows-generated debug messages. It is +possible it will show invalid handles being used. You may have fun seeing what commercial programs cause these normally hidden errors! Microsoft recommend using the debugging version of Windows, which shows up even -more problems. However, I doubt it's worth the hassle for most +more problems. However, I doubt it is worth the hassle for most applications. wxWindows is designed to minimize the possibility of such errors, but they can still happen occasionally, slipping through unnoticed because they are not severe enough to cause a crash. @@ -808,4 +798,3 @@ different happens. You may have an intuition why a change will make a difference otherwise, just try altering the order of code, comment lines out, anything to get over an impasse. Obviously, this is usually a last resort. -