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