]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/function.tex
added wxWindow::Set/GetMin/MaxClientSize convenience functions
[wxWidgets.git] / docs / latex / wx / function.tex
CommitLineData
ce045aed
WS
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: function.tex
3%% Purpose: Functions and macros
4%% Author: wxWidgets Team
5%% Modified by:
6%% Created:
7%% RCS-ID: $Id$
8%% Copyright: (c) wxWidgets Team
9%% License: wxWindows license
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
6d98f963 12\chapter{Functions and macros}\label{functions}
a660d684
KB
13\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
14\setfooter{\thepage}{}{}{}{}{\thepage}
15
fc2171bd 16The functions and macros defined in wxWidgets are described here: you can
b0fc8832
VZ
17either look up a function using the alphabetical listing of them or find it in
18the corresponding topic.
19
569ef72a 20\section{Alphabetical functions and macros list}\label{functionsalphabetically}
b0fc8832
VZ
21
22\helpref{CLASSINFO}{classinfo}\\
23\helpref{DECLARE\_ABSTRACT\_CLASS}{declareabstractclass}\\
24\helpref{DECLARE\_APP}{declareapp}\\
25\helpref{DECLARE\_CLASS}{declareclass}\\
26\helpref{DECLARE\_DYNAMIC\_CLASS}{declaredynamicclass}\\
27\helpref{IMPLEMENT\_ABSTRACT\_CLASS2}{implementabstractclass2}\\
28\helpref{IMPLEMENT\_ABSTRACT\_CLASS}{implementabstractclass}\\
29\helpref{IMPLEMENT\_APP}{implementapp}\\
30\helpref{IMPLEMENT\_CLASS2}{implementclass2}\\
31\helpref{IMPLEMENT\_CLASS}{implementclass}\\
32\helpref{IMPLEMENT\_DYNAMIC\_CLASS2}{implementdynamicclass2}\\
33\helpref{IMPLEMENT\_DYNAMIC\_CLASS}{implementdynamicclass}\\
c2709a3d 34\helpref{wxAboutBox}{wxaboutbox}\\
2bd3cba6 35\helpref{wxASSERT}{wxassert}\\
8f5d9104 36\helpref{wxASSERT\_MIN\_BITSIZE}{wxassertminbitsize}\\
b0fc8832 37\helpref{wxASSERT\_MSG}{wxassertmsg}\\
cde76cf2
VZ
38\helpref{wxAtomicDec}{wxatomicdec}\\
39\helpref{wxAtomicInc}{wxatomicinc}\\
4db03d26
VZ
40\helpref{wxBase64Decode}{wxbase64decode}\\
41\helpref{wxBase64Encode}{wxbase64encode}\\
b0fc8832
VZ
42\helpref{wxBeginBusyCursor}{wxbeginbusycursor}\\
43\helpref{wxBell}{wxbell}\\
2bd3cba6 44\helpref{wxBITMAP}{wxbitmapmacro}\\
8482e4bd 45\helpref{wxCHANGE\_UMASK}{wxchangeumask}\\
a30c309a 46\helpref{wxCHECK}{wxcheck}\\
b0fc8832
VZ
47\helpref{wxCHECK2\_MSG}{wxcheck2msg}\\
48\helpref{wxCHECK2}{wxcheck2}\\
a30c309a 49\helpref{wxCHECK\_GCC\_VERSION}{wxcheckgccversion}\\
b0fc8832
VZ
50\helpref{wxCHECK\_MSG}{wxcheckmsg}\\
51\helpref{wxCHECK\_RET}{wxcheckret}\\
2686d933 52\helpref{wxCHECK\_SUNCC\_VERSION}{wxchecksunccversion}\\
b0fc8832 53\helpref{wxCHECK\_VERSION}{wxcheckversion}\\
eeade4cc 54\helpref{wxCHECK\_VERSION\_FULL}{wxcheckversionfull}\\
a38c9b43 55\helpref{wxCHECK\_VISUALC\_VERSION}{wxcheckvisualcversion}\\
a30c309a 56\helpref{wxCHECK\_W32API\_VERSION}{wxcheckw32apiversion}\\
b0fc8832 57\helpref{wxClientDisplayRect}{wxclientdisplayrect}\\
f4fcc291 58\helpref{wxClipboardOpen}{functionwxclipboardopen}\\
b0fc8832
VZ
59\helpref{wxCloseClipboard}{wxcloseclipboard}\\
60\helpref{wxColourDisplay}{wxcolourdisplay}\\
8f5d9104 61\helpref{wxCOMPILE\_TIME\_ASSERT}{wxcompiletimeassert}\\
5b8643ea 62\helpref{wxCOMPILE\_TIME\_ASSERT2}{wxcompiletimeassert2}\\
2bd3cba6 63\helpref{wxCONCAT}{wxconcat}\\
b0fc8832
VZ
64\helpref{wxConcatFiles}{wxconcatfiles}\\
65\helpref{wxConstCast}{wxconstcast}\\
66\helpref{wxCopyFile}{wxcopyfile}\\
67\helpref{wxCreateDynamicObject}{wxcreatedynamicobject}\\
68\helpref{wxCreateFileTipProvider}{wxcreatefiletipprovider}\\
789bdf9b 69\helpref{wxCRIT\_SECT\_DECLARE}{wxcritsectdeclare}\\
db882c54 70\helpref{wxCRIT\_SECT\_DECLARE\_MEMBER}{wxcritsectdeclaremember}\\
789bdf9b
VZ
71\helpref{wxCRIT\_SECT\_LOCKER}{wxcritsectlocker}\\
72\helpref{wxCRITICAL\_SECTION}{wxcriticalsectionmacro}\\ % wxcs already taken!
b0fc8832
VZ
73\helpref{wxDDECleanUp}{wxddecleanup}\\
74\helpref{wxDDEInitialize}{wxddeinitialize}\\
75\helpref{wxDROP\_ICON}{wxdropicon}\\
76\helpref{wxDebugMsg}{wxdebugmsg}\\
2bd3cba6 77\helpref{WXDEBUG\_NEW}{debugnew}\\
5d88a6b5
VZ
78\helpref{wxDEPRECATED}{wxdeprecated}\\
79\helpref{wxDEPRECATED\_BUT\_USED\_INTERNALLY}{wxdeprecatedbutusedinternally}\\
3694bb76 80\helpref{wxDEPRECATED\_INLINE}{wxdeprecatedinline}\\
2bd3cba6 81\helpref{wxDirExists}{functionwxdirexists}\\
b0fc8832
VZ
82\helpref{wxDirSelector}{wxdirselector}\\
83\helpref{wxDisplayDepth}{wxdisplaydepth}\\
b0fc8832 84\helpref{wxDisplaySize}{wxdisplaysize}\\
f4fcc291 85\helpref{wxDisplaySizeMM}{wxdisplaysizemm}\\
b0fc8832
VZ
86\helpref{wxDos2UnixFilename}{wxdos2unixfilename}\\
87\helpref{wxDynamicCastThis}{wxdynamiccastthis}\\
88\helpref{wxDynamicCast}{wxdynamiccast}\\
4104ed92 89\helpref{wxDYNLIB\_FUNCTION}{wxdynlibfunction}\\
b0fc8832
VZ
90\helpref{wxEmptyClipboard}{wxemptyclipboard}\\
91\helpref{wxEnableTopLevelWindows}{wxenabletoplevelwindows}\\
92\helpref{wxEndBusyCursor}{wxendbusycursor}\\
789bdf9b 93\helpref{wxENTER\_CRIT\_SECT}{wxentercritsect}\\
b0fc8832 94\helpref{wxEntry}{wxentry}\\
9b2d4f0e
VZ
95\helpref{wxEntryStart}{wxentrystart}\\
96\helpref{wxEntryCleanup}{wxentrycleanup}\\
b0fc8832
VZ
97\helpref{wxEnumClipboardFormats}{wxenumclipboardformats}\\
98\helpref{wxError}{wxerror}\\
99\helpref{wxExecute}{wxexecute}\\
100\helpref{wxExit}{wxexit}\\
986ecc86 101\helpref{wxEXPLICIT}{wxexplicit}\\
b0fc8832
VZ
102\helpref{wxFAIL\_MSG}{wxfailmsg}\\
103\helpref{wxFAIL}{wxfail}\\
104\helpref{wxFatalError}{wxfatalerror}\\
f4fcc291 105\helpref{wxFileExists}{functionwxfileexists}\\
b0fc8832
VZ
106\helpref{wxFileModificationTime}{wxfilemodificationtime}\\
107\helpref{wxFileNameFromPath}{wxfilenamefrompath}\\
108\helpref{wxFileSelector}{wxfileselector}\\
109\helpref{wxFindFirstFile}{wxfindfirstfile}\\
110\helpref{wxFindMenuItemId}{wxfindmenuitemid}\\
111\helpref{wxFindNextFile}{wxfindnextfile}\\
112\helpref{wxFindWindowAtPointer}{wxfindwindowatpointer}\\
113\helpref{wxFindWindowAtPoint}{wxfindwindowatpoint}\\
114\helpref{wxFindWindowByLabel}{wxfindwindowbylabel}\\
115\helpref{wxFindWindowByName}{wxfindwindowbyname}\\
a02afd14 116\helpref{wxFinite}{wxfinite}\\
c2709a3d 117\helpref{wxGenericAboutBox}{wxgenericaboutbox}\\
b0fc8832 118\helpref{wxGetActiveWindow}{wxgetactivewindow}\\
749caeeb 119\helpref{wxGetApp}{wxgetapp}\\
8ea92b4d 120\helpref{wxGetBatteryState}{wxgetbatterystate}\\
b0fc8832
VZ
121\helpref{wxGetClipboardData}{wxgetclipboarddata}\\
122\helpref{wxGetClipboardFormatName}{wxgetclipboardformatname}\\
123\helpref{wxGetColourFromUser}{wxgetcolourfromuser}\\
124\helpref{wxGetCwd}{wxgetcwd}\\
125\helpref{wxGetDiskSpace}{wxgetdiskspace}\\
126\helpref{wxGetDisplayName}{wxgetdisplayname}\\
f70c0443 127\helpref{wxGetDisplaySize}{wxdisplaysize}\\
3980000c 128\helpref{wxGetDisplaySizeMM}{wxdisplaysizemm}\\
b0fc8832
VZ
129\helpref{wxGetEmailAddress}{wxgetemailaddress}\\
130\helpref{wxGetEnv}{wxgetenv}\\
0912690b 131\helpref{wxGetFileKind}{wxgetfilekind}\\
d741c583 132\helpref{wxGetFontFromUser}{wxgetfontfromuser}\\
b0fc8832
VZ
133\helpref{wxGetFreeMemory}{wxgetfreememory}\\
134\helpref{wxGetFullHostName}{wxgetfullhostname}\\
135\helpref{wxGetHomeDir}{wxgethomedir}\\
136\helpref{wxGetHostName}{wxgethostname}\\
f52d9e92 137\helpref{wxGetKeyState}{wxgetkeystate}\\
b0fc8832
VZ
138\helpref{wxGetLocalTimeMillis}{wxgetlocaltimemillis}\\
139\helpref{wxGetLocalTime}{wxgetlocaltime}\\
140\helpref{wxGetMousePosition}{wxgetmouseposition}\\
7dd40b6f 141\helpref{wxGetMouseState}{wxgetmousestate}\\
b0fc8832 142\helpref{wxGetMultipleChoices}{wxgetmultiplechoices}\\
b0fc8832
VZ
143\helpref{wxGetNumberFromUser}{wxgetnumberfromuser}\\
144\helpref{wxGetOSDirectory}{wxgetosdirectory}\\
145\helpref{wxGetOsDescription}{wxgetosdescription}\\
146\helpref{wxGetOsVersion}{wxgetosversion}\\
147\helpref{wxGetPasswordFromUser}{wxgetpasswordfromuser}\\
8ea92b4d 148\helpref{wxGetPowerType}{wxgetpowertype}\\
b0fc8832
VZ
149\helpref{wxGetPrinterCommand}{wxgetprintercommand}\\
150\helpref{wxGetPrinterFile}{wxgetprinterfile}\\
151\helpref{wxGetPrinterMode}{wxgetprintermode}\\
152\helpref{wxGetPrinterOptions}{wxgetprinteroptions}\\
153\helpref{wxGetPrinterOrientation}{wxgetprinterorientation}\\
154\helpref{wxGetPrinterPreviewCommand}{wxgetprinterpreviewcommand}\\
155\helpref{wxGetPrinterScaling}{wxgetprinterscaling}\\
156\helpref{wxGetPrinterTranslation}{wxgetprintertranslation}\\
c1cb4153 157\helpref{wxGetProcessId}{wxgetprocessid}\\
b0fc8832
VZ
158\helpref{wxGetSingleChoiceData}{wxgetsinglechoicedata}\\
159\helpref{wxGetSingleChoiceIndex}{wxgetsinglechoiceindex}\\
160\helpref{wxGetSingleChoice}{wxgetsinglechoice}\\
161\helpref{wxGetTempFileName}{wxgettempfilename}\\
162\helpref{wxGetTextFromUser}{wxgettextfromuser}\\
33b494d6 163\helpref{wxGetTopLevelParent}{wxgettoplevelparent}\\
b0fc8832
VZ
164\helpref{wxGetTranslation}{wxgettranslation}\\
165\helpref{wxGetUTCTime}{wxgetutctime}\\
166\helpref{wxGetUserHome}{wxgetuserhome}\\
167\helpref{wxGetUserId}{wxgetuserid}\\
168\helpref{wxGetUserName}{wxgetusername}\\
169\helpref{wxGetWorkingDirectory}{wxgetworkingdirectory}\\
170\helpref{wxGetenv}{wxgetenvmacro}\\
171\helpref{wxHandleFatalExceptions}{wxhandlefatalexceptions}\\
172\helpref{wxICON}{wxiconmacro}\\
8cf304f8 173\helpref{wxInfoMessageBox}{wxinfomessagebox}\\
b0fc8832
VZ
174\helpref{wxINTXX\_SWAP\_ALWAYS}{intswapalways}\\
175\helpref{wxINTXX\_SWAP\_ON\_BE}{intswaponbe}\\
176\helpref{wxINTXX\_SWAP\_ON\_LE}{intswaponle}\\
177\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}\\
178\helpref{wxInitialize}{wxinitialize}\\
179\helpref{wxIsAbsolutePath}{wxisabsolutepath}\\
180\helpref{wxIsBusy}{wxisbusy}\\
181\helpref{wxIsClipboardFormatAvailable}{wxisclipboardformatavailable}\\
a434b43f 182\helpref{wxIsDebuggerRunning}{wxisdebuggerrunning}\\
b0fc8832 183\helpref{wxIsEmpty}{wxisempty}\\
789bdf9b 184\helpref{wxIsMainThread}{wxismainthread}\\
a02afd14 185\helpref{wxIsNaN}{wxisnan}\\
8bb6b2c0
VZ
186\helpref{wxIsPlatformLittleEndian}{wxisplatformlittleendian}\\
187\helpref{wxIsPlatform64Bit}{wxisplatform64bit}\\
b0fc8832 188\helpref{wxIsWild}{wxiswild}\\
abbb59e8 189\helpref{wxJoin}{wxjoin}\\
b0fc8832 190\helpref{wxKill}{wxkill}\\
498a1eeb 191\helpref{wxLaunchDefaultBrowser}{wxlaunchdefaultbrowser}\\
789bdf9b 192\helpref{wxLEAVE\_CRIT\_SECT}{wxleavecritsect}\\
b0fc8832
VZ
193\helpref{wxLoadUserResource}{wxloaduserresource}\\
194\helpref{wxLogDebug}{wxlogdebug}\\
195\helpref{wxLogError}{wxlogerror}\\
196\helpref{wxLogFatalError}{wxlogfatalerror}\\
197\helpref{wxLogMessage}{wxlogmessage}\\
198\helpref{wxLogStatus}{wxlogstatus}\\
199\helpref{wxLogSysError}{wxlogsyserror}\\
200\helpref{wxLogTrace}{wxlogtrace}\\
201\helpref{wxLogVerbose}{wxlogverbose}\\
202\helpref{wxLogWarning}{wxlogwarning}\\
2b5f62a0
VZ
203\helpref{wxLL}{wxll}\\
204\helpref{wxLongLongFmtSpec}{wxlonglongfmtspec}\\
b0fc8832
VZ
205\helpref{wxMakeMetafilePlaceable}{wxmakemetafileplaceable}\\
206\helpref{wxMatchWild}{wxmatchwild}\\
207\helpref{wxMessageBox}{wxmessagebox}\\
08873d36
VZ
208\helpref{wxMilliSleep}{wxmillisleep}\\
209\helpref{wxMicroSleep}{wxmicrosleep}\\
b0fc8832
VZ
210\helpref{wxMkdir}{wxmkdir}\\
211\helpref{wxMutexGuiEnter}{wxmutexguienter}\\
212\helpref{wxMutexGuiLeave}{wxmutexguileave}\\
213\helpref{wxNewId}{wxnewid}\\
214\helpref{wxNow}{wxnow}\\
215\helpref{wxOnAssert}{wxonassert}\\
1a64b24d
VZ
216\helpref{wxON\_BLOCK\_EXIT}{wxonblockexit}\\
217\helpref{wxON\_BLOCK\_EXIT\_OBJ}{wxonblockexitobj}\\
b0fc8832 218\helpref{wxOpenClipboard}{wxopenclipboard}\\
daf32463 219\helpref{wxParseCommonDialogsFilter}{wxparsecommondialogsfilter}\\
b0fc8832 220\helpref{wxPathOnly}{wxpathonly}\\
2bd3cba6 221\helpref{wxPLURAL}{wxplural}\\
b0fc8832
VZ
222\helpref{wxPostDelete}{wxpostdelete}\\
223\helpref{wxPostEvent}{wxpostevent}\\
224\helpref{wxRegisterClipboardFormat}{wxregisterclipboardformat}\\
225\helpref{wxRegisterId}{wxregisterid}\\
226\helpref{wxRemoveFile}{wxremovefile}\\
227\helpref{wxRenameFile}{wxrenamefile}\\
b0fc8832 228\helpref{wxRmdir}{wxrmdir}\\
a0516656 229\helpref{wxS}{wxs}\\
c11d62a6 230\helpref{wxSafeShowMessage}{wxsafeshowmessage}\\
b0fc8832
VZ
231\helpref{wxSafeYield}{wxsafeyield}\\
232\helpref{wxSetClipboardData}{wxsetclipboarddata}\\
233\helpref{wxSetCursor}{wxsetcursor}\\
234\helpref{wxSetDisplayName}{wxsetdisplayname}\\
235\helpref{wxSetEnv}{wxsetenv}\\
236\helpref{wxSetPrinterCommand}{wxsetprintercommand}\\
237\helpref{wxSetPrinterFile}{wxsetprinterfile}\\
238\helpref{wxSetPrinterMode}{wxsetprintermode}\\
239\helpref{wxSetPrinterOptions}{wxsetprinteroptions}\\
240\helpref{wxSetPrinterOrientation}{wxsetprinterorientation}\\
241\helpref{wxSetPrinterPreviewCommand}{wxsetprinterpreviewcommand}\\
242\helpref{wxSetPrinterScaling}{wxsetprinterscaling}\\
243\helpref{wxSetPrinterTranslation}{wxsetprintertranslation}\\
244\helpref{wxSetWorkingDirectory}{wxsetworkingdirectory}\\
245\helpref{wxShell}{wxshell}\\
246\helpref{wxShowTip}{wxshowtip}\\
f6ba47d9 247\helpref{wxShutdown}{wxshutdown}\\
b0fc8832
VZ
248\helpref{wxSleep}{wxsleep}\\
249\helpref{wxSnprintf}{wxsnprintf}\\
abbb59e8 250\helpref{wxSplit}{wxsplit}\\
b0fc8832 251\helpref{wxSplitPath}{wxsplitfunction}\\
b0fc8832 252\helpref{wxStaticCast}{wxstaticcast}\\
2f930c85 253\helpref{wxStrcmp}{wxstrcmp}\\
b0fc8832
VZ
254\helpref{wxStricmp}{wxstricmp}\\
255\helpref{wxStringEq}{wxstringeq}\\
256\helpref{wxStringMatch}{wxstringmatch}\\
bf00c875 257\helpref{wxStringTokenize}{wxstringtokenize}\\
b0fc8832
VZ
258\helpref{wxStripMenuCodes}{wxstripmenucodes}\\
259\helpref{wxStrlen}{wxstrlen}\\
b4a81453 260\helpref{wxSTRINGIZE}{wxstringize}\\
84206bbb 261\helpref{wxSTRINGIZE\_T}{wxstringizet}\\
7261746a 262\helpref{wxSUPPRESS\_GCC\_PRIVATE\_DTOR\_WARNING}{wxsuppressgccprivatedtorwarning}\\
b0fc8832
VZ
263\helpref{wxSysErrorCode}{wxsyserrorcode}\\
264\helpref{wxSysErrorMsg}{wxsyserrormsg}\\
0bbe4e29 265\helpref{wxT}{wxt}\\
b0fc8832 266\helpref{wxTrace}{wxtrace}\\
2bd3cba6
VZ
267\helpref{WXTRACE}{trace}\\
268\helpref{wxTraceLevel}{wxtracelevel}\\
269\helpref{WXTRACELEVEL}{tracelevel}\\
b0fc8832
VZ
270\helpref{wxTransferFileToStream}{wxtransferfiletostream}\\
271\helpref{wxTransferStreamToFile}{wxtransferstreamtofile}\\
272\helpref{wxTrap}{wxtrap}\\
84ed77ef 273\helpref{wxULL}{wxull}\\
b0fc8832
VZ
274\helpref{wxUninitialize}{wxuninitialize}\\
275\helpref{wxUnix2DosFilename}{wxunix2dosfilename}\\
276\helpref{wxUnsetEnv}{wxunsetenv}\\
277\helpref{wxUsleep}{wxusleep}\\
d85cfb37 278\helpref{wxVaCopy}{wxvacopy}\\
b0fc8832
VZ
279\helpref{wxVsnprintf}{wxvsnprintf}\\
280\helpref{wxWakeUpIdle}{wxwakeupidle}\\
0bbe4e29 281\helpref{wxYield}{wxyield}\\
f29fe169 282\helpref{wx\_const\_cast}{wxconstcastraw}\\
8c8d66c5 283\helpref{wx\_reinterpret\_cast}{wxreinterpretcastraw}\\
f29fe169 284\helpref{wx\_static\_cast}{wxstaticcastraw}\\
e6b2a3b3 285\helpref{wx\_truncate\_cast}{wxtruncatecast}\\
0bbe4e29
VZ
286\helpref{\_}{underscore}\\
287\helpref{\_T}{underscoret}
fd05688e 288\helpref{\_\_WXFUNCTION\_\_}{wxfunction}
f6bcfd97 289
84ed77ef
VZ
290
291
f6bcfd97
BP
292\section{Version macros}\label{versionfunctions}
293
fc2171bd 294The following constants are defined in wxWidgets:
f6bcfd97
BP
295
296\begin{itemize}\itemsep=0pt
fc2171bd
JS
297\item {\tt wxMAJOR\_VERSION} is the major version of wxWidgets
298\item {\tt wxMINOR\_VERSION} is the minor version of wxWidgets
ff8fda36 299\item {\tt wxRELEASE\_NUMBER} is the release number
eeade4cc
VZ
300\item {\tt wxSUBRELEASE\_NUMBER} is the subrelease number which is $0$ for all
301official releases
f6bcfd97
BP
302\end{itemize}
303
fc2171bd 304For example, the values or these constants for wxWidgets 2.1.15 are 2, 1 and
f6bcfd97
BP
30515.
306
307Additionally, {\tt wxVERSION\_STRING} is a user-readable string containing
fc2171bd 308the full wxWidgets version and {\tt wxVERSION\_NUMBER} is a combination of the
f6bcfd97 309three version numbers above: for 2.1.15, it is 2115 and it is 2200 for
fc2171bd 310wxWidgets 2.2.
f6bcfd97 311
eeade4cc
VZ
312The subrelease number is only used for the sources in between official releases
313and so normally is not useful.
314
f6bcfd97
BP
315\wxheading{Include files}
316
317<wx/version.h> or <wx/defs.h>
318
84ed77ef 319
eeade4cc
VZ
320\membersection{wxCHECK\_GCC\_VERSION}\label{wxcheckgccversion}
321
09d66b2b 322\func{bool}{wxCHECK\_GCC\_VERSION}{\param{}{major, minor}}
eeade4cc
VZ
323
324Returns $1$ if the compiler being used to compile the code is GNU C++
09d66b2b 325compiler (g++) version major.minor or greater. Otherwise, and also if
eeade4cc
VZ
326the compiler is not GNU C++ at all, returns $0$.
327
328
2686d933
VZ
329\membersection{wxCHECK\_SUNCC\_VERSION}\label{wxchecksunccversion}
330
331\func{bool}{wxCHECK\_SUNCC\_VERSION}{\param{}{major, minor}}
332
333Returns $1$ if the compiler being used to compile the code is Sun CC Pro
334compiler and its version is at least \texttt{major.minor}. Otherwise returns
335$0$.
336
337
f6bcfd97
BP
338\membersection{wxCHECK\_VERSION}\label{wxcheckversion}
339
340\func{bool}{wxCHECK\_VERSION}{\param{}{major, minor, release}}
341
fc2171bd 342This is a macro which evaluates to true if the current wxWidgets version is at
f6bcfd97
BP
343least major.minor.release.
344
fc2171bd 345For example, to test if the program is compiled with wxWidgets 2.2 or higher,
f6bcfd97
BP
346the following can be done:
347
348\begin{verbatim}
349 wxString s;
350#if wxCHECK_VERSION(2, 2, 0)
351 if ( s.StartsWith("foo") )
352#else // replacement code for old version
353 if ( strncmp(s, "foo", 3) == 0 )
354#endif
355 {
356 ...
357 }
358\end{verbatim}
a660d684 359
84ed77ef 360
eeade4cc 361\membersection{wxCHECK\_VERSION\_FULL}\label{wxcheckversionfull}
a30c309a 362
eeade4cc 363\func{bool}{wxCHECK\_VERSION\_FULL}{\param{}{major, minor, release, subrel}}
a30c309a 364
9d8aca48 365Same as \helpref{wxCHECK\_VERSION}{wxcheckversion} but also checks that
eeade4cc 366\texttt{wxSUBRELEASE\_NUMBER} is at least \arg{subrel}.
a30c309a 367
84ed77ef 368
a38c9b43
VS
369\membersection{wxCHECK\_VISUALC\_VERSION}\label{wxcheckvisualcversion}
370
371\func{bool}{wxCHECK\_VISUALC\_VERSION}{\param{}{major}}
372
373Returns $1$ if the compiler being used to compile the code is Visual C++
374compiler version \arg{major} or greater. Otherwise, and also if
375the compiler is not Visual C++ at all, returns $0$.
376
377
a30c309a
VZ
378\membersection{wxCHECK\_W32API\_VERSION}\label{wxcheckw32apiversion}
379
fbcb0229 380\func{bool}{wxCHECK\_W32API\_VERSION}{\param{}{major, minor, release}}
a30c309a
VZ
381
382Returns $1$ if the version of w32api headers used is major.minor.release or
383greater. Otherwise, and also if we are not compiling with mingw32/cygwin under
384Win32 at all, returns $0$.
385
84ed77ef
VZ
386
387
b0fc8832 388\section{Application initialization and termination}\label{appinifunctions}
c88275cb 389
b0fc8832
VZ
390The functions in this section are used on application startup/shutdown and also
391to control the behaviour of the main event loop of the GUI programs.
c88275cb 392
84ed77ef 393
b0fc8832 394\membersection{::wxEntry}\label{wxentry}
c88275cb 395
9b2d4f0e
VZ
396This initializes wxWidgets in a platform-dependent way. Use this if you are not
397using the default wxWidgets entry code (e.g. main or WinMain). For example, you
398can initialize wxWidgets from an Microsoft Foundation Classes application using
b0fc8832 399this function.
c88275cb 400
9b2d4f0e 401The following overload of wxEntry is available under all platforms:
c88275cb 402
9b2d4f0e 403\func{int}{wxEntry}{\param{int\&}{ argc}, \param{wxChar **}{argv}}
c88275cb 404
9b2d4f0e
VZ
405Under MS Windows, an additional overload suitable for calling from
406\texttt{WinMain} is available:
c88275cb 407
9b2d4f0e 408\func{int}{wxEntry}{\param{HINSTANCE }{hInstance}, \param{HINSTANCE }{hPrevInstance = \NULL}, \param{char *}{pCmdLine = \NULL}, \param{int }{nCmdShow = \texttt{SW\_SHOWNORMAL}}}
c88275cb 409
9b2d4f0e
VZ
410(notice that under Windows CE platform, and only there, the type of
411\arg{pCmdLine} is \texttt{wchar\_t *}, otherwise it is \texttt{char *}, even in
412Unicode build).
c88275cb 413
9b2d4f0e
VZ
414\wxheading{See also}
415
416\helpref{wxEntryStart}{wxentrystart}
c88275cb 417
b0fc8832 418\wxheading{Remarks}
c88275cb 419
fc2171bd
JS
420To clean up wxWidgets, call wxApp::OnExit followed by the static function
421wxApp::CleanUp. For example, if exiting from an MFC application that also uses wxWidgets:
4aff28fc 422
b0fc8832
VZ
423\begin{verbatim}
424int CTheApp::ExitInstance()
425{
426 // OnExit isn't called by CleanUp so must be called explicitly.
427 wxTheApp->OnExit();
428 wxApp::CleanUp();
429
430 return CWinApp::ExitInstance();
c88275cb
RR
431}
432\end{verbatim}
433
b0fc8832 434\wxheading{Include files}
c88275cb 435
b0fc8832 436<wx/app.h>
c88275cb 437
749caeeb 438
84ed77ef 439
9b2d4f0e
VZ
440\membersection{::wxEntryCleanup}\label{wxentrycleanup}
441
442\func{void}{wxEntryCleanup}{\void}
443
444Free resources allocated by a successful call to \helpref{wxEntryStart}{wxentrystart}.
445
446\wxheading{Include files}
447
448<wx/init.h>
449
450
451\membersection{::wxEntryStart}\label{wxentrystart}
452
453\func{bool}{wxEntryStart}{\param{int\&}{ argc}, \param{wxChar **}{argv}}
454
455This function can be used to perform the initialization of wxWidgets if you
456can't use the default initialization code for any reason.
457
458If the function returns \true, the initialization was successful and the global
459\helpref{wxApp}{wxapp} object \texttt{wxTheApp} has been created. Moreover,
460\helpref{wxEntryCleanup}{wxentrycleanup} must be called afterwards. If the
461function returns \false, a catastrophic initialization error occured and (at
462least the GUI part of) the library can't be used at all.
463
464Notice that parameters \arg{argc} and \arg{argv} may be modified by this
465function.
466
d76a558d
VZ
467An additional overload of wxEntryStart() is provided under MSW only: it is
468meant to be called with the parameters passed to \texttt{WinMain()}.
469
470\func{bool}{wxEntryStart}{\param{HINSTANCE }{hInstance}, \param{HINSTANCE }{hPrevInstance = \NULL}, \param{char *}{pCmdLine = \NULL}, \param{int }{nCmdShow = \texttt{SW\_SHOWNORMAL}}}
471
472(notice that under Windows CE platform, and only there, the type of
473\arg{pCmdLine} is \texttt{wchar\_t *}, otherwise it is \texttt{char *}, even in
474Unicode build).
475
9b2d4f0e
VZ
476\wxheading{Include files}
477
478<wx/init.h>
479
480
749caeeb
VZ
481\membersection{::wxGetApp}\label{wxgetapp}
482
483\func{wxAppDerivedClass\&}{wxGetApp}{\void}
484
fc2171bd 485This function doesn't exist in wxWidgets but it is created by using
749caeeb
VZ
486the \helpref{IMPLEMENT\_APP}{implementapp} macro. Thus, before using it
487anywhere but in the same module where this macro is used, you must make it
488available using \helpref{DECLARE\_APP}{declareapp}.
489
490The advantage of using this function compared to directly using the global
491wxTheApp pointer is that the latter is of type {\tt wxApp *} and so wouldn't
492allow you to access the functions specific to your application class but not
493present in wxApp while wxGetApp() returns the object of the right type.
494
84ed77ef 495
b0fc8832 496\membersection{::wxHandleFatalExceptions}\label{wxhandlefatalexceptions}
c88275cb 497
cc81d32f 498\func{bool}{wxHandleFatalExceptions}{\param{bool}{ doIt = true}}
c88275cb 499
cc81d32f 500If {\it doIt} is true, the fatal exceptions (also known as general protection
b0fc8832
VZ
501faults under Windows or segmentation violations in the Unix world) will be
502caught and passed to \helpref{wxApp::OnFatalException}{wxapponfatalexception}.
503By default, i.e. before this function is called, they will be handled in the
504normal way which usually just means that the application will be terminated.
cc81d32f 505Calling wxHandleFatalExceptions() with {\it doIt} equal to false will restore
b0fc8832 506this default behaviour.
c88275cb 507
3dce0e4d
VZ
508Notice that this function is only available if
509\texttt{wxUSE\_ON\_FATAL\_EXCEPTION} is $1$ and under Windows platform this
510requires a compiler with support for SEH (structured exception handling) which
511currently means only Microsoft Visual C++ or a recent Borland C++ version.
512
84ed77ef 513
b0fc8832 514\membersection{::wxInitAllImageHandlers}\label{wxinitallimagehandlers}
a660d684 515
b0fc8832 516\func{void}{wxInitAllImageHandlers}{\void}
954b8ae6 517
b0fc8832
VZ
518Initializes all available image handlers. For a list of available handlers,
519see \helpref{wxImage}{wximage}.
954b8ae6
JS
520
521\wxheading{See also}
522
b0fc8832 523\helpref{wxImage}{wximage}, \helpref{wxImageHandler}{wximagehandler}
a660d684 524
b0fc8832 525\wxheading{Include files}
a660d684 526
b0fc8832 527<wx/image.h>
a660d684 528
84ed77ef 529
b0fc8832 530\membersection{::wxInitialize}\label{wxinitialize}
a660d684 531
b0fc8832 532\func{bool}{wxInitialize}{\void}
a660d684 533
b0fc8832
VZ
534This function is used in wxBase only and only if you don't create
535\helpref{wxApp}{wxapp} object at all. In this case you must call it from your
fc2171bd 536{\tt main()} function before calling any other wxWidgets functions.
a660d684 537
43e8916f 538If the function returns \false the initialization could not be performed,
b0fc8832
VZ
539in this case the library cannot be used and
540\helpref{wxUninitialize}{wxuninitialize} shouldn't be called neither.
a660d684 541
b0fc8832
VZ
542This function may be called several times but
543\helpref{wxUninitialize}{wxuninitialize} must be called for each successful
544call to this function.
a660d684 545
b0fc8832 546\wxheading{Include files}
a47ce4a7 547
b0fc8832 548<wx/app.h>
a47ce4a7 549
84ed77ef 550
b0fc8832 551\membersection{::wxSafeYield}\label{wxsafeyield}
a47ce4a7 552
b829bf55 553\func{bool}{wxSafeYield}{\param{wxWindow*}{ win = NULL}, \param{bool}{
cc81d32f 554 onlyIfNeeded = false}}
a660d684 555
b0fc8832
VZ
556This function is similar to wxYield, except that it disables the user input to
557all program windows before calling wxYield and re-enables it again
558afterwards. If {\it win} is not NULL, this window will remain enabled,
559allowing the implementation of some limited user interaction.
a660d684 560
b0fc8832 561Returns the result of the call to \helpref{::wxYield}{wxyield}.
532372a3 562
b0fc8832 563\wxheading{Include files}
a660d684 564
b0fc8832 565<wx/utils.h>
a660d684 566
84ed77ef 567
b0fc8832 568\membersection{::wxUninitialize}\label{wxuninitialize}
a660d684 569
b0fc8832 570\func{void}{wxUninitialize}{\void}
a660d684 571
b0fc8832
VZ
572This function is for use in console (wxBase) programs only. It must be called
573once for each previous successful call to \helpref{wxInitialize}{wxinitialize}.
a660d684 574
b0fc8832 575\wxheading{Include files}
a660d684 576
b0fc8832 577<wx/app.h>
a660d684 578
84ed77ef 579
b0fc8832 580\membersection{::wxYield}\label{wxyield}
a660d684 581
b0fc8832 582\func{bool}{wxYield}{\void}
a660d684 583
b0fc8832 584Calls \helpref{wxApp::Yield}{wxappyield}.
a660d684 585
b829bf55 586This function is kept only for backwards compatibility. Please use
2b5f62a0 587the \helpref{wxApp::Yield}{wxappyield} method instead in any new code.
a660d684 588
b0fc8832 589\wxheading{Include files}
5ab656cd 590
b0fc8832 591<wx/app.h> or <wx/utils.h>
eadd7bd2 592
84ed77ef 593
b0fc8832 594\membersection{::wxWakeUpIdle}\label{wxwakeupidle}
eadd7bd2 595
b0fc8832 596\func{void}{wxWakeUpIdle}{\void}
eadd7bd2 597
b0fc8832
VZ
598This functions wakes up the (internal and platform dependent) idle system, i.e. it
599will force the system to send an idle event even if the system currently {\it is}
600 idle and thus would not send any idle event until after some other event would get
601sent. This is also useful for sending events between two threads and is used by
602the corresponding functions \helpref{::wxPostEvent}{wxpostevent} and
603\helpref{wxEvtHandler::AddPendingEvent}{wxevthandleraddpendingevent}.
eadd7bd2 604
b0fc8832 605\wxheading{Include files}
eadd7bd2 606
7a0a4c09 607<wx/app.h>
eadd7bd2 608
84ed77ef
VZ
609
610
b0fc8832 611\section{Process control functions}\label{processfunctions}
eadd7bd2 612
b0fc8832
VZ
613The functions in this section are used to launch or terminate the other
614processes.
eadd7bd2 615
84ed77ef 616
b0fc8832 617\membersection{::wxExecute}\label{wxexecute}
631f1bfe 618
fbf456aa 619\func{long}{wxExecute}{\param{const wxString\& }{command}, \param{int }{sync = wxEXEC\_ASYNC}, \param{wxProcess *}{callback = NULL}}
631f1bfe 620
d6c6a323
MB
621\perlnote{In wxPerl this function is called \texttt{Wx::ExecuteCommand}}
622
fbf456aa 623\func{long}{wxExecute}{\param{char **}{argv}, \param{int }{flags = wxEXEC\_ASYNC}, \param{wxProcess *}{callback = NULL}}
631f1bfe 624
d6c6a323
MB
625\perlnote{In wxPerl this function is called \texttt{Wx::ExecuteArgs}}
626
4d172154 627\func{long}{wxExecute}{\param{const wxString\& }{command}, \param{wxArrayString\& }{output}, \param{int }{flags = 0}}
a660d684 628
d6c6a323
MB
629\perlnote{In wxPerl this function is called \texttt{Wx::ExecuteStdout} and it
630only takes the {\tt command} argument,
9722642d
MB
631and returns a 2-element list {\tt ( status, output )}, where {\tt output} is
632an array reference.}
633
4d172154 634\func{long}{wxExecute}{\param{const wxString\& }{command}, \param{wxArrayString\& }{output}, \param{wxArrayString\& }{errors}, \param{int }{flags = 0}}
a660d684 635
9d8aca48 636\perlnote{In wxPerl this function is called \texttt{Wx::ExecuteStdoutStderr}
d6c6a323 637and it only takes the {\tt command} argument,
9722642d
MB
638and returns a 3-element list {\tt ( status, output, errors )}, where
639{\tt output} and {\tt errors} are array references.}
640
b0fc8832 641Executes another program in Unix or Windows.
a660d684 642
b0fc8832 643The first form takes a command string, such as {\tt "emacs file.txt"}.
a660d684 644
b0fc8832
VZ
645The second form takes an array of values: a command, any number of
646arguments, terminated by NULL.
a660d684 647
b0fc8832
VZ
648The semantics of the third and fourth versions is different from the first two
649and is described in more details below.
a660d684 650
fbf456aa
VZ
651If {\it flags} parameter contains {\tt wxEXEC\_ASYNC} flag (the default), flow
652of control immediately returns. If it contains {\tt wxEXEC\_SYNC}, the current
653application waits until the other program has terminated.
a660d684 654
b0fc8832
VZ
655In the case of synchronous execution, the return value is the exit code of
656the process (which terminates by the moment the function returns) and will be
657$-1$ if the process couldn't be started and typically 0 if the process
658terminated successfully. Also, while waiting for the process to
f38f6899
VZ
659terminate, wxExecute will call \helpref{wxYield}{wxyield}. Because of this, by
660default this function disables all application windows to avoid unexpected
661reentrancies which could result from the users interaction with the program
662while the child process is running. If you are sure that it is safe to not
663disable the program windows, you may pass \texttt{wxEXEC\_NODISABLE} flag to
664prevent this automatic disabling from happening.
a660d684 665
b0fc8832
VZ
666For asynchronous execution, however, the return value is the process id and
667zero value indicates that the command could not be executed. As an added
2edb0bde 668complication, the return value of $-1$ in this case indicates that we didn't
b0fc8832
VZ
669launch a new process, but connected to the running one (this can only happen in
670case of using DDE under Windows for command execution). In particular, in this,
671and only this, case the calling code will not get the notification about
672process termination.
a660d684 673
b829bf55 674If callback isn't NULL and if execution is asynchronous,
b0fc8832 675\helpref{wxProcess::OnTerminate}{wxprocessonterminate} will be called when
fbf456aa 676the process finishes. Specifying this parameter also allows you to redirect the
b829bf55 677standard input and/or output of the process being launched by calling
fbf456aa
VZ
678\helpref{Redirect}{wxprocessredirect}. If the child process IO is redirected,
679under Windows the process window is not shown by default (this avoids having to
680flush an unnecessary console for the processes which don't create any windows
681anyhow) but a {\tt wxEXEC\_NOHIDE} flag can be used to prevent this from
682happening, i.e. with this flag the child process window will be shown normally.
a660d684 683
e1082c9f
VZ
684Under Unix the flag {\tt wxEXEC\_MAKE\_GROUP\_LEADER} may be used to ensure
685that the new process is a group leader (this will create a new session if
e0f6b731 686needed). Calling \helpref{wxKill}{wxkill} passing wxKILL\_CHILDREN will
ece291c7 687kill this process as well as all of its children (except those which have
e0f6b731 688started their own session).
e1082c9f 689
bc855d09
VZ
690The {\tt wxEXEC\_NOEVENTS} flag prevents processing of any events from taking
691place while the child process is running. It should be only used for very
692short-lived processes as otherwise the application windows risk becoming
693unresponsive from the users point of view. As this flag only makes sense with
694{\tt wxEXEC\_SYNC}, {\tt wxEXEC\_BLOCK} equal to the sum of both of these flags
695is provided as a convenience.
696
b0fc8832 697Finally, you may use the third overloaded version of this function to execute
9d8aca48 698a process (always synchronously, the contents of \arg{flags} is or'd with
12f6571f 699\texttt{wxEXEC\_SYNC}) and capture its output in the array \arg{output}. The
4d172154
VZ
700fourth version adds the possibility to additionally capture the messages from
701standard error output in the \arg{errors} array.
a660d684 702
647b8e37
VZ
703{\bf NB:} Currently wxExecute() can only be used from the main thread, calling
704this function from another thread will result in an assert failure in debug
705build and won't work.
706
707\wxheading{See also}
708
709\helpref{wxShell}{wxshell}, \helpref{wxProcess}{wxprocess}, \helpref{Exec sample}{sampleexec}.
a660d684 710
fbf456aa
VZ
711\wxheading{Parameters}
712
713\docparam{command}{The command to execute and any parameters to pass to it as a
714single string.}
715
716\docparam{argv}{The command to execute should be the first element of this
717array, any additional ones are the command parameters and the array must be
718terminated with a NULL pointer.}
719
d2c2afc9 720\docparam{flags}{Combination of bit masks {\tt wxEXEC\_ASYNC},\rtfsp
fbf456aa
VZ
721{\tt wxEXEC\_SYNC} and {\tt wxEXEC\_NOHIDE}}
722
723\docparam{callback}{An optional pointer to \helpref{wxProcess}{wxprocess}}
724
b0fc8832 725\wxheading{Include files}
a660d684 726
b0fc8832 727<wx/utils.h>
a660d684 728
84ed77ef 729
b0fc8832 730\membersection{::wxExit}\label{wxexit}
a660d684 731
b0fc8832 732\func{void}{wxExit}{\void}
7af89395 733
b0fc8832
VZ
734Exits application after calling \helpref{wxApp::OnExit}{wxapponexit}.
735Should only be used in an emergency: normally the top-level frame
736should be deleted (after deleting all other frames) to terminate the
f4fcc291 737application. See \helpref{wxCloseEvent}{wxcloseevent} and \helpref{wxApp}{wxapp}.
7af89395 738
b0fc8832 739\wxheading{Include files}
7af89395 740
b0fc8832 741<wx/app.h>
a660d684 742
84ed77ef 743
abbb59e8
VZ
744\membersection{::wxJoin}\label{wxjoin}
745
854386fd 746\func{wxString}{wxJoin}{\param{const wxArrayString\&}{ arr}, \param{const wxChar}{ sep}, \param{const wxChar}{ escape = '$\backslash$'}}
abbb59e8
VZ
747
748Concatenate all lines of the given \helpref{wxArrayString}{wxarraystring} object using the separator \arg{sep} and returns
854386fd 749the result as a \helpref{wxString}{wxstring}.
abbb59e8
VZ
750
751If the \arg{escape} character is non-\NULL, then it's used as prefix for each occurrence of \arg{sep}
752in the strings contained in \arg{arr} before joining them which is necessary
753in order to be able to recover the original array contents from the string
754later using \helpref{wxSplit}{wxsplit}.
755
756\wxheading{Include files}
757
758<wx/arrstr.h>
759
760
b0fc8832 761\membersection{::wxKill}\label{wxkill}
a660d684 762
e0f6b731 763\func{int}{wxKill}{\param{long}{ pid}, \param{int}{ sig = wxSIGTERM}, \param{wxKillError }{*rc = NULL}, \param{int }{flags = 0}}
7af89395 764
b0fc8832 765Equivalent to the Unix kill function: send the given signal {\it sig} to the
2edb0bde 766process with PID {\it pid}. The valid signal values are
a660d684 767
b0fc8832
VZ
768\begin{verbatim}
769enum wxSignal
770{
771 wxSIGNONE = 0, // verify if the process exists under Unix
772 wxSIGHUP,
773 wxSIGINT,
774 wxSIGQUIT,
775 wxSIGILL,
776 wxSIGTRAP,
777 wxSIGABRT,
778 wxSIGEMT,
779 wxSIGFPE,
780 wxSIGKILL, // forcefully kill, dangerous!
781 wxSIGBUS,
782 wxSIGSEGV,
783 wxSIGSYS,
784 wxSIGPIPE,
785 wxSIGALRM,
786 wxSIGTERM // terminate the process gently
787};
788\end{verbatim}
a660d684 789
b0fc8832 790{\tt wxSIGNONE}, {\tt wxSIGKILL} and {\tt wxSIGTERM} have the same meaning
9d8aca48 791under both Unix and Windows but all the other signals are equivalent to
b0fc8832 792{\tt wxSIGTERM} under Windows.
a660d684 793
b0fc8832
VZ
794Returns 0 on success, -1 on failure. If {\it rc} parameter is not NULL, it will
795be filled with an element of {\tt wxKillError} enum:
a660d684 796
b0fc8832
VZ
797\begin{verbatim}
798enum wxKillError
799{
800 wxKILL_OK, // no error
801 wxKILL_BAD_SIGNAL, // no such signal
802 wxKILL_ACCESS_DENIED, // permission denied
803 wxKILL_NO_PROCESS, // no such process
804 wxKILL_ERROR // another, unspecified error
805};
806\end{verbatim}
c0ab6adf 807
e0f6b731
JS
808The {\it flags} parameter can be wxKILL\_NOCHILDREN (the default),
809or wxKILL\_CHILDREN, in which case the child processes of this
810process will be killed too. Note that under Unix, for wxKILL\_CHILDREN
bb772a8e 811to work you should have created the process by passing wxEXEC\_MAKE\_GROUP\_LEADER
e0f6b731
JS
812to wxExecute.
813
b0fc8832 814\wxheading{See also}
ade35f11 815
b0fc8832
VZ
816\helpref{wxProcess::Kill}{wxprocesskill},\rtfsp
817\helpref{wxProcess::Exists}{wxprocessexists},\rtfsp
818\helpref{Exec sample}{sampleexec}
a660d684 819
b0fc8832 820\wxheading{Include files}
a660d684 821
b0fc8832 822<wx/utils.h>
a660d684 823
84ed77ef 824
c1cb4153
VZ
825\membersection{::wxGetProcessId}\label{wxgetprocessid}
826
827\func{unsigned long}{wxGetProcessId}{\void}
828
829Returns the number uniquely identifying the current process in the system.
830
831If an error occurs, $0$ is returned.
832
833\wxheading{Include files}
834
835<wx/utils.h>
836
84ed77ef 837
b0fc8832 838\membersection{::wxShell}\label{wxshell}
a660d684 839
b0fc8832 840\func{bool}{wxShell}{\param{const wxString\& }{command = NULL}}
a660d684 841
b0fc8832
VZ
842Executes a command in an interactive shell window. If no command is
843specified, then just the shell is spawned.
a660d684 844
b0fc8832 845See also \helpref{wxExecute}{wxexecute}, \helpref{Exec sample}{sampleexec}.
a660d684 846
b0fc8832 847\wxheading{Include files}
a660d684 848
b0fc8832 849<wx/utils.h>
a660d684 850
84ed77ef 851
f6ba47d9
VZ
852\membersection{::wxShutdown}\label{wxshutdown}
853
854\func{bool}{wxShutdown}{\param{wxShutdownFlags}{flags}}
855
b829bf55 856This function shuts down or reboots the computer depending on the value of the
f6ba47d9 857{\it flags}. Please notice that doing this requires the corresponding access
154b6b0f 858rights (superuser under Unix, {\tt SE\_SHUTDOWN} privilege under Windows NT)
f6ba47d9
VZ
859and that this function is only implemented under Unix and Win32.
860
861\wxheading{Parameters}
862
863\docparam{flags}{Either {\tt wxSHUTDOWN\_POWEROFF} or {\tt wxSHUTDOWN\_REBOOT}}
864
865\wxheading{Returns}
866
43e8916f 867\true on success, \false if an error occurred.
f6ba47d9
VZ
868
869\wxheading{Include files}
870
871<wx/utils.h>
a660d684 872
84ed77ef
VZ
873
874
b0fc8832 875\section{Thread functions}\label{threadfunctions}
1a33c3ba 876
789bdf9b
VZ
877The functions and macros here mainly exist to make it writing the code which
878may be compiled in multi thread build ({\tt wxUSE\_THREADS} $= 1$) as well as
879in single thread configuration ({\tt wxUSE\_THREADS} $= 0$).
880
881For example, a static variable must be protected against simultaneous access by
882multiple threads in the former configuration but in the latter the extra
883overhead of using the critical section is not needed. To solve this problem,
884the \helpref{wxCRITICAL\_SECTION}{wxcriticalsectionmacro} macro may be used
885to create and use the critical section only when needed.
886
b0fc8832 887\wxheading{Include files}
a660d684 888
b0fc8832 889<wx/thread.h>
a660d684 890
b0fc8832 891\wxheading{See also}
a660d684 892
b0fc8832 893\helpref{wxThread}{wxthread}, \helpref{wxMutex}{wxmutex}, \helpref{Multithreading overview}{wxthreadoverview}
a660d684 894
789bdf9b 895
84ed77ef 896
789bdf9b
VZ
897\membersection{wxCRIT\_SECT\_DECLARE}\label{wxcritsectdeclare}
898
899\func{}{wxCRIT\_SECT\_DECLARE}{\param{}{cs}}
900
9d8aca48 901This macro declares a (static) critical section object named {\it cs} if
789bdf9b
VZ
902{\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$.
903
904
84ed77ef 905
db882c54
VZ
906\membersection{wxCRIT\_SECT\_DECLARE\_MEMBER}\label{wxcritsectdeclaremember}
907
908\func{}{wxCRIT\_SECT\_DECLARE}{\param{}{cs}}
909
9d8aca48 910This macro declares a critical section object named {\it cs} if
db882c54 911{\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$. As it doesn't
9d8aca48 912include the {\tt static} keyword (unlike
db882c54
VZ
913\helpref{wxCRIT\_SECT\_DECLARE}{wxcritsectdeclare}), it can be used to declare
914a class or struct member which explains its name.
915
916
84ed77ef 917
789bdf9b
VZ
918\membersection{wxCRIT\_SECT\_LOCKER}\label{wxcritsectlocker}
919
920\func{}{wxCRIT\_SECT\_LOCKER}{\param{}{name}, \param{}{cs}}
921
9d8aca48
WS
922This macro creates a \helpref{critical section lock}{wxcriticalsectionlocker}
923object named {\it name} and associated with the critical section {\it cs} if
789bdf9b
VZ
924{\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$.
925
926
84ed77ef 927
789bdf9b
VZ
928\membersection{wxCRITICAL\_SECTION}\label{wxcriticalsectionmacro}
929
930\func{}{wxCRITICAL\_SECTION}{\param{}{name}}
931
9d8aca48 932This macro combines \helpref{wxCRIT\_SECT\_DECLARE}{wxcritsectdeclare} and
789bdf9b
VZ
933\helpref{wxCRIT\_SECT\_LOCKER}{wxcritsectlocker}: it creates a static critical
934section object and also the lock object associated with it. Because of this, it
935can be only used inside a function, not at global scope. For example:
936
937\begin{verbatim}
938int IncCount()
939{
940 static int s_counter = 0;
941
942 wxCRITICAL_SECTION(counter);
943
944 return ++s_counter;
945}
946\end{verbatim}
947
948(note that we suppose that the function is called the first time from the main
949thread so that the critical section object is initialized correctly by the time
9d8aca48 950other threads start calling it, if this is not the case this approach can
789bdf9b
VZ
951{\bf not} be used and the critical section must be made a global instead).
952
953
84ed77ef 954
789bdf9b
VZ
955\membersection{wxENTER\_CRIT\_SECT}\label{wxentercritsect}
956
957\func{}{wxENTER\_CRIT\_SECT}{\param{wxCriticalSection\& }{cs}}
958
9d8aca48 959This macro is equivalent to \helpref{cs.Enter()}{wxcriticalsectionenter} if
789bdf9b
VZ
960{\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$.
961
962
84ed77ef 963
789bdf9b
VZ
964\membersection{::wxIsMainThread}\label{wxismainthread}
965
966\func{bool}{wxIsMainThread}{\void}
967
43e8916f 968Returns \true if this thread is the main one. Always returns \true if
789bdf9b
VZ
969{\tt wxUSE\_THREADS} is $0$.
970
971
84ed77ef 972
789bdf9b
VZ
973\membersection{wxLEAVE\_CRIT\_SECT}\label{wxleavecritsect}
974
975\func{}{wxLEAVE\_CRIT\_SECT}{\param{wxCriticalSection\& }{cs}}
976
9d8aca48 977This macro is equivalent to \helpref{cs.Leave()}{wxcriticalsectionleave} if
789bdf9b
VZ
978{\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$.
979
980
84ed77ef 981
b0fc8832 982\membersection{::wxMutexGuiEnter}\label{wxmutexguienter}
a660d684 983
b0fc8832 984\func{void}{wxMutexGuiEnter}{\void}
a660d684 985
b0fc8832
VZ
986This function must be called when any thread other than the main GUI thread
987wants to get access to the GUI library. This function will block the execution
988of the calling thread until the main thread (or any other thread holding the
989main GUI lock) leaves the GUI library and no other thread will enter the GUI
990library until the calling thread calls \helpref{::wxMutexGuiLeave()}{wxmutexguileave}.
a660d684 991
b0fc8832 992Typically, these functions are used like this:
a660d684 993
b0fc8832
VZ
994\begin{verbatim}
995void MyThread::Foo(void)
996{
997 // before doing any GUI calls we must ensure that this thread is the only
998 // one doing it!
a660d684 999
b0fc8832 1000 wxMutexGuiEnter();
a660d684 1001
b0fc8832
VZ
1002 // Call GUI here:
1003 my_window->DrawSomething();
a660d684 1004
b0fc8832
VZ
1005 wxMutexGuiLeave();
1006}
1007\end{verbatim}
a660d684 1008
b0fc8832
VZ
1009Note that under GTK, no creation of top-level windows is allowed in any
1010thread but the main one.
a660d684 1011
b0fc8832
VZ
1012This function is only defined on platforms which support preemptive
1013threads.
d37fd2fa 1014
84ed77ef 1015
b0fc8832 1016\membersection{::wxMutexGuiLeave}\label{wxmutexguileave}
d37fd2fa 1017
b0fc8832 1018\func{void}{wxMutexGuiLeave}{\void}
d37fd2fa 1019
b0fc8832 1020See \helpref{::wxMutexGuiEnter()}{wxmutexguienter}.
d37fd2fa 1021
b0fc8832
VZ
1022This function is only defined on platforms which support preemptive
1023threads.
d37fd2fa 1024
84ed77ef
VZ
1025
1026
b0fc8832 1027\section{File functions}\label{filefunctions}
d37fd2fa 1028
b0fc8832 1029\wxheading{Include files}
ed93168b 1030
8482e4bd 1031<wx/filefn.h>
ed93168b 1032
b0fc8832 1033\wxheading{See also}
ed93168b 1034
b0fc8832
VZ
1035\helpref{wxPathList}{wxpathlist}\\
1036\helpref{wxDir}{wxdir}\\
1037\helpref{wxFile}{wxfile}\\
1038\helpref{wxFileName}{wxfilename}
ed93168b 1039
84ed77ef 1040
b0fc8832 1041\membersection{::wxDos2UnixFilename}\label{wxdos2unixfilename}
ed93168b 1042
b0fc8832 1043\func{void}{wxDos2UnixFilename}{\param{wxChar *}{s}}
d524e22d 1044
b0fc8832
VZ
1045Converts a DOS to a Unix filename by replacing backslashes with forward
1046slashes.
d524e22d 1047
84ed77ef 1048
f4fcc291 1049\membersection{::wxFileExists}\label{functionwxfileexists}
d524e22d 1050
b0fc8832 1051\func{bool}{wxFileExists}{\param{const wxString\& }{filename}}
d524e22d 1052
c3558af5 1053Returns true if the file exists and is a plain file.
e12be2f7 1054
84ed77ef 1055
b0fc8832 1056\membersection{::wxFileModificationTime}\label{wxfilemodificationtime}
d524e22d 1057
b0fc8832 1058\func{time\_t}{wxFileModificationTime}{\param{const wxString\& }{filename}}
d524e22d 1059
b0fc8832 1060Returns time of last modification of given file.
d524e22d 1061
b2b4f8c0
VZ
1062The function returns \texttt{(time\_t)}$-1$ if an error occurred (e.g. file not
1063found).
40786029 1064
84ed77ef 1065
b0fc8832 1066\membersection{::wxFileNameFromPath}\label{wxfilenamefrompath}
d524e22d 1067
b0fc8832 1068\func{wxString}{wxFileNameFromPath}{\param{const wxString\& }{path}}
d524e22d 1069
7ac13b21 1070\func{char *}{wxFileNameFromPath}{\param{char *}{path}}
d524e22d 1071
b829bf55 1072{\bf NB:} This function is obsolete, please use
2bd25c5a
VZ
1073\helpref{wxFileName::SplitPath}{wxfilenamesplitpath} instead.
1074
b0fc8832
VZ
1075Returns the filename for a full path. The second form returns a pointer to
1076temporary storage that should not be deallocated.
d524e22d 1077
84ed77ef 1078
b0fc8832 1079\membersection{::wxFindFirstFile}\label{wxfindfirstfile}
d524e22d 1080
86501081 1081\func{wxString}{wxFindFirstFile}{\param{const wxString\& }{spec}, \param{int}{ flags = 0}}
d524e22d 1082
b0fc8832
VZ
1083This function does directory searching; returns the first file
1084that matches the path {\it spec}, or the empty string. Use \helpref{wxFindNextFile}{wxfindnextfile} to
1085get the next matching file. Neither will report the current directory "." or the
1086parent directory "..".
d524e22d 1087
f70c0443
WS
1088\wxheading{Warning}
1089
43e8916f 1090As of wx 2.5.2, these functions are not thread-safe! (they use static variables). You probably want to use \helpref{wxDir::GetFirst}{wxdirgetfirst} or \helpref{wxDirTraverser}{wxdirtraverser} instead.
f70c0443 1091
b0fc8832 1092{\it spec} may contain wildcards.
85ec2f26 1093
b0fc8832 1094{\it flags} may be wxDIR for restricting the query to directories, wxFILE for files or zero for either.
d524e22d 1095
b0fc8832 1096For example:
d524e22d 1097
b0fc8832
VZ
1098\begin{verbatim}
1099 wxString f = wxFindFirstFile("/home/project/*.*");
8ea92b4d 1100 while ( !f.empty() )
b0fc8832
VZ
1101 {
1102 ...
1103 f = wxFindNextFile();
1104 }
1105\end{verbatim}
d524e22d 1106
84ed77ef 1107
b0fc8832 1108\membersection{::wxFindNextFile}\label{wxfindnextfile}
d524e22d 1109
b0fc8832 1110\func{wxString}{wxFindNextFile}{\void}
e12be2f7 1111
b0fc8832 1112Returns the next file that matches the path passed to \helpref{wxFindFirstFile}{wxfindfirstfile}.
d524e22d 1113
b0fc8832 1114See \helpref{wxFindFirstFile}{wxfindfirstfile} for an example.
d524e22d 1115
84ed77ef 1116
b0fc8832 1117\membersection{::wxGetDiskSpace}\label{wxgetdiskspace}
d524e22d 1118
b0fc8832 1119\func{bool}{wxGetDiskSpace}{\param{const wxString\& }{path}, \param{wxLongLong }{*total = NULL}, \param{wxLongLong }{*free = NULL}}
d524e22d 1120
b0fc8832
VZ
1121This function returns the total number of bytes and number of free bytes on
1122the disk containing the directory {\it path} (it should exist). Both
1123{\it total} and {\it free} parameters may be {\tt NULL} if the corresponding
1124information is not needed.
d524e22d 1125
b0fc8832 1126\wxheading{Returns}
85ec2f26 1127
43e8916f 1128\true on success, \false if an error occurred (for example, the
b0fc8832 1129directory doesn't exist).
d524e22d 1130
b0fc8832 1131\wxheading{Portability}
d524e22d 1132
b3eb9bf5
VZ
1133The generic Unix implementation depends on the system having
1134the \texttt{statfs()} or \texttt{statvfs()} function.
d524e22d 1135
fc2171bd 1136This function first appeared in wxWidgets 2.3.2.
d524e22d 1137
84ed77ef 1138
0912690b 1139\membersection{::wxGetFileKind}\label{wxgetfilekind}
3c70014d 1140
0912690b 1141\func{wxFileKind}{wxGetFileKind}{\param{int }{fd}}
3c70014d 1142
0912690b 1143\func{wxFileKind}{wxGetFileKind}{\param{FILE *}{fp}}
3c70014d
MW
1144
1145Returns the type of an open file. Possible return values are:
1146
1147\begin{verbatim}
0912690b 1148enum wxFileKind
3c70014d 1149{
0912690b
MW
1150 wxFILE_KIND_UNKNOWN,
1151 wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets
1152 wxFILE_KIND_TERMINAL, // a tty
1153 wxFILE_KIND_PIPE // a pipe
3c70014d
MW
1154};
1155
1156\end{verbatim}
1157
1158\wxheading{Include files}
1159
1160<wx/filefn.h>
1161
1162
b0fc8832 1163\membersection{::wxGetOSDirectory}\label{wxgetosdirectory}
e12be2f7 1164
b0fc8832 1165\func{wxString}{wxGetOSDirectory}{\void}
d524e22d 1166
b0fc8832 1167Returns the Windows directory under Windows; on other platforms returns the empty string.
d524e22d 1168
84ed77ef 1169
b0fc8832 1170\membersection{::wxIsAbsolutePath}\label{wxisabsolutepath}
d524e22d 1171
b0fc8832 1172\func{bool}{wxIsAbsolutePath}{\param{const wxString\& }{filename}}
d524e22d 1173
cc81d32f 1174Returns true if the argument is an absolute filename, i.e. with a slash
b0fc8832 1175or drive name at the beginning.
85ec2f26 1176
84ed77ef 1177
da865fdd 1178\membersection{::wxDirExists}\label{functionwxdirexists}
27b2dd53 1179
e960c20e 1180\func{bool}{wxDirExists}{\param{const wxString\& }{dirname}}
27b2dd53 1181
5145a8cf 1182Returns true if \arg{dirname} exists and is a directory.
27b2dd53
WS
1183
1184
b0fc8832 1185\membersection{::wxPathOnly}\label{wxpathonly}
d524e22d 1186
b0fc8832 1187\func{wxString}{wxPathOnly}{\param{const wxString\& }{path}}
d524e22d 1188
b0fc8832 1189Returns the directory part of the filename.
d524e22d 1190
84ed77ef 1191
b0fc8832 1192\membersection{::wxUnix2DosFilename}\label{wxunix2dosfilename}
d524e22d 1193
9aba21ea
VZ
1194\func{void}{wxUnix2DosFilename}{\param{wxChar *}{s}}
1195
1196This function is deprecated, use \helpref{wxFileName}{wxfilename} instead.
e12be2f7 1197
b0fc8832
VZ
1198Converts a Unix to a DOS filename by replacing forward
1199slashes with backslashes.
d524e22d 1200
84ed77ef 1201
8482e4bd
VZ
1202\membersection{wxCHANGE\_UMASK}\label{wxchangeumask}
1203
1204\func{}{wxCHANGE\_UMASK}{\param{int }{mask}}
1205
1206Under Unix this macro changes the current process umask to the given value,
1207unless it is equal to $-1$ in which case nothing is done, and restores it to
1208the original value on scope exit. It works by declaring a variable which sets
1209umask to \arg{mask} in its constructor and restores it in its destructor.
1210
1211Under other platforms this macro expands to nothing.
1212
1213
b0fc8832 1214\membersection{::wxConcatFiles}\label{wxconcatfiles}
d524e22d 1215
b0fc8832
VZ
1216\func{bool}{wxConcatFiles}{\param{const wxString\& }{file1}, \param{const wxString\& }{file2},
1217\param{const wxString\& }{file3}}
d524e22d 1218
b0fc8832 1219Concatenates {\it file1} and {\it file2} to {\it file3}, returning
cc81d32f 1220true if successful.
a660d684 1221
84ed77ef 1222
b0fc8832 1223\membersection{::wxCopyFile}\label{wxcopyfile}
a660d684 1224
cc81d32f 1225\func{bool}{wxCopyFile}{\param{const wxString\& }{file1}, \param{const wxString\& }{file2}, \param{bool }{overwrite = true}}
a660d684 1226
cc81d32f 1227Copies {\it file1} to {\it file2}, returning true if successful. If
0597e7f9
VZ
1228{\it overwrite} parameter is \true (default), the destination file is overwritten
1229if it exists, but if {\it overwrite} is \false, the functions fails in this
b0fc8832 1230case.
a660d684 1231
0597e7f9
VZ
1232This function supports resources forks under Mac OS.
1233
84ed77ef 1234
b0fc8832 1235\membersection{::wxGetCwd}\label{wxgetcwd}
7ae8ee14 1236
b0fc8832 1237\func{wxString}{wxGetCwd}{\void}
7ae8ee14 1238
b0fc8832 1239Returns a string containing the current (or working) directory.
7ae8ee14 1240
84ed77ef 1241
b0fc8832 1242\membersection{::wxGetWorkingDirectory}\label{wxgetworkingdirectory}
7ae8ee14 1243
7ac13b21 1244\func{wxString}{wxGetWorkingDirectory}{\param{char *}{buf=NULL}, \param{int }{sz=1000}}
7ae8ee14 1245
ce045aed 1246{\bf NB:} This function is deprecated: use \helpref{wxGetCwd}{wxgetcwd} instead.
7ae8ee14 1247
b0fc8832 1248Copies the current working directory into the buffer if supplied, or
cc232c93
VZ
1249copies the working directory into new storage (which you {\emph must} delete
1250yourself) if the buffer is NULL.
7ae8ee14 1251
b0fc8832 1252{\it sz} is the size of the buffer if supplied.
a660d684 1253
84ed77ef 1254
b0fc8832 1255\membersection{::wxGetTempFileName}\label{wxgettempfilename}
a660d684 1256
7ac13b21 1257\func{char *}{wxGetTempFileName}{\param{const wxString\& }{prefix}, \param{char *}{buf=NULL}}
a660d684 1258
b0fc8832 1259\func{bool}{wxGetTempFileName}{\param{const wxString\& }{prefix}, \param{wxString\& }{buf}}
7ae8ee14 1260
b0fc8832
VZ
1261%% Makes a temporary filename based on {\it prefix}, opens and closes the file,
1262%% and places the name in {\it buf}. If {\it buf} is NULL, new store
1263%% is allocated for the temporary filename using {\it new}.
1264%%
1265%% Under Windows, the filename will include the drive and name of the
1266%% directory allocated for temporary files (usually the contents of the
1267%% TEMP variable). Under Unix, the {\tt /tmp} directory is used.
1268%%
1269%% It is the application's responsibility to create and delete the file.
a660d684 1270
2bd25c5a 1271{\bf NB:} These functions are obsolete, please use\rtfsp
b0fc8832
VZ
1272\helpref{wxFileName::CreateTempFileName}{wxfilenamecreatetempfilename}\rtfsp
1273instead.
a660d684 1274
84ed77ef 1275
b0fc8832 1276\membersection{::wxIsWild}\label{wxiswild}
a660d684 1277
b0fc8832 1278\func{bool}{wxIsWild}{\param{const wxString\& }{pattern}}
a660d684 1279
cc81d32f 1280Returns true if the pattern contains wildcards. See \helpref{wxMatchWild}{wxmatchwild}.
a660d684 1281
84ed77ef 1282
b0fc8832 1283\membersection{::wxMatchWild}\label{wxmatchwild}
ed93168b 1284
b0fc8832 1285\func{bool}{wxMatchWild}{\param{const wxString\& }{pattern}, \param{const wxString\& }{text}, \param{bool}{ dot\_special}}
ed93168b 1286
d29bf677 1287Returns true if the \arg{pattern}\/ matches the {\it text}\/; if {\it
cc81d32f 1288dot\_special}\/ is true, filenames beginning with a dot are not matched
b0fc8832 1289with wildcard characters. See \helpref{wxIsWild}{wxiswild}.
ed93168b 1290
84ed77ef 1291
b0fc8832 1292\membersection{::wxMkdir}\label{wxmkdir}
ed93168b 1293
b0fc8832 1294\func{bool}{wxMkdir}{\param{const wxString\& }{dir}, \param{int }{perm = 0777}}
ed93168b 1295
d29bf677 1296Makes the directory \arg{dir}, returning true if successful.
a660d684 1297
b0fc8832 1298{\it perm} is the access mask for the directory for the systems on which it is
154b6b0f 1299supported (Unix) and doesn't have any effect on the other ones.
378b05f7 1300
84ed77ef 1301
daf32463 1302\membersection{::wxParseCommonDialogsFilter}\label{wxparsecommondialogsfilter}
9e152a55 1303
daf32463 1304\func{int}{wxParseCommonDialogsFilter}{\param{const wxString\& }{wildCard}, \param{wxArrayString\& }{descriptions}, \param{wxArrayString\& }{filters}}
9e152a55 1305
d29bf677 1306Parses the \arg{wildCard}, returning the number of filters.
aaf65941 1307Returns 0 if none or if there's a problem.
9e152a55 1308The arrays will contain an equal number of items found before the error.
daf32463
WS
1309On platforms where native dialogs handle only one filter per entry,
1310entries in arrays are automatically adjusted.
d29bf677 1311\arg{wildCard} is in the form:
9e152a55
WS
1312\begin{verbatim}
1313 "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
1314\end{verbatim}
1315
b0fc8832 1316\membersection{::wxRemoveFile}\label{wxremovefile}
378b05f7 1317
b0fc8832 1318\func{bool}{wxRemoveFile}{\param{const wxString\& }{file}}
378b05f7 1319
d29bf677 1320Removes \arg{file}, returning true if successful.
378b05f7 1321
84ed77ef 1322
b0fc8832 1323\membersection{::wxRenameFile}\label{wxrenamefile}
e12be2f7 1324
12f34171 1325\func{bool}{wxRenameFile}{\param{const wxString\& }{file1}, \param{const wxString\& }{file2}, \param{bool }{overwrite = true}}
378b05f7 1326
d29bf677 1327Renames \arg{file1} to \arg{file2}, returning true if successful.
378b05f7 1328
57e988b8
VZ
1329If \arg{overwrite} parameter is true (default), the destination file is
1330overwritten if it exists, but if \arg{overwrite} is false, the functions fails
1331in this case.
1332
84ed77ef 1333
b0fc8832 1334\membersection{::wxRmdir}\label{wxrmdir}
378b05f7 1335
b0fc8832 1336\func{bool}{wxRmdir}{\param{const wxString\& }{dir}, \param{int}{ flags=0}}
378b05f7 1337
cc81d32f 1338Removes the directory {\it dir}, returning true if successful. Does not work under VMS.
e12be2f7 1339
b0fc8832 1340The {\it flags} parameter is reserved for future use.
378b05f7 1341
9b8a360d
VZ
1342Please notice that there is also a wxRmDir() function which simply wraps the
1343standard POSIX rmdir() function and so return an integer error code instead of
1344a boolean value (but otherwise is currently identical to wxRmdir), don't
1345confuse these two functions.
1346
84ed77ef 1347
b0fc8832 1348\membersection{::wxSetWorkingDirectory}\label{wxsetworkingdirectory}
a660d684 1349
b0fc8832 1350\func{bool}{wxSetWorkingDirectory}{\param{const wxString\& }{dir}}
a660d684 1351
cc81d32f 1352Sets the current working directory, returning true if the operation succeeded.
b0fc8832 1353Under MS Windows, the current drive is also changed if {\it dir} contains a drive specification.
c50f1fb9 1354
84ed77ef 1355
abbb59e8
VZ
1356\membersection{::wxSplit}\label{wxsplit}
1357
1358\func{wxArrayString}{wxSplit}{\param{const wxString\&}{ str}, \param{const wxChar}{ sep}, \param{const wxChar}{ escape = '\\'}}
1359
1360Splits the given \helpref{wxString}{wxstring} object using the separator \arg{sep} and returns the
1361result as a \helpref{wxArrayString}{wxarraystring}.
1362
1363If the \arg{escape} character is non-\NULL, then the occurrences of \arg{sep} immediately prefixed
1364with \arg{escape} are not considered as separators.
1365
1366Note that empty tokens will be generated if there are two or more adjacent separators.
1367
1368\wxheading{See also}
1369
1370\helpref{wxJoin}{wxjoin}
1371
1372\wxheading{Include files}
1373
1374<wx/arrstr.h>
1375
1376
b0fc8832 1377\membersection{::wxSplitPath}\label{wxsplitfunction}
c50f1fb9 1378
86501081 1379\func{void}{wxSplitPath}{\param{const wxString\&}{ fullname}, \param{wxString *}{ path}, \param{wxString *}{ name}, \param{wxString *}{ ext}}
c50f1fb9 1380
b829bf55 1381{\bf NB:} This function is obsolete, please use
2bd25c5a
VZ
1382\helpref{wxFileName::SplitPath}{wxfilenamesplitpath} instead.
1383
b0fc8832
VZ
1384This function splits a full file name into components: the path (including possible disk/drive
1385specification under Windows), the base name and the extension. Any of the output parameters
1386({\it path}, {\it name} or {\it ext}) may be NULL if you are not interested in the value of
1387a particular component.
c50f1fb9 1388
b0fc8832
VZ
1389wxSplitPath() will correctly handle filenames with both DOS and Unix path separators under
1390Windows, however it will not consider backslashes as path separators under Unix (where backslash
1391is a valid character in a filename).
c50f1fb9 1392
b0fc8832 1393On entry, {\it fullname} should be non-NULL (it may be empty though).
c50f1fb9 1394
b0fc8832
VZ
1395On return, {\it path} contains the file path (without the trailing separator), {\it name}
1396contains the file name and {\it ext} contains the file extension without leading dot. All
1397three of them may be empty if the corresponding component is. The old contents of the
1398strings pointed to by these parameters will be overwritten in any case (if the pointers
1399are not NULL).
c50f1fb9 1400
84ed77ef 1401
b0fc8832 1402\membersection{::wxTransferFileToStream}\label{wxtransferfiletostream}
c50f1fb9 1403
b0fc8832 1404\func{bool}{wxTransferFileToStream}{\param{const wxString\& }{filename}, \param{ostream\& }{stream}}
10eb1f1e 1405
b0fc8832
VZ
1406Copies the given file to {\it stream}. Useful when converting an old application to
1407use streams (within the document/view framework, for example).
10eb1f1e 1408
b0fc8832 1409\wxheading{Include files}
10eb1f1e 1410
b0fc8832 1411<wx/docview.h>
10eb1f1e 1412
84ed77ef 1413
b0fc8832
VZ
1414\membersection{::wxTransferStreamToFile}\label{wxtransferstreamtofile}
1415
1416\func{bool}{wxTransferStreamToFile}{\param{istream\& }{stream} \param{const wxString\& }{filename}}
1417
1418Copies the given stream to the file {\it filename}. Useful when converting an old application to
1419use streams (within the document/view framework, for example).
10eb1f1e
VZ
1420
1421\wxheading{Include files}
1422
b0fc8832 1423<wx/docview.h>
10eb1f1e 1424
84ed77ef
VZ
1425
1426
b0fc8832 1427\section{Network, user and OS functions}\label{networkfunctions}
a660d684 1428
b0fc8832
VZ
1429The functions in this section are used to retrieve information about the
1430current computer and/or user characteristics.
a660d684 1431
84ed77ef 1432
f8665629
WS
1433\membersection{::wxGetEmailAddress}\label{wxgetemailaddress}
1434
1435\func{wxString}{wxGetEmailAddress}{\void}
1436
1437\func{bool}{wxGetEmailAddress}{\param{char * }{buf}, \param{int }{sz}}
1438
1439Copies the user's email address into the supplied buffer, by
1440concatenating the values returned by \helpref{wxGetFullHostName}{wxgetfullhostname}\rtfsp
1441and \helpref{wxGetUserId}{wxgetuserid}.
1442
1443Returns true if successful, false otherwise.
1444
1445\wxheading{Include files}
1446
1447<wx/utils.h>
1448
1449
b0fc8832 1450\membersection{::wxGetFreeMemory}\label{wxgetfreememory}
a660d684 1451
9d8aca48 1452\func{wxMemorySize}{wxGetFreeMemory}{\void}
a660d684 1453
b0fc8832 1454Returns the amount of free memory in bytes under environments which
f8665629 1455support it, and -1 if not supported or failed to perform measurement.
a660d684 1456
b0fc8832 1457\wxheading{Include files}
a660d684 1458
b0fc8832 1459<wx/utils.h>
a660d684 1460
84ed77ef 1461
b0fc8832 1462\membersection{::wxGetFullHostName}\label{wxgetfullhostname}
a660d684 1463
b0fc8832 1464\func{wxString}{wxGetFullHostName}{\void}
954b8ae6 1465
b0fc8832
VZ
1466Returns the FQDN (fully qualified domain host name) or an empty string on
1467error.
954b8ae6 1468
b0fc8832 1469\wxheading{See also}
c49245f8 1470
b0fc8832 1471\helpref{wxGetHostName}{wxgethostname}
4aff28fc 1472
b0fc8832 1473\wxheading{Include files}
4aff28fc 1474
b0fc8832 1475<wx/utils.h>
4aff28fc 1476
84ed77ef 1477
b0fc8832 1478\membersection{::wxGetHomeDir}\label{wxgethomedir}
d6c9c1b7 1479
b0fc8832 1480\func{wxString}{wxGetHomeDir}{\void}
d6c9c1b7 1481
b0fc8832 1482Return the (current) user's home directory.
d6c9c1b7 1483
b0fc8832 1484\wxheading{See also}
d6c9c1b7 1485
08890e27
VZ
1486\helpref{wxGetUserHome}{wxgetuserhome}\\
1487\helpref{wxStandardPaths}{wxstandardpaths}
d6c9c1b7
VZ
1488
1489\wxheading{Include files}
1490
b0fc8832 1491<wx/utils.h>
d6c9c1b7 1492
84ed77ef 1493
b0fc8832 1494\membersection{::wxGetHostName}\label{wxgethostname}
f3539882 1495
b0fc8832 1496\func{wxString}{wxGetHostName}{\void}
4aff28fc 1497
b0fc8832 1498\func{bool}{wxGetHostName}{\param{char * }{buf}, \param{int }{sz}}
c49245f8 1499
b0fc8832
VZ
1500Copies the current host machine's name into the supplied buffer. Please note
1501that the returned name is {\it not} fully qualified, i.e. it does not include
1502the domain name.
c49245f8 1503
b0fc8832
VZ
1504Under Windows or NT, this function first looks in the environment
1505variable SYSTEM\_NAME; if this is not found, the entry {\bf HostName}\rtfsp
fc2171bd 1506in the {\bf wxWidgets} section of the WIN.INI file is tried.
c49245f8 1507
b0fc8832 1508The first variant of this function returns the hostname if successful or an
cc81d32f
VS
1509empty string otherwise. The second (deprecated) function returns true
1510if successful, false otherwise.
b0fc8832
VZ
1511
1512\wxheading{See also}
1513
1514\helpref{wxGetFullHostName}{wxgetfullhostname}
c49245f8
VZ
1515
1516\wxheading{Include files}
a294c6d5 1517
b0fc8832 1518<wx/utils.h>
a294c6d5 1519
84ed77ef 1520
b0fc8832 1521\membersection{::wxGetOsDescription}\label{wxgetosdescription}
a660d684 1522
b0fc8832 1523\func{wxString}{wxGetOsDescription}{\void}
a660d684 1524
b0fc8832
VZ
1525Returns the string containing the description of the current platform in a
1526user-readable form. For example, this function may return strings like
1527{\tt Windows NT Version 4.0} or {\tt Linux 2.2.2 i386}.
a660d684 1528
b0fc8832
VZ
1529\wxheading{See also}
1530
1531\helpref{::wxGetOsVersion}{wxgetosversion}
a660d684 1532
954b8ae6
JS
1533\wxheading{Include files}
1534
b0fc8832 1535<wx/utils.h>
954b8ae6 1536
84ed77ef 1537
b0fc8832 1538\membersection{::wxGetOsVersion}\label{wxgetosversion}
a660d684 1539
8bb6b2c0 1540\func{wxOperatingSystemId}{wxGetOsVersion}{\param{int *}{major = NULL}, \param{int *}{minor = NULL}}
a660d684 1541
8bb6b2c0
VZ
1542Gets the version and the operating system ID for currently running OS.
1543See \helpref{wxPlatformInfo}{wxplatforminfo} for more details about wxOperatingSystemId.
a660d684 1544
8bb6b2c0
VZ
1545\wxheading{See also}
1546
1547\helpref{::wxGetOsDescription}{wxgetosdescription},
1548\helpref{wxPlatformInfo}{wxplatforminfo}
1549
1550\wxheading{Include files}
1551
1552<wx/utils.h>
1553
1554
1555\membersection{::wxIsPlatformLittleEndian}\label{wxisplatformlittleendian}
1556
1557\func{bool}{wxIsPlatformLittleEndian}{\void}
1558
1559Returns \true if the current platform is little endian (instead of big endian).
1560The check is performed at run-time.
a660d684 1561
b0fc8832 1562\wxheading{See also}
a660d684 1563
8bb6b2c0
VZ
1564\helpref{Byte order macros}{byteordermacros}
1565
1566\wxheading{Include files}
1567
1568<wx/utils.h>
1569
1570
1571\membersection{::wxIsPlatform64Bit}\label{wxisplatform64bit}
1572
1573\func{bool}{wxIsPlatform64Bit}{\void}
1574
1575Returns \true if the operating system the program is running under is 64 bit.
1576The check is performed at run-time and may differ from the value available at
1577compile-time (at compile-time you can just check if {\tt sizeof(void*)==8})
1578since the program could be running in emulation mode or in a mixed 32/64 bit system
1579(bi-architecture operating system).
1580
1581Very important: this function is not 100\% reliable on some systems given the fact
1582that there isn't always a standard way to do a reliable check on the OS architecture.
a660d684 1583
b0fc8832
VZ
1584\wxheading{Include files}
1585
1586<wx/utils.h>
1587
84ed77ef 1588
b0fc8832
VZ
1589\membersection{::wxGetUserHome}\label{wxgetuserhome}
1590
14d63513 1591\func{wxString}{wxGetUserHome}{\param{const wxString\& }{user = ""}}
b0fc8832 1592
14d63513
VZ
1593Returns the home directory for the given user. If the \arg{user} is empty
1594(default value), this function behaves like
1595\helpref{wxGetHomeDir}{wxgethomedir} i.e. returns the current user home
1596directory.
1597
1598If the home directory couldn't be determined, an empty string is returned.
a660d684 1599
954b8ae6
JS
1600\wxheading{Include files}
1601
b0fc8832 1602<wx/utils.h>
954b8ae6 1603
84ed77ef 1604
f8665629
WS
1605\membersection{::wxGetUserId}\label{wxgetuserid}
1606
1607\func{wxString}{wxGetUserId}{\void}
1608
1609\func{bool}{wxGetUserId}{\param{char * }{buf}, \param{int }{sz}}
1610
1611This function returns the "user id" also known as "login name" under Unix i.e.
1612something like "jsmith". It uniquely identifies the current user (on this system).
1613
1614Under Windows or NT, this function first looks in the environment
1615variables USER and LOGNAME; if neither of these is found, the entry {\bf UserId}\rtfsp
1616in the {\bf wxWidgets} section of the WIN.INI file is tried.
1617
1618The first variant of this function returns the login name if successful or an
1619empty string otherwise. The second (deprecated) function returns true
1620if successful, false otherwise.
1621
1622\wxheading{See also}
1623
1624\helpref{wxGetUserName}{wxgetusername}
1625
1626\wxheading{Include files}
1627
1628<wx/utils.h>
1629
1630
b0fc8832 1631\membersection{::wxGetUserName}\label{wxgetusername}
a660d684 1632
b0fc8832 1633\func{wxString}{wxGetUserName}{\void}
d6c9c1b7 1634
b0fc8832 1635\func{bool}{wxGetUserName}{\param{char * }{buf}, \param{int }{sz}}
d6c9c1b7 1636
b0fc8832 1637This function returns the full user name (something like "Mr. John Smith").
d6c9c1b7 1638
b0fc8832 1639Under Windows or NT, this function looks for the entry {\bf UserName}\rtfsp
fc2171bd 1640in the {\bf wxWidgets} section of the WIN.INI file. If PenWindows
b0fc8832
VZ
1641is running, the entry {\bf Current} in the section {\bf User} of
1642the PENWIN.INI file is used.
d6c9c1b7 1643
b0fc8832 1644The first variant of this function returns the user name if successful or an
43e8916f
MW
1645empty string otherwise. The second (deprecated) function returns \true
1646if successful, \false otherwise.
b0fc8832
VZ
1647
1648\wxheading{See also}
1649
1650\helpref{wxGetUserId}{wxgetuserid}
a660d684 1651
954b8ae6
JS
1652\wxheading{Include files}
1653
b0fc8832 1654<wx/utils.h>
954b8ae6 1655
84ed77ef
VZ
1656
1657
569ef72a 1658\section{String functions}\label{stringfunctions}
f3539882 1659
0bbe4e29
VZ
1660\membersection{::wxGetTranslation}\label{wxgettranslation}
1661
31b7522e
VS
1662\func{const wxString\& }{wxGetTranslation}{\param{const wxString\& }{str},
1663 \param{const wxString\& }{domain = wxEmptyString}}
0bbe4e29 1664
31b7522e
VS
1665\func{const wxString\& }{wxGetTranslation}{\param{const wxString\& }{str}, \param{const wxString\& }{strPlural}, \param{size\_t }{n},
1666 \param{const wxString\& }{domain = wxEmptyString}}
6f80247a 1667
0bbe4e29
VZ
1668This function returns the translation of string {\it str} in the current
1669\helpref{locale}{wxlocale}. If the string is not found in any of the loaded
1670message catalogs (see \helpref{internationalization overview}{internationalization}), the
1671original string is returned. In debug build, an error message is logged -- this
d4a724d4
RD
1672should help to find the strings which were not yet translated. If
1673{\it domain} is specified then only that domain/catalog is searched
1674for a matching string. As this function
0bbe4e29
VZ
1675is used very often, an alternative (and also common in Unix world) syntax is
1676provided: the \helpref{\_()}{underscore} macro is defined to do the same thing
1677as wxGetTranslation.
1678
6f80247a
VS
1679The second form is used when retrieving translation of string that has
1680different singular and plural form in English or different plural forms in some
ce045aed 1681other language. It takes two extra arguments: as above, \arg{str}
15d06954
VZ
1682parameter must contain the singular form of the string to be converted and
1683is used as the key for the search in the catalog. The \arg{strPlural} parameter
1684is the plural form (in English). The parameter \arg{n} is used to determine the
1685plural form. If no message catalog is found \arg{str} is returned if `n == 1',
30e5722f 1686otherwise \arg{strPlural}.
15d06954 1687
ce045aed 1688See \urlref{GNU gettext manual}{http://www.gnu.org/manual/gettext/html\_chapter/gettext\_10.html\#SEC150}
15d06954
VZ
1689for additional information on plural forms handling. For a shorter alternative
1690see the \helpref{wxPLURAL()}{wxplural} macro.
84ed77ef 1691
30e5722f
VS
1692Both versions call \helpref{wxLocale::GetString}{wxlocalegetstring}.
1693
15d06954 1694Note that this function is not suitable for literal strings in Unicode
ce045aed 1695builds, since the literal strings must be enclosed into
15d06954
VZ
1696\helpref{\_T()}{underscoret} or \helpref{wxT}{wxt} macro which makes them
1697unrecognised by \texttt{xgettext}, and so they are not extracted to the message
ce045aed 1698catalog. Instead, use the \helpref{\_()}{underscore} and
15d06954
VZ
1699\helpref{wxPLURAL}{wxplural} macro for all literal strings.
1700
1701
b0fc8832 1702\membersection{::wxIsEmpty}\label{wxisempty}
954b8ae6 1703
b0fc8832 1704\func{bool}{wxIsEmpty}{\param{const char *}{ p}}
954b8ae6 1705
43e8916f
MW
1706Returns \true if the pointer is either {\tt NULL} or points to an empty
1707string, \false otherwise.
f3539882 1708
84ed77ef 1709
a0516656
VZ
1710\membersection{wxS}\label{wxs}
1711
1712\func{wxStringCharType}{wxS}{\param{char }{ch}}
1713
1714\func{const wxStringCharType *}{wxS}{\param{const char *}{s}}
1715
1716wxS is macro which can be used with character and string literals to either
1717convert them to wide characters or strings in \texttt{wchar\_t}-based Unicode
1718builds or keep them unchanged in UTF-8 builds. The use of this macro is
1719optional as the translation will always be done at run-time even if there is a
1720mismatch between the kind of the literal used and wxStringCharType used in the
1721current build, but using it can be beneficial in performance-sensitive code to
1722do the conversion at compile-time instead.
1723
1724\wxheading{See also}
1725
1726\helpref{wxT}{wxt}
1727
1728
2f930c85
JS
1729\membersection{::wxStrcmp}\label{wxstrcmp}
1730
1731\func{int}{wxStrcmp}{\param{const char *}{p1}, \param{const char *}{p2}}
1732
1733Returns a negative value, 0, or positive value if {\it p1} is less than, equal
1734to or greater than {\it p2}. The comparison is case-sensitive.
1735
1736This function complements the standard C function {\it stricmp()} which performs
1737case-insensitive comparison.
1738
84ed77ef 1739
b0fc8832 1740\membersection{::wxStricmp}\label{wxstricmp}
a660d684 1741
b0fc8832 1742\func{int}{wxStricmp}{\param{const char *}{p1}, \param{const char *}{p2}}
d6c9c1b7 1743
b0fc8832
VZ
1744Returns a negative value, 0, or positive value if {\it p1} is less than, equal
1745to or greater than {\it p2}. The comparison is case-insensitive.
a660d684 1746
b0fc8832
VZ
1747This function complements the standard C function {\it strcmp()} which performs
1748case-sensitive comparison.
a660d684 1749
84ed77ef 1750
bf00c875
VZ
1751\membersection{::wxStringEq}\label{wxstringeq}
1752
1753\func{bool}{wxStringEq}{\param{const wxString\& }{s1}, \param{const wxString\& }{s2}}
1754
1755{\bf NB:} This function is obsolete, use \helpref{wxString}{wxstring} instead.
1756
1757A macro defined as:
1758
1759\begin{verbatim}
1760#define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) == 0))
1761\end{verbatim}
1762
1763
b0fc8832 1764\membersection{::wxStringMatch}\label{wxstringmatch}
954b8ae6 1765
b0fc8832 1766\func{bool}{wxStringMatch}{\param{const wxString\& }{s1}, \param{const wxString\& }{s2},\\
cc81d32f 1767 \param{bool}{ subString = true}, \param{bool}{ exact = false}}
954b8ae6 1768
2bd25c5a
VZ
1769{\bf NB:} This function is obsolete, use \helpref{wxString::Find}{wxstringfind} instead.
1770
43e8916f
MW
1771Returns \true if the substring {\it s1} is found within {\it s2},
1772ignoring case if {\it exact} is false. If {\it subString} is \false,
b0fc8832 1773no substring matching is done.
f3539882 1774
84ed77ef 1775
bf00c875 1776\membersection{::wxStringTokenize}\label{wxstringtokenize}
a660d684 1777
bf00c875
VZ
1778\func{wxArrayString}{wxStringTokenize}{\param{const wxString\& }{str},\\
1779 \param{const wxString\& }{delims = wxDEFAULT\_DELIMITERS},\\
1780 \param{wxStringTokenizerMode }{mode = wxTOKEN\_DEFAULT}}
2bd25c5a 1781
ce045aed 1782This is a convenience function wrapping
bf00c875
VZ
1783\helpref{wxStringTokenizer}{wxstringtokenizer} which simply returns all tokens
1784found in the given \arg{str} in an array.
b0fc8832 1785
ce045aed
WS
1786Please see
1787\helpref{wxStringTokenizer::wxStringTokenizer}{wxstringtokenizerwxstringtokenizer}
bf00c875 1788for the description of the other parameters.
b0fc8832 1789
84ed77ef 1790
b0fc8832
VZ
1791\membersection{::wxStrlen}\label{wxstrlen}
1792
1793\func{size\_t}{wxStrlen}{\param{const char *}{ p}}
1794
1795This is a safe version of standard function {\it strlen()}: it does exactly the
1796same thing (i.e. returns the length of the string) except that it returns 0 if
1797{\it p} is the {\tt NULL} pointer.
1798
84ed77ef 1799
b0fc8832 1800\membersection{::wxSnprintf}\label{wxsnprintf}
a660d684 1801
b0fc8832 1802\func{int}{wxSnprintf}{\param{wxChar *}{buf}, \param{size\_t }{len}, \param{const wxChar *}{format}, \param{}{...}}
a660d684 1803
b0fc8832
VZ
1804This function replaces the dangerous standard function {\tt sprintf()} and is
1805like {\tt snprintf()} available on some platforms. The only difference with
1806sprintf() is that an additional argument - buffer size - is taken and the
1807buffer is never overflowed.
a660d684 1808
b0fc8832
VZ
1809Returns the number of characters copied to the buffer or -1 if there is not
1810enough space.
a660d684 1811
b0fc8832 1812\wxheading{See also}
a660d684 1813
b0fc8832
VZ
1814\helpref{wxVsnprintf}{wxvsnprintf}, \helpref{wxString::Printf}{wxstringprintf}
1815
84ed77ef 1816
0bbe4e29
VZ
1817\membersection{wxT}\label{wxt}
1818
1819\func{wxChar}{wxT}{\param{char }{ch}}
1820
1821\func{const wxChar *}{wxT}{\param{const char *}{s}}
1822
1823wxT() is a macro which can be used with character and string literals (in other
1824words, {\tt 'x'} or {\tt "foo"}) to automatically convert them to Unicode in
9d8aca48 1825Unicode build configuration. Please see the
0bbe4e29
VZ
1826\helpref{Unicode overview}{unicode} for more information.
1827
1828This macro is simply returns the value passed to it without changes in ASCII
1829build. In fact, its definition is:
1830\begin{verbatim}
1831#ifdef UNICODE
1832#define wxT(x) L ## x
1833#else // !Unicode
1834#define wxT(x) x
1835#endif
1836\end{verbatim}
1837
84ed77ef 1838
0bbe4e29
VZ
1839\membersection{wxTRANSLATE}\label{wxtranslate}
1840
1841\func{const wxChar *}{wxTRANSLATE}{\param{const char *}{s}}
1842
1843This macro doesn't do anything in the program code -- it simply expands to the
e6d4038a 1844value of its argument.
0bbe4e29 1845
e6d4038a 1846However it does have a purpose which is to mark the literal strings for the
0bbe4e29
VZ
1847extraction into the message catalog created by {\tt xgettext} program. Usually
1848this is achieved using \helpref{\_()}{underscore} but that macro not only marks
9d8aca48 1849the string for extraction but also expands into a
0bbe4e29 1850\helpref{wxGetTranslation}{wxgettranslation} function call which means that it
7445e247 1851cannot be used in some situations, notably for static array
0bbe4e29
VZ
1852initialization.
1853
1854Here is an example which should make it more clear: suppose that you have a
1855static array of strings containing the weekday names and which have to be
8ea92b4d 1856translated (note that it is a bad example, really, as
0bbe4e29
VZ
1857\helpref{wxDateTime}{wxdatetime} already can be used to get the localized week
1858day names already). If you write
d2c2afc9 1859
0bbe4e29 1860\begin{verbatim}
e6d4038a 1861static const char * const weekdays[] = { _("Mon"), ..., _("Sun") };
0bbe4e29
VZ
1862...
1863// use weekdays[n] as usual
1864\end{verbatim}
d2c2afc9 1865
0bbe4e29
VZ
1866the code wouldn't compile because the function calls are forbidden in the array
1867initializer. So instead you should do
d2c2afc9 1868
0bbe4e29 1869\begin{verbatim}
e6d4038a 1870static const char * const weekdays[] = { wxTRANSLATE("Mon"), ..., wxTRANSLATE("Sun") };
0bbe4e29
VZ
1871...
1872// use wxGetTranslation(weekdays[n])
1873\end{verbatim}
d2c2afc9 1874
0bbe4e29
VZ
1875here.
1876
1877Note that although the code {\bf would} compile if you simply omit
1878wxTRANSLATE() in the above, it wouldn't work as expected because there would be
1879no translations for the weekday names in the program message catalog and
1880wxGetTranslation wouldn't find them.
1881
e6d4038a 1882
b0fc8832
VZ
1883\membersection{::wxVsnprintf}\label{wxvsnprintf}
1884
ea44a631 1885\func{int}{wxVsnprintf}{\param{wxChar *}{buf}, \param{size\_t }{len}, \param{const wxChar *}{format}, \param{va\_list }{argPtr}}
b0fc8832 1886
7ac13b21 1887The same as \helpref{wxSnprintf}{wxsnprintf} but takes a {\tt va\_list }
b0fc8832 1888argument instead of arbitrary number of parameters.
c50f1fb9 1889
418ab1e7 1890Note that if \texttt{wxUSE\_PRINTF\_POS\_PARAMS} is set to 1, then this function supports
412a5c57
VZ
1891positional arguments (see \helpref{wxString::Printf}{wxstringprintf} for more information).
1892However other functions of the same family (wxPrintf, wxSprintf, wxFprintf, wxVfprintf,
1893wxVfprintf, wxVprintf, wxVsprintf) currently do not to support positional parameters
418ab1e7 1894even when \texttt{wxUSE\_PRINTF\_POS\_PARAMS} is 1.
412a5c57 1895
e12be2f7 1896\wxheading{See also}
c50f1fb9 1897
b0fc8832 1898\helpref{wxSnprintf}{wxsnprintf}, \helpref{wxString::PrintfV}{wxstringprintfv}
c50f1fb9 1899
0bbe4e29 1900
84ed77ef 1901
0bbe4e29
VZ
1902\membersection{\_}\label{underscore}
1903
31b7522e 1904\func{const wxString\&}{\_}{\param{const wxString\&}{s}}
0bbe4e29 1905
8ea92b4d 1906This macro expands into a call to \helpref{wxGetTranslation}{wxgettranslation}
0bbe4e29
VZ
1907function, so it marks the message for the extraction by {\tt xgettext} just as
1908\helpref{wxTRANSLATE}{wxtranslate} does, but also returns the translation of
1909the string for the current locale during execution.
1910
1911Don't confuse this macro with \helpref{\_T()}{underscoret}!
1912
84ed77ef 1913
15d06954
VZ
1914\membersection{wxPLURAL}\label{wxplural}
1915
31b7522e 1916\func{const wxString\&}{wxPLURAL}{\param{const wxString\&}{sing}, \param{const wxString\&}{plur}, \param{size\_t}{n}}
15d06954
VZ
1917
1918This macro is identical to \helpref{\_()}{underscore} but for the plural variant
1919of \helpref{wxGetTranslation}{wxgettranslation}.
1920
1921
0bbe4e29
VZ
1922\membersection{\_T}\label{underscoret}
1923
1924\func{wxChar}{\_T}{\param{char }{ch}}
1925
1926\func{const wxChar *}{\_T}{\param{const wxChar }{ch}}
1927
1928This macro is exactly the same as \helpref{wxT}{wxt} and is defined in
fc2171bd 1929wxWidgets simply because it may be more intuitive for Windows programmers as
0bbe4e29
VZ
1930the standard Win32 headers also define it (as well as yet another name for the
1931same macro which is {\tt \_TEXT()}).
1932
1933Don't confuse this macro with \helpref{\_()}{underscore}!
1934
84ed77ef
VZ
1935
1936
b0fc8832 1937\section{Dialog functions}\label{dialogfunctions}
c50f1fb9 1938
b0fc8832
VZ
1939Below are a number of convenience functions for getting input from the
1940user or displaying messages. Note that in these functions the last three
1941parameters are optional. However, it is recommended to pass a parent frame
1942parameter, or (in MS Windows or Motif) the wrong window frame may be brought to
1943the front when the dialog box is popped up.
c50f1fb9 1944
84ed77ef 1945
c2709a3d
VZ
1946\membersection{::wxAboutBox}\label{wxaboutbox}
1947
1948\func{void}{wxAboutBox}{\param{const wxAboutDialogInfo\& }{info}}
1949
1950This function shows the standard about dialog containing the information
1951specified in \arg{info}. If the current platform has a native about dialog
1952which is capable of showing all the fields in \arg{info}, the native dialog is
1953used, otherwise the function falls back to the generic wxWidgets version of the
1954dialog, i.e. does the same thing as \helpref{wxGenericAboutBox()}{wxgenericaboutbox}.
1955
1956Here is an example of how this function may be used:
1957\begin{verbatim}
1958void MyFrame::ShowSimpleAboutDialog(wxCommandEvent& WXUNUSED(event))
1959{
1960 wxAboutDialogInfo info;
1961 info.SetName(_("My Program"));
1962 info.SetVersion(_("1.2.3 Beta"));
1963 info.SetDescription(_("This program does something great."));
1964 info.SetCopyright(_T("(C) 2007 Me <my@email.addre.ss>"));
1965
1966 wxAboutBox(info);
1967}
1968\end{verbatim}
1969
1970Please see the \helpref{dialogs sample}{sampledialogs} for more examples of
1971using this function and \helpref{wxAboutDialogInfo}{wxaboutdialoginfo} for the
1972description of the information which can be shown in the about dialog.
1973
1974\wxheading{Include files}
1975
1976<wx/aboutdlg.h>
1977
1978
b0fc8832 1979\membersection{::wxBeginBusyCursor}\label{wxbeginbusycursor}
a660d684 1980
b0fc8832
VZ
1981\func{void}{wxBeginBusyCursor}{\param{wxCursor *}{cursor = wxHOURGLASS\_CURSOR}}
1982
1983Changes the cursor to the given cursor for all windows in the application.
1984Use \helpref{wxEndBusyCursor}{wxendbusycursor} to revert the cursor back
1985to its previous state. These two calls can be nested, and a counter
1986ensures that only the outer calls take effect.
1987
1988See also \helpref{wxIsBusy}{wxisbusy}, \helpref{wxBusyCursor}{wxbusycursor}.
a660d684 1989
954b8ae6
JS
1990\wxheading{Include files}
1991
b0fc8832 1992<wx/utils.h>
954b8ae6 1993
84ed77ef 1994
b0fc8832 1995\membersection{::wxBell}\label{wxbell}
ec5d7799 1996
b0fc8832 1997\func{void}{wxBell}{\void}
ec5d7799 1998
b0fc8832 1999Ring the system bell.
ec5d7799 2000
576b18f2
VZ
2001Note that this function is categorized as a GUI one and so is not thread-safe.
2002
b0fc8832 2003\wxheading{Include files}
ec5d7799 2004
b0fc8832 2005<wx/utils.h>
a660d684 2006
84ed77ef 2007
b0fc8832 2008\membersection{::wxCreateFileTipProvider}\label{wxcreatefiletipprovider}
a660d684 2009
b0fc8832
VZ
2010\func{wxTipProvider *}{wxCreateFileTipProvider}{\param{const wxString\& }{filename},
2011 \param{size\_t }{currentTip}}
a660d684 2012
b0fc8832
VZ
2013This function creates a \helpref{wxTipProvider}{wxtipprovider} which may be
2014used with \helpref{wxShowTip}{wxshowtip}.
a660d684 2015
b0fc8832
VZ
2016\docparam{filename}{The name of the file containing the tips, one per line}
2017\docparam{currentTip}{The index of the first tip to show - normally this index
2018is remembered between the 2 program runs.}
a660d684 2019
b0fc8832 2020\wxheading{See also}
a660d684 2021
b0fc8832 2022\helpref{Tips overview}{tipsoverview}
904a68b6 2023
b0fc8832 2024\wxheading{Include files}
904a68b6 2025
b0fc8832 2026<wx/tipdlg.h>
904a68b6 2027
84ed77ef 2028
b0fc8832 2029\membersection{::wxDirSelector}\label{wxdirselector}
904a68b6 2030
b0fc8832
VZ
2031\func{wxString}{wxDirSelector}{\param{const wxString\& }{message = wxDirSelectorPromptStr},\\
2032 \param{const wxString\& }{default\_path = ""},\\
2033 \param{long }{style = 0}, \param{const wxPoint\& }{pos = wxDefaultPosition},\\
2034 \param{wxWindow *}{parent = NULL}}
904a68b6 2035
b0fc8832
VZ
2036Pops up a directory selector dialog. The arguments have the same meaning as
2037those of wxDirDialog::wxDirDialog(). The message is displayed at the top,
2038and the default\_path, if specified, is set as the initial selection.
904a68b6 2039
b0fc8832
VZ
2040The application must check for an empty return value (if the user pressed
2041Cancel). For example:
904a68b6 2042
b0fc8832
VZ
2043\begin{verbatim}
2044const wxString& dir = wxDirSelector("Choose a folder");
2045if ( !dir.empty() )
2046{
2047 ...
2048}
2049\end{verbatim}
904a68b6 2050
b0fc8832 2051\wxheading{Include files}
a660d684 2052
b0fc8832 2053<wx/dirdlg.h>
a660d684 2054
84ed77ef 2055
b0fc8832 2056\membersection{::wxFileSelector}\label{wxfileselector}
a660d684 2057
b0fc8832
VZ
2058\func{wxString}{wxFileSelector}{\param{const wxString\& }{message}, \param{const wxString\& }{default\_path = ""},\\
2059 \param{const wxString\& }{default\_filename = ""}, \param{const wxString\& }{default\_extension = ""},\\
cf700088 2060 \param{const wxString\& }{wildcard = "*.*"}, \param{int }{flags = 0}, \param{wxWindow *}{parent = NULL},\\
b0fc8832 2061 \param{int}{ x = -1}, \param{int}{ y = -1}}
a660d684 2062
b0fc8832
VZ
2063Pops up a file selector box. In Windows, this is the common file selector
2064dialog. In X, this is a file selector box with the same functionality.
2065The path and filename are distinct elements of a full file pathname.
2066If path is empty, the current directory will be used. If filename is empty,
2067no default filename will be supplied. The wildcard determines what files
2068are displayed in the file selector, and file extension supplies a type
f4f5d569
VZ
2069extension for the required filename. Flags may be a combination of wxFD\_OPEN,
2070wxFD\_SAVE, wxFD\_OVERWRITE\_PROMPT or wxFD\_FILE\_MUST\_EXIST. Note that wxFD\_MULTIPLE
9b38386f
VZ
2071can only be used with \helpref{wxFileDialog}{wxfiledialog} and not here as this
2072function only returns a single file name.
a660d684 2073
b0fc8832
VZ
2074Both the Unix and Windows versions implement a wildcard filter. Typing a
2075filename containing wildcards (*, ?) in the filename text item, and
2076clicking on Ok, will result in only those files matching the pattern being
2077displayed.
a660d684 2078
b0fc8832
VZ
2079The wildcard may be a specification for multiple types of file
2080with a description for each, such as:
a660d684 2081
b0fc8832
VZ
2082\begin{verbatim}
2083 "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
2084\end{verbatim}
a660d684 2085
b0fc8832
VZ
2086The application must check for an empty return value (the user pressed
2087Cancel). For example:
a660d684 2088
b0fc8832 2089\begin{verbatim}
f0f12073
VZ
2090wxString filename = wxFileSelector("Choose a file to open");
2091if ( !filename.empty() )
b0fc8832 2092{
f0f12073
VZ
2093 // work with the file
2094 ...
b0fc8832 2095}
f0f12073 2096//else: cancelled by user
b0fc8832 2097\end{verbatim}
a660d684 2098
b0fc8832 2099\wxheading{Include files}
a660d684 2100
b0fc8832 2101<wx/filedlg.h>
a660d684 2102
84ed77ef 2103
b0fc8832 2104\membersection{::wxEndBusyCursor}\label{wxendbusycursor}
a660d684 2105
b0fc8832 2106\func{void}{wxEndBusyCursor}{\void}
f53561f1 2107
b0fc8832
VZ
2108Changes the cursor back to the original cursor, for all windows in the application.
2109Use with \helpref{wxBeginBusyCursor}{wxbeginbusycursor}.
2110
2111See also \helpref{wxIsBusy}{wxisbusy}, \helpref{wxBusyCursor}{wxbusycursor}.
a660d684 2112
954b8ae6
JS
2113\wxheading{Include files}
2114
b0fc8832 2115<wx/utils.h>
954b8ae6 2116
84ed77ef 2117
c2709a3d
VZ
2118\membersection{::wxGenericAboutBox}\label{wxgenericaboutbox}
2119
2120\func{void}{wxGenericAboutBox}{\param{const wxAboutDialogInfo\& }{info}}
2121
2122This function does the same thing as \helpref{wxAboutBox}{wxaboutbox} except
2123that it always uses the generic wxWidgets version of the dialog instead of the
2124native one. This is mainly useful if you need to customize the dialog by e.g.
2125adding custom controls to it (customizing the native dialog is not currently
2126supported).
2127
2128See the \helpref{dialogs sample}{sampledialogs} for an example of about dialog
2129customization.
2130
2131\wxheading{See also}
2132
2133\helpref{wxAboutDialogInfo}{wxaboutdialoginfo}
2134
2135\wxheading{Include files}
2136
20d9c24a 2137<wx/aboutdlg.h>\\
c2709a3d
VZ
2138<wx/generic/aboutdlgg.h>
2139
2140
b0fc8832 2141\membersection{::wxGetColourFromUser}\label{wxgetcolourfromuser}
a660d684 2142
e6ef9ea4 2143\func{wxColour}{wxGetColourFromUser}{\param{wxWindow *}{parent}, \param{const wxColour\& }{colInit}, \param{const wxString\& }{caption = wxEmptyString}, \param{wxColourData *}{data = \NULL}}
a660d684 2144
b0fc8832 2145Shows the colour selection dialog and returns the colour selected by user or
b7cacb43 2146invalid colour (use \helpref{wxColour:IsOk}{wxcolourisok} to test whether a colour
b0fc8832 2147is valid) if the dialog was cancelled.
a660d684 2148
b0fc8832 2149\wxheading{Parameters}
a660d684 2150
b0fc8832 2151\docparam{parent}{The parent window for the colour selection dialog}
a660d684 2152
b0fc8832 2153\docparam{colInit}{If given, this will be the colour initially selected in the dialog.}
a660d684 2154
f14d6dd1
JS
2155\docparam{caption}{If given, this will be used for the dialog caption.}
2156
e6ef9ea4
VZ
2157\docparam{data}{Optional object storing additional colour dialog settings, such
2158as custom colours. If none is provided the same settings as the last time are
2159used.}
2160
b0fc8832 2161\wxheading{Include files}
a660d684 2162
b0fc8832 2163<wx/colordlg.h>
a660d684 2164
84ed77ef 2165
d741c583
VZ
2166\membersection{::wxGetFontFromUser}\label{wxgetfontfromuser}
2167
f14d6dd1 2168\func{wxFont}{wxGetFontFromUser}{\param{wxWindow *}{parent}, \param{const wxFont\& }{fontInit}, \param{const wxString\& }{caption = wxEmptyString}}
d741c583
VZ
2169
2170Shows the font selection dialog and returns the font selected by user or
b7cacb43 2171invalid font (use \helpref{wxFont:IsOk}{wxfontisok} to test whether a font
d741c583
VZ
2172is valid) if the dialog was cancelled.
2173
2174\wxheading{Parameters}
2175
65d877d2 2176\docparam{parent}{The parent window for the font selection dialog}
d741c583
VZ
2177
2178\docparam{fontInit}{If given, this will be the font initially selected in the dialog.}
2179
f14d6dd1
JS
2180\docparam{caption}{If given, this will be used for the dialog caption.}
2181
d741c583
VZ
2182\wxheading{Include files}
2183
2184<wx/fontdlg.h>
2185
2186
84ed77ef 2187
b0fc8832 2188\membersection{::wxGetMultipleChoices}\label{wxgetmultiplechoices}
a660d684 2189
b0fc8832
VZ
2190\func{size\_t}{wxGetMultipleChoices}{\\
2191 \param{wxArrayInt\& }{selections},\\
2192 \param{const wxString\& }{message},\\
2193 \param{const wxString\& }{caption},\\
2194 \param{const wxArrayString\& }{aChoices},\\
2195 \param{wxWindow *}{parent = NULL},\\
2196 \param{int}{ x = -1}, \param{int}{ y = -1},\\
cc81d32f 2197 \param{bool}{ centre = true},\\
b0fc8832 2198 \param{int }{width=150}, \param{int }{height=200}}
a660d684 2199
b0fc8832
VZ
2200\func{size\_t}{wxGetMultipleChoices}{\\
2201 \param{wxArrayInt\& }{selections},\\
2202 \param{const wxString\& }{message},\\
2203 \param{const wxString\& }{caption},\\
2204 \param{int}{ n}, \param{const wxString\& }{choices[]},\\
2205 \param{wxWindow *}{parent = NULL},\\
2206 \param{int}{ x = -1}, \param{int}{ y = -1},\\
cc81d32f 2207 \param{bool}{ centre = true},\\
b0fc8832 2208 \param{int }{width=150}, \param{int }{height=200}}
a660d684 2209
b0fc8832
VZ
2210Pops up a dialog box containing a message, OK/Cancel buttons and a
2211multiple-selection listbox. The user may choose an arbitrary (including 0)
2212number of items in the listbox whose indices will be returned in
2213{\it selection} array. The initial contents of this array will be used to
2214select the items when the dialog is shown.
a660d684 2215
b0fc8832
VZ
2216You may pass the list of strings to choose from either using {\it choices}
2217which is an array of {\it n} strings for the listbox or by using a single
2218{\it aChoices} parameter of type \helpref{wxArrayString}{wxarraystring}.
a660d684 2219
cc81d32f
VS
2220If {\it centre} is true, the message text (which may include new line
2221characters) is centred; if false, the message is left-justified.
a660d684 2222
b0fc8832 2223\wxheading{Include files}
a660d684 2224
b0fc8832 2225<wx/choicdlg.h>
a660d684 2226
b0fc8832
VZ
2227\perlnote{In wxPerl there is just an array reference in place of {\tt n}
2228and {\tt choices}, and no {\tt selections} parameter; the function
2229returns an array containing the user selections.}
a660d684 2230
84ed77ef 2231
b0fc8832 2232\membersection{::wxGetNumberFromUser}\label{wxgetnumberfromuser}
a660d684 2233
b0fc8832
VZ
2234\func{long}{wxGetNumberFromUser}{
2235 \param{const wxString\& }{message},
2236 \param{const wxString\& }{prompt},
2237 \param{const wxString\& }{caption},
2238 \param{long }{value},
2239 \param{long }{min = 0},
2240 \param{long }{max = 100},
2241 \param{wxWindow *}{parent = NULL},
2242 \param{const wxPoint\& }{pos = wxDefaultPosition}}
a660d684 2243
b0fc8832
VZ
2244Shows a dialog asking the user for numeric input. The dialogs title is set to
2245{\it caption}, it contains a (possibly) multiline {\it message} above the
2246single line {\it prompt} and the zone for entering the number.
a660d684 2247
b0fc8832
VZ
2248The number entered must be in the range {\it min}..{\it max} (both of which
2249should be positive) and {\it value} is the initial value of it. If the user
2250enters an invalid value or cancels the dialog, the function will return -1.
a660d684 2251
b0fc8832
VZ
2252Dialog is centered on its {\it parent} unless an explicit position is given in
2253{\it pos}.
a660d684 2254
b0fc8832 2255\wxheading{Include files}
a660d684 2256
bc253a97 2257<wx/numdlg.h>
a660d684 2258
84ed77ef 2259
b0fc8832 2260\membersection{::wxGetPasswordFromUser}\label{wxgetpasswordfromuser}
a660d684 2261
57dd96a6
KH
2262\func{wxString}{wxGetPasswordFromUser}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Input text"},\\
2263 \param{const wxString\& }{default\_value = ``"}, \param{wxWindow *}{parent = NULL},\\
2264 \param{int}{ x = wxDefaultCoord}, \param{int}{ y = wxDefaultCoord}, \param{bool}{ centre = true}}
a660d684 2265
b0fc8832
VZ
2266Similar to \helpref{wxGetTextFromUser}{wxgettextfromuser} but the text entered
2267in the dialog is not shown on screen but replaced with stars. This is intended
2268to be used for entering passwords as the function name implies.
a660d684 2269
b0fc8832 2270\wxheading{Include files}
a660d684 2271
b0fc8832 2272<wx/textdlg.h>
a660d684 2273
84ed77ef 2274
b0fc8832 2275\membersection{::wxGetTextFromUser}\label{wxgettextfromuser}
a660d684 2276
b0fc8832
VZ
2277\func{wxString}{wxGetTextFromUser}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Input text"},\\
2278 \param{const wxString\& }{default\_value = ``"}, \param{wxWindow *}{parent = NULL},\\
57dd96a6 2279 \param{int}{ x = wxDefaultCoord}, \param{int}{ y = wxDefaultCoord}, \param{bool}{ centre = true}}
a660d684 2280
b0fc8832
VZ
2281Pop up a dialog box with title set to {\it caption}, {\it message}, and a
2282\rtfsp{\it default\_value}. The user may type in text and press OK to return this text,
2283or press Cancel to return the empty string.
a660d684 2284
cc81d32f
VS
2285If {\it centre} is true, the message text (which may include new line characters)
2286is centred; if false, the message is left-justified.
a660d684 2287
b0fc8832 2288\wxheading{Include files}
a660d684 2289
b0fc8832 2290<wx/textdlg.h>
a660d684 2291
84ed77ef 2292
b0fc8832 2293\membersection{::wxGetSingleChoice}\label{wxgetsinglechoice}
a660d684 2294
b0fc8832
VZ
2295\func{wxString}{wxGetSingleChoice}{\param{const wxString\& }{message},\\
2296 \param{const wxString\& }{caption},\\
2297 \param{const wxArrayString\& }{aChoices},\\
2298 \param{wxWindow *}{parent = NULL},\\
2299 \param{int}{ x = -1}, \param{int}{ y = -1},\\
cc81d32f 2300 \param{bool}{ centre = true},\\
b0fc8832 2301 \param{int }{width=150}, \param{int }{height=200}}
a660d684 2302
b0fc8832
VZ
2303\func{wxString}{wxGetSingleChoice}{\param{const wxString\& }{message},\\
2304 \param{const wxString\& }{caption},\\
2305 \param{int}{ n}, \param{const wxString\& }{choices[]},\\
2306 \param{wxWindow *}{parent = NULL},\\
2307 \param{int}{ x = -1}, \param{int}{ y = -1},\\
cc81d32f 2308 \param{bool}{ centre = true},\\
b0fc8832 2309 \param{int }{width=150}, \param{int }{height=200}}
a660d684 2310
b0fc8832
VZ
2311Pops up a dialog box containing a message, OK/Cancel buttons and a
2312single-selection listbox. The user may choose an item and press OK to return a
2313string or Cancel to return the empty string. Use
2314\helpref{wxGetSingleChoiceIndex}{wxgetsinglechoiceindex} if empty string is a
2315valid choice and if you want to be able to detect pressing Cancel reliably.
a660d684 2316
b0fc8832
VZ
2317You may pass the list of strings to choose from either using {\it choices}
2318which is an array of {\it n} strings for the listbox or by using a single
2319{\it aChoices} parameter of type \helpref{wxArrayString}{wxarraystring}.
a660d684 2320
cc81d32f
VS
2321If {\it centre} is true, the message text (which may include new line
2322characters) is centred; if false, the message is left-justified.
a660d684 2323
954b8ae6
JS
2324\wxheading{Include files}
2325
b0fc8832 2326<wx/choicdlg.h>
954b8ae6 2327
b0fc8832
VZ
2328\perlnote{In wxPerl there is just an array reference in place of {\tt n}
2329and {\tt choices}.}
a660d684 2330
84ed77ef 2331
b0fc8832 2332\membersection{::wxGetSingleChoiceIndex}\label{wxgetsinglechoiceindex}
a660d684 2333
b0fc8832
VZ
2334\func{int}{wxGetSingleChoiceIndex}{\param{const wxString\& }{message},\\
2335 \param{const wxString\& }{caption},\\
2336 \param{const wxArrayString\& }{aChoices},\\
2337 \param{wxWindow *}{parent = NULL}, \param{int}{ x = -1}, \param{int}{ y = -1},\\
cc81d32f 2338 \param{bool}{ centre = true}, \param{int }{width=150}, \param{int }{height=200}}
a660d684 2339
b0fc8832
VZ
2340\func{int}{wxGetSingleChoiceIndex}{\param{const wxString\& }{message},\\
2341 \param{const wxString\& }{caption},\\
2342 \param{int}{ n}, \param{const wxString\& }{choices[]},\\
2343 \param{wxWindow *}{parent = NULL}, \param{int}{ x = -1}, \param{int}{ y = -1},\\
cc81d32f 2344 \param{bool}{ centre = true}, \param{int }{width=150}, \param{int }{height=200}}
a660d684 2345
b0fc8832
VZ
2346As {\bf wxGetSingleChoice} but returns the index representing the selected
2347string. If the user pressed cancel, -1 is returned.
a660d684 2348
b0fc8832 2349\wxheading{Include files}
a660d684 2350
b0fc8832 2351<wx/choicdlg.h>
a660d684 2352
b0fc8832
VZ
2353\perlnote{In wxPerl there is just an array reference in place of {\tt n}
2354and {\tt choices}.}
a660d684 2355
84ed77ef 2356
b0fc8832 2357\membersection{::wxGetSingleChoiceData}\label{wxgetsinglechoicedata}
a660d684 2358
b0fc8832
VZ
2359\func{wxString}{wxGetSingleChoiceData}{\param{const wxString\& }{message},\\
2360 \param{const wxString\& }{caption},\\
2361 \param{const wxArrayString\& }{aChoices},\\
2362 \param{const wxString\& }{client\_data[]},\\
2363 \param{wxWindow *}{parent = NULL},\\
2364 \param{int}{ x = -1}, \param{int}{ y = -1},\\
cc81d32f 2365 \param{bool}{ centre = true}, \param{int }{width=150}, \param{int }{height=200}}
a660d684 2366
b0fc8832
VZ
2367\func{wxString}{wxGetSingleChoiceData}{\param{const wxString\& }{message},\\
2368 \param{const wxString\& }{caption},\\
2369 \param{int}{ n}, \param{const wxString\& }{choices[]},\\
2370 \param{const wxString\& }{client\_data[]},\\
2371 \param{wxWindow *}{parent = NULL},\\
2372 \param{int}{ x = -1}, \param{int}{ y = -1},\\
cc81d32f 2373 \param{bool}{ centre = true}, \param{int }{width=150}, \param{int }{height=200}}
a660d684 2374
b0fc8832
VZ
2375As {\bf wxGetSingleChoice} but takes an array of client data pointers
2376corresponding to the strings, and returns one of these pointers or NULL if
2377Cancel was pressed. The {\it client\_data} array must have the same number of
2378elements as {\it choices} or {\it aChoices}!
a660d684 2379
b0fc8832 2380\wxheading{Include files}
a660d684 2381
b0fc8832 2382<wx/choicdlg.h>
a660d684 2383
b0fc8832
VZ
2384\perlnote{In wxPerl there is just an array reference in place of {\tt n}
2385and {\tt choices}, and the client data array must have the
2386same length as the choices array.}
a660d684 2387
84ed77ef 2388
8cf304f8
VZ
2389\membersection{::wxInfoMessageBox}\label{wxinfomessagebox}
2390
2391\func{void}{wxInfoMessageBox}{\param{wxWindow (}{parent = \NULL}}
2392
2393Shows a message box with the information about the wxWidgets build used,
2394including its version, most important build parameters and the version of the
2395underlying GUI toolkit. This is mainly used for diagnostic purposes and can be
2396invoked by Ctrl-Alt-middle clicking on any wxWindow which doesn't otherwise
2397handle this event.
2398
2399\newsince{2.9.0}
2400
2401\wxheading{Include files}
2402
2403<wx/utils.h>
2404
2405
b0fc8832 2406\membersection{::wxIsBusy}\label{wxisbusy}
a660d684 2407
b0fc8832 2408\func{bool}{wxIsBusy}{\void}
a660d684 2409
cc81d32f 2410Returns true if between two \helpref{wxBeginBusyCursor}{wxbeginbusycursor} and\rtfsp
b0fc8832 2411\helpref{wxEndBusyCursor}{wxendbusycursor} calls.
a660d684 2412
b0fc8832 2413See also \helpref{wxBusyCursor}{wxbusycursor}.
a660d684 2414
b0fc8832 2415\wxheading{Include files}
a660d684 2416
b0fc8832 2417<wx/utils.h>
a660d684 2418
84ed77ef 2419
b0fc8832 2420\membersection{::wxMessageBox}\label{wxmessagebox}
a660d684 2421
dc0cecbc 2422\func{int}{wxMessageBox}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Message"}, \param{int}{ style = wxOK},\\
b0fc8832 2423 \param{wxWindow *}{parent = NULL}, \param{int}{ x = -1}, \param{int}{ y = -1}}
a660d684 2424
b0fc8832
VZ
2425General purpose message dialog. {\it style} may be a bit list of the
2426following identifiers:
a660d684 2427
b0fc8832
VZ
2428\begin{twocollist}\itemsep=0pt
2429\twocolitem{wxYES\_NO}{Puts Yes and No buttons on the message box. May be combined with
2430wxCANCEL.}
0a6f92b8 2431\twocolitem{wxCANCEL}{Puts a Cancel button on the message box. May only be combined with
b0fc8832
VZ
2432wxYES\_NO or wxOK.}
2433\twocolitem{wxOK}{Puts an Ok button on the message box. May be combined with wxCANCEL.}
b0fc8832
VZ
2434\twocolitem{wxICON\_EXCLAMATION}{Displays an exclamation mark symbol.}
2435\twocolitem{wxICON\_HAND}{Displays an error symbol.}
2436\twocolitem{wxICON\_ERROR}{Displays an error symbol - the same as wxICON\_HAND.}
2437\twocolitem{wxICON\_QUESTION}{Displays a question mark symbol.}
2438\twocolitem{wxICON\_INFORMATION}{Displays an information symbol.}
2439\end{twocollist}
a660d684 2440
b0fc8832 2441The return value is one of: wxYES, wxNO, wxCANCEL, wxOK.
a660d684 2442
b0fc8832 2443For example:
a660d684 2444
b0fc8832
VZ
2445\begin{verbatim}
2446 ...
2447 int answer = wxMessageBox("Quit program?", "Confirm",
2448 wxYES_NO | wxCANCEL, main_frame);
2449 if (answer == wxYES)
933b675e 2450 main_frame->Close();
b0fc8832
VZ
2451 ...
2452\end{verbatim}
a660d684 2453
b0fc8832
VZ
2454{\it message} may contain newline characters, in which case the
2455message will be split into separate lines, to cater for large messages.
a660d684 2456
b0fc8832 2457\wxheading{Include files}
a660d684 2458
b0fc8832 2459<wx/msgdlg.h>
a660d684 2460
84ed77ef 2461
b0fc8832 2462\membersection{::wxShowTip}\label{wxshowtip}
a660d684 2463
b0fc8832
VZ
2464\func{bool}{wxShowTip}{\param{wxWindow *}{parent},
2465 \param{wxTipProvider *}{tipProvider},
cc81d32f 2466 \param{bool }{showAtStartup = true}}
a660d684 2467
7975104d 2468This function shows a "startup tip" to the user. The return value is the
cf700088 2469state of the `Show tips at startup' checkbox.
a660d684 2470
b0fc8832 2471\docparam{parent}{The parent window for the modal dialog}
a660d684 2472
b0fc8832
VZ
2473\docparam{tipProvider}{An object which is used to get the text of the tips.
2474It may be created with the \helpref{wxCreateFileTipProvider}{wxcreatefiletipprovider} function.}
a660d684 2475
cc81d32f 2476\docparam{showAtStartup}{Should be true if startup tips are shown, false
b0fc8832
VZ
2477otherwise. This is used as the initial value for "Show tips at startup"
2478checkbox which is shown in the tips dialog.}
a660d684 2479
b0fc8832 2480\wxheading{See also}
a660d684 2481
b0fc8832 2482\helpref{Tips overview}{tipsoverview}
a660d684 2483
b0fc8832 2484\wxheading{Include files}
f6bcfd97 2485
b0fc8832 2486<wx/tipdlg.h>
f6bcfd97 2487
a02afd14 2488
84ed77ef
VZ
2489
2490
569ef72a 2491\section{Math functions}\label{mathfunctions}
a02afd14
VZ
2492
2493\wxheading{Include files}
2494
2495<wx/math.h>
2496
84ed77ef 2497
a02afd14
VZ
2498\membersection{wxFinite}\label{wxfinite}
2499
2500\func{int}{wxFinite}{\param{double }{x}}
2501
39434ba3 2502Returns a non-zero value if {\it x} is neither infinite nor NaN (not a number),
a02afd14
VZ
2503returns 0 otherwise.
2504
84ed77ef 2505
a02afd14
VZ
2506\membersection{wxIsNaN}\label{wxisnan}
2507
2508\func{bool}{wxIsNaN}{\param{double }{x}}
2509
2510Returns a non-zero value if {\it x} is NaN (not a number), returns 0
2511otherwise.
2512
2513
84ed77ef
VZ
2514
2515
b0fc8832 2516\section{GDI functions}\label{gdifunctions}
f6bcfd97 2517
b0fc8832 2518The following are relevant to the GDI (Graphics Device Interface).
f6bcfd97
BP
2519
2520\wxheading{Include files}
2521
b0fc8832 2522<wx/gdicmn.h>
f6bcfd97 2523
84ed77ef 2524
b0fc8832 2525\membersection{wxBITMAP}\label{wxbitmapmacro}
a660d684 2526
b0fc8832 2527\func{}{wxBITMAP}{bitmapName}
a660d684 2528
b0fc8832
VZ
2529This macro loads a bitmap from either application resources (on the platforms
2530for which they exist, i.e. Windows and OS2) or from an XPM file. It allows to
2531avoid using {\tt \#ifdef}s when creating bitmaps.
a660d684 2532
b0fc8832 2533\wxheading{See also}
954b8ae6 2534
b0fc8832
VZ
2535\helpref{Bitmaps and icons overview}{wxbitmapoverview},
2536\helpref{wxICON}{wxiconmacro}
a660d684 2537
b0fc8832 2538\wxheading{Include files}
954b8ae6 2539
b0fc8832 2540<wx/gdicmn.h>
a660d684 2541
84ed77ef 2542
b0fc8832 2543\membersection{::wxClientDisplayRect}\label{wxclientdisplayrect}
a660d684 2544
b0fc8832
VZ
2545\func{void}{wxClientDisplayRect}{\param{int *}{x}, \param{int *}{y},
2546\param{int *}{width}, \param{int *}{height}}
954b8ae6 2547
b0fc8832 2548\func{wxRect}{wxGetClientDisplayRect}{\void}
954b8ae6 2549
b0fc8832
VZ
2550Returns the dimensions of the work area on the display. On Windows
2551this means the area not covered by the taskbar, etc. Other platforms
2552are currently defaulting to the whole display until a way is found to
2553provide this info for all window managers, etc.
a660d684 2554
84ed77ef 2555
b0fc8832 2556\membersection{::wxColourDisplay}\label{wxcolourdisplay}
a660d684 2557
b0fc8832 2558\func{bool}{wxColourDisplay}{\void}
a660d684 2559
cc81d32f 2560Returns true if the display is colour, false otherwise.
a660d684 2561
84ed77ef 2562
b0fc8832 2563\membersection{::wxDisplayDepth}\label{wxdisplaydepth}
954b8ae6 2564
b0fc8832 2565\func{int}{wxDisplayDepth}{\void}
954b8ae6 2566
b0fc8832 2567Returns the depth of the display (a value of 1 denotes a monochrome display).
a660d684 2568
84ed77ef 2569
b0fc8832 2570\membersection{::wxDisplaySize}\label{wxdisplaysize}
a660d684 2571
b0fc8832 2572\func{void}{wxDisplaySize}{\param{int *}{width}, \param{int *}{height}}
a660d684 2573
b0fc8832 2574\func{wxSize}{wxGetDisplaySize}{\void}
a660d684 2575
b0fc8832 2576Returns the display size in pixels.
a660d684 2577
84ed77ef 2578
b0fc8832 2579\membersection{::wxDisplaySizeMM}\label{wxdisplaysizemm}
a660d684 2580
b0fc8832 2581\func{void}{wxDisplaySizeMM}{\param{int *}{width}, \param{int *}{height}}
a660d684 2582
b0fc8832 2583\func{wxSize}{wxGetDisplaySizeMM}{\void}
a660d684 2584
b0fc8832 2585Returns the display size in millimeters.
e2a6f233 2586
84ed77ef 2587
b0fc8832 2588\membersection{::wxDROP\_ICON}\label{wxdropicon}
e2a6f233 2589
b0fc8832 2590\func{wxIconOrCursor}{wxDROP\_ICON}{\param{const char *}{name}}
e2a6f233 2591
b0fc8832
VZ
2592This macro creates either a cursor (MSW) or an icon (elsewhere) with the given
2593name. Under MSW, the cursor is loaded from the resource file and the icon is
2594loaded from XPM file under other platforms.
2595
2596This macro should be used with
2597\helpref{wxDropSource constructor}{wxdropsourcewxdropsource}.
e2a6f233 2598
954b8ae6
JS
2599\wxheading{Include files}
2600
b0fc8832 2601<wx/dnd.h>
954b8ae6 2602
84ed77ef 2603
b0fc8832 2604\membersection{wxICON}\label{wxiconmacro}
e2a6f233 2605
b0fc8832 2606\func{}{wxICON}{iconName}
e2a6f233 2607
b0fc8832
VZ
2608This macro loads an icon from either application resources (on the platforms
2609for which they exist, i.e. Windows and OS2) or from an XPM file. It allows to
2610avoid using {\tt \#ifdef}s when creating icons.
e2a6f233 2611
b0fc8832 2612\wxheading{See also}
e2a6f233 2613
b0fc8832
VZ
2614\helpref{Bitmaps and icons overview}{wxbitmapoverview},
2615\helpref{wxBITMAP}{wxbitmapmacro}
e2a6f233 2616
954b8ae6
JS
2617\wxheading{Include files}
2618
b0fc8832 2619<wx/gdicmn.h>
a660d684 2620
84ed77ef 2621
b0fc8832 2622\membersection{::wxMakeMetafilePlaceable}\label{wxmakemetafileplaceable}
de6019fb 2623
b0fc8832
VZ
2624\func{bool}{wxMakeMetafilePlaceable}{\param{const wxString\& }{filename}, \param{int }{minX}, \param{int }{minY},
2625 \param{int }{maxX}, \param{int }{maxY}, \param{float }{scale=1.0}}
a660d684 2626
b0fc8832
VZ
2627Given a filename for an existing, valid metafile (as constructed using \helpref{wxMetafileDC}{wxmetafiledc})
2628makes it into a placeable metafile by prepending a header containing the given
2629bounding box. The bounding box may be obtained from a device context after drawing
2630into it, using the functions wxDC::MinX, wxDC::MinY, wxDC::MaxX and wxDC::MaxY.
a660d684 2631
b0fc8832
VZ
2632In addition to adding the placeable metafile header, this function adds
2633the equivalent of the following code to the start of the metafile data:
a660d684 2634
b0fc8832
VZ
2635\begin{verbatim}
2636 SetMapMode(dc, MM_ANISOTROPIC);
2637 SetWindowOrg(dc, minX, minY);
2638 SetWindowExt(dc, maxX - minX, maxY - minY);
2639\end{verbatim}
6fb26ea3 2640
fc2171bd 2641This simulates the wxMM\_TEXT mapping mode, which wxWidgets assumes.
954b8ae6 2642
b0fc8832
VZ
2643Placeable metafiles may be imported by many Windows applications, and can be
2644used in RTF (Rich Text Format) files.
954b8ae6 2645
b0fc8832 2646{\it scale} allows the specification of scale for the metafile.
a660d684 2647
b0fc8832 2648This function is only available under Windows.
a660d684 2649
84ed77ef 2650
b0fc8832 2651\membersection{::wxSetCursor}\label{wxsetcursor}
a660d684 2652
2766de13
JS
2653\func{void}{wxSetCursor}{\param{const wxCursor\&}{ cursor}}
2654
2655Globally sets the cursor; only has an effect on Windows, Mac and GTK+. You should
2656call this function with wxNullCursor to restore the system cursor.
954b8ae6 2657
b0fc8832 2658See also \helpref{wxCursor}{wxcursor}, \helpref{wxWindow::SetCursor}{wxwindowsetcursor}.
954b8ae6 2659
84ed77ef
VZ
2660
2661
b0fc8832 2662\section{Printer settings}\label{printersettings}
8e193f38 2663
2bd25c5a 2664{\bf NB:} These routines are obsolete and should no longer be used!
8e193f38 2665
b0fc8832
VZ
2666The following functions are used to control PostScript printing. Under
2667Windows, PostScript output can only be sent to a file.
8e193f38
VZ
2668
2669\wxheading{Include files}
2670
b0fc8832 2671<wx/dcps.h>
a660d684 2672
84ed77ef 2673
b0fc8832 2674\membersection{::wxGetPrinterCommand}\label{wxgetprintercommand}
a660d684 2675
b0fc8832 2676\func{wxString}{wxGetPrinterCommand}{\void}
a660d684 2677
b0fc8832 2678Gets the printer command used to print a file. The default is {\tt lpr}.
a660d684 2679
84ed77ef 2680
b0fc8832 2681\membersection{::wxGetPrinterFile}\label{wxgetprinterfile}
a660d684 2682
b0fc8832 2683\func{wxString}{wxGetPrinterFile}{\void}
a660d684 2684
b0fc8832 2685Gets the PostScript output filename.
a660d684 2686
84ed77ef 2687
b0fc8832 2688\membersection{::wxGetPrinterMode}\label{wxgetprintermode}
a660d684 2689
b0fc8832 2690\func{int}{wxGetPrinterMode}{\void}
954b8ae6 2691
b0fc8832
VZ
2692Gets the printing mode controlling where output is sent (PS\_PREVIEW, PS\_FILE or PS\_PRINTER).
2693The default is PS\_PREVIEW.
954b8ae6 2694
84ed77ef 2695
b0fc8832 2696\membersection{::wxGetPrinterOptions}\label{wxgetprinteroptions}
954b8ae6 2697
b0fc8832 2698\func{wxString}{wxGetPrinterOptions}{\void}
954b8ae6 2699
b0fc8832 2700Gets the additional options for the print command (e.g. specific printer). The default is nothing.
954b8ae6 2701
84ed77ef 2702
b0fc8832 2703\membersection{::wxGetPrinterOrientation}\label{wxgetprinterorientation}
954b8ae6 2704
b0fc8832 2705\func{int}{wxGetPrinterOrientation}{\void}
a660d684 2706
b0fc8832 2707Gets the orientation (PS\_PORTRAIT or PS\_LANDSCAPE). The default is PS\_PORTRAIT.
a660d684 2708
84ed77ef 2709
b0fc8832 2710\membersection{::wxGetPrinterPreviewCommand}\label{wxgetprinterpreviewcommand}
8e193f38 2711
b0fc8832 2712\func{wxString}{wxGetPrinterPreviewCommand}{\void}
a660d684 2713
b0fc8832 2714Gets the command used to view a PostScript file. The default depends on the platform.
954b8ae6 2715
84ed77ef 2716
b0fc8832 2717\membersection{::wxGetPrinterScaling}\label{wxgetprinterscaling}
954b8ae6 2718
b0fc8832 2719\func{void}{wxGetPrinterScaling}{\param{float *}{x}, \param{float *}{y}}
a660d684 2720
b0fc8832 2721Gets the scaling factor for PostScript output. The default is 1.0, 1.0.
a660d684 2722
84ed77ef 2723
b0fc8832 2724\membersection{::wxGetPrinterTranslation}\label{wxgetprintertranslation}
a660d684 2725
b0fc8832 2726\func{void}{wxGetPrinterTranslation}{\param{float *}{x}, \param{float *}{y}}
954b8ae6 2727
b0fc8832 2728Gets the translation (from the top left corner) for PostScript output. The default is 0.0, 0.0.
954b8ae6 2729
84ed77ef 2730
b0fc8832 2731\membersection{::wxSetPrinterCommand}\label{wxsetprintercommand}
a660d684 2732
b0fc8832 2733\func{void}{wxSetPrinterCommand}{\param{const wxString\& }{command}}
a660d684 2734
b0fc8832 2735Sets the printer command used to print a file. The default is {\tt lpr}.
a660d684 2736
84ed77ef 2737
b0fc8832 2738\membersection{::wxSetPrinterFile}\label{wxsetprinterfile}
cd6ce4a9 2739
b0fc8832 2740\func{void}{wxSetPrinterFile}{\param{const wxString\& }{filename}}
f6bcfd97 2741
b0fc8832 2742Sets the PostScript output filename.
a660d684 2743
84ed77ef 2744
b0fc8832 2745\membersection{::wxSetPrinterMode}\label{wxsetprintermode}
a660d684 2746
b0fc8832 2747\func{void}{wxSetPrinterMode}{\param{int }{mode}}
a660d684 2748
b0fc8832
VZ
2749Sets the printing mode controlling where output is sent (PS\_PREVIEW, PS\_FILE or PS\_PRINTER).
2750The default is PS\_PREVIEW.
cd6ce4a9 2751
84ed77ef 2752
b0fc8832 2753\membersection{::wxSetPrinterOptions}\label{wxsetprinteroptions}
a660d684 2754
b0fc8832 2755\func{void}{wxSetPrinterOptions}{\param{const wxString\& }{options}}
e6045e08 2756
b0fc8832 2757Sets the additional options for the print command (e.g. specific printer). The default is nothing.
a660d684 2758
84ed77ef 2759
b0fc8832 2760\membersection{::wxSetPrinterOrientation}\label{wxsetprinterorientation}
eafc087e 2761
b0fc8832 2762\func{void}{wxSetPrinterOrientation}{\param{int}{ orientation}}
cd6ce4a9 2763
b0fc8832 2764Sets the orientation (PS\_PORTRAIT or PS\_LANDSCAPE). The default is PS\_PORTRAIT.
a660d684 2765
84ed77ef 2766
b0fc8832 2767\membersection{::wxSetPrinterPreviewCommand}\label{wxsetprinterpreviewcommand}
954b8ae6 2768
b0fc8832 2769\func{void}{wxSetPrinterPreviewCommand}{\param{const wxString\& }{command}}
954b8ae6 2770
b0fc8832 2771Sets the command used to view a PostScript file. The default depends on the platform.
a660d684 2772
84ed77ef 2773
b0fc8832 2774\membersection{::wxSetPrinterScaling}\label{wxsetprinterscaling}
a660d684 2775
b0fc8832 2776\func{void}{wxSetPrinterScaling}{\param{float }{x}, \param{float }{y}}
a660d684 2777
b0fc8832 2778Sets the scaling factor for PostScript output. The default is 1.0, 1.0.
954b8ae6 2779
84ed77ef 2780
b0fc8832 2781\membersection{::wxSetPrinterTranslation}\label{wxsetprintertranslation}
954b8ae6 2782
b0fc8832 2783\func{void}{wxSetPrinterTranslation}{\param{float }{x}, \param{float }{y}}
a660d684 2784
b0fc8832 2785Sets the translation (from the top left corner) for PostScript output. The default is 0.0, 0.0.
a660d684 2786
84ed77ef
VZ
2787
2788
b0fc8832
VZ
2789\section{Clipboard functions}\label{clipsboard}
2790
2791These clipboard functions are implemented for Windows only. The use of these functions
2792is deprecated and the code is no longer maintained. Use the \helpref{wxClipboard}{wxclipboard}
2793class instead.
a660d684 2794
954b8ae6
JS
2795\wxheading{Include files}
2796
b0fc8832 2797<wx/clipbrd.h>
954b8ae6 2798
84ed77ef 2799
f4fcc291 2800\membersection{::wxClipboardOpen}\label{functionwxclipboardopen}
a660d684 2801
b0fc8832 2802\func{bool}{wxClipboardOpen}{\void}
a660d684 2803
cc81d32f 2804Returns true if this application has already opened the clipboard.
a660d684 2805
84ed77ef 2806
b0fc8832 2807\membersection{::wxCloseClipboard}\label{wxcloseclipboard}
954b8ae6 2808
b0fc8832 2809\func{bool}{wxCloseClipboard}{\void}
954b8ae6 2810
b0fc8832 2811Closes the clipboard to allow other applications to use it.
a660d684 2812
84ed77ef 2813
b0fc8832 2814\membersection{::wxEmptyClipboard}\label{wxemptyclipboard}
a660d684 2815
b0fc8832 2816\func{bool}{wxEmptyClipboard}{\void}
a660d684 2817
b0fc8832 2818Empties the clipboard.
954b8ae6 2819
84ed77ef 2820
b0fc8832 2821\membersection{::wxEnumClipboardFormats}\label{wxenumclipboardformats}
954b8ae6 2822
e7dfcb8e 2823\func{int}{wxEnumClipboardFormats}{\param{int}{ dataFormat}}
a660d684 2824
b0fc8832
VZ
2825Enumerates the formats found in a list of available formats that belong
2826to the clipboard. Each call to this function specifies a known
2827available format; the function returns the format that appears next in
2828the list.
a660d684 2829
b0fc8832
VZ
2830{\it dataFormat} specifies a known format. If this parameter is zero,
2831the function returns the first format in the list.
a660d684 2832
b0fc8832
VZ
2833The return value specifies the next known clipboard data format if the
2834function is successful. It is zero if the {\it dataFormat} parameter specifies
2835the last format in the list of available formats, or if the clipboard
2836is not open.
a660d684 2837
b0fc8832
VZ
2838Before it enumerates the formats function, an application must open the clipboard by using the
2839wxOpenClipboard function.
954b8ae6 2840
84ed77ef 2841
b0fc8832 2842\membersection{::wxGetClipboardData}\label{wxgetclipboarddata}
954b8ae6 2843
e7dfcb8e 2844\func{wxObject *}{wxGetClipboardData}{\param{int}{ dataFormat}}
26a80c22 2845
b0fc8832 2846Gets data from the clipboard.
26a80c22 2847
b0fc8832 2848{\it dataFormat} may be one of:
26a80c22 2849
b0fc8832
VZ
2850\begin{itemize}\itemsep=0pt
2851\item wxCF\_TEXT or wxCF\_OEMTEXT: returns a pointer to new memory containing a null-terminated text string.
2852\item wxCF\_BITMAP: returns a new wxBitmap.
2853\end{itemize}
26a80c22 2854
b0fc8832 2855The clipboard must have previously been opened for this call to succeed.
26a80c22 2856
84ed77ef 2857
b0fc8832 2858\membersection{::wxGetClipboardFormatName}\label{wxgetclipboardformatname}
26a80c22 2859
e7dfcb8e 2860\func{bool}{wxGetClipboardFormatName}{\param{int}{ dataFormat}, \param{const wxString\& }{formatName}, \param{int}{ maxCount}}
a660d684 2861
b0fc8832
VZ
2862Gets the name of a registered clipboard format, and puts it into the buffer {\it formatName} which is of maximum
2863length {\it maxCount}. {\it dataFormat} must not specify a predefined clipboard format.
a660d684 2864
84ed77ef 2865
b0fc8832 2866\membersection{::wxIsClipboardFormatAvailable}\label{wxisclipboardformatavailable}
a660d684 2867
e7dfcb8e 2868\func{bool}{wxIsClipboardFormatAvailable}{\param{int}{ dataFormat}}
954b8ae6 2869
cc81d32f 2870Returns true if the given data format is available on the clipboard.
954b8ae6 2871
84ed77ef 2872
b0fc8832 2873\membersection{::wxOpenClipboard}\label{wxopenclipboard}
a660d684 2874
b0fc8832 2875\func{bool}{wxOpenClipboard}{\void}
a660d684 2876
b0fc8832 2877Opens the clipboard for passing data to it or getting data from it.
a660d684 2878
84ed77ef 2879
b0fc8832 2880\membersection{::wxRegisterClipboardFormat}\label{wxregisterclipboardformat}
954b8ae6 2881
b0fc8832 2882\func{int}{wxRegisterClipboardFormat}{\param{const wxString\& }{formatName}}
954b8ae6 2883
b0fc8832 2884Registers the clipboard data format name and returns an identifier.
a660d684 2885
84ed77ef 2886
b0fc8832 2887\membersection{::wxSetClipboardData}\label{wxsetclipboarddata}
a660d684 2888
e7dfcb8e 2889\func{bool}{wxSetClipboardData}{\param{int}{ dataFormat}, \param{wxObject*}{ data}, \param{int}{ width}, \param{int}{ height}}
c51deffc 2890
b0fc8832 2891Passes data to the clipboard.
c51deffc 2892
b0fc8832 2893{\it dataFormat} may be one of:
a660d684 2894
b0fc8832
VZ
2895\begin{itemize}\itemsep=0pt
2896\item wxCF\_TEXT or wxCF\_OEMTEXT: {\it data} is a null-terminated text string.
2897\item wxCF\_BITMAP: {\it data} is a wxBitmap.
2898\item wxCF\_DIB: {\it data} is a wxBitmap. The bitmap is converted to a DIB (device independent bitmap).
2899\item wxCF\_METAFILE: {\it data} is a wxMetafile. {\it width} and {\it height} are used to give recommended dimensions.
2900\end{itemize}
954b8ae6 2901
b0fc8832 2902The clipboard must have previously been opened for this call to succeed.
954b8ae6 2903
4104ed92 2904
6d98f963 2905\section{Miscellaneous functions and macros}\label{miscellany}
a660d684 2906
84ed77ef 2907
4db03d26
VZ
2908\membersection{wxBase64Decode}\label{wxbase64decode}
2909
6af76942
VZ
2910\func{size\_t}{wxBase64Decode}{\param{void *}{dst}, \param{size\_t }{dstLen},
2911\param{const char * }{src}, \param{size\_t }{srcLen = wxNO\_LEN},
2912\param{wxBase64DecodeMode }{mode = wxBase64DecodeMode\_Strict},
4db03d26
VZ
2913\param{size\_t }{*posErr = \NULL}}
2914
2915\func{wxMemoryBuffer}{wxBase64Decode}{\\
2916\param{const char * }{src}, \param{size\_t }{srcLen = wxNO\_LEN},\\
2917\param{wxBase64DecodeMode }{mode = wxBase64DecodeMode\_Strict},\\
2918\param{size\_t }{*posErr = \NULL}}
2919
e3408b70
VZ
2920\func{wxMemoryBuffer}{wxBase64Decode}{\\
2921\param{const wxString\& }{src},\\
2922\param{wxBase64DecodeMode }{mode = wxBase64DecodeMode\_Strict},\\
2923\param{size\_t }{*posErr = \NULL}}
2924
4db03d26
VZ
2925These function decode a Base64-encoded string. The first version is a raw
2926decoding function and decodes the data into the provided buffer \arg{dst} of
2927the given size \arg{dstLen}. An error is returned if the buffer is not large
2928enough -- that is not at least \helpref{wxBase64DecodedSize(srcLen)}{wxbase64decodedsize}
2929bytes. The second version allocates memory internally and returns it as
2930\helpref{wxMemoryBuffer}{wxmemorybuffer} and is recommended for normal use.
2931
2932The first version returns the number of bytes written to the buffer or the
2933necessary buffer size if \arg{dst} was \NULL or \texttt{wxCONV\_FAILED} on
2934error, e.g. if the output buffer is too small or invalid characters were
2935encountered in the input string. The second version returns a buffer with the
2936base64 decoded binary equivalent of the input string. In neither case is the
2937buffer NUL-terminated.
2938
2939\wxheading{Parameters}
2940
2941\docparam{dst}{Pointer to output buffer, may be \NULL to just compute the
2942necessary buffer size.}
2943
2944\docparam{dstLen}{The size of the output buffer, ignored if \arg{dst} is
2945\NULL.}
2946
e3408b70
VZ
2947\docparam{src}{The input string, must not be \NULL. For the version using
2948wxString, the input string should contain only ASCII characters.}
4db03d26
VZ
2949
2950\docparam{srcLen}{The length of the input string or special value
2951\texttt{wxNO\_LEN} if the string is \NUL-terminated and the length should be
2952computed by this function itself.}
2953
2954\docparam{mode}{This parameter specifies the function behaviour when invalid
2955characters are encountered in input. By default, any such character stops the
2956decoding with error. If the mode is wxBase64DecodeMode\_SkipWS, then the white
2957space characters are silently skipped instead. And if it is
2958wxBase64DecodeMode\_Relaxed, then all invalid characters are skipped.}
2959
2960\docparam{posErr}{If this pointer is non-\NULL and an error occurs during
2961decoding, it is filled with the index of the invalid character.}
2962
2963\wxheading{Include files}
2964
2965<wx/base64.h>
2966
2967
2968\membersection{wxBase64DecodedSize}\label{wxbase64decodedsize}
2969
2970\func{size\_t}{wxBase64DecodedSize}{\param{size\_t }{srcLen}}
2971
2972Returns the size of the buffer necessary to contain the data encoded in a
2973base64 string of length \arg{srcLen}. This can be useful for allocating a
2974buffer to be passed to \helpref{wxBase64Decode}{wxbase64decode}.
2975
2976
2977\membersection{wxBase64Encode}\label{wxbase64encode}
2978
6af76942 2979\func{size\_t}{wxBase64Encode}{\param{char *}{dst}, \param{size\_t }{dstLen},
4db03d26
VZ
2980\param{const void *}{src}, \param{size\_t }{srcLen}}
2981
6af76942 2982\func{wxString}{wxBase64Encode}{\param{const void *}{src}, \param{size\_t }{srcLen}}
4db03d26
VZ
2983
2984\func{wxString}{wxBase64Encode}{\param{const wxMemoryBuffer\& }{buf}}
2985
2986These functions encode the given data using base64. The first of them is the
2987raw encoding function writing the output string into provided buffer while the
2988other ones return the output as wxString. There is no error return for these
2989functions except for the first one which returns \texttt{wxCONV\_FAILED} if the
2990output buffer is too small. To allocate the buffer of the correct size, use
2991\helpref{wxBase64EncodedSize}{wxbase64encodedsize} or call this function with
2992\arg{dst} set to \NULL -- it will then return the necessary buffer size.
2993
2994\wxheading{Parameters}
2995
2996\docparam{dst}{The output buffer, may be \NULL to retrieve the needed buffer
2997size.}
2998
2999\docparam{dstLen}{The output buffer size, ignored if \arg{dst} is \NULL.}
3000
3001\docparam{src}{The input buffer, must not be \NULL.}
3002
3003\docparam{srcLen}{The length of the input data.}
3004
3005\wxheading{Include files}
3006
3007<wx/base64.h>
3008
3009
3010\membersection{wxBase64EncodedSize}\label{wxbase64encodedsize}
3011
6af76942 3012\func{size\_t}{wxBase64EncodedSize}{\param{size\_t }{len}}
4db03d26
VZ
3013
3014Returns the length of the string with base64 representation of a buffer of
3015specified size \arg{len}. This can be useful for allocating the buffer passed
3016to \helpref{wxBase64Encode}{wxbase64encode}.
3017
3018
3c595496
VZ
3019\membersection{wxCONCAT}\label{wxconcat}
3020
1894e49f 3021\func{}{wxCONCAT}{\param{}{x1}, \param{}{x2}}
3c595496 3022
1894e49f
VZ
3023\func{}{wxCONCAT3}{\param{}{x1}, \param{}{x2}, \param{}{x3}}
3024
3025\func{}{wxCONCAT4}{\param{}{x1}, \param{}{x2}, \param{}{x3}, \param{}{x4}}
3026
3027\func{}{wxCONCAT5}{\param{}{x1}, \param{}{x2}, \param{}{x3}, \param{}{x4}, \param{}{x5}}
3028
3029These macro return the concatenation of the tokens passed as their arguments.
3030Unlike when using the preprocessor \texttt{##} operator, the arguments undergo
3031the macro expansion before being concatenated.
3c595496
VZ
3032
3033
a57f7612
FM
3034\membersection{wxDECLARE\_APP}\label{wxdeclareapp}
3035
3036\func{}{wxDECLARE\_APP}{className}
3037
3038This is used in headers to create a forward declaration of the
3039\helpref{wxGetApp}{wxgetapp} function implemented by
3040\helpref{wxIMPLEMENT\_APP}{wximplementapp}. It creates the declaration
3041{\tt className\& wxGetApp(void)}.
3042
3043Example:
3044
3045\begin{verbatim}
3046 wxDECLARE_APP(MyApp)
3047\end{verbatim}
3048
3049\wxheading{Include files}
3050
3051<wx/app.h>
3052
3053
4104ed92
VZ
3054\membersection{wxDYNLIB\_FUNCTION}\label{wxdynlibfunction}
3055
3056\func{}{wxDYNLIB\_FUNCTION}{\param{}{type}, \param{}{name}, \param{}{dynlib}}
3057
8ea92b4d 3058When loading a function from a DLL you always have to cast the returned
b325f27f 3059{\tt void *} pointer to the correct type and, even more annoyingly, you have to
4104ed92
VZ
3060repeat this type twice if you want to declare and define a function pointer all
3061in one line
3062
3063This macro makes this slightly less painful by allowing you to specify the
3064type only once, as the first parameter, and creating a variable of this type
3065named after the function but with {\tt pfn} prefix and initialized with the
8ea92b4d 3066function \arg{name} from the \helpref{wxDynamicLibrary}{wxdynamiclibrary}
4104ed92
VZ
3067\arg{dynlib}.
3068
3069\wxheading{Parameters}
3070
3071\docparam{type}{the type of the function}
3072
3073\docparam{name}{the name of the function to load, not a string (without quotes,
3074it is quoted automatically by the macro)}
3075
3076\docparam{dynlib}{the library to load the function from}
3077
3078
84ed77ef 3079
5d88a6b5
VZ
3080\membersection{wxDEPRECATED}\label{wxdeprecated}
3081
3082This macro can be used around a function declaration to generate warnings
3083indicating that this function is deprecated (i.e. obsolete and planned to be
3084removed in the future) when it is used. Only Visual C++ 7 and higher and g++
3085compilers currently support this functionality.
3086
3087Example of use:
3088\begin{verbatim}
3089 // old function, use wxString version instead
3090 wxDEPRECATED( void wxGetSomething(char *buf, size_t len) );
3091
3092 // ...
3093 wxString wxGetSomething();
3094\end{verbatim}
3095
3096
3097\membersection{wxDEPRECATED\_BUT\_USED\_INTERNALLY}\label{wxdeprecatedbutusedinternally}
3098
3099This is a special version of \helpref{wxDEPRECATED}{wxdeprecated} macro which
3100only does something when the deprecated function is used from the code outside
3101wxWidgets itself but doesn't generate warnings when it is used from wxWidgets.
3102It is used with the virtual functions which are called by the library itself --
3103even if such function is deprecated the library still has to call it to ensure
3104that the existing code overriding it continues to work, but the use of this
3105macro ensures that a deprecation warning will be generated if this function is
3106used from the user code or, in case of Visual C++, even when it is simply
3107overridden.
3108
3109
3694bb76
VZ
3110\membersection{wxDEPRECATED\_INLINE}\label{wxdeprecatedinline}
3111
3112\func{}{wxDEPRECATED\_INLINE}{\param{}{func}, \param{}{body}}
3113
3114This macro is similar to \helpref{wxDEPRECATED}{wxdeprecated} but can be used
3115to not only declare the function \arg{func} as deprecated but to also provide
3116its (inline) implementation \arg{body}.
3117
3118It can be used as following:
3119\begin{verbatim}
3120 class wxFoo
3121 {
3122 public:
3123 // OldMethod() is deprecated, use NewMethod() instead
3124 void NewMethod();
3125 wxDEPRECATED_INLINE( void OldMethod(), NewMethod() );
3126 };
3127\end{verbatim}
3128
986ecc86
VZ
3129\membersection{wxEXPLICIT}\label{wxexplicit}
3130
3131{\tt wxEXPLICIT} is a macro which expands to the C++ {\tt explicit} keyword if
3132the compiler supports it or nothing otherwise. Thus, it can be used even in the
3133code which might have to be compiled with an old compiler without support for
3134this language feature but still take advantage of it when it is available.
3135
84ed77ef 3136
6445acc7 3137
f52d9e92
VZ
3138\membersection{::wxGetKeyState}\label{wxgetkeystate}
3139
1751226c 3140\func{bool}{wxGetKeyState}{\param{wxKeyCode }{key}}
f52d9e92 3141
44353523
VZ
3142For normal keys, returns \true if the specified key is currently down.
3143
3144For togglable keys (Caps Lock, Num Lock and Scroll Lock), returns
3145\true if the key is toggled such that its LED indicator is lit. There is
3146currently no way to test whether togglable keys are up or down.
3147
3148Even though there are virtual key codes defined for mouse buttons, they
3149cannot be used with this function currently.
f52d9e92
VZ
3150
3151\wxheading{Include files}
3152
3153<wx/utils.h>
3154
3155
2b5f62a0
VZ
3156\membersection{wxLL}\label{wxll}
3157
3158\func{wxLongLong\_t}{wxLL}{\param{}{number}}
3159
3160This macro is defined for the platforms with a native 64 bit integer type and
3161allows to define 64 bit compile time constants:
3162
3163\begin{verbatim}
3164 #ifdef wxLongLong_t
3165 wxLongLong_t ll = wxLL(0x1234567890abcdef);
3166 #endif
3167\end{verbatim}
3168
3169\wxheading{Include files}
3170
3171<wx/longlong.h>
3172
84ed77ef
VZ
3173\wxheading{See also}
3174
3175\helpref{wxULL}{wxull}, \helpref{wxLongLong}{wxlonglong}
3176
3177
2b5f62a0
VZ
3178\membersection{wxLongLongFmtSpec}\label{wxlonglongfmtspec}
3179
3180This macro is defined to contain the {\tt printf()} format specifier using
3181which 64 bit integer numbers (i.e. those of type {\tt wxLongLong\_t}) can be
3182printed. Example of using it:
3183
3184\begin{verbatim}
3185 #ifdef wxLongLong_t
3186 wxLongLong_t ll = wxLL(0x1234567890abcdef);
3187 printf("Long long = %" wxLongLongFmtSpec "x\n", ll);
3188 #endif
3189\end{verbatim}
3190
3191\wxheading{See also}
3192
3193\helpref{wxLL}{wxll}
3194
3195\wxheading{Include files}
3196
3197<wx/longlong.h>
3198
84ed77ef 3199
b0fc8832 3200\membersection{::wxNewId}\label{wxnewid}
a660d684 3201
b0fc8832
VZ
3202\func{long}{wxNewId}{\void}
3203
15c6269f
VZ
3204This function is deprecated as the ids generated by it can conflict with the
3205ids defined by the user code, use \texttt{wxID\_ANY} to assign ids which are
3206guaranteed to not conflict with the user-defined ids for the controls and menu
3207items you create instead of using this function.
3208
3209
b0fc8832 3210Generates an integer identifier unique to this run of the program.
a660d684 3211
954b8ae6
JS
3212\wxheading{Include files}
3213
3214<wx/utils.h>
3215
84ed77ef 3216
1a64b24d
VZ
3217\membersection{wxON\_BLOCK\_EXIT}\label{wxonblockexit}
3218
3219\func{}{wxON\_BLOCK\_EXIT0}{\param{}{func}}
6af76942 3220
1a64b24d 3221\func{}{wxON\_BLOCK\_EXIT1}{\param{}{func}, \param{}{p1}}
6af76942 3222
1a64b24d
VZ
3223\func{}{wxON\_BLOCK\_EXIT2}{\param{}{func}, \param{}{p1}, \param{}{p2}}
3224
3225This family of macros allows to ensure that the global function \arg{func}
3226with 0, 1, 2 or more parameters (up to some implementaton-defined limit) is
3227executed on scope exit, whether due to a normal function return or because an
3228exception has been thrown. A typical example of its usage:
3229\begin{verbatim}
3230 void *buf = malloc(size);
3231 wxON_BLOCK_EXIT1(free, buf);
3232\end{verbatim}
3233
3234Please see the original article by Andrei Alexandrescu and Petru Marginean
3235published in December 2000 issue of \emph{C/C++ Users Journal} for more
3236details.
3237
3238\wxheading{Include files}
3239
3240<wx/scopeguard.h>
3241
3242\wxheading{See also}
3243
3244\helpref{wxON\_BLOCK\_EXIT\_OBJ}{wxonblockexitobj}
3245
3246
3247\membersection{wxON\_BLOCK\_EXIT\_OBJ}\label{wxonblockexitobj}
3248
3249\func{}{wxON\_BLOCK\_EXIT\_OBJ0}{\param{}{obj}, \param{}{method}}
6af76942 3250
1a64b24d 3251\func{}{wxON\_BLOCK\_EXIT\_OBJ1}{\param{}{obj}, \param{}{method}, \param{}{p1}}
6af76942 3252
1a64b24d
VZ
3253\func{}{wxON\_BLOCK\_EXIT\_OBJ2}{\param{}{obj}, \param{}{method}, \param{}{p1}, \param{}{p2}}
3254
ce045aed 3255This family of macros is similar to \helpref{wxON\_BLOCK\_EXIT}{wxonblockexit}
1a64b24d
VZ
3256but calls a method of the given object instead of a free function.
3257
3258\wxheading{Include files}
3259
3260<wx/scopeguard.h>
3261
3262
b0fc8832 3263\membersection{::wxRegisterId}\label{wxregisterid}
a660d684 3264
b0fc8832 3265\func{void}{wxRegisterId}{\param{long}{ id}}
a660d684 3266
b0fc8832
VZ
3267Ensures that ids subsequently generated by {\bf NewId} do not clash with
3268the given {\bf id}.
a660d684 3269
954b8ae6
JS
3270\wxheading{Include files}
3271
3272<wx/utils.h>
3273
84ed77ef 3274
b0fc8832 3275\membersection{::wxDDECleanUp}\label{wxddecleanup}
bdc72a22 3276
b0fc8832 3277\func{void}{wxDDECleanUp}{\void}
bdc72a22 3278
fc2171bd 3279Called when wxWidgets exits, to clean up the DDE system. This no longer needs to be
b0fc8832 3280called by the application.
bdc72a22 3281
b0fc8832 3282See also \helpref{wxDDEInitialize}{wxddeinitialize}.
bdc72a22
VZ
3283
3284\wxheading{Include files}
3285
b0fc8832 3286<wx/dde.h>
a660d684 3287
84ed77ef 3288
b0fc8832 3289\membersection{::wxDDEInitialize}\label{wxddeinitialize}
a660d684 3290
b0fc8832 3291\func{void}{wxDDEInitialize}{\void}
a660d684 3292
b0fc8832 3293Initializes the DDE system. May be called multiple times without harm.
a660d684 3294
b0fc8832 3295This no longer needs to be called by the application: it will be called
fc2171bd 3296by wxWidgets if necessary.
bdc72a22 3297
d2c2afc9 3298See also \helpref{wxDDEServer}{wxddeserver}, \helpref{wxDDEClient}{wxddeclient}, \helpref{wxDDEConnection}{wxddeconnection},\rtfsp
b0fc8832 3299\helpref{wxDDECleanUp}{wxddecleanup}.
bdc72a22 3300
954b8ae6
JS
3301\wxheading{Include files}
3302
b0fc8832 3303<wx/dde.h>
a660d684 3304
84ed77ef 3305
b0fc8832 3306\membersection{::wxEnableTopLevelWindows}\label{wxenabletoplevelwindows}
a660d684 3307
08890e27 3308\func{void}{wxEnableTopLevelWindows}{\param{bool}{ enable = true}}
a660d684 3309
b0fc8832
VZ
3310This function enables or disables all top level windows. It is used by
3311\helpref{::wxSafeYield}{wxsafeyield}.
a660d684 3312
954b8ae6
JS
3313\wxheading{Include files}
3314
3315<wx/utils.h>
3316
84ed77ef 3317
b0fc8832 3318\membersection{::wxFindMenuItemId}\label{wxfindmenuitemid}
a660d684 3319
b0fc8832 3320\func{int}{wxFindMenuItemId}{\param{wxFrame *}{frame}, \param{const wxString\& }{menuString}, \param{const wxString\& }{itemString}}
a660d684 3321
b0fc8832 3322Find a menu item identifier associated with the given frame's menu bar.
a660d684 3323
954b8ae6
JS
3324\wxheading{Include files}
3325
3326<wx/utils.h>
3327
84ed77ef 3328
b0fc8832 3329\membersection{::wxFindWindowByLabel}\label{wxfindwindowbylabel}
c51deffc 3330
b0fc8832 3331\func{wxWindow *}{wxFindWindowByLabel}{\param{const wxString\& }{label}, \param{wxWindow *}{parent=NULL}}
c51deffc 3332
b829bf55 3333{\bf NB:} This function is obsolete, please use
146ba0fe
VZ
3334\helpref{wxWindow::FindWindowByLabel}{wxwindowfindwindowbylabel} instead.
3335
b0fc8832
VZ
3336Find a window by its label. Depending on the type of window, the label may be a window title
3337or panel item label. If {\it parent} is NULL, the search will start from all top-level
3338frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.
3339The search is recursive in both cases.
c51deffc
VZ
3340
3341\wxheading{Include files}
3342
3343<wx/utils.h>
3344
84ed77ef 3345
b0fc8832
VZ
3346\membersection{::wxFindWindowByName}\label{wxfindwindowbyname}
3347
3348\func{wxWindow *}{wxFindWindowByName}{\param{const wxString\& }{name}, \param{wxWindow *}{parent=NULL}}
a660d684 3349
b829bf55 3350{\bf NB:} This function is obsolete, please use
146ba0fe
VZ
3351\helpref{wxWindow::FindWindowByName}{wxwindowfindwindowbyname} instead.
3352
b0fc8832
VZ
3353Find a window by its name (as given in a window constructor or {\bf Create} function call).
3354If {\it parent} is NULL, the search will start from all top-level
3355frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.
3356The search is recursive in both cases.
a660d684 3357
b0fc8832 3358If no such named window is found, {\bf wxFindWindowByLabel} is called.
a660d684 3359
954b8ae6
JS
3360\wxheading{Include files}
3361
3362<wx/utils.h>
3363
84ed77ef 3364
b0fc8832 3365\membersection{::wxFindWindowAtPoint}\label{wxfindwindowatpoint}
6787e41e 3366
b0fc8832 3367\func{wxWindow *}{wxFindWindowAtPoint}{\param{const wxPoint\& }{pt}}
6787e41e 3368
b0fc8832
VZ
3369Find the deepest window at the given mouse position in screen coordinates,
3370returning the window if found, or NULL if not.
4d01e583 3371
84ed77ef 3372
b0fc8832 3373\membersection{::wxFindWindowAtPointer}\label{wxfindwindowatpointer}
4d01e583 3374
b0fc8832 3375\func{wxWindow *}{wxFindWindowAtPointer}{\param{wxPoint\& }{pt}}
4d01e583 3376
b0fc8832
VZ
3377Find the deepest window at the mouse pointer position, returning the window
3378and current pointer position in screen coordinates.
4d01e583 3379
84ed77ef 3380
8b51786f
VZ
3381\membersection{wxFromString}\label{wxfromstring}
3382
4d76ea94 3383\func{bool}{wxFromString}{\param{const wxString\& }{str},
fc9361e3
VZ
3384 \param{wxColour* }{col}}
3385
3386\func{bool}{wxFromString}{\param{const wxString\& }{str},
3387 \param{wxFont* }{col}}
8b51786f
VZ
3388
3389Converts string to the type of the second argument. Returns \true on success.
3390See also: \helpref{wxToString}{wxtostring}.
3391
3392
b0fc8832 3393\membersection{::wxGetActiveWindow}\label{wxgetactivewindow}
4d01e583 3394
b0fc8832 3395\func{wxWindow *}{wxGetActiveWindow}{\void}
4d01e583 3396
33de8c70
VZ
3397Gets the currently active window (implemented for MSW and GTK only currently,
3398always returns \NULL in the other ports).
4d01e583 3399
b0fc8832 3400\wxheading{Include files}
4d01e583 3401
3de65dab 3402<wx/window.h>
4d01e583 3403
84ed77ef 3404
8ea92b4d
WS
3405\membersection{::wxGetBatteryState}\label{wxgetbatterystate}
3406
3407\func{wxBatteryState}{wxGetBatteryState}{\void}
3408
bb772a8e
RN
3409Returns battery state as one of \texttt{wxBATTERY\_NORMAL\_STATE},
3410\texttt{wxBATTERY\_LOW\_STATE}, \texttt{wxBATTERY\_CRITICAL\_STATE},
3411\texttt{wxBATTERY\_SHUTDOWN\_STATE} or \texttt{wxBATTERY\_UNKNOWN\_STATE}.
3412\texttt{wxBATTERY\_UNKNOWN\_STATE} is also the default on platforms where
3032b7b5 3413this feature is not implemented (currently everywhere but MS Windows).
8ea92b4d
WS
3414
3415\wxheading{Include files}
3416
3417<wx/utils.h>
3418
3419
b0fc8832 3420\membersection{::wxGetDisplayName}\label{wxgetdisplayname}
4d01e583 3421
b0fc8832 3422\func{wxString}{wxGetDisplayName}{\void}
4d01e583 3423
b0fc8832 3424Under X only, returns the current display name. See also \helpref{wxSetDisplayName}{wxsetdisplayname}.
4d01e583
VZ
3425
3426\wxheading{Include files}
3427
b0fc8832 3428<wx/utils.h>
4d01e583 3429
84ed77ef 3430
8ea92b4d
WS
3431\membersection{::wxGetPowerType}\label{wxgetpowertype}
3432
3433\func{wxPowerType}{wxGetPowerType}{\void}
3434
bb772a8e
RN
3435Returns the type of power source as one of \texttt{wxPOWER\_SOCKET},
3436\texttt{wxPOWER\_BATTERY} or \texttt{wxPOWER\_UNKNOWN}.
3437\texttt{wxPOWER\_UNKNOWN} is also the default on platforms where this
3032b7b5 3438feature is not implemented (currently everywhere but MS Windows).
8ea92b4d
WS
3439
3440\wxheading{Include files}
3441
3442<wx/utils.h>
3443
3444
b0fc8832 3445\membersection{::wxGetMousePosition}\label{wxgetmouseposition}
4d01e583 3446
b0fc8832 3447\func{wxPoint}{wxGetMousePosition}{\void}
4d01e583 3448
b0fc8832 3449Returns the mouse position in screen coordinates.
4d01e583
VZ
3450
3451\wxheading{Include files}
3452
3453<wx/utils.h>
3454
84ed77ef 3455
7dd40b6f
RD
3456\membersection{::wxGetMouseState}\label{wxgetmousestate}
3457
3458\func{wxMouseState}{wxGetMouseState}{\void}
3459
3460Returns the current state of the mouse. Returns a wxMouseState
3461instance that contains the current position of the mouse pointer in
576b18f2 3462screen coordinates, as well as boolean values indicating the up/down
7dd40b6f
RD
3463status of the mouse buttons and the modifier keys.
3464
3465\wxheading{Include files}
3466
3467<wx/utils.h>
3468
3469wxMouseState has the following interface:
3470
3471\begin{verbatim}
3472class wxMouseState
3473{
3474public:
3475 wxMouseState();
3476
3477 wxCoord GetX();
3478 wxCoord GetY();
3479
3480 bool LeftDown();
3481 bool MiddleDown();
3482 bool RightDown();
3483
3484 bool ControlDown();
3485 bool ShiftDown();
3486 bool AltDown();
3487 bool MetaDown();
3488 bool CmdDown();
3489
3490 void SetX(wxCoord x);
3491 void SetY(wxCoord y);
3492
3493 void SetLeftDown(bool down);
3494 void SetMiddleDown(bool down);
3495 void SetRightDown(bool down);
e0c8d2d9 3496
7dd40b6f
RD
3497 void SetControlDown(bool down);
3498 void SetShiftDown(bool down);
3499 void SetAltDown(bool down);
3500 void SetMetaDown(bool down);
3501};
3502\end{verbatim}
3503
3504
84ed77ef 3505
634629fa
WS
3506\membersection{::wxGetStockLabel}\label{wxgetstocklabel}
3507
fbfb8bcc 3508\func{wxString}{wxGetStockLabel}{\param{wxWindowID }{id}, \param{bool }{withCodes = true}, \param{const wxString\& }{accelerator = wxEmptyString}}
634629fa
WS
3509
3510Returns label that should be used for given {\it id} element.
3511
3512\wxheading{Parameters}
3513
3514\docparam{id}{given id of the \helpref{wxMenuItem}{wxmenuitem}, \helpref{wxButton}{wxbutton}, \helpref{wxToolBar}{wxtoolbar} tool, etc.}
3515
3516\docparam{withCodes}{if false then strip accelerator code from the label;
576b18f2
VZ
3517useful for getting labels without accelerator char code like for toolbar tooltip or
3518on platforms without traditional keyboard like smartphones}
634629fa
WS
3519
3520\docparam{accelerator}{optional accelerator string automatically added to label; useful
3521for building labels for \helpref{wxMenuItem}{wxmenuitem}}
3522
3523\wxheading{Include files}
3524
3525<wx/stockitem.h>
3526
3527
33b494d6
VZ
3528\membersection{::wxGetTopLevelParent}\label{wxgettoplevelparent}
3529
3530\func{wxWindow *}{wxGetTopLevelParent}{\param{wxWindow }{*win}}
3531
3532Returns the first top level parent of the given window, or in other words, the
3533frame or dialog containing it, or {\tt NULL}.
3534
3535\wxheading{Include files}
3536
3537<wx/window.h>
3538
84ed77ef 3539
498a1eeb
RN
3540\membersection{::wxLaunchDefaultBrowser}\label{wxlaunchdefaultbrowser}
3541
42d0df00 3542\func{bool}{wxLaunchDefaultBrowser}{\param{const wxString\& }{url}, \param{int }{flags = $0$}}
498a1eeb 3543
ce045aed 3544Open the \arg{url} in user's default browser. If \arg{flags} parameter contains
42d0df00 3545\texttt{wxBROWSER\_NEW\_WINDOW} flag, a new window is opened for the URL
54f69143
VZ
3546(currently this is only supported under Windows). The \arg{url} may also be a
3547local file path (with or without \texttt{file://} prefix), if it doesn't
3548correspond to an existing file and the URL has no scheme \texttt{http://} is
3549prepended to it by default.
498a1eeb 3550
42d0df00 3551Returns \true if the application was successfully launched.
498a1eeb 3552
17ede0b1
RR
3553Note that for some configurations of the running user, the application which
3554is launched to open the given URL may be URL-dependent (e.g. a browser may be used for
3555local URLs while another one may be used for remote URLs).
3556
498a1eeb
RN
3557\wxheading{Include files}
3558
3559<wx/utils.h>
3560
42d0df00 3561
a660d684
KB
3562\membersection{::wxLoadUserResource}\label{wxloaduserresource}
3563
3564\func{wxString}{wxLoadUserResource}{\param{const wxString\& }{resourceName}, \param{const wxString\& }{resourceType=``TEXT"}}
3565
3566Loads a user-defined Windows resource as a string. If the resource is found, the function creates
3567a new character array and copies the data into it. A pointer to this data is returned. If unsuccessful, NULL is returned.
3568
3569The resource must be defined in the {\tt .rc} file using the following syntax:
3570
3571\begin{verbatim}
3572myResource TEXT file.ext
3573\end{verbatim}
3574
3575where {\tt file.ext} is a file that the resource compiler can find.
3576
a660d684
KB
3577This function is available under Windows only.
3578
954b8ae6
JS
3579\wxheading{Include files}
3580
3581<wx/utils.h>
3582
84ed77ef 3583
a660d684
KB
3584\membersection{::wxPostDelete}\label{wxpostdelete}
3585
3586\func{void}{wxPostDelete}{\param{wxObject *}{object}}
3587
954b8ae6 3588Tells the system to delete the specified object when
a660d684
KB
3589all other events have been processed. In some environments, it is
3590necessary to use this instead of deleting a frame directly with the
954b8ae6 3591delete operator, because some GUIs will still send events to a deleted window.
a660d684
KB
3592
3593Now obsolete: use \helpref{wxWindow::Close}{wxwindowclose} instead.
3594
954b8ae6
JS
3595\wxheading{Include files}
3596
3597<wx/utils.h>
3598
84ed77ef 3599
8e193f38
VZ
3600\membersection{::wxPostEvent}\label{wxpostevent}
3601
3602\func{void}{wxPostEvent}{\param{wxEvtHandler *}{dest}, \param{wxEvent\& }{event}}
3603
9a9e73f6
RR
3604In a GUI application, this function posts {\it event} to the specified {\it dest}
3605object using \helpref{wxEvtHandler::AddPendingEvent}{wxevthandleraddpendingevent}.
3606Otherwise, it dispatches {\it event} immediately using
3607\helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent}.
3608See the respective documentation for details (and caveats).
8e193f38
VZ
3609
3610\wxheading{Include files}
3611
3612<wx/app.h>
3613
84ed77ef 3614
a660d684
KB
3615\membersection{::wxSetDisplayName}\label{wxsetdisplayname}
3616
3617\func{void}{wxSetDisplayName}{\param{const wxString\& }{displayName}}
3618
3619Under X only, sets the current display name. This is the X host and display name such
3620as ``colonsay:0.0", and the function indicates which display should be used for creating
3621windows from this point on. Setting the display within an application allows multiple
3622displays to be used.
3623
3624See also \helpref{wxGetDisplayName}{wxgetdisplayname}.
3625
954b8ae6
JS
3626\wxheading{Include files}
3627
3628<wx/utils.h>
3629
84ed77ef 3630
b0fc8832 3631\membersection{::wxStripMenuCodes}\label{wxstripmenucodes}
a660d684 3632
74639764 3633\func{wxString}{wxStripMenuCodes}{\param{const wxString\& }{str}, \param{int }{flags = wxStrip\_All}}
8a2c6ef8 3634
74639764 3635Strips any menu codes from \arg{str} and returns the result.
a660d684 3636
74639764
VZ
3637By default, the functions strips both the mnemonics character (\texttt{'\&'})
3638which is used to indicate a keyboard shortkey, and the accelerators, which are
3639used only in the menu items and are separated from the main text by the
3640\texttt{$\backslash$t} (TAB) character. By using \arg{flags} of
3641\texttt{wxStrip\_Mnemonics} or \texttt{wxStrip\_Accel} to strip only the former
3642or the latter part, respectively.
8a2c6ef8 3643
8bb6b2c0
VZ
3644Notice that in most cases
3645\helpref{wxMenuItem::GetLabelFromText}{wxmenuitemgetlabelfromtext} or
74639764 3646\helpref{wxControl::GetLabelText}{wxcontrolgetlabeltext} can be used instead.
a660d684 3647
954b8ae6
JS
3648\wxheading{Include files}
3649
3650<wx/utils.h>
3651
84ed77ef 3652
b4a81453
VZ
3653\membersection{wxSTRINGIZE}\label{wxstringize}
3654
3655\func{}{wxSTRINGIZE}{\param{}{x}}
3656
3657Returns the string representation of the given symbol which can be either a
3658literal or a macro (hence the advantage of using this macro instead of the
3659standard preprocessor \texttt{\#} operator which doesn't work with macros).
3660
84206bbb
VZ
3661Notice that this macro always produces a \texttt{char} string, use
3662\helpref{wxSTRINGIZE\_T}{wxstringizet} to build a wide string Unicode build.
3663
b4a81453
VZ
3664\wxheading{See also}
3665
3666\helpref{wxCONCAT}{wxconcat}
3667
3668
84206bbb
VZ
3669\membersection{wxSTRINGIZE\_T}\label{wxstringizet}
3670
3671\func{}{wxSTRINGIZE\_T}{\param{}{x}}
3672
3673Returns the string representation of the given symbol as either an ASCII or
3674Unicode string, depending on the current build. This is the Unicode-friendly
3675equivalent of \helpref{wxSTRINGIZE}{wxstringize}.
3676
3677
7261746a 3678\membersection{wxSUPPRESS\_GCC\_PRIVATE\_DTOR\_WARNING}\label{wxsuppressgccprivatedtorwarning}
b47f1f95
VZ
3679
3680\func{}{wxSUPPRESS\_GCC\_PRIVATE\_DTOR\_WARNING}{\param{}{name}}
3681
3682GNU C++ compiler gives a warning for any class whose destructor is private
3683unless it has a friend. This warning may sometimes be useful but it doesn't
3684make sense for reference counted class which always delete themselves (hence
3685destructor should be private) but don't necessarily have any friends, so this
3686macro is provided to disable the warning in such case. The \arg{name} parameter
3687should be the name of the class but is only used to construct a unique friend
3688class name internally. Example of using the macro:
3689
3690\begin{verbatim}
3691 class RefCounted
3692 {
3693 public:
3694 RefCounted() { m_nRef = 1; }
3695 void IncRef() { m_nRef++ ; }
3696 void DecRef() { if ( !--m_nRef ) delete this; }
3697
3698 private:
3699 ~RefCounted() { }
3700
3701 wxSUPPRESS_GCC_PRIVATE_DTOR(RefCounted)
3702 };
3703\end{verbatim}
3704
3705Notice that there should be no semicolon after this macro.
3706
3707
8b51786f
VZ
3708\membersection{wxToString}\label{wxtostring}
3709
fc9361e3
VZ
3710\func{wxString}{wxToString}{\param{const wxColour\& }{col}}
3711
3712\func{wxString}{wxToString}{\param{const wxFont\& }{col}}
8b51786f
VZ
3713
3714Converts its argument to string.
3715See also: \helpref{wxFromString}{wxfromstring}.
3716
3717
84ed77ef
VZ
3718\membersection{wxULL}\label{wxull}
3719
3720\func{wxLongLong\_t}{wxULL}{\param{}{number}}
3721
3722This macro is defined for the platforms with a native 64 bit integer type and
3723allows to define unsigned 64 bit compile time constants:
3724
3725\begin{verbatim}
3726 #ifdef wxLongLong_t
3727 unsigned wxLongLong_t ll = wxULL(0x1234567890abcdef);
3728 #endif
3729\end{verbatim}
3730
3731\wxheading{Include files}
3732
3733<wx/longlong.h>
3734
3735\wxheading{See also}
3736
3737\helpref{wxLL}{wxll}, \helpref{wxLongLong}{wxlonglong}
3738
3739
d85cfb37
VZ
3740\membersection{wxVaCopy}\label{wxvacopy}
3741
e7dfcb8e 3742\func{void}{wxVaCopy}{\param{va\_list }{argptrDst}, \param{va\_list}{ argptrSrc}}
d85cfb37
VZ
3743
3744This macro is the same as the standard C99 \texttt{va\_copy} for the compilers
3745which support it or its replacement for those that don't. It must be used to
3746preserve the value of a \texttt{va\_list} object if you need to use it after
3747passing it to another function because it can be modified by the latter.
3748
8ea92b4d 3749As with \texttt{va\_start}, each call to \texttt{wxVaCopy} must have a matching
d85cfb37
VZ
3750\texttt{va\_end}.
3751
3752
84ed77ef 3753
fd05688e
VZ
3754\membersection{\_\_WXFUNCTION\_\_}\label{wxfunction}
3755
3756\func{}{\_\_WXFUNCTION\_\_}{\void}
3757
3758This macro expands to the name of the current function if the compiler supports
3759any of \texttt{\_\_FUNCTION\_\_}, \texttt{\_\_func\_\_} or equivalent variables
3760or macros or to \NULL if none of them is available.
3761
3762
84ed77ef 3763
81c9effa 3764\section{Byte order macros}\label{byteordermacros}
a660d684 3765
b0fc8832
VZ
3766The endian-ness issues (that is the difference between big-endian and
3767little-endian architectures) are important for the portable programs working
3768with the external binary data (for example, data files or data coming from
3769network) which is usually in some fixed, platform-independent format. The
3770macros are helpful for transforming the data to the correct format.
a660d684 3771
84ed77ef 3772
0180dad6
RR
3773\membersection{wxINTXX\_SWAP\_ALWAYS}\label{intswapalways}
3774
3775\func{wxInt32}{wxINT32\_SWAP\_ALWAYS}{\param{wxInt32 }{value}}
3776
3777\func{wxUint32}{wxUINT32\_SWAP\_ALWAYS}{\param{wxUint32 }{value}}
3778
3779\func{wxInt16}{wxINT16\_SWAP\_ALWAYS}{\param{wxInt16 }{value}}
3780
3781\func{wxUint16}{wxUINT16\_SWAP\_ALWAYS}{\param{wxUint16 }{value}}
3782
b0fc8832
VZ
3783These macros will swap the bytes of the {\it value} variable from little
3784endian to big endian or vice versa unconditionally, i.e. independently of the
3785current platform.
0180dad6 3786
84ed77ef 3787
0180dad6
RR
3788\membersection{wxINTXX\_SWAP\_ON\_BE}\label{intswaponbe}
3789
3790\func{wxInt32}{wxINT32\_SWAP\_ON\_BE}{\param{wxInt32 }{value}}
3791
3792\func{wxUint32}{wxUINT32\_SWAP\_ON\_BE}{\param{wxUint32 }{value}}
3793
3794\func{wxInt16}{wxINT16\_SWAP\_ON\_BE}{\param{wxInt16 }{value}}
3795
3796\func{wxUint16}{wxUINT16\_SWAP\_ON\_BE}{\param{wxUint16 }{value}}
3797
3798This macro will swap the bytes of the {\it value} variable from little
3799endian to big endian or vice versa if the program is compiled on a
ec5d7799 3800big-endian architecture (such as Sun work stations). If the program has
0180dad6
RR
3801been compiled on a little-endian architecture, the value will be unchanged.
3802
ec5d7799 3803Use these macros to read data from and write data to a file that stores
b0fc8832 3804data in little-endian (for example Intel i386) format.
0180dad6 3805
84ed77ef 3806
0180dad6
RR
3807\membersection{wxINTXX\_SWAP\_ON\_LE}\label{intswaponle}
3808
3809\func{wxInt32}{wxINT32\_SWAP\_ON\_LE}{\param{wxInt32 }{value}}
3810
3811\func{wxUint32}{wxUINT32\_SWAP\_ON\_LE}{\param{wxUint32 }{value}}
3812
3813\func{wxInt16}{wxINT16\_SWAP\_ON\_LE}{\param{wxInt16 }{value}}
3814
3815\func{wxUint16}{wxUINT16\_SWAP\_ON\_LE}{\param{wxUint16 }{value}}
3816
3817This macro will swap the bytes of the {\it value} variable from little
3818endian to big endian or vice versa if the program is compiled on a
ec5d7799 3819little-endian architecture (such as Intel PCs). If the program has
0180dad6
RR
3820been compiled on a big-endian architecture, the value will be unchanged.
3821
ec5d7799 3822Use these macros to read data from and write data to a file that stores
b0fc8832
VZ
3823data in big-endian format.
3824
84ed77ef 3825
6d98f963
FM
3826\membersection{wxFORCE\_LINK\_THIS\_MODULE}\label{wxforcelinkthismodule}
3827
3828\func{}{wxFORCE\_LINK\_THIS\_MODULE}{moduleName}
3829
3830This macro can be used in conjunction with the
3831\helpref{wxFORCE\_LINK\_MODULE}{wxforcelinkmodule} macro to force
3832the linker to include in its output a specific object file.
3833
3834In particular, you should use this macro in the source file which you want
3835to force for inclusion. The \tt{moduleName} needs to be a name not already
3836in use in other \tt{wxFORCE\_LINK\_THIS\_MODULE} macros, but is not required
3837to be e.g. the same name of the source file (even if it's a good choice).
3838
3839\wxheading{Include files}
3840
3841<wx/link.h>
3842
3843
3844\membersection{wxFORCE\_LINK\_MODULE}\label{wxforcelinkmodule}
3845
3846\func{}{wxFORCE\_LINK\_MODULE}{moduleName}
3847
3848This macro can be used in conjunction with the
3849\helpref{wxFORCE\_LINK\_THIS\_MODULE}{wxforcelinkthismodule} macro to force
3850the linker to include in its output a specific object file.
3851
3852In particular, you should use this macro in a source file which you know
3853for sure is linked in the output (e.g. the source file containing the "main()"
3854of your app). The \tt{moduleName} is the name of the module you want to forcefully link
3855(i.e. the name you used in the relative \helpref{wxFORCE\_LINK\_THIS\_MODULE}{wxforcelinkthismodule} macro.
3856
3857\wxheading{Include files}
3858
3859<wx/link.h>
3860
3861
3862\membersection{wxIMPLEMENT\_APP}\label{wximplementapp}
3863
3864\func{}{wxIMPLEMENT\_APP}{className}
3865
3866This is used in the application class implementation file to make the application class
3867known to wxWidgets for dynamic construction. You use this as:
3868
3869\begin{verbatim}
3870 wxIMPLEMENT_APP(MyApp)
3871\end{verbatim}
3872
3873See also \helpref{wxDECLARE\_APP}{wxdeclareapp}.
3874
3875\wxheading{Include files}
3876
3877<wx/app.h>
3878
84ed77ef 3879
f4fcc291 3880\section{RTTI functions}\label{rttimacros}
b0fc8832 3881
fc2171bd 3882wxWidgets uses its own RTTI ("run-time type identification") system which
b0fc8832 3883predates the current standard C++ RTTI and so is kept for backwards
2edb0bde 3884compatibility reasons but also because it allows some things which the
b0fc8832
VZ
3885standard RTTI doesn't directly support (such as creating a class from its
3886name).
3887
3888The standard C++ RTTI can be used in the user code without any problems and in
3889general you shouldn't need to use the functions and the macros in this section
fc2171bd 3890unless you are thinking of modifying or adding any wxWidgets classes.
b0fc8832
VZ
3891
3892\wxheading{See also}
3893
3894\helpref{RTTI overview}{runtimeclassoverview}
0180dad6 3895
84ed77ef 3896
a660d684
KB
3897\membersection{CLASSINFO}\label{classinfo}
3898
3899\func{wxClassInfo *}{CLASSINFO}{className}
3900
3901Returns a pointer to the wxClassInfo object associated with this class.
3902
954b8ae6
JS
3903\wxheading{Include files}
3904
3905<wx/object.h>
3906
84ed77ef 3907
b0fc8832 3908\membersection{DECLARE\_ABSTRACT\_CLASS}\label{declareabstractclass}
a660d684
KB
3909
3910\func{}{DECLARE\_ABSTRACT\_CLASS}{className}
3911
3912Used inside a class declaration to declare that the class should be
3913made known to the class hierarchy, but objects of this class cannot be created
3914dynamically. The same as DECLARE\_CLASS.
3915
3916Example:
3917
3918\begin{verbatim}
3919class wxCommand: public wxObject
3920{
3921 DECLARE_ABSTRACT_CLASS(wxCommand)
3922
3923 private:
3924 ...
3925 public:
3926 ...
3927};
3928\end{verbatim}
3929
954b8ae6
JS
3930\wxheading{Include files}
3931
3932<wx/object.h>
3933
84ed77ef 3934
a660d684
KB
3935\membersection{DECLARE\_APP}\label{declareapp}
3936
3937\func{}{DECLARE\_APP}{className}
3938
8ea92b4d
WS
3939This is used in headers to create a forward declaration of the
3940\helpref{wxGetApp}{wxgetapp} function implemented by
3941\helpref{IMPLEMENT\_APP}{implementapp}. It creates the declaration
749caeeb 3942{\tt className\& wxGetApp(void)}.
a660d684
KB
3943
3944Example:
3945
3946\begin{verbatim}
3947 DECLARE_APP(MyApp)
3948\end{verbatim}
3949
954b8ae6
JS
3950\wxheading{Include files}
3951
3952<wx/app.h>
3953
84ed77ef 3954
b0fc8832 3955\membersection{DECLARE\_CLASS}\label{declareclass}
a660d684
KB
3956
3957\func{}{DECLARE\_CLASS}{className}
3958
3959Used inside a class declaration to declare that the class should be
3960made known to the class hierarchy, but objects of this class cannot be created
3961dynamically. The same as DECLARE\_ABSTRACT\_CLASS.
3962
954b8ae6
JS
3963\wxheading{Include files}
3964
3965<wx/object.h>
3966
84ed77ef 3967
b0fc8832 3968\membersection{DECLARE\_DYNAMIC\_CLASS}\label{declaredynamicclass}
a660d684
KB
3969
3970\func{}{DECLARE\_DYNAMIC\_CLASS}{className}
3971
f3886d37
VZ
3972Used inside a class declaration to make the class known to wxWidgets RTTI
3973system and also declare that the objects of this class should be dynamically
3974creatable from run-time type information. Notice that this implies that the
ce045aed 3975class should have a default constructor, if this is not the case consider using
f3886d37 3976\helpref{DECLARE\_CLASS}{declareclass}.
a660d684
KB
3977
3978Example:
3979
3980\begin{verbatim}
3981class wxFrame: public wxWindow
3982{
3983 DECLARE_DYNAMIC_CLASS(wxFrame)
3984
3985 private:
2b5f62a0 3986 const wxString& frameTitle;
a660d684
KB
3987 public:
3988 ...
3989};
3990\end{verbatim}
3991
954b8ae6
JS
3992\wxheading{Include files}
3993
3994<wx/object.h>
3995
84ed77ef 3996
b0fc8832 3997\membersection{IMPLEMENT\_ABSTRACT\_CLASS}\label{implementabstractclass}
a660d684
KB
3998
3999\func{}{IMPLEMENT\_ABSTRACT\_CLASS}{className, baseClassName}
4000
4001Used in a C++ implementation file to complete the declaration of
4002a class that has run-time type information. The same as IMPLEMENT\_CLASS.
4003
4004Example:
4005
4006\begin{verbatim}
4007IMPLEMENT_ABSTRACT_CLASS(wxCommand, wxObject)
4008
4009wxCommand::wxCommand(void)
4010{
4011...
4012}
4013\end{verbatim}
4014
954b8ae6
JS
4015\wxheading{Include files}
4016
4017<wx/object.h>
4018
84ed77ef 4019
b0fc8832 4020\membersection{IMPLEMENT\_ABSTRACT\_CLASS2}\label{implementabstractclass2}
a660d684
KB
4021
4022\func{}{IMPLEMENT\_ABSTRACT\_CLASS2}{className, baseClassName1, baseClassName2}
4023
4024Used in a C++ implementation file to complete the declaration of
4025a class that has run-time type information and two base classes. The same as IMPLEMENT\_CLASS2.
4026
954b8ae6
JS
4027\wxheading{Include files}
4028
4029<wx/object.h>
4030
84ed77ef 4031
a660d684
KB
4032\membersection{IMPLEMENT\_APP}\label{implementapp}
4033
4034\func{}{IMPLEMENT\_APP}{className}
4035
4036This is used in the application class implementation file to make the application class known to
fc2171bd 4037wxWidgets for dynamic construction. You use this instead of
a660d684
KB
4038
4039Old form:
4040
4041\begin{verbatim}
4042 MyApp myApp;
4043\end{verbatim}
4044
4045New form:
4046
4047\begin{verbatim}
4048 IMPLEMENT_APP(MyApp)
4049\end{verbatim}
4050
4051See also \helpref{DECLARE\_APP}{declareapp}.
4052
954b8ae6
JS
4053\wxheading{Include files}
4054
4055<wx/app.h>
4056
84ed77ef 4057
b0fc8832 4058\membersection{IMPLEMENT\_CLASS}\label{implementclass}
a660d684
KB
4059
4060\func{}{IMPLEMENT\_CLASS}{className, baseClassName}
4061
4062Used in a C++ implementation file to complete the declaration of
4063a class that has run-time type information. The same as IMPLEMENT\_ABSTRACT\_CLASS.
4064
954b8ae6
JS
4065\wxheading{Include files}
4066
4067<wx/object.h>
4068
84ed77ef 4069
b0fc8832 4070\membersection{IMPLEMENT\_CLASS2}\label{implementclass2}
a660d684
KB
4071
4072\func{}{IMPLEMENT\_CLASS2}{className, baseClassName1, baseClassName2}
4073
4074Used in a C++ implementation file to complete the declaration of a
4075class that has run-time type information and two base classes. The
4076same as IMPLEMENT\_ABSTRACT\_CLASS2.
4077
954b8ae6
JS
4078\wxheading{Include files}
4079
4080<wx/object.h>
4081
84ed77ef 4082
b0fc8832 4083\membersection{IMPLEMENT\_DYNAMIC\_CLASS}\label{implementdynamicclass}
a660d684
KB
4084
4085\func{}{IMPLEMENT\_DYNAMIC\_CLASS}{className, baseClassName}
4086
4087Used in a C++ implementation file to complete the declaration of
4088a class that has run-time type information, and whose instances
4089can be created dynamically.
4090
4091Example:
4092
4093\begin{verbatim}
4094IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
4095
4096wxFrame::wxFrame(void)
4097{
4098...
4099}
4100\end{verbatim}
4101
954b8ae6
JS
4102\wxheading{Include files}
4103
4104<wx/object.h>
4105
84ed77ef 4106
b0fc8832 4107\membersection{IMPLEMENT\_DYNAMIC\_CLASS2}\label{implementdynamicclass2}
a660d684
KB
4108
4109\func{}{IMPLEMENT\_DYNAMIC\_CLASS2}{className, baseClassName1, baseClassName2}
4110
4111Used in a C++ implementation file to complete the declaration of
4112a class that has run-time type information, and whose instances
4113can be created dynamically. Use this for classes derived from two
4114base classes.
4115
954b8ae6
JS
4116\wxheading{Include files}
4117
4118<wx/object.h>
4119
84ed77ef 4120
f6bcfd97
BP
4121\membersection{wxConstCast}\label{wxconstcast}
4122
f7637829 4123\func{classname *}{wxConstCast}{ptr, classname}
f6bcfd97
BP
4124
4125This macro expands into {\tt const\_cast<classname *>(ptr)} if the compiler
4126supports {\it const\_cast} or into an old, C-style cast, otherwise.
4127
4128\wxheading{See also}
4129
f29fe169 4130\helpref{wx\_const\_cast}{wxconstcastraw}\\
f6bcfd97
BP
4131\helpref{wxDynamicCast}{wxdynamiccast}\\
4132\helpref{wxStaticCast}{wxstaticcast}
4133
84ed77ef 4134
b0fc8832
VZ
4135\membersection{::wxCreateDynamicObject}\label{wxcreatedynamicobject}
4136
4137\func{wxObject *}{wxCreateDynamicObject}{\param{const wxString\& }{className}}
4138
4139Creates and returns an object of the given class, if the class has been
4140registered with the dynamic class system using DECLARE... and IMPLEMENT... macros.
4141
84ed77ef 4142
34636400
VZ
4143\membersection{WXDEBUG\_NEW}\label{debugnew}
4144
4145\func{}{WXDEBUG\_NEW}{arg}
4146
4147This is defined in debug mode to be call the redefined new operator
4148with filename and line number arguments. The definition is:
4149
4150\begin{verbatim}
4151#define WXDEBUG_NEW new(__FILE__,__LINE__)
4152\end{verbatim}
4153
4154In non-debug mode, this is defined as the normal new operator.
4155
4156\wxheading{Include files}
4157
4158<wx/object.h>
4159
84ed77ef 4160
34636400
VZ
4161\membersection{wxDynamicCast}\label{wxdynamiccast}
4162
f7637829 4163\func{classname *}{wxDynamicCast}{ptr, classname}
34636400
VZ
4164
4165This macro returns the pointer {\it ptr} cast to the type {\it classname *} if
8a7f3379 4166the pointer is of this type (the check is done during the run-time) or
f7637829
VZ
4167{\tt NULL} otherwise. Usage of this macro is preferred over obsoleted
4168wxObject::IsKindOf() function.
34636400 4169
f7637829
VZ
4170The {\it ptr} argument may be {\tt NULL}, in which case {\tt NULL} will be
4171returned.
34636400
VZ
4172
4173Example:
4174
4175\begin{verbatim}
4176 wxWindow *win = wxWindow::FindFocus();
4177 wxTextCtrl *text = wxDynamicCast(win, wxTextCtrl);
4178 if ( text )
4179 {
4180 // a text control has the focus...
4181 }
4182 else
4183 {
f6bcfd97 4184 // no window has the focus or it is not a text control
34636400
VZ
4185 }
4186\end{verbatim}
4187
4188\wxheading{See also}
4189
f6bcfd97 4190\helpref{RTTI overview}{runtimeclassoverview}\\
f7637829 4191\helpref{wxDynamicCastThis}{wxdynamiccastthis}\\
f6bcfd97 4192\helpref{wxConstCast}{wxconstcast}\\
330be534 4193\helpref{wxStaticCast}{wxstaticcast}
34636400 4194
84ed77ef 4195
f7637829
VZ
4196\membersection{wxDynamicCastThis}\label{wxdynamiccastthis}
4197
4198\func{classname *}{wxDynamicCastThis}{classname}
4199
4200This macro is equivalent to {\tt wxDynamicCast(this, classname)} but the
4201latter provokes spurious compilation warnings from some compilers (because it
154b6b0f 4202tests whether {\tt this} pointer is non-{\tt NULL} which is always true), so
f7637829
VZ
4203this macro should be used to avoid them.
4204
4205\wxheading{See also}
4206
4207\helpref{wxDynamicCast}{wxdynamiccast}
4208
84ed77ef 4209
f6bcfd97
BP
4210\membersection{wxStaticCast}\label{wxstaticcast}
4211
f7637829 4212\func{classname *}{wxStaticCast}{ptr, classname}
f6bcfd97
BP
4213
4214This macro checks that the cast is valid in debug mode (an assert failure will
4215result if {\tt wxDynamicCast(ptr, classname) == NULL}) and then returns the
4216result of executing an equivalent of {\tt static\_cast<classname *>(ptr)}.
4217
f29fe169
VZ
4218\wxheading{See also}
4219
4220\helpref{wx\_static\_cast}{wxstaticcastraw}\\
f6bcfd97
BP
4221\helpref{wxDynamicCast}{wxdynamiccast}\\
4222\helpref{wxConstCast}{wxconstcast}
4223
84ed77ef 4224
f29fe169
VZ
4225\membersection{wx\_const\_cast}\label{wxconstcastraw}
4226
4227\func{T}{wx\_const\_cast}{T, x}
4228
8ea92b4d 4229Same as \texttt{const\_cast<T>(x)} if the compiler supports const cast or
f29fe169
VZ
4230\texttt{(T)x} for old compilers. Unlike \helpref{wxConstCast}{wxconstcast},
4231the cast it to the type \arg{T} and not to \texttt{T *} and also the order of
4232arguments is the same as for the standard cast.
4233
4234\wxheading{See also}
4235
8c8d66c5
VZ
4236\helpref{wx\_reinterpret\_cast}{wxreinterpretcastraw},\\
4237\helpref{wx\_static\_cast}{wxstaticcastraw}
4238
4239
4240\membersection{wx\_reinterpret\_cast}\label{wxreinterpretcastraw}
4241
4242\func{T}{wx\_reinterpret\_cast}{T, x}
4243
8ea92b4d 4244Same as \texttt{reinterpret\_cast<T>(x)} if the compiler supports reinterpret cast or
8c8d66c5
VZ
4245\texttt{(T)x} for old compilers.
4246
4247\wxheading{See also}
4248
4249\helpref{wx\_const\_cast}{wxconstcastraw},\\
4250\helpref{wx\_static\_cast}{wxstaticcastraw}
f29fe169
VZ
4251
4252
4253\membersection{wx\_static\_cast}\label{wxstaticcastraw}
4254
4255\func{T}{wx\_static\_cast}{T, x}
4256
8ea92b4d 4257Same as \texttt{static\_cast<T>(x)} if the compiler supports static cast or
f29fe169
VZ
4258\texttt{(T)x} for old compilers. Unlike \helpref{wxStaticCast}{wxstaticcast},
4259there are no checks being done and the meaning of the macro arguments is exactly
4260the same as for the standard static cast, i.e. \arg{T} is the full type name and
4261star is not appended to it.
4262
4263\wxheading{See also}
4264
8c8d66c5 4265\helpref{wx\_const\_cast}{wxconstcastraw},\\
e6b2a3b3
VZ
4266\helpref{wx\_reinterpret\_cast}{wxreinterpretcastraw},\\
4267\helpref{wx\_truncate\_cast}{wxtruncatecast}
4268
4269
4270\membersection{wx\_truncate\_cast}\label{wxtruncatecast}
4271
4272\func{T}{wx\_truncate\_cast}{T, x}
f29fe169 4273
e6b2a3b3
VZ
4274This case doesn't correspond to any standard cast but exists solely to make
4275casts which possibly result in a truncation of an integer value more readable.
4276
4277\wxheading{See also}
4278
4279\helpref{wx\_static\_cast}{wxstaticcastraw}
f29fe169 4280
84ed77ef 4281
6fb26ea3
JS
4282\section{Log functions}\label{logfunctions}
4283
4284These functions provide a variety of logging functions: see \helpref{Log classes overview}{wxlogoverview} for
f68586e5
VZ
4285further information. The functions use (implicitly) the currently active log
4286target, so their descriptions here may not apply if the log target is not the
fc2171bd 4287standard one (installed by wxWidgets in the beginning of the program).
6fb26ea3 4288
954b8ae6
JS
4289\wxheading{Include files}
4290
4291<wx/log.h>
4292
84ed77ef 4293
b0fc8832
VZ
4294\membersection{::wxDebugMsg}\label{wxdebugmsg}
4295
4296\func{void}{wxDebugMsg}{\param{const wxString\& }{fmt}, \param{...}{}}
4297
2bd25c5a
VZ
4298{\bf NB:} This function is now obsolete, replaced by \helpref{Log
4299functions}{logfunctions} and \helpref{wxLogDebug}{wxlogdebug} in particular.
b0fc8832
VZ
4300
4301Display a debugging message; under Windows, this will appear on the
4302debugger command window, and under Unix, it will be written to standard
4303error.
4304
4305The syntax is identical to {\bf printf}: pass a format string and a
4306variable list of arguments.
4307
4308{\bf Tip:} under Windows, if your application crashes before the
4309message appears in the debugging window, put a wxYield call after
4310each wxDebugMsg call. wxDebugMsg seems to be broken under WIN32s
4311(at least for Watcom C++): preformat your messages and use OutputDebugString
4312instead.
4313
b0fc8832
VZ
4314\wxheading{Include files}
4315
4316<wx/utils.h>
4317
84ed77ef 4318
b0fc8832
VZ
4319\membersection{::wxError}\label{wxerror}
4320
fc2171bd 4321\func{void}{wxError}{\param{const wxString\& }{msg}, \param{const wxString\& }{title = "wxWidgets Internal Error"}}
b0fc8832 4322
b829bf55 4323{\bf NB:} This function is now obsolete, please use \helpref{wxLogError}{wxlogerror}
b0fc8832
VZ
4324instead.
4325
4326Displays {\it msg} and continues. This writes to standard error under
4327Unix, and pops up a message box under Windows. Used for internal
fc2171bd 4328wxWidgets errors. See also \helpref{wxFatalError}{wxfatalerror}.
b0fc8832
VZ
4329
4330\wxheading{Include files}
4331
4332<wx/utils.h>
4333
84ed77ef 4334
b0fc8832
VZ
4335\membersection{::wxFatalError}\label{wxfatalerror}
4336
fc2171bd 4337\func{void}{wxFatalError}{\param{const wxString\& }{msg}, \param{const wxString\& }{title = "wxWidgets Fatal Error"}}
b0fc8832 4338
b829bf55 4339{\bf NB:} This function is now obsolete, please use
b0fc8832
VZ
4340\helpref{wxLogFatalError}{wxlogfatalerror} instead.
4341
4342Displays {\it msg} and exits. This writes to standard error under Unix,
4343and pops up a message box under Windows. Used for fatal internal
fc2171bd 4344wxWidgets errors. See also \helpref{wxError}{wxerror}.
b0fc8832
VZ
4345
4346\wxheading{Include files}
4347
4348<wx/utils.h>
4349
84ed77ef 4350
6fb26ea3
JS
4351\membersection{::wxLogError}\label{wxlogerror}
4352
7ac13b21 4353\func{void}{wxLogError}{\param{const char *}{formatString}, \param{...}{}}
6fb26ea3 4354
1d63fd6b
GD
4355\func{void}{wxVLogError}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
4356
ea44a631 4357The functions to use for error messages, i.e. the messages that must be shown
f68586e5
VZ
4358to the user. The default processing is to pop up a message box to inform the
4359user about it.
6fb26ea3 4360
84ed77ef 4361
6fb26ea3
JS
4362\membersection{::wxLogFatalError}\label{wxlogfatalerror}
4363
7ac13b21 4364\func{void}{wxLogFatalError}{\param{const char *}{formatString}, \param{...}{}}
6fb26ea3 4365
1d63fd6b
GD
4366\func{void}{wxVLogFatalError}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
4367
6fb26ea3
JS
4368Like \helpref{wxLogError}{wxlogerror}, but also
4369terminates the program with the exit code 3. Using {\it abort()} standard
4370function also terminates the program with this exit code.
4371
84ed77ef 4372
6fb26ea3
JS
4373\membersection{::wxLogWarning}\label{wxlogwarning}
4374
7ac13b21 4375\func{void}{wxLogWarning}{\param{const char *}{formatString}, \param{...}{}}
6fb26ea3 4376
1d63fd6b
GD
4377\func{void}{wxVLogWarning}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
4378
f68586e5
VZ
4379For warnings - they are also normally shown to the user, but don't interrupt
4380the program work.
6fb26ea3 4381
84ed77ef 4382
6fb26ea3
JS
4383\membersection{::wxLogMessage}\label{wxlogmessage}
4384
7ac13b21 4385\func{void}{wxLogMessage}{\param{const char *}{formatString}, \param{...}{}}
6fb26ea3 4386
1d63fd6b
GD
4387\func{void}{wxVLogMessage}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
4388
ea44a631 4389For all normal, informational messages. They also appear in a message box by
8004cd7a 4390default (but it can be changed).
84ed77ef 4391
6fb26ea3
JS
4392\membersection{::wxLogVerbose}\label{wxlogverbose}
4393
7ac13b21
GT
4394\func{void}{wxLogVerbose}{\param{const char *}{formatString}, \param{...}{}}
4395
1d63fd6b 4396\func{void}{wxVLogVerbose}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
6fb26ea3 4397
f6bcfd97 4398For verbose output. Normally, it is suppressed, but
6fb26ea3
JS
4399might be activated if the user wishes to know more details about the program
4400progress (another, but possibly confusing name for the same function is {\bf wxLogInfo}).
4401
84ed77ef 4402
6fb26ea3
JS
4403\membersection{::wxLogStatus}\label{wxlogstatus}
4404
7ac13b21 4405\func{void}{wxLogStatus}{\param{wxFrame *}{frame}, \param{const char *}{formatString}, \param{...}{}}
f68586e5 4406
1d63fd6b 4407\func{void}{wxVLogStatus}{\param{wxFrame *}{frame}, \param{const char *}{formatString}, \param{va\_list }{argPtr}}
7ac13b21
GT
4408
4409\func{void}{wxLogStatus}{\param{const char *}{formatString}, \param{...}{}}
6fb26ea3 4410
1d63fd6b
GD
4411\func{void}{wxVLogStatus}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
4412
ea44a631 4413Messages logged by these functions will appear in the statusbar of the {\it
f68586e5 4414frame} or of the top level application window by default (i.e. when using
ea44a631 4415the second version of the functions).
f68586e5
VZ
4416
4417If the target frame doesn't have a statusbar, the message will be lost.
6fb26ea3 4418
84ed77ef 4419
6fb26ea3
JS
4420\membersection{::wxLogSysError}\label{wxlogsyserror}
4421
7ac13b21
GT
4422\func{void}{wxLogSysError}{\param{const char *}{formatString}, \param{...}{}}
4423
1d63fd6b 4424\func{void}{wxVLogSysError}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
6fb26ea3 4425
fc2171bd 4426Mostly used by wxWidgets itself, but might be handy for logging errors after
f68586e5
VZ
4427system call (API function) failure. It logs the specified message text as well
4428as the last system error code ({\it errno} or {\it ::GetLastError()} depending
4429on the platform) and the corresponding error message. The second form
f6bcfd97 4430of this function takes the error code explicitly as the first argument.
6fb26ea3 4431
6d516e09
VZ
4432\wxheading{See also}
4433
4434\helpref{wxSysErrorCode}{wxsyserrorcode},
4435\helpref{wxSysErrorMsg}{wxsyserrormsg}
4436
84ed77ef 4437
6fb26ea3
JS
4438\membersection{::wxLogDebug}\label{wxlogdebug}
4439
7ac13b21
GT
4440\func{void}{wxLogDebug}{\param{const char *}{formatString}, \param{...}{}}
4441
1d63fd6b 4442\func{void}{wxVLogDebug}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
6fb26ea3 4443
ea44a631
GD
4444The right functions for debug output. They only do something in debug
4445mode (when the preprocessor symbol \_\_WXDEBUG\_\_ is defined) and expand to
f68586e5 4446nothing in release mode (otherwise).
6fb26ea3 4447
84ed77ef 4448
6fb26ea3
JS
4449\membersection{::wxLogTrace}\label{wxlogtrace}
4450
7ac13b21 4451\func{void}{wxLogTrace}{\param{const char *}{formatString}, \param{...}{}}
1d63fd6b
GD
4452
4453\func{void}{wxVLogTrace}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
6fb26ea3 4454
f68586e5 4455\func{void}{wxLogTrace}{\param{const char *}{mask}, \param{const char *}{formatString}, \param{...}{}}
7ac13b21 4456
1d63fd6b 4457\func{void}{wxVLogTrace}{\param{const char *}{mask}, \param{const char *}{formatString}, \param{va\_list }{argPtr}}
f68586e5
VZ
4458
4459\func{void}{wxLogTrace}{\param{wxTraceMask}{ mask}, \param{const char *}{formatString}, \param{...}{}}
7ac13b21 4460
1d63fd6b 4461\func{void}{wxVLogTrace}{\param{wxTraceMask}{ mask}, \param{const char *}{formatString}, \param{va\_list }{argPtr}}
f68586e5
VZ
4462
4463As {\bf wxLogDebug}, trace functions only do something in debug build and
4464expand to nothing in the release one. The reason for making
4465it a separate function from it is that usually there are a lot of trace
4466messages, so it might make sense to separate them from other debug messages.
4467
4468The trace messages also usually can be separated into different categories and
ec5d7799 4469the second and third versions of this function only log the message if the
f68586e5
VZ
4470{\it mask} which it has is currently enabled in \helpref{wxLog}{wxlog}. This
4471allows to selectively trace only some operations and not others by changing
4472the value of the trace mask (possible during the run-time).
4473
4474For the second function (taking a string mask), the message is logged only if
ec5d7799 4475the mask has been previously enabled by the call to
6f97a409
VS
4476\helpref{AddTraceMask}{wxlogaddtracemask} or by setting
4477\helpref{{\tt WXTRACE} environment variable}{envvars}.
4478The predefined string trace masks
fc2171bd 4479used by wxWidgets are:
f68586e5
VZ
4480
4481\begin{itemize}\itemsep=0pt
4482\item wxTRACE\_MemAlloc: trace memory allocation (new/delete)
4483\item wxTRACE\_Messages: trace window messages/X callbacks
4484\item wxTRACE\_ResAlloc: trace GDI resource allocation
4485\item wxTRACE\_RefCount: trace various ref counting operations
4486\item wxTRACE\_OleCalls: trace OLE method calls (Win32 only)
4487\end{itemize}
6fb26ea3 4488
f70c0443
WS
4489{\bf Caveats:} since both the mask and the format string are strings,
4490this might lead to function signature confusion in some cases:
4491if you intend to call the format string only version of wxLogTrace,
4492then add a \%s format string parameter and then supply a second string parameter for that \%s, the string mask version of wxLogTrace will erroneously get called instead, since you are supplying two string parameters to the function.
4493In this case you'll unfortunately have to avoid having two leading
3980000c 4494string parameters, e.g. by adding a bogus integer (with its \%d format string).
f70c0443
WS
4495
4496The third version of the function only logs the message if all the bits
f68586e5
VZ
4497corresponding to the {\it mask} are set in the wxLog trace mask which can be
4498set by \helpref{SetTraceMask}{wxlogsettracemask}. This version is less
4499flexible than the previous one because it doesn't allow defining the user
4500trace masks easily - this is why it is deprecated in favour of using string
4501trace masks.
6fb26ea3
JS
4502
4503\begin{itemize}\itemsep=0pt
4504\item wxTraceMemAlloc: trace memory allocation (new/delete)
4505\item wxTraceMessages: trace window messages/X callbacks
4506\item wxTraceResAlloc: trace GDI resource allocation
4507\item wxTraceRefCount: trace various ref counting operations
f68586e5 4508\item wxTraceOleCalls: trace OLE method calls (Win32 only)
6fb26ea3
JS
4509\end{itemize}
4510
84ed77ef 4511
c11d62a6
VZ
4512\membersection{::wxSafeShowMessage}\label{wxsafeshowmessage}
4513
4514\func{void}{wxSafeShowMessage}{\param{const wxString\& }{title}, \param{const wxString\& }{text}}
4515
4516This function shows a message to the user in a safe way and should be safe to
4517call even before the application has been initialized or if it is currently in
4518some other strange state (for example, about to crash). Under Windows this
b829bf55 4519function shows a message box using a native dialog instead of
c11d62a6
VZ
4520\helpref{wxMessageBox}{wxmessagebox} (which might be unsafe to call), elsewhere
4521it simply prints the message to the standard output using the title as prefix.
4522
4523\wxheading{Parameters}
4524
4525\docparam{title}{The title of the message box shown to the user or the prefix
4526of the message string}
4527
4528\docparam{text}{The text to show to the user}
4529
4530\wxheading{See also}
4531
4532\helpref{wxLogFatalError}{wxlogfatalerror}
4533
4534\wxheading{Include files}
4535
4536<wx/log.h>
4537
84ed77ef 4538
6d516e09
VZ
4539\membersection{::wxSysErrorCode}\label{wxsyserrorcode}
4540
4541\func{unsigned long}{wxSysErrorCode}{\void}
4542
4543Returns the error code from the last system call. This function uses
4544{\tt errno} on Unix platforms and {\tt GetLastError} under Win32.
4545
4546\wxheading{See also}
4547
4548\helpref{wxSysErrorMsg}{wxsyserrormsg},
4549\helpref{wxLogSysError}{wxlogsyserror}
4550
84ed77ef 4551
6d516e09
VZ
4552\membersection{::wxSysErrorMsg}\label{wxsyserrormsg}
4553
4554\func{const wxChar *}{wxSysErrorMsg}{\param{unsigned long }{errCode = 0}}
4555
ec5d7799
RD
4556Returns the error message corresponding to the given system error code. If
4557{\it errCode} is $0$ (default), the last error code (as returned by
6d516e09
VZ
4558\helpref{wxSysErrorCode}{wxsyserrorcode}) is used.
4559
4560\wxheading{See also}
4561
4562\helpref{wxSysErrorCode}{wxsyserrorcode},
4563\helpref{wxLogSysError}{wxlogsyserror}
4564
84ed77ef 4565
b0fc8832
VZ
4566\membersection{WXTRACE}\label{trace}
4567
4568\wxheading{Include files}
4569
4570<wx/object.h>
4571
4572\func{}{WXTRACE}{formatString, ...}
4573
2bd25c5a
VZ
4574{\bf NB:} This macro is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
4575
b0fc8832
VZ
4576Calls wxTrace with printf-style variable argument syntax. Output
4577is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
4578
b0fc8832
VZ
4579\wxheading{Include files}
4580
4581<wx/memory.h>
4582
84ed77ef 4583
b0fc8832
VZ
4584\membersection{WXTRACELEVEL}\label{tracelevel}
4585
4586\func{}{WXTRACELEVEL}{level, formatString, ...}
4587
2bd25c5a
VZ
4588{\bf NB:} This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
4589
b0fc8832
VZ
4590Calls wxTraceLevel with printf-style variable argument syntax. Output
4591is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
4592The first argument should be the level at which this information is appropriate.
4593It will only be output if the level returned by wxDebugContext::GetLevel is equal to or greater than
4594this value.
4595
b0fc8832
VZ
4596\wxheading{Include files}
4597
4598<wx/memory.h>
4599
84ed77ef 4600
b0fc8832
VZ
4601\membersection{::wxTrace}\label{wxtrace}
4602
4603\func{void}{wxTrace}{\param{const wxString\& }{fmt}, \param{...}{}}
4604
2bd25c5a
VZ
4605{\bf NB:} This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
4606
b0fc8832
VZ
4607Takes printf-style variable argument syntax. Output
4608is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
4609
b0fc8832
VZ
4610\wxheading{Include files}
4611
4612<wx/memory.h>
4613
84ed77ef 4614
b0fc8832
VZ
4615\membersection{::wxTraceLevel}\label{wxtracelevel}
4616
4617\func{void}{wxTraceLevel}{\param{int}{ level}, \param{const wxString\& }{fmt}, \param{...}{}}
4618
2bd25c5a
VZ
4619{\bf NB:} This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
4620
b0fc8832
VZ
4621Takes printf-style variable argument syntax. Output
4622is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
4623The first argument should be the level at which this information is appropriate.
4624It will only be output if the level returned by wxDebugContext::GetLevel is equal to or greater than
4625this value.
4626
b0fc8832
VZ
4627\wxheading{Include files}
4628
4629<wx/memory.h>
4630
84ed77ef
VZ
4631
4632
f6bcfd97
BP
4633\section{Time functions}\label{timefunctions}
4634
26822b76
VZ
4635The functions in this section deal with getting the current time and sleeping
4636for the specified time interval.
f6bcfd97 4637
84ed77ef 4638
f6bcfd97
BP
4639\membersection{::wxGetLocalTime}\label{wxgetlocaltime}
4640
4641\func{long}{wxGetLocalTime}{\void}
4642
4643Returns the number of seconds since local time 00:00:00 Jan 1st 1970.
4644
4645\wxheading{See also}
4646
4647\helpref{wxDateTime::Now}{wxdatetimenow}
4648
4649\wxheading{Include files}
4650
26822b76 4651<wx/stopwatch.h>
f6bcfd97 4652
84ed77ef 4653
f6bcfd97
BP
4654\membersection{::wxGetLocalTimeMillis}\label{wxgetlocaltimemillis}
4655
a9d171bd 4656\func{wxLongLong}{wxGetLocalTimeMillis}{\void}
f6bcfd97
BP
4657
4658Returns the number of milliseconds since local time 00:00:00 Jan 1st 1970.
4659
4660\wxheading{See also}
4661
4662\helpref{wxDateTime::Now}{wxdatetimenow},\\
a9d171bd 4663\helpref{wxLongLong}{wxlonglong}
f6bcfd97
BP
4664
4665\wxheading{Include files}
4666
26822b76 4667<wx/stopwatch.h>
f6bcfd97 4668
84ed77ef 4669
f6bcfd97
BP
4670\membersection{::wxGetUTCTime}\label{wxgetutctime}
4671
4672\func{long}{wxGetUTCTime}{\void}
4673
4674Returns the number of seconds since GMT 00:00:00 Jan 1st 1970.
4675
4676\wxheading{See also}
4677
4678\helpref{wxDateTime::Now}{wxdatetimenow}
4679
4680\wxheading{Include files}
4681
26822b76 4682<wx/stopwatch.h>
f6bcfd97 4683
84ed77ef 4684
08873d36
VZ
4685\membersection{::wxMicroSleep}\label{wxmicrosleep}
4686
4687\func{void}{wxMicroSleep}{\param{unsigned long}{ microseconds}}
4688
4689Sleeps for the specified number of microseconds. The microsecond resolution may
4690not, in fact, be available on all platforms (currently only Unix platforms with
8ea92b4d 4691nanosleep(2) may provide it) in which case this is the same as
08873d36
VZ
4692\helpref{wxMilliSleep}{wxmillisleep}(\arg{microseconds}$/1000$).
4693
4694\wxheading{Include files}
4695
4696<wx/utils.h>
4697
4698
4699\membersection{::wxMilliSleep}\label{wxmillisleep}
4700
4701\func{void}{wxMilliSleep}{\param{unsigned long}{ milliseconds}}
4702
4703Sleeps for the specified number of milliseconds. Notice that usage of this
4704function is encouraged instead of calling usleep(3) directly because the
4705standard usleep() function is not MT safe.
4706
4707\wxheading{Include files}
4708
4709<wx/utils.h>
4710
4711
b0fc8832
VZ
4712\membersection{::wxNow}\label{wxnow}
4713
4714\func{wxString}{wxNow}{\void}
4715
4716Returns a string representing the current date and time.
4717
4718\wxheading{Include files}
4719
4720<wx/utils.h>
4721
84ed77ef 4722
b0fc8832
VZ
4723\membersection{::wxSleep}\label{wxsleep}
4724
4725\func{void}{wxSleep}{\param{int}{ secs}}
4726
4727Sleeps for the specified number of seconds.
4728
4729\wxheading{Include files}
4730
4731<wx/utils.h>
4732
84ed77ef 4733
b0fc8832
VZ
4734\membersection{::wxUsleep}\label{wxusleep}
4735
4736\func{void}{wxUsleep}{\param{unsigned long}{ milliseconds}}
4737
08873d36 4738This function is deprecated because its name is misleading: notice that the
8ea92b4d
WS
4739argument is in milliseconds, not microseconds. Please use either
4740\helpref{wxMilliSleep}{wxmillisleep} or \helpref{wxMicroSleep}{wxmicrosleep}
08873d36 4741depending on the resolution you need.
b0fc8832 4742
84ed77ef
VZ
4743
4744
6fb26ea3
JS
4745\section{Debugging macros and functions}\label{debugmacros}
4746
8f5d9104 4747Useful macros and functions for error checking and defensive programming.
fc2171bd 4748wxWidgets defines three families of the assert-like macros:
8f5d9104
VZ
4749the wxASSERT and wxFAIL macros only do anything if \_\_WXDEBUG\_\_ is defined
4750(in other words, in the debug build) but disappear completely in the release
4751build. On the other hand, the wxCHECK macros stay event in release builds but a
4752check failure doesn't generate any user-visible effects then. Finally, the
4753compile time assertions don't happen during the run-time but result in the
4754compilation error messages if the condition they check fail.
6fb26ea3 4755
954b8ae6
JS
4756\wxheading{Include files}
4757
4758<wx/debug.h>
4759
84ed77ef 4760
6fb26ea3
JS
4761\membersection{::wxOnAssert}\label{wxonassert}
4762
09007669 4763\func{void}{wxOnAssert}{\param{const char *}{fileName}, \param{int}{ lineNumber}, \param{const char *}{func}, \param{const char *}{cond}, \param{const char *}{msg = NULL}}
6fb26ea3 4764
8f5d9104
VZ
4765This function is called whenever one of debugging macros fails (i.e. condition
4766is false in an assertion). It is only defined in the debug mode, in release
4767builds the \helpref{wxCHECK}{wxcheck} failures don't result in anything.
4768
4769To override the default behaviour in the debug builds which is to show the user
4770a dialog asking whether he wants to abort the program, continue or continue
b829bf55 4771ignoring any subsequent assert failures, you may override
e0c8d2d9 4772\helpref{wxApp::OnAssertFailure}{wxapponassertfailure} which is called by this function if
8f5d9104 4773the global application object exists.
6fb26ea3 4774
84ed77ef 4775
6fb26ea3
JS
4776\membersection{wxASSERT}\label{wxassert}
4777
4778\func{}{wxASSERT}{\param{}{condition}}
4779
cc81d32f 4780Assert macro. An error message will be generated if the condition is false in
b207457c
VZ
4781debug mode, but nothing will be done in the release build.
4782
4783Please note that the condition in wxASSERT() should have no side effects
4784because it will not be executed in release mode at all.
4785
8f5d9104
VZ
4786\wxheading{See also}
4787
4788\helpref{wxASSERT\_MSG}{wxassertmsg},\\
4789\helpref{wxCOMPILE\_TIME\_ASSERT}{wxcompiletimeassert}
4790
84ed77ef 4791
8f5d9104
VZ
4792\membersection{wxASSERT\_MIN\_BITSIZE}\label{wxassertminbitsize}
4793
4794\func{}{wxASSERT\_MIN\_BITSIZE}{\param{}{type}, \param{}{size}}
4795
b829bf55 4796This macro results in a
9722642d 4797\helpref{compile time assertion failure}{wxcompiletimeassert} if the size
8f5d9104
VZ
4798of the given type {\it type} is less than {\it size} bits.
4799
4800You may use it like this, for example:
4801
4802\begin{verbatim}
4803 // we rely on the int being able to hold values up to 2^32
4804 wxASSERT_MIN_BITSIZE(int, 32);
4805
4806 // can't work with the platforms using UTF-8 for wchar_t
4807 wxASSERT_MIN_BITSIZE(wchar_t, 16);
4808\end{verbatim}
6fb26ea3 4809
84ed77ef 4810
6fb26ea3
JS
4811\membersection{wxASSERT\_MSG}\label{wxassertmsg}
4812
4813\func{}{wxASSERT\_MSG}{\param{}{condition}, \param{}{msg}}
4814
cc81d32f 4815Assert macro with message. An error message will be generated if the condition is false.
6fb26ea3 4816
8f5d9104
VZ
4817\wxheading{See also}
4818
4819\helpref{wxASSERT}{wxassert},\\
4820\helpref{wxCOMPILE\_TIME\_ASSERT}{wxcompiletimeassert}
4821
84ed77ef 4822
8f5d9104
VZ
4823\membersection{wxCOMPILE\_TIME\_ASSERT}\label{wxcompiletimeassert}
4824
4825\func{}{wxCOMPILE\_TIME\_ASSERT}{\param{}{condition}, \param{}{msg}}
4826
4827Using {\tt wxCOMPILE\_TIME\_ASSERT} results in a compilation error if the
9722642d 4828specified {\it condition} is false. The compiler error message should include
8f5d9104
VZ
4829the {\it msg} identifier - please note that it must be a valid C++ identifier
4830and not a string unlike in the other cases.
4831
b829bf55 4832This macro is mostly useful for testing the expressions involving the
8f5d9104
VZ
4833{\tt sizeof} operator as they can't be tested by the preprocessor but it is
4834sometimes desirable to test them at the compile time.
4835
5b8643ea
VZ
4836Note that this macro internally declares a struct whose name it tries to make
4837unique by using the {\tt \_\_LINE\_\_} in it but it may still not work if you
4838use it on the same line in two different source files. In this case you may
b829bf55 4839either change the line in which either of them appears on or use the
5b8643ea
VZ
4840\helpref{wxCOMPILE\_TIME\_ASSERT2}{wxcompiletimeassert2} macro.
4841
150018ae 4842Also note that Microsoft Visual C++ has a bug which results in compiler errors
cf700088
JS
4843if you use this macro with `Program Database For Edit And Continue'
4844(\texttt{/ZI}) option, so you shouldn't use it (`Program Database'
150018ae
VZ
4845(\texttt{/Zi}) is ok though) for the code making use of this macro.
4846
8f5d9104
VZ
4847\wxheading{See also}
4848
4849\helpref{wxASSERT\_MSG}{wxassertmsg},\\
4850\helpref{wxASSERT\_MIN\_BITSIZE}{wxassertminbitsize}
b207457c 4851
84ed77ef 4852
5b8643ea
VZ
4853\membersection{wxCOMPILE\_TIME\_ASSERT2}\label{wxcompiletimeassert2}
4854
4855\func{}{wxCOMPILE\_TIME\_ASSERT}{\param{}{condition}, \param{}{msg}, \param{}{name}}
4856
b829bf55 4857This macro is identical to \helpref{wxCOMPILE\_TIME\_ASSERT2}{wxcompiletimeassert2}
5b8643ea
VZ
4858except that it allows you to specify a unique {\it name} for the struct
4859internally defined by this macro to avoid getting the compilation errors
4860described \helpref{above}{wxcompiletimeassert}.
4861
84ed77ef 4862
6fb26ea3
JS
4863\membersection{wxFAIL}\label{wxfail}
4864
b207457c 4865\func{}{wxFAIL}{\void}
6fb26ea3
JS
4866
4867Will always generate an assert error if this code is reached (in debug mode).
4868
b207457c
VZ
4869See also: \helpref{wxFAIL\_MSG}{wxfailmsg}
4870
84ed77ef 4871
6fb26ea3
JS
4872\membersection{wxFAIL\_MSG}\label{wxfailmsg}
4873
b207457c 4874\func{}{wxFAIL\_MSG}{\param{}{msg}}
6fb26ea3
JS
4875
4876Will always generate an assert error with specified message if this code is reached (in debug mode).
4877
b207457c
VZ
4878This macro is useful for marking unreachable" code areas, for example
4879it may be used in the "default:" branch of a switch statement if all possible
4880cases are processed above.
4881
8f5d9104
VZ
4882\wxheading{See also}
4883
4884\helpref{wxFAIL}{wxfail}
b207457c 4885
84ed77ef 4886
6fb26ea3
JS
4887\membersection{wxCHECK}\label{wxcheck}
4888
4889\func{}{wxCHECK}{\param{}{condition}, \param{}{retValue}}
4890
4891Checks that the condition is true, returns with the given return value if not (FAILs in debug mode).
4892This check is done even in release mode.
4893
84ed77ef 4894
6fb26ea3
JS
4895\membersection{wxCHECK\_MSG}\label{wxcheckmsg}
4896
4897\func{}{wxCHECK\_MSG}{\param{}{condition}, \param{}{retValue}, \param{}{msg}}
4898
4899Checks that the condition is true, returns with the given return value if not (FAILs in debug mode).
4900This check is done even in release mode.
4901
154b6b0f 4902This macro may be only used in non-void functions, see also
b207457c
VZ
4903\helpref{wxCHECK\_RET}{wxcheckret}.
4904
84ed77ef 4905
b207457c
VZ
4906\membersection{wxCHECK\_RET}\label{wxcheckret}
4907
4908\func{}{wxCHECK\_RET}{\param{}{condition}, \param{}{msg}}
4909
4910Checks that the condition is true, and returns if not (FAILs with given error
4911message in debug mode). This check is done even in release mode.
4912
ec5d7799 4913This macro should be used in void functions instead of
b207457c
VZ
4914\helpref{wxCHECK\_MSG}{wxcheckmsg}.
4915
84ed77ef 4916
b207457c
VZ
4917\membersection{wxCHECK2}\label{wxcheck2}
4918
4919\func{}{wxCHECK2}{\param{}{condition}, \param{}{operation}}
4920
ec5d7799
RD
4921Checks that the condition is true and \helpref{wxFAIL}{wxfail} and execute
4922{\it operation} if it is not. This is a generalisation of
b207457c
VZ
4923\helpref{wxCHECK}{wxcheck} and may be used when something else than just
4924returning from the function must be done when the {\it condition} is false.
4925
4926This check is done even in release mode.
4927
84ed77ef 4928
b207457c
VZ
4929\membersection{wxCHECK2\_MSG}\label{wxcheck2msg}
4930
4931\func{}{wxCHECK2}{\param{}{condition}, \param{}{operation}, \param{}{msg}}
4932
ec5d7799 4933This is the same as \helpref{wxCHECK2}{wxcheck2}, but
b207457c
VZ
4934\helpref{wxFAIL\_MSG}{wxfailmsg} with the specified {\it msg} is called
4935instead of wxFAIL() if the {\it condition} is false.
4936
84ed77ef 4937
b0fc8832
VZ
4938\membersection{::wxTrap}\label{wxtrap}
4939
4940\func{void}{wxTrap}{\void}
4941
4942In debug mode (when {\tt \_\_WXDEBUG\_\_} is defined) this function generates a
4943debugger exception meaning that the control is passed to the debugger if one is
4944attached to the process. Otherwise the program just terminates abnormally.
4945
4946In release mode this function does nothing.
4947
4948\wxheading{Include files}
4949
4950<wx/debug.h>
4951
a434b43f 4952
84ed77ef 4953
a434b43f
VZ
4954\membersection{::wxIsDebuggerRunning}\label{wxisdebuggerrunning}
4955
4956\func{bool}{wxIsDebuggerRunning}{\void}
4957
c50a4038 4958Returns \true if the program is running under debugger, \false otherwise.
a434b43f 4959
c50a4038
VZ
4960Please note that this function is currently only implemented for Win32 and Mac
4961builds using CodeWarrior and always returns \false elsewhere.
a434b43f
VZ
4962
4963
84ed77ef
VZ
4964
4965
5807634c
VZ
4966\section{Environment access functions}\label{environfunctions}
4967
4968The functions in this section allow to access (get) or change value of
4969environment variables in a portable way. They are currently implemented under
4970Win32 and POSIX-like systems (Unix).
4971
4972% TODO add some stuff about env var inheriting but not propagating upwards (VZ)
4973
4974\wxheading{Include files}
4975
4976<wx/utils.h>
4977
84ed77ef 4978
308978f6 4979\membersection{wxGetenv}\label{wxgetenvmacro}
5807634c
VZ
4980
4981\func{wxChar *}{wxGetEnv}{\param{const wxString\&}{ var}}
4982
308978f6
VZ
4983This is a macro defined as {\tt getenv()} or its wide char version in Unicode
4984mode.
4985
4986Note that under Win32 it may not return correct value for the variables set
4987with \helpref{wxSetEnv}{wxsetenv}, use \helpref{wxGetEnv}{wxgetenv} function
4988instead.
4989
84ed77ef 4990
308978f6
VZ
4991\membersection{wxGetEnv}\label{wxgetenv}
4992
4993\func{bool}{wxGetEnv}{\param{const wxString\&}{ var}, \param{wxString *}{value}}
4994
4995Returns the current value of the environment variable {\it var} in {\it value}.
4996{\it value} may be {\tt NULL} if you just want to know if the variable exists
4997and are not interested in its value.
4998
43e8916f 4999Returns \true if the variable exists, \false otherwise.
5807634c 5000
84ed77ef 5001
5807634c
VZ
5002\membersection{wxSetEnv}\label{wxsetenv}
5003
90a77e64 5004\func{bool}{wxSetEnv}{\param{const wxString\&}{ var}, \param{const wxString\& }{value}}
5807634c
VZ
5005
5006Sets the value of the environment variable {\it var} (adding it if necessary)
5007to {\it value}.
5008
43e8916f 5009Returns \true on success.
5807634c 5010
90a77e64
VS
5011\wxheading{See also}
5012
5013\helpref{wxUnsetEnv}{wxunsetenv}
5014
84ed77ef 5015
5807634c
VZ
5016\membersection{wxUnsetEnv}\label{wxunsetenv}
5017
5018\func{bool}{wxUnsetEnv}{\param{const wxString\&}{ var}}
5019
ec5d7799 5020Removes the variable {\it var} from the environment.
5df6ed1c 5021\helpref{wxGetEnv}{wxgetenv} will return {\tt NULL} after the call to this
5807634c
VZ
5022function.
5023
43e8916f 5024Returns \true on success.
90a77e64
VS
5025
5026\wxheading{See also}
5027
5028\helpref{wxSetEnv}{wxsetenv}
cde76cf2
VZ
5029
5030
5031\section{Atomic operations}\label{atomicoperations}
5032
5033When using multi-threaded applications, it is often required to access or
5034modify memory which is shared between threads. Atomic integer and pointer
5035operations are an efficient way to handle this issue (another, less efficient,
5036way is to use a \helpref{mutex}{wxmutex} or \helpref{critical
5037section}{wxcriticalsection}). A native implementation exists for Windows,
5038Linux, Solaris and Mac OS X, for other OS, a
5039\helpref{wxCriticalSection}{wxcriticalsection} is used to protect the data.
5040
5041One particular application is reference counting (used by so-called smart
5042pointers).
5043
5044You should define your variable with the type wxAtomicInt in order to apply
5045atomic operations to it.
5046
5047\wxheading{Include files}
5048
5049<wx/atomic.h>
5050
5051\membersection{::wxAtomicInc}\label{wxatomicinc}
5052
5053\func{void}{wxAtomicInc}{\param{wxAtomicInt\& }{value}}
5054
5055This function increments \arg{value} in an atomic manner.
5056
5057
5058\membersection{::wxAtomicDec}\label{wxatomicdec}
5059
5060\func{wxInt32}{wxAtomicDec}{\param{wxAtomicInt\& }{value}}
5061
5062This function decrements \arg{value} in an atomic manner.
5063
5064Returns 0 if \arg{value} is 0 after decrementation or any non-zero value (not
5065necessarily equal to the value of the variable) otherwise.
5066
5067