]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/function.tex
more LaTeX error fixes
[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
3009\func{}{wxCONCAT}{\param{}{x}, \param{}{y}}
3010
3011This macro returns the concatenation of two tokens \arg{x} and \arg{y}.
3012
3013
a57f7612
FM
3014\membersection{wxDECLARE\_APP}\label{wxdeclareapp}
3015
3016\func{}{wxDECLARE\_APP}{className}
3017
3018This is used in headers to create a forward declaration of the
3019\helpref{wxGetApp}{wxgetapp} function implemented by
3020\helpref{wxIMPLEMENT\_APP}{wximplementapp}. It creates the declaration
3021{\tt className\& wxGetApp(void)}.
3022
3023Example:
3024
3025\begin{verbatim}
3026 wxDECLARE_APP(MyApp)
3027\end{verbatim}
3028
3029\wxheading{Include files}
3030
3031<wx/app.h>
3032
3033
4104ed92
VZ
3034\membersection{wxDYNLIB\_FUNCTION}\label{wxdynlibfunction}
3035
3036\func{}{wxDYNLIB\_FUNCTION}{\param{}{type}, \param{}{name}, \param{}{dynlib}}
3037
8ea92b4d 3038When loading a function from a DLL you always have to cast the returned
b325f27f 3039{\tt void *} pointer to the correct type and, even more annoyingly, you have to
4104ed92
VZ
3040repeat this type twice if you want to declare and define a function pointer all
3041in one line
3042
3043This macro makes this slightly less painful by allowing you to specify the
3044type only once, as the first parameter, and creating a variable of this type
3045named after the function but with {\tt pfn} prefix and initialized with the
8ea92b4d 3046function \arg{name} from the \helpref{wxDynamicLibrary}{wxdynamiclibrary}
4104ed92
VZ
3047\arg{dynlib}.
3048
3049\wxheading{Parameters}
3050
3051\docparam{type}{the type of the function}
3052
3053\docparam{name}{the name of the function to load, not a string (without quotes,
3054it is quoted automatically by the macro)}
3055
3056\docparam{dynlib}{the library to load the function from}
3057
3058
84ed77ef 3059
5d88a6b5
VZ
3060\membersection{wxDEPRECATED}\label{wxdeprecated}
3061
3062This macro can be used around a function declaration to generate warnings
3063indicating that this function is deprecated (i.e. obsolete and planned to be
3064removed in the future) when it is used. Only Visual C++ 7 and higher and g++
3065compilers currently support this functionality.
3066
3067Example of use:
3068\begin{verbatim}
3069 // old function, use wxString version instead
3070 wxDEPRECATED( void wxGetSomething(char *buf, size_t len) );
3071
3072 // ...
3073 wxString wxGetSomething();
3074\end{verbatim}
3075
3076
3077\membersection{wxDEPRECATED\_BUT\_USED\_INTERNALLY}\label{wxdeprecatedbutusedinternally}
3078
3079This is a special version of \helpref{wxDEPRECATED}{wxdeprecated} macro which
3080only does something when the deprecated function is used from the code outside
3081wxWidgets itself but doesn't generate warnings when it is used from wxWidgets.
3082It is used with the virtual functions which are called by the library itself --
3083even if such function is deprecated the library still has to call it to ensure
3084that the existing code overriding it continues to work, but the use of this
3085macro ensures that a deprecation warning will be generated if this function is
3086used from the user code or, in case of Visual C++, even when it is simply
3087overridden.
3088
3089
3694bb76
VZ
3090\membersection{wxDEPRECATED\_INLINE}\label{wxdeprecatedinline}
3091
3092\func{}{wxDEPRECATED\_INLINE}{\param{}{func}, \param{}{body}}
3093
3094This macro is similar to \helpref{wxDEPRECATED}{wxdeprecated} but can be used
3095to not only declare the function \arg{func} as deprecated but to also provide
3096its (inline) implementation \arg{body}.
3097
3098It can be used as following:
3099\begin{verbatim}
3100 class wxFoo
3101 {
3102 public:
3103 // OldMethod() is deprecated, use NewMethod() instead
3104 void NewMethod();
3105 wxDEPRECATED_INLINE( void OldMethod(), NewMethod() );
3106 };
3107\end{verbatim}
3108
986ecc86
VZ
3109\membersection{wxEXPLICIT}\label{wxexplicit}
3110
3111{\tt wxEXPLICIT} is a macro which expands to the C++ {\tt explicit} keyword if
3112the compiler supports it or nothing otherwise. Thus, it can be used even in the
3113code which might have to be compiled with an old compiler without support for
3114this language feature but still take advantage of it when it is available.
3115
84ed77ef 3116
6445acc7 3117
f52d9e92
VZ
3118\membersection{::wxGetKeyState}\label{wxgetkeystate}
3119
1751226c 3120\func{bool}{wxGetKeyState}{\param{wxKeyCode }{key}}
f52d9e92 3121
44353523
VZ
3122For normal keys, returns \true if the specified key is currently down.
3123
3124For togglable keys (Caps Lock, Num Lock and Scroll Lock), returns
3125\true if the key is toggled such that its LED indicator is lit. There is
3126currently no way to test whether togglable keys are up or down.
3127
3128Even though there are virtual key codes defined for mouse buttons, they
3129cannot be used with this function currently.
f52d9e92
VZ
3130
3131\wxheading{Include files}
3132
3133<wx/utils.h>
3134
3135
2b5f62a0
VZ
3136\membersection{wxLL}\label{wxll}
3137
3138\func{wxLongLong\_t}{wxLL}{\param{}{number}}
3139
3140This macro is defined for the platforms with a native 64 bit integer type and
3141allows to define 64 bit compile time constants:
3142
3143\begin{verbatim}
3144 #ifdef wxLongLong_t
3145 wxLongLong_t ll = wxLL(0x1234567890abcdef);
3146 #endif
3147\end{verbatim}
3148
3149\wxheading{Include files}
3150
3151<wx/longlong.h>
3152
84ed77ef
VZ
3153\wxheading{See also}
3154
3155\helpref{wxULL}{wxull}, \helpref{wxLongLong}{wxlonglong}
3156
3157
2b5f62a0
VZ
3158\membersection{wxLongLongFmtSpec}\label{wxlonglongfmtspec}
3159
3160This macro is defined to contain the {\tt printf()} format specifier using
3161which 64 bit integer numbers (i.e. those of type {\tt wxLongLong\_t}) can be
3162printed. Example of using it:
3163
3164\begin{verbatim}
3165 #ifdef wxLongLong_t
3166 wxLongLong_t ll = wxLL(0x1234567890abcdef);
3167 printf("Long long = %" wxLongLongFmtSpec "x\n", ll);
3168 #endif
3169\end{verbatim}
3170
3171\wxheading{See also}
3172
3173\helpref{wxLL}{wxll}
3174
3175\wxheading{Include files}
3176
3177<wx/longlong.h>
3178
84ed77ef 3179
b0fc8832 3180\membersection{::wxNewId}\label{wxnewid}
a660d684 3181
b0fc8832
VZ
3182\func{long}{wxNewId}{\void}
3183
15c6269f
VZ
3184This function is deprecated as the ids generated by it can conflict with the
3185ids defined by the user code, use \texttt{wxID\_ANY} to assign ids which are
3186guaranteed to not conflict with the user-defined ids for the controls and menu
3187items you create instead of using this function.
3188
3189
b0fc8832 3190Generates an integer identifier unique to this run of the program.
a660d684 3191
954b8ae6
JS
3192\wxheading{Include files}
3193
3194<wx/utils.h>
3195
84ed77ef 3196
1a64b24d
VZ
3197\membersection{wxON\_BLOCK\_EXIT}\label{wxonblockexit}
3198
3199\func{}{wxON\_BLOCK\_EXIT0}{\param{}{func}}
6af76942 3200
1a64b24d 3201\func{}{wxON\_BLOCK\_EXIT1}{\param{}{func}, \param{}{p1}}
6af76942 3202
1a64b24d
VZ
3203\func{}{wxON\_BLOCK\_EXIT2}{\param{}{func}, \param{}{p1}, \param{}{p2}}
3204
3205This family of macros allows to ensure that the global function \arg{func}
3206with 0, 1, 2 or more parameters (up to some implementaton-defined limit) is
3207executed on scope exit, whether due to a normal function return or because an
3208exception has been thrown. A typical example of its usage:
3209\begin{verbatim}
3210 void *buf = malloc(size);
3211 wxON_BLOCK_EXIT1(free, buf);
3212\end{verbatim}
3213
3214Please see the original article by Andrei Alexandrescu and Petru Marginean
3215published in December 2000 issue of \emph{C/C++ Users Journal} for more
3216details.
3217
3218\wxheading{Include files}
3219
3220<wx/scopeguard.h>
3221
3222\wxheading{See also}
3223
3224\helpref{wxON\_BLOCK\_EXIT\_OBJ}{wxonblockexitobj}
3225
3226
3227\membersection{wxON\_BLOCK\_EXIT\_OBJ}\label{wxonblockexitobj}
3228
3229\func{}{wxON\_BLOCK\_EXIT\_OBJ0}{\param{}{obj}, \param{}{method}}
6af76942 3230
1a64b24d 3231\func{}{wxON\_BLOCK\_EXIT\_OBJ1}{\param{}{obj}, \param{}{method}, \param{}{p1}}
6af76942 3232
1a64b24d
VZ
3233\func{}{wxON\_BLOCK\_EXIT\_OBJ2}{\param{}{obj}, \param{}{method}, \param{}{p1}, \param{}{p2}}
3234
ce045aed 3235This family of macros is similar to \helpref{wxON\_BLOCK\_EXIT}{wxonblockexit}
1a64b24d
VZ
3236but calls a method of the given object instead of a free function.
3237
3238\wxheading{Include files}
3239
3240<wx/scopeguard.h>
3241
3242
b0fc8832 3243\membersection{::wxRegisterId}\label{wxregisterid}
a660d684 3244
b0fc8832 3245\func{void}{wxRegisterId}{\param{long}{ id}}
a660d684 3246
b0fc8832
VZ
3247Ensures that ids subsequently generated by {\bf NewId} do not clash with
3248the given {\bf id}.
a660d684 3249
954b8ae6
JS
3250\wxheading{Include files}
3251
3252<wx/utils.h>
3253
84ed77ef 3254
b0fc8832 3255\membersection{::wxDDECleanUp}\label{wxddecleanup}
bdc72a22 3256
b0fc8832 3257\func{void}{wxDDECleanUp}{\void}
bdc72a22 3258
fc2171bd 3259Called when wxWidgets exits, to clean up the DDE system. This no longer needs to be
b0fc8832 3260called by the application.
bdc72a22 3261
b0fc8832 3262See also \helpref{wxDDEInitialize}{wxddeinitialize}.
bdc72a22
VZ
3263
3264\wxheading{Include files}
3265
b0fc8832 3266<wx/dde.h>
a660d684 3267
84ed77ef 3268
b0fc8832 3269\membersection{::wxDDEInitialize}\label{wxddeinitialize}
a660d684 3270
b0fc8832 3271\func{void}{wxDDEInitialize}{\void}
a660d684 3272
b0fc8832 3273Initializes the DDE system. May be called multiple times without harm.
a660d684 3274
b0fc8832 3275This no longer needs to be called by the application: it will be called
fc2171bd 3276by wxWidgets if necessary.
bdc72a22 3277
d2c2afc9 3278See also \helpref{wxDDEServer}{wxddeserver}, \helpref{wxDDEClient}{wxddeclient}, \helpref{wxDDEConnection}{wxddeconnection},\rtfsp
b0fc8832 3279\helpref{wxDDECleanUp}{wxddecleanup}.
bdc72a22 3280
954b8ae6
JS
3281\wxheading{Include files}
3282
b0fc8832 3283<wx/dde.h>
a660d684 3284
84ed77ef 3285
b0fc8832 3286\membersection{::wxEnableTopLevelWindows}\label{wxenabletoplevelwindows}
a660d684 3287
08890e27 3288\func{void}{wxEnableTopLevelWindows}{\param{bool}{ enable = true}}
a660d684 3289
b0fc8832
VZ
3290This function enables or disables all top level windows. It is used by
3291\helpref{::wxSafeYield}{wxsafeyield}.
a660d684 3292
954b8ae6
JS
3293\wxheading{Include files}
3294
3295<wx/utils.h>
3296
84ed77ef 3297
b0fc8832 3298\membersection{::wxFindMenuItemId}\label{wxfindmenuitemid}
a660d684 3299
b0fc8832 3300\func{int}{wxFindMenuItemId}{\param{wxFrame *}{frame}, \param{const wxString\& }{menuString}, \param{const wxString\& }{itemString}}
a660d684 3301
b0fc8832 3302Find a menu item identifier associated with the given frame's menu bar.
a660d684 3303
954b8ae6
JS
3304\wxheading{Include files}
3305
3306<wx/utils.h>
3307
84ed77ef 3308
b0fc8832 3309\membersection{::wxFindWindowByLabel}\label{wxfindwindowbylabel}
c51deffc 3310
b0fc8832 3311\func{wxWindow *}{wxFindWindowByLabel}{\param{const wxString\& }{label}, \param{wxWindow *}{parent=NULL}}
c51deffc 3312
b829bf55 3313{\bf NB:} This function is obsolete, please use
146ba0fe
VZ
3314\helpref{wxWindow::FindWindowByLabel}{wxwindowfindwindowbylabel} instead.
3315
b0fc8832
VZ
3316Find a window by its label. Depending on the type of window, the label may be a window title
3317or panel item label. If {\it parent} is NULL, the search will start from all top-level
3318frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.
3319The search is recursive in both cases.
c51deffc
VZ
3320
3321\wxheading{Include files}
3322
3323<wx/utils.h>
3324
84ed77ef 3325
b0fc8832
VZ
3326\membersection{::wxFindWindowByName}\label{wxfindwindowbyname}
3327
3328\func{wxWindow *}{wxFindWindowByName}{\param{const wxString\& }{name}, \param{wxWindow *}{parent=NULL}}
a660d684 3329
b829bf55 3330{\bf NB:} This function is obsolete, please use
146ba0fe
VZ
3331\helpref{wxWindow::FindWindowByName}{wxwindowfindwindowbyname} instead.
3332
b0fc8832
VZ
3333Find a window by its name (as given in a window constructor or {\bf Create} function call).
3334If {\it parent} is NULL, the search will start from all top-level
3335frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.
3336The search is recursive in both cases.
a660d684 3337
b0fc8832 3338If no such named window is found, {\bf wxFindWindowByLabel} is called.
a660d684 3339
954b8ae6
JS
3340\wxheading{Include files}
3341
3342<wx/utils.h>
3343
84ed77ef 3344
b0fc8832 3345\membersection{::wxFindWindowAtPoint}\label{wxfindwindowatpoint}
6787e41e 3346
b0fc8832 3347\func{wxWindow *}{wxFindWindowAtPoint}{\param{const wxPoint\& }{pt}}
6787e41e 3348
b0fc8832
VZ
3349Find the deepest window at the given mouse position in screen coordinates,
3350returning the window if found, or NULL if not.
4d01e583 3351
84ed77ef 3352
b0fc8832 3353\membersection{::wxFindWindowAtPointer}\label{wxfindwindowatpointer}
4d01e583 3354
b0fc8832 3355\func{wxWindow *}{wxFindWindowAtPointer}{\param{wxPoint\& }{pt}}
4d01e583 3356
b0fc8832
VZ
3357Find the deepest window at the mouse pointer position, returning the window
3358and current pointer position in screen coordinates.
4d01e583 3359
84ed77ef 3360
8b51786f
VZ
3361\membersection{wxFromString}\label{wxfromstring}
3362
4d76ea94 3363\func{bool}{wxFromString}{\param{const wxString\& }{str},
fc9361e3
VZ
3364 \param{wxColour* }{col}}
3365
3366\func{bool}{wxFromString}{\param{const wxString\& }{str},
3367 \param{wxFont* }{col}}
8b51786f
VZ
3368
3369Converts string to the type of the second argument. Returns \true on success.
3370See also: \helpref{wxToString}{wxtostring}.
3371
3372
b0fc8832 3373\membersection{::wxGetActiveWindow}\label{wxgetactivewindow}
4d01e583 3374
b0fc8832 3375\func{wxWindow *}{wxGetActiveWindow}{\void}
4d01e583 3376
33de8c70
VZ
3377Gets the currently active window (implemented for MSW and GTK only currently,
3378always returns \NULL in the other ports).
4d01e583 3379
b0fc8832 3380\wxheading{Include files}
4d01e583 3381
3de65dab 3382<wx/window.h>
4d01e583 3383
84ed77ef 3384
8ea92b4d
WS
3385\membersection{::wxGetBatteryState}\label{wxgetbatterystate}
3386
3387\func{wxBatteryState}{wxGetBatteryState}{\void}
3388
bb772a8e
RN
3389Returns battery state as one of \texttt{wxBATTERY\_NORMAL\_STATE},
3390\texttt{wxBATTERY\_LOW\_STATE}, \texttt{wxBATTERY\_CRITICAL\_STATE},
3391\texttt{wxBATTERY\_SHUTDOWN\_STATE} or \texttt{wxBATTERY\_UNKNOWN\_STATE}.
3392\texttt{wxBATTERY\_UNKNOWN\_STATE} is also the default on platforms where
3032b7b5 3393this feature is not implemented (currently everywhere but MS Windows).
8ea92b4d
WS
3394
3395\wxheading{Include files}
3396
3397<wx/utils.h>
3398
3399
b0fc8832 3400\membersection{::wxGetDisplayName}\label{wxgetdisplayname}
4d01e583 3401
b0fc8832 3402\func{wxString}{wxGetDisplayName}{\void}
4d01e583 3403
b0fc8832 3404Under X only, returns the current display name. See also \helpref{wxSetDisplayName}{wxsetdisplayname}.
4d01e583
VZ
3405
3406\wxheading{Include files}
3407
b0fc8832 3408<wx/utils.h>
4d01e583 3409
84ed77ef 3410
8ea92b4d
WS
3411\membersection{::wxGetPowerType}\label{wxgetpowertype}
3412
3413\func{wxPowerType}{wxGetPowerType}{\void}
3414
bb772a8e
RN
3415Returns the type of power source as one of \texttt{wxPOWER\_SOCKET},
3416\texttt{wxPOWER\_BATTERY} or \texttt{wxPOWER\_UNKNOWN}.
3417\texttt{wxPOWER\_UNKNOWN} is also the default on platforms where this
3032b7b5 3418feature is not implemented (currently everywhere but MS Windows).
8ea92b4d
WS
3419
3420\wxheading{Include files}
3421
3422<wx/utils.h>
3423
3424
b0fc8832 3425\membersection{::wxGetMousePosition}\label{wxgetmouseposition}
4d01e583 3426
b0fc8832 3427\func{wxPoint}{wxGetMousePosition}{\void}
4d01e583 3428
b0fc8832 3429Returns the mouse position in screen coordinates.
4d01e583
VZ
3430
3431\wxheading{Include files}
3432
3433<wx/utils.h>
3434
84ed77ef 3435
7dd40b6f
RD
3436\membersection{::wxGetMouseState}\label{wxgetmousestate}
3437
3438\func{wxMouseState}{wxGetMouseState}{\void}
3439
3440Returns the current state of the mouse. Returns a wxMouseState
3441instance that contains the current position of the mouse pointer in
576b18f2 3442screen coordinates, as well as boolean values indicating the up/down
7dd40b6f
RD
3443status of the mouse buttons and the modifier keys.
3444
3445\wxheading{Include files}
3446
3447<wx/utils.h>
3448
3449wxMouseState has the following interface:
3450
3451\begin{verbatim}
3452class wxMouseState
3453{
3454public:
3455 wxMouseState();
3456
3457 wxCoord GetX();
3458 wxCoord GetY();
3459
3460 bool LeftDown();
3461 bool MiddleDown();
3462 bool RightDown();
3463
3464 bool ControlDown();
3465 bool ShiftDown();
3466 bool AltDown();
3467 bool MetaDown();
3468 bool CmdDown();
3469
3470 void SetX(wxCoord x);
3471 void SetY(wxCoord y);
3472
3473 void SetLeftDown(bool down);
3474 void SetMiddleDown(bool down);
3475 void SetRightDown(bool down);
e0c8d2d9 3476
7dd40b6f
RD
3477 void SetControlDown(bool down);
3478 void SetShiftDown(bool down);
3479 void SetAltDown(bool down);
3480 void SetMetaDown(bool down);
3481};
3482\end{verbatim}
3483
3484
84ed77ef 3485
634629fa
WS
3486\membersection{::wxGetStockLabel}\label{wxgetstocklabel}
3487
fbfb8bcc 3488\func{wxString}{wxGetStockLabel}{\param{wxWindowID }{id}, \param{bool }{withCodes = true}, \param{const wxString\& }{accelerator = wxEmptyString}}
634629fa
WS
3489
3490Returns label that should be used for given {\it id} element.
3491
3492\wxheading{Parameters}
3493
3494\docparam{id}{given id of the \helpref{wxMenuItem}{wxmenuitem}, \helpref{wxButton}{wxbutton}, \helpref{wxToolBar}{wxtoolbar} tool, etc.}
3495
3496\docparam{withCodes}{if false then strip accelerator code from the label;
576b18f2
VZ
3497useful for getting labels without accelerator char code like for toolbar tooltip or
3498on platforms without traditional keyboard like smartphones}
634629fa
WS
3499
3500\docparam{accelerator}{optional accelerator string automatically added to label; useful
3501for building labels for \helpref{wxMenuItem}{wxmenuitem}}
3502
3503\wxheading{Include files}
3504
3505<wx/stockitem.h>
3506
3507
33b494d6
VZ
3508\membersection{::wxGetTopLevelParent}\label{wxgettoplevelparent}
3509
3510\func{wxWindow *}{wxGetTopLevelParent}{\param{wxWindow }{*win}}
3511
3512Returns the first top level parent of the given window, or in other words, the
3513frame or dialog containing it, or {\tt NULL}.
3514
3515\wxheading{Include files}
3516
3517<wx/window.h>
3518
84ed77ef 3519
498a1eeb
RN
3520\membersection{::wxLaunchDefaultBrowser}\label{wxlaunchdefaultbrowser}
3521
42d0df00 3522\func{bool}{wxLaunchDefaultBrowser}{\param{const wxString\& }{url}, \param{int }{flags = $0$}}
498a1eeb 3523
ce045aed 3524Open the \arg{url} in user's default browser. If \arg{flags} parameter contains
42d0df00 3525\texttt{wxBROWSER\_NEW\_WINDOW} flag, a new window is opened for the URL
54f69143
VZ
3526(currently this is only supported under Windows). The \arg{url} may also be a
3527local file path (with or without \texttt{file://} prefix), if it doesn't
3528correspond to an existing file and the URL has no scheme \texttt{http://} is
3529prepended to it by default.
498a1eeb 3530
42d0df00 3531Returns \true if the application was successfully launched.
498a1eeb 3532
17ede0b1
RR
3533Note that for some configurations of the running user, the application which
3534is launched to open the given URL may be URL-dependent (e.g. a browser may be used for
3535local URLs while another one may be used for remote URLs).
3536
498a1eeb
RN
3537\wxheading{Include files}
3538
3539<wx/utils.h>
3540
42d0df00 3541
a660d684
KB
3542\membersection{::wxLoadUserResource}\label{wxloaduserresource}
3543
3544\func{wxString}{wxLoadUserResource}{\param{const wxString\& }{resourceName}, \param{const wxString\& }{resourceType=``TEXT"}}
3545
3546Loads a user-defined Windows resource as a string. If the resource is found, the function creates
3547a new character array and copies the data into it. A pointer to this data is returned. If unsuccessful, NULL is returned.
3548
3549The resource must be defined in the {\tt .rc} file using the following syntax:
3550
3551\begin{verbatim}
3552myResource TEXT file.ext
3553\end{verbatim}
3554
3555where {\tt file.ext} is a file that the resource compiler can find.
3556
a660d684
KB
3557This function is available under Windows only.
3558
954b8ae6
JS
3559\wxheading{Include files}
3560
3561<wx/utils.h>
3562
84ed77ef 3563
a660d684
KB
3564\membersection{::wxPostDelete}\label{wxpostdelete}
3565
3566\func{void}{wxPostDelete}{\param{wxObject *}{object}}
3567
954b8ae6 3568Tells the system to delete the specified object when
a660d684
KB
3569all other events have been processed. In some environments, it is
3570necessary to use this instead of deleting a frame directly with the
954b8ae6 3571delete operator, because some GUIs will still send events to a deleted window.
a660d684
KB
3572
3573Now obsolete: use \helpref{wxWindow::Close}{wxwindowclose} instead.
3574
954b8ae6
JS
3575\wxheading{Include files}
3576
3577<wx/utils.h>
3578
84ed77ef 3579
8e193f38
VZ
3580\membersection{::wxPostEvent}\label{wxpostevent}
3581
3582\func{void}{wxPostEvent}{\param{wxEvtHandler *}{dest}, \param{wxEvent\& }{event}}
3583
9a9e73f6
RR
3584In a GUI application, this function posts {\it event} to the specified {\it dest}
3585object using \helpref{wxEvtHandler::AddPendingEvent}{wxevthandleraddpendingevent}.
3586Otherwise, it dispatches {\it event} immediately using
3587\helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent}.
3588See the respective documentation for details (and caveats).
8e193f38
VZ
3589
3590\wxheading{Include files}
3591
3592<wx/app.h>
3593
84ed77ef 3594
a660d684
KB
3595\membersection{::wxSetDisplayName}\label{wxsetdisplayname}
3596
3597\func{void}{wxSetDisplayName}{\param{const wxString\& }{displayName}}
3598
3599Under X only, sets the current display name. This is the X host and display name such
3600as ``colonsay:0.0", and the function indicates which display should be used for creating
3601windows from this point on. Setting the display within an application allows multiple
3602displays to be used.
3603
3604See also \helpref{wxGetDisplayName}{wxgetdisplayname}.
3605
954b8ae6
JS
3606\wxheading{Include files}
3607
3608<wx/utils.h>
3609
84ed77ef 3610
b0fc8832 3611\membersection{::wxStripMenuCodes}\label{wxstripmenucodes}
a660d684 3612
74639764 3613\func{wxString}{wxStripMenuCodes}{\param{const wxString\& }{str}, \param{int }{flags = wxStrip\_All}}
8a2c6ef8 3614
74639764 3615Strips any menu codes from \arg{str} and returns the result.
a660d684 3616
74639764
VZ
3617By default, the functions strips both the mnemonics character (\texttt{'\&'})
3618which is used to indicate a keyboard shortkey, and the accelerators, which are
3619used only in the menu items and are separated from the main text by the
3620\texttt{$\backslash$t} (TAB) character. By using \arg{flags} of
3621\texttt{wxStrip\_Mnemonics} or \texttt{wxStrip\_Accel} to strip only the former
3622or the latter part, respectively.
8a2c6ef8 3623
8bb6b2c0
VZ
3624Notice that in most cases
3625\helpref{wxMenuItem::GetLabelFromText}{wxmenuitemgetlabelfromtext} or
74639764 3626\helpref{wxControl::GetLabelText}{wxcontrolgetlabeltext} can be used instead.
a660d684 3627
954b8ae6
JS
3628\wxheading{Include files}
3629
3630<wx/utils.h>
3631
84ed77ef 3632
b4a81453
VZ
3633\membersection{wxSTRINGIZE}\label{wxstringize}
3634
3635\func{}{wxSTRINGIZE}{\param{}{x}}
3636
3637Returns the string representation of the given symbol which can be either a
3638literal or a macro (hence the advantage of using this macro instead of the
3639standard preprocessor \texttt{\#} operator which doesn't work with macros).
3640
84206bbb
VZ
3641Notice that this macro always produces a \texttt{char} string, use
3642\helpref{wxSTRINGIZE\_T}{wxstringizet} to build a wide string Unicode build.
3643
b4a81453
VZ
3644\wxheading{See also}
3645
3646\helpref{wxCONCAT}{wxconcat}
3647
3648
84206bbb
VZ
3649\membersection{wxSTRINGIZE\_T}\label{wxstringizet}
3650
3651\func{}{wxSTRINGIZE\_T}{\param{}{x}}
3652
3653Returns the string representation of the given symbol as either an ASCII or
3654Unicode string, depending on the current build. This is the Unicode-friendly
3655equivalent of \helpref{wxSTRINGIZE}{wxstringize}.
3656
3657
7261746a 3658\membersection{wxSUPPRESS\_GCC\_PRIVATE\_DTOR\_WARNING}\label{wxsuppressgccprivatedtorwarning}
b47f1f95
VZ
3659
3660\func{}{wxSUPPRESS\_GCC\_PRIVATE\_DTOR\_WARNING}{\param{}{name}}
3661
3662GNU C++ compiler gives a warning for any class whose destructor is private
3663unless it has a friend. This warning may sometimes be useful but it doesn't
3664make sense for reference counted class which always delete themselves (hence
3665destructor should be private) but don't necessarily have any friends, so this
3666macro is provided to disable the warning in such case. The \arg{name} parameter
3667should be the name of the class but is only used to construct a unique friend
3668class name internally. Example of using the macro:
3669
3670\begin{verbatim}
3671 class RefCounted
3672 {
3673 public:
3674 RefCounted() { m_nRef = 1; }
3675 void IncRef() { m_nRef++ ; }
3676 void DecRef() { if ( !--m_nRef ) delete this; }
3677
3678 private:
3679 ~RefCounted() { }
3680
3681 wxSUPPRESS_GCC_PRIVATE_DTOR(RefCounted)
3682 };
3683\end{verbatim}
3684
3685Notice that there should be no semicolon after this macro.
3686
3687
8b51786f
VZ
3688\membersection{wxToString}\label{wxtostring}
3689
fc9361e3
VZ
3690\func{wxString}{wxToString}{\param{const wxColour\& }{col}}
3691
3692\func{wxString}{wxToString}{\param{const wxFont\& }{col}}
8b51786f
VZ
3693
3694Converts its argument to string.
3695See also: \helpref{wxFromString}{wxfromstring}.
3696
3697
84ed77ef
VZ
3698\membersection{wxULL}\label{wxull}
3699
3700\func{wxLongLong\_t}{wxULL}{\param{}{number}}
3701
3702This macro is defined for the platforms with a native 64 bit integer type and
3703allows to define unsigned 64 bit compile time constants:
3704
3705\begin{verbatim}
3706 #ifdef wxLongLong_t
3707 unsigned wxLongLong_t ll = wxULL(0x1234567890abcdef);
3708 #endif
3709\end{verbatim}
3710
3711\wxheading{Include files}
3712
3713<wx/longlong.h>
3714
3715\wxheading{See also}
3716
3717\helpref{wxLL}{wxll}, \helpref{wxLongLong}{wxlonglong}
3718
3719
d85cfb37
VZ
3720\membersection{wxVaCopy}\label{wxvacopy}
3721
e7dfcb8e 3722\func{void}{wxVaCopy}{\param{va\_list }{argptrDst}, \param{va\_list}{ argptrSrc}}
d85cfb37
VZ
3723
3724This macro is the same as the standard C99 \texttt{va\_copy} for the compilers
3725which support it or its replacement for those that don't. It must be used to
3726preserve the value of a \texttt{va\_list} object if you need to use it after
3727passing it to another function because it can be modified by the latter.
3728
8ea92b4d 3729As with \texttt{va\_start}, each call to \texttt{wxVaCopy} must have a matching
d85cfb37
VZ
3730\texttt{va\_end}.
3731
3732
84ed77ef 3733
fd05688e
VZ
3734\membersection{\_\_WXFUNCTION\_\_}\label{wxfunction}
3735
3736\func{}{\_\_WXFUNCTION\_\_}{\void}
3737
3738This macro expands to the name of the current function if the compiler supports
3739any of \texttt{\_\_FUNCTION\_\_}, \texttt{\_\_func\_\_} or equivalent variables
3740or macros or to \NULL if none of them is available.
3741
3742
84ed77ef 3743
81c9effa 3744\section{Byte order macros}\label{byteordermacros}
a660d684 3745
b0fc8832
VZ
3746The endian-ness issues (that is the difference between big-endian and
3747little-endian architectures) are important for the portable programs working
3748with the external binary data (for example, data files or data coming from
3749network) which is usually in some fixed, platform-independent format. The
3750macros are helpful for transforming the data to the correct format.
a660d684 3751
84ed77ef 3752
0180dad6
RR
3753\membersection{wxINTXX\_SWAP\_ALWAYS}\label{intswapalways}
3754
3755\func{wxInt32}{wxINT32\_SWAP\_ALWAYS}{\param{wxInt32 }{value}}
3756
3757\func{wxUint32}{wxUINT32\_SWAP\_ALWAYS}{\param{wxUint32 }{value}}
3758
3759\func{wxInt16}{wxINT16\_SWAP\_ALWAYS}{\param{wxInt16 }{value}}
3760
3761\func{wxUint16}{wxUINT16\_SWAP\_ALWAYS}{\param{wxUint16 }{value}}
3762
b0fc8832
VZ
3763These macros will swap the bytes of the {\it value} variable from little
3764endian to big endian or vice versa unconditionally, i.e. independently of the
3765current platform.
0180dad6 3766
84ed77ef 3767
0180dad6
RR
3768\membersection{wxINTXX\_SWAP\_ON\_BE}\label{intswaponbe}
3769
3770\func{wxInt32}{wxINT32\_SWAP\_ON\_BE}{\param{wxInt32 }{value}}
3771
3772\func{wxUint32}{wxUINT32\_SWAP\_ON\_BE}{\param{wxUint32 }{value}}
3773
3774\func{wxInt16}{wxINT16\_SWAP\_ON\_BE}{\param{wxInt16 }{value}}
3775
3776\func{wxUint16}{wxUINT16\_SWAP\_ON\_BE}{\param{wxUint16 }{value}}
3777
3778This macro will swap the bytes of the {\it value} variable from little
3779endian to big endian or vice versa if the program is compiled on a
ec5d7799 3780big-endian architecture (such as Sun work stations). If the program has
0180dad6
RR
3781been compiled on a little-endian architecture, the value will be unchanged.
3782
ec5d7799 3783Use these macros to read data from and write data to a file that stores
b0fc8832 3784data in little-endian (for example Intel i386) format.
0180dad6 3785
84ed77ef 3786
0180dad6
RR
3787\membersection{wxINTXX\_SWAP\_ON\_LE}\label{intswaponle}
3788
3789\func{wxInt32}{wxINT32\_SWAP\_ON\_LE}{\param{wxInt32 }{value}}
3790
3791\func{wxUint32}{wxUINT32\_SWAP\_ON\_LE}{\param{wxUint32 }{value}}
3792
3793\func{wxInt16}{wxINT16\_SWAP\_ON\_LE}{\param{wxInt16 }{value}}
3794
3795\func{wxUint16}{wxUINT16\_SWAP\_ON\_LE}{\param{wxUint16 }{value}}
3796
3797This macro will swap the bytes of the {\it value} variable from little
3798endian to big endian or vice versa if the program is compiled on a
ec5d7799 3799little-endian architecture (such as Intel PCs). If the program has
0180dad6
RR
3800been compiled on a big-endian architecture, the value will be unchanged.
3801
ec5d7799 3802Use these macros to read data from and write data to a file that stores
b0fc8832
VZ
3803data in big-endian format.
3804
84ed77ef 3805
6d98f963
FM
3806\membersection{wxFORCE\_LINK\_THIS\_MODULE}\label{wxforcelinkthismodule}
3807
3808\func{}{wxFORCE\_LINK\_THIS\_MODULE}{moduleName}
3809
3810This macro can be used in conjunction with the
3811\helpref{wxFORCE\_LINK\_MODULE}{wxforcelinkmodule} macro to force
3812the linker to include in its output a specific object file.
3813
3814In particular, you should use this macro in the source file which you want
3815to force for inclusion. The \tt{moduleName} needs to be a name not already
3816in use in other \tt{wxFORCE\_LINK\_THIS\_MODULE} macros, but is not required
3817to be e.g. the same name of the source file (even if it's a good choice).
3818
3819\wxheading{Include files}
3820
3821<wx/link.h>
3822
3823
3824\membersection{wxFORCE\_LINK\_MODULE}\label{wxforcelinkmodule}
3825
3826\func{}{wxFORCE\_LINK\_MODULE}{moduleName}
3827
3828This macro can be used in conjunction with the
3829\helpref{wxFORCE\_LINK\_THIS\_MODULE}{wxforcelinkthismodule} macro to force
3830the linker to include in its output a specific object file.
3831
3832In particular, you should use this macro in a source file which you know
3833for sure is linked in the output (e.g. the source file containing the "main()"
3834of your app). The \tt{moduleName} is the name of the module you want to forcefully link
3835(i.e. the name you used in the relative \helpref{wxFORCE\_LINK\_THIS\_MODULE}{wxforcelinkthismodule} macro.
3836
3837\wxheading{Include files}
3838
3839<wx/link.h>
3840
3841
3842\membersection{wxIMPLEMENT\_APP}\label{wximplementapp}
3843
3844\func{}{wxIMPLEMENT\_APP}{className}
3845
3846This is used in the application class implementation file to make the application class
3847known to wxWidgets for dynamic construction. You use this as:
3848
3849\begin{verbatim}
3850 wxIMPLEMENT_APP(MyApp)
3851\end{verbatim}
3852
3853See also \helpref{wxDECLARE\_APP}{wxdeclareapp}.
3854
3855\wxheading{Include files}
3856
3857<wx/app.h>
3858
84ed77ef 3859
f4fcc291 3860\section{RTTI functions}\label{rttimacros}
b0fc8832 3861
fc2171bd 3862wxWidgets uses its own RTTI ("run-time type identification") system which
b0fc8832 3863predates the current standard C++ RTTI and so is kept for backwards
2edb0bde 3864compatibility reasons but also because it allows some things which the
b0fc8832
VZ
3865standard RTTI doesn't directly support (such as creating a class from its
3866name).
3867
3868The standard C++ RTTI can be used in the user code without any problems and in
3869general you shouldn't need to use the functions and the macros in this section
fc2171bd 3870unless you are thinking of modifying or adding any wxWidgets classes.
b0fc8832
VZ
3871
3872\wxheading{See also}
3873
3874\helpref{RTTI overview}{runtimeclassoverview}
0180dad6 3875
84ed77ef 3876
a660d684
KB
3877\membersection{CLASSINFO}\label{classinfo}
3878
3879\func{wxClassInfo *}{CLASSINFO}{className}
3880
3881Returns a pointer to the wxClassInfo object associated with this class.
3882
954b8ae6
JS
3883\wxheading{Include files}
3884
3885<wx/object.h>
3886
84ed77ef 3887
b0fc8832 3888\membersection{DECLARE\_ABSTRACT\_CLASS}\label{declareabstractclass}
a660d684
KB
3889
3890\func{}{DECLARE\_ABSTRACT\_CLASS}{className}
3891
3892Used inside a class declaration to declare that the class should be
3893made known to the class hierarchy, but objects of this class cannot be created
3894dynamically. The same as DECLARE\_CLASS.
3895
3896Example:
3897
3898\begin{verbatim}
3899class wxCommand: public wxObject
3900{
3901 DECLARE_ABSTRACT_CLASS(wxCommand)
3902
3903 private:
3904 ...
3905 public:
3906 ...
3907};
3908\end{verbatim}
3909
954b8ae6
JS
3910\wxheading{Include files}
3911
3912<wx/object.h>
3913
84ed77ef 3914
a660d684
KB
3915\membersection{DECLARE\_APP}\label{declareapp}
3916
3917\func{}{DECLARE\_APP}{className}
3918
8ea92b4d
WS
3919This is used in headers to create a forward declaration of the
3920\helpref{wxGetApp}{wxgetapp} function implemented by
3921\helpref{IMPLEMENT\_APP}{implementapp}. It creates the declaration
749caeeb 3922{\tt className\& wxGetApp(void)}.
a660d684
KB
3923
3924Example:
3925
3926\begin{verbatim}
3927 DECLARE_APP(MyApp)
3928\end{verbatim}
3929
954b8ae6
JS
3930\wxheading{Include files}
3931
3932<wx/app.h>
3933
84ed77ef 3934
b0fc8832 3935\membersection{DECLARE\_CLASS}\label{declareclass}
a660d684
KB
3936
3937\func{}{DECLARE\_CLASS}{className}
3938
3939Used inside a class declaration to declare that the class should be
3940made known to the class hierarchy, but objects of this class cannot be created
3941dynamically. The same as DECLARE\_ABSTRACT\_CLASS.
3942
954b8ae6
JS
3943\wxheading{Include files}
3944
3945<wx/object.h>
3946
84ed77ef 3947
b0fc8832 3948\membersection{DECLARE\_DYNAMIC\_CLASS}\label{declaredynamicclass}
a660d684
KB
3949
3950\func{}{DECLARE\_DYNAMIC\_CLASS}{className}
3951
f3886d37
VZ
3952Used inside a class declaration to make the class known to wxWidgets RTTI
3953system and also declare that the objects of this class should be dynamically
3954creatable from run-time type information. Notice that this implies that the
ce045aed 3955class should have a default constructor, if this is not the case consider using
f3886d37 3956\helpref{DECLARE\_CLASS}{declareclass}.
a660d684
KB
3957
3958Example:
3959
3960\begin{verbatim}
3961class wxFrame: public wxWindow
3962{
3963 DECLARE_DYNAMIC_CLASS(wxFrame)
3964
3965 private:
2b5f62a0 3966 const wxString& frameTitle;
a660d684
KB
3967 public:
3968 ...
3969};
3970\end{verbatim}
3971
954b8ae6
JS
3972\wxheading{Include files}
3973
3974<wx/object.h>
3975
84ed77ef 3976
b0fc8832 3977\membersection{IMPLEMENT\_ABSTRACT\_CLASS}\label{implementabstractclass}
a660d684
KB
3978
3979\func{}{IMPLEMENT\_ABSTRACT\_CLASS}{className, baseClassName}
3980
3981Used in a C++ implementation file to complete the declaration of
3982a class that has run-time type information. The same as IMPLEMENT\_CLASS.
3983
3984Example:
3985
3986\begin{verbatim}
3987IMPLEMENT_ABSTRACT_CLASS(wxCommand, wxObject)
3988
3989wxCommand::wxCommand(void)
3990{
3991...
3992}
3993\end{verbatim}
3994
954b8ae6
JS
3995\wxheading{Include files}
3996
3997<wx/object.h>
3998
84ed77ef 3999
b0fc8832 4000\membersection{IMPLEMENT\_ABSTRACT\_CLASS2}\label{implementabstractclass2}
a660d684
KB
4001
4002\func{}{IMPLEMENT\_ABSTRACT\_CLASS2}{className, baseClassName1, baseClassName2}
4003
4004Used in a C++ implementation file to complete the declaration of
4005a class that has run-time type information and two base classes. The same as IMPLEMENT\_CLASS2.
4006
954b8ae6
JS
4007\wxheading{Include files}
4008
4009<wx/object.h>
4010
84ed77ef 4011
a660d684
KB
4012\membersection{IMPLEMENT\_APP}\label{implementapp}
4013
4014\func{}{IMPLEMENT\_APP}{className}
4015
4016This is used in the application class implementation file to make the application class known to
fc2171bd 4017wxWidgets for dynamic construction. You use this instead of
a660d684
KB
4018
4019Old form:
4020
4021\begin{verbatim}
4022 MyApp myApp;
4023\end{verbatim}
4024
4025New form:
4026
4027\begin{verbatim}
4028 IMPLEMENT_APP(MyApp)
4029\end{verbatim}
4030
4031See also \helpref{DECLARE\_APP}{declareapp}.
4032
954b8ae6
JS
4033\wxheading{Include files}
4034
4035<wx/app.h>
4036
84ed77ef 4037
b0fc8832 4038\membersection{IMPLEMENT\_CLASS}\label{implementclass}
a660d684
KB
4039
4040\func{}{IMPLEMENT\_CLASS}{className, baseClassName}
4041
4042Used in a C++ implementation file to complete the declaration of
4043a class that has run-time type information. The same as IMPLEMENT\_ABSTRACT\_CLASS.
4044
954b8ae6
JS
4045\wxheading{Include files}
4046
4047<wx/object.h>
4048
84ed77ef 4049
b0fc8832 4050\membersection{IMPLEMENT\_CLASS2}\label{implementclass2}
a660d684
KB
4051
4052\func{}{IMPLEMENT\_CLASS2}{className, baseClassName1, baseClassName2}
4053
4054Used in a C++ implementation file to complete the declaration of a
4055class that has run-time type information and two base classes. The
4056same as IMPLEMENT\_ABSTRACT\_CLASS2.
4057
954b8ae6
JS
4058\wxheading{Include files}
4059
4060<wx/object.h>
4061
84ed77ef 4062
b0fc8832 4063\membersection{IMPLEMENT\_DYNAMIC\_CLASS}\label{implementdynamicclass}
a660d684
KB
4064
4065\func{}{IMPLEMENT\_DYNAMIC\_CLASS}{className, baseClassName}
4066
4067Used in a C++ implementation file to complete the declaration of
4068a class that has run-time type information, and whose instances
4069can be created dynamically.
4070
4071Example:
4072
4073\begin{verbatim}
4074IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
4075
4076wxFrame::wxFrame(void)
4077{
4078...
4079}
4080\end{verbatim}
4081
954b8ae6
JS
4082\wxheading{Include files}
4083
4084<wx/object.h>
4085
84ed77ef 4086
b0fc8832 4087\membersection{IMPLEMENT\_DYNAMIC\_CLASS2}\label{implementdynamicclass2}
a660d684
KB
4088
4089\func{}{IMPLEMENT\_DYNAMIC\_CLASS2}{className, baseClassName1, baseClassName2}
4090
4091Used in a C++ implementation file to complete the declaration of
4092a class that has run-time type information, and whose instances
4093can be created dynamically. Use this for classes derived from two
4094base classes.
4095
954b8ae6
JS
4096\wxheading{Include files}
4097
4098<wx/object.h>
4099
84ed77ef 4100
f6bcfd97
BP
4101\membersection{wxConstCast}\label{wxconstcast}
4102
f7637829 4103\func{classname *}{wxConstCast}{ptr, classname}
f6bcfd97
BP
4104
4105This macro expands into {\tt const\_cast<classname *>(ptr)} if the compiler
4106supports {\it const\_cast} or into an old, C-style cast, otherwise.
4107
4108\wxheading{See also}
4109
f29fe169 4110\helpref{wx\_const\_cast}{wxconstcastraw}\\
f6bcfd97
BP
4111\helpref{wxDynamicCast}{wxdynamiccast}\\
4112\helpref{wxStaticCast}{wxstaticcast}
4113
84ed77ef 4114
b0fc8832
VZ
4115\membersection{::wxCreateDynamicObject}\label{wxcreatedynamicobject}
4116
4117\func{wxObject *}{wxCreateDynamicObject}{\param{const wxString\& }{className}}
4118
4119Creates and returns an object of the given class, if the class has been
4120registered with the dynamic class system using DECLARE... and IMPLEMENT... macros.
4121
84ed77ef 4122
34636400
VZ
4123\membersection{WXDEBUG\_NEW}\label{debugnew}
4124
4125\func{}{WXDEBUG\_NEW}{arg}
4126
4127This is defined in debug mode to be call the redefined new operator
4128with filename and line number arguments. The definition is:
4129
4130\begin{verbatim}
4131#define WXDEBUG_NEW new(__FILE__,__LINE__)
4132\end{verbatim}
4133
4134In non-debug mode, this is defined as the normal new operator.
4135
4136\wxheading{Include files}
4137
4138<wx/object.h>
4139
84ed77ef 4140
34636400
VZ
4141\membersection{wxDynamicCast}\label{wxdynamiccast}
4142
f7637829 4143\func{classname *}{wxDynamicCast}{ptr, classname}
34636400
VZ
4144
4145This macro returns the pointer {\it ptr} cast to the type {\it classname *} if
8a7f3379 4146the pointer is of this type (the check is done during the run-time) or
f7637829
VZ
4147{\tt NULL} otherwise. Usage of this macro is preferred over obsoleted
4148wxObject::IsKindOf() function.
34636400 4149
f7637829
VZ
4150The {\it ptr} argument may be {\tt NULL}, in which case {\tt NULL} will be
4151returned.
34636400
VZ
4152
4153Example:
4154
4155\begin{verbatim}
4156 wxWindow *win = wxWindow::FindFocus();
4157 wxTextCtrl *text = wxDynamicCast(win, wxTextCtrl);
4158 if ( text )
4159 {
4160 // a text control has the focus...
4161 }
4162 else
4163 {
f6bcfd97 4164 // no window has the focus or it is not a text control
34636400
VZ
4165 }
4166\end{verbatim}
4167
4168\wxheading{See also}
4169
f6bcfd97 4170\helpref{RTTI overview}{runtimeclassoverview}\\
f7637829 4171\helpref{wxDynamicCastThis}{wxdynamiccastthis}\\
f6bcfd97 4172\helpref{wxConstCast}{wxconstcast}\\
330be534 4173\helpref{wxStaticCast}{wxstaticcast}
34636400 4174
84ed77ef 4175
f7637829
VZ
4176\membersection{wxDynamicCastThis}\label{wxdynamiccastthis}
4177
4178\func{classname *}{wxDynamicCastThis}{classname}
4179
4180This macro is equivalent to {\tt wxDynamicCast(this, classname)} but the
4181latter provokes spurious compilation warnings from some compilers (because it
154b6b0f 4182tests whether {\tt this} pointer is non-{\tt NULL} which is always true), so
f7637829
VZ
4183this macro should be used to avoid them.
4184
4185\wxheading{See also}
4186
4187\helpref{wxDynamicCast}{wxdynamiccast}
4188
84ed77ef 4189
f6bcfd97
BP
4190\membersection{wxStaticCast}\label{wxstaticcast}
4191
f7637829 4192\func{classname *}{wxStaticCast}{ptr, classname}
f6bcfd97
BP
4193
4194This macro checks that the cast is valid in debug mode (an assert failure will
4195result if {\tt wxDynamicCast(ptr, classname) == NULL}) and then returns the
4196result of executing an equivalent of {\tt static\_cast<classname *>(ptr)}.
4197
f29fe169
VZ
4198\wxheading{See also}
4199
4200\helpref{wx\_static\_cast}{wxstaticcastraw}\\
f6bcfd97
BP
4201\helpref{wxDynamicCast}{wxdynamiccast}\\
4202\helpref{wxConstCast}{wxconstcast}
4203
84ed77ef 4204
f29fe169
VZ
4205\membersection{wx\_const\_cast}\label{wxconstcastraw}
4206
4207\func{T}{wx\_const\_cast}{T, x}
4208
8ea92b4d 4209Same as \texttt{const\_cast<T>(x)} if the compiler supports const cast or
f29fe169
VZ
4210\texttt{(T)x} for old compilers. Unlike \helpref{wxConstCast}{wxconstcast},
4211the cast it to the type \arg{T} and not to \texttt{T *} and also the order of
4212arguments is the same as for the standard cast.
4213
4214\wxheading{See also}
4215
8c8d66c5
VZ
4216\helpref{wx\_reinterpret\_cast}{wxreinterpretcastraw},\\
4217\helpref{wx\_static\_cast}{wxstaticcastraw}
4218
4219
4220\membersection{wx\_reinterpret\_cast}\label{wxreinterpretcastraw}
4221
4222\func{T}{wx\_reinterpret\_cast}{T, x}
4223
8ea92b4d 4224Same as \texttt{reinterpret\_cast<T>(x)} if the compiler supports reinterpret cast or
8c8d66c5
VZ
4225\texttt{(T)x} for old compilers.
4226
4227\wxheading{See also}
4228
4229\helpref{wx\_const\_cast}{wxconstcastraw},\\
4230\helpref{wx\_static\_cast}{wxstaticcastraw}
f29fe169
VZ
4231
4232
4233\membersection{wx\_static\_cast}\label{wxstaticcastraw}
4234
4235\func{T}{wx\_static\_cast}{T, x}
4236
8ea92b4d 4237Same as \texttt{static\_cast<T>(x)} if the compiler supports static cast or
f29fe169
VZ
4238\texttt{(T)x} for old compilers. Unlike \helpref{wxStaticCast}{wxstaticcast},
4239there are no checks being done and the meaning of the macro arguments is exactly
4240the same as for the standard static cast, i.e. \arg{T} is the full type name and
4241star is not appended to it.
4242
4243\wxheading{See also}
4244
8c8d66c5 4245\helpref{wx\_const\_cast}{wxconstcastraw},\\
e6b2a3b3
VZ
4246\helpref{wx\_reinterpret\_cast}{wxreinterpretcastraw},\\
4247\helpref{wx\_truncate\_cast}{wxtruncatecast}
4248
4249
4250\membersection{wx\_truncate\_cast}\label{wxtruncatecast}
4251
4252\func{T}{wx\_truncate\_cast}{T, x}
f29fe169 4253
e6b2a3b3
VZ
4254This case doesn't correspond to any standard cast but exists solely to make
4255casts which possibly result in a truncation of an integer value more readable.
4256
4257\wxheading{See also}
4258
4259\helpref{wx\_static\_cast}{wxstaticcastraw}
f29fe169 4260
84ed77ef 4261
6fb26ea3
JS
4262\section{Log functions}\label{logfunctions}
4263
4264These functions provide a variety of logging functions: see \helpref{Log classes overview}{wxlogoverview} for
f68586e5
VZ
4265further information. The functions use (implicitly) the currently active log
4266target, so their descriptions here may not apply if the log target is not the
fc2171bd 4267standard one (installed by wxWidgets in the beginning of the program).
6fb26ea3 4268
954b8ae6
JS
4269\wxheading{Include files}
4270
4271<wx/log.h>
4272
84ed77ef 4273
b0fc8832
VZ
4274\membersection{::wxDebugMsg}\label{wxdebugmsg}
4275
4276\func{void}{wxDebugMsg}{\param{const wxString\& }{fmt}, \param{...}{}}
4277
2bd25c5a
VZ
4278{\bf NB:} This function is now obsolete, replaced by \helpref{Log
4279functions}{logfunctions} and \helpref{wxLogDebug}{wxlogdebug} in particular.
b0fc8832
VZ
4280
4281Display a debugging message; under Windows, this will appear on the
4282debugger command window, and under Unix, it will be written to standard
4283error.
4284
4285The syntax is identical to {\bf printf}: pass a format string and a
4286variable list of arguments.
4287
4288{\bf Tip:} under Windows, if your application crashes before the
4289message appears in the debugging window, put a wxYield call after
4290each wxDebugMsg call. wxDebugMsg seems to be broken under WIN32s
4291(at least for Watcom C++): preformat your messages and use OutputDebugString
4292instead.
4293
b0fc8832
VZ
4294\wxheading{Include files}
4295
4296<wx/utils.h>
4297
84ed77ef 4298
b0fc8832
VZ
4299\membersection{::wxError}\label{wxerror}
4300
fc2171bd 4301\func{void}{wxError}{\param{const wxString\& }{msg}, \param{const wxString\& }{title = "wxWidgets Internal Error"}}
b0fc8832 4302
b829bf55 4303{\bf NB:} This function is now obsolete, please use \helpref{wxLogError}{wxlogerror}
b0fc8832
VZ
4304instead.
4305
4306Displays {\it msg} and continues. This writes to standard error under
4307Unix, and pops up a message box under Windows. Used for internal
fc2171bd 4308wxWidgets errors. See also \helpref{wxFatalError}{wxfatalerror}.
b0fc8832
VZ
4309
4310\wxheading{Include files}
4311
4312<wx/utils.h>
4313
84ed77ef 4314
b0fc8832
VZ
4315\membersection{::wxFatalError}\label{wxfatalerror}
4316
fc2171bd 4317\func{void}{wxFatalError}{\param{const wxString\& }{msg}, \param{const wxString\& }{title = "wxWidgets Fatal Error"}}
b0fc8832 4318
b829bf55 4319{\bf NB:} This function is now obsolete, please use
b0fc8832
VZ
4320\helpref{wxLogFatalError}{wxlogfatalerror} instead.
4321
4322Displays {\it msg} and exits. This writes to standard error under Unix,
4323and pops up a message box under Windows. Used for fatal internal
fc2171bd 4324wxWidgets errors. See also \helpref{wxError}{wxerror}.
b0fc8832
VZ
4325
4326\wxheading{Include files}
4327
4328<wx/utils.h>
4329
84ed77ef 4330
6fb26ea3
JS
4331\membersection{::wxLogError}\label{wxlogerror}
4332
7ac13b21 4333\func{void}{wxLogError}{\param{const char *}{formatString}, \param{...}{}}
6fb26ea3 4334
1d63fd6b
GD
4335\func{void}{wxVLogError}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
4336
ea44a631 4337The functions to use for error messages, i.e. the messages that must be shown
f68586e5
VZ
4338to the user. The default processing is to pop up a message box to inform the
4339user about it.
6fb26ea3 4340
84ed77ef 4341
6fb26ea3
JS
4342\membersection{::wxLogFatalError}\label{wxlogfatalerror}
4343
7ac13b21 4344\func{void}{wxLogFatalError}{\param{const char *}{formatString}, \param{...}{}}
6fb26ea3 4345
1d63fd6b
GD
4346\func{void}{wxVLogFatalError}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
4347
6fb26ea3
JS
4348Like \helpref{wxLogError}{wxlogerror}, but also
4349terminates the program with the exit code 3. Using {\it abort()} standard
4350function also terminates the program with this exit code.
4351
84ed77ef 4352
6fb26ea3
JS
4353\membersection{::wxLogWarning}\label{wxlogwarning}
4354
7ac13b21 4355\func{void}{wxLogWarning}{\param{const char *}{formatString}, \param{...}{}}
6fb26ea3 4356
1d63fd6b
GD
4357\func{void}{wxVLogWarning}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
4358
f68586e5
VZ
4359For warnings - they are also normally shown to the user, but don't interrupt
4360the program work.
6fb26ea3 4361
84ed77ef 4362
6fb26ea3
JS
4363\membersection{::wxLogMessage}\label{wxlogmessage}
4364
7ac13b21 4365\func{void}{wxLogMessage}{\param{const char *}{formatString}, \param{...}{}}
6fb26ea3 4366
1d63fd6b
GD
4367\func{void}{wxVLogMessage}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
4368
ea44a631 4369For all normal, informational messages. They also appear in a message box by
8004cd7a 4370default (but it can be changed).
84ed77ef 4371
6fb26ea3
JS
4372\membersection{::wxLogVerbose}\label{wxlogverbose}
4373
7ac13b21
GT
4374\func{void}{wxLogVerbose}{\param{const char *}{formatString}, \param{...}{}}
4375
1d63fd6b 4376\func{void}{wxVLogVerbose}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
6fb26ea3 4377
f6bcfd97 4378For verbose output. Normally, it is suppressed, but
6fb26ea3
JS
4379might be activated if the user wishes to know more details about the program
4380progress (another, but possibly confusing name for the same function is {\bf wxLogInfo}).
4381
84ed77ef 4382
6fb26ea3
JS
4383\membersection{::wxLogStatus}\label{wxlogstatus}
4384
7ac13b21 4385\func{void}{wxLogStatus}{\param{wxFrame *}{frame}, \param{const char *}{formatString}, \param{...}{}}
f68586e5 4386
1d63fd6b 4387\func{void}{wxVLogStatus}{\param{wxFrame *}{frame}, \param{const char *}{formatString}, \param{va\_list }{argPtr}}
7ac13b21
GT
4388
4389\func{void}{wxLogStatus}{\param{const char *}{formatString}, \param{...}{}}
6fb26ea3 4390
1d63fd6b
GD
4391\func{void}{wxVLogStatus}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
4392
ea44a631 4393Messages logged by these functions will appear in the statusbar of the {\it
f68586e5 4394frame} or of the top level application window by default (i.e. when using
ea44a631 4395the second version of the functions).
f68586e5
VZ
4396
4397If the target frame doesn't have a statusbar, the message will be lost.
6fb26ea3 4398
84ed77ef 4399
6fb26ea3
JS
4400\membersection{::wxLogSysError}\label{wxlogsyserror}
4401
7ac13b21
GT
4402\func{void}{wxLogSysError}{\param{const char *}{formatString}, \param{...}{}}
4403
1d63fd6b 4404\func{void}{wxVLogSysError}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
6fb26ea3 4405
fc2171bd 4406Mostly used by wxWidgets itself, but might be handy for logging errors after
f68586e5
VZ
4407system call (API function) failure. It logs the specified message text as well
4408as the last system error code ({\it errno} or {\it ::GetLastError()} depending
4409on the platform) and the corresponding error message. The second form
f6bcfd97 4410of this function takes the error code explicitly as the first argument.
6fb26ea3 4411
6d516e09
VZ
4412\wxheading{See also}
4413
4414\helpref{wxSysErrorCode}{wxsyserrorcode},
4415\helpref{wxSysErrorMsg}{wxsyserrormsg}
4416
84ed77ef 4417
6fb26ea3
JS
4418\membersection{::wxLogDebug}\label{wxlogdebug}
4419
7ac13b21
GT
4420\func{void}{wxLogDebug}{\param{const char *}{formatString}, \param{...}{}}
4421
1d63fd6b 4422\func{void}{wxVLogDebug}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
6fb26ea3 4423
ea44a631
GD
4424The right functions for debug output. They only do something in debug
4425mode (when the preprocessor symbol \_\_WXDEBUG\_\_ is defined) and expand to
f68586e5 4426nothing in release mode (otherwise).
6fb26ea3 4427
84ed77ef 4428
6fb26ea3
JS
4429\membersection{::wxLogTrace}\label{wxlogtrace}
4430
7ac13b21 4431\func{void}{wxLogTrace}{\param{const char *}{formatString}, \param{...}{}}
1d63fd6b
GD
4432
4433\func{void}{wxVLogTrace}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
6fb26ea3 4434
f68586e5 4435\func{void}{wxLogTrace}{\param{const char *}{mask}, \param{const char *}{formatString}, \param{...}{}}
7ac13b21 4436
1d63fd6b 4437\func{void}{wxVLogTrace}{\param{const char *}{mask}, \param{const char *}{formatString}, \param{va\_list }{argPtr}}
f68586e5
VZ
4438
4439\func{void}{wxLogTrace}{\param{wxTraceMask}{ mask}, \param{const char *}{formatString}, \param{...}{}}
7ac13b21 4440
1d63fd6b 4441\func{void}{wxVLogTrace}{\param{wxTraceMask}{ mask}, \param{const char *}{formatString}, \param{va\_list }{argPtr}}
f68586e5
VZ
4442
4443As {\bf wxLogDebug}, trace functions only do something in debug build and
4444expand to nothing in the release one. The reason for making
4445it a separate function from it is that usually there are a lot of trace
4446messages, so it might make sense to separate them from other debug messages.
4447
4448The trace messages also usually can be separated into different categories and
ec5d7799 4449the second and third versions of this function only log the message if the
f68586e5
VZ
4450{\it mask} which it has is currently enabled in \helpref{wxLog}{wxlog}. This
4451allows to selectively trace only some operations and not others by changing
4452the value of the trace mask (possible during the run-time).
4453
4454For the second function (taking a string mask), the message is logged only if
ec5d7799 4455the mask has been previously enabled by the call to
6f97a409
VS
4456\helpref{AddTraceMask}{wxlogaddtracemask} or by setting
4457\helpref{{\tt WXTRACE} environment variable}{envvars}.
4458The predefined string trace masks
fc2171bd 4459used by wxWidgets are:
f68586e5
VZ
4460
4461\begin{itemize}\itemsep=0pt
4462\item wxTRACE\_MemAlloc: trace memory allocation (new/delete)
4463\item wxTRACE\_Messages: trace window messages/X callbacks
4464\item wxTRACE\_ResAlloc: trace GDI resource allocation
4465\item wxTRACE\_RefCount: trace various ref counting operations
4466\item wxTRACE\_OleCalls: trace OLE method calls (Win32 only)
4467\end{itemize}
6fb26ea3 4468
f70c0443
WS
4469{\bf Caveats:} since both the mask and the format string are strings,
4470this might lead to function signature confusion in some cases:
4471if you intend to call the format string only version of wxLogTrace,
4472then 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.
4473In this case you'll unfortunately have to avoid having two leading
3980000c 4474string parameters, e.g. by adding a bogus integer (with its \%d format string).
f70c0443
WS
4475
4476The third version of the function only logs the message if all the bits
f68586e5
VZ
4477corresponding to the {\it mask} are set in the wxLog trace mask which can be
4478set by \helpref{SetTraceMask}{wxlogsettracemask}. This version is less
4479flexible than the previous one because it doesn't allow defining the user
4480trace masks easily - this is why it is deprecated in favour of using string
4481trace masks.
6fb26ea3
JS
4482
4483\begin{itemize}\itemsep=0pt
4484\item wxTraceMemAlloc: trace memory allocation (new/delete)
4485\item wxTraceMessages: trace window messages/X callbacks
4486\item wxTraceResAlloc: trace GDI resource allocation
4487\item wxTraceRefCount: trace various ref counting operations
f68586e5 4488\item wxTraceOleCalls: trace OLE method calls (Win32 only)
6fb26ea3
JS
4489\end{itemize}
4490
84ed77ef 4491
c11d62a6
VZ
4492\membersection{::wxSafeShowMessage}\label{wxsafeshowmessage}
4493
4494\func{void}{wxSafeShowMessage}{\param{const wxString\& }{title}, \param{const wxString\& }{text}}
4495
4496This function shows a message to the user in a safe way and should be safe to
4497call even before the application has been initialized or if it is currently in
4498some other strange state (for example, about to crash). Under Windows this
b829bf55 4499function shows a message box using a native dialog instead of
c11d62a6
VZ
4500\helpref{wxMessageBox}{wxmessagebox} (which might be unsafe to call), elsewhere
4501it simply prints the message to the standard output using the title as prefix.
4502
4503\wxheading{Parameters}
4504
4505\docparam{title}{The title of the message box shown to the user or the prefix
4506of the message string}
4507
4508\docparam{text}{The text to show to the user}
4509
4510\wxheading{See also}
4511
4512\helpref{wxLogFatalError}{wxlogfatalerror}
4513
4514\wxheading{Include files}
4515
4516<wx/log.h>
4517
84ed77ef 4518
6d516e09
VZ
4519\membersection{::wxSysErrorCode}\label{wxsyserrorcode}
4520
4521\func{unsigned long}{wxSysErrorCode}{\void}
4522
4523Returns the error code from the last system call. This function uses
4524{\tt errno} on Unix platforms and {\tt GetLastError} under Win32.
4525
4526\wxheading{See also}
4527
4528\helpref{wxSysErrorMsg}{wxsyserrormsg},
4529\helpref{wxLogSysError}{wxlogsyserror}
4530
84ed77ef 4531
6d516e09
VZ
4532\membersection{::wxSysErrorMsg}\label{wxsyserrormsg}
4533
4534\func{const wxChar *}{wxSysErrorMsg}{\param{unsigned long }{errCode = 0}}
4535
ec5d7799
RD
4536Returns the error message corresponding to the given system error code. If
4537{\it errCode} is $0$ (default), the last error code (as returned by
6d516e09
VZ
4538\helpref{wxSysErrorCode}{wxsyserrorcode}) is used.
4539
4540\wxheading{See also}
4541
4542\helpref{wxSysErrorCode}{wxsyserrorcode},
4543\helpref{wxLogSysError}{wxlogsyserror}
4544
84ed77ef 4545
b0fc8832
VZ
4546\membersection{WXTRACE}\label{trace}
4547
4548\wxheading{Include files}
4549
4550<wx/object.h>
4551
4552\func{}{WXTRACE}{formatString, ...}
4553
2bd25c5a
VZ
4554{\bf NB:} This macro is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
4555
b0fc8832
VZ
4556Calls wxTrace with printf-style variable argument syntax. Output
4557is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
4558
b0fc8832
VZ
4559\wxheading{Include files}
4560
4561<wx/memory.h>
4562
84ed77ef 4563
b0fc8832
VZ
4564\membersection{WXTRACELEVEL}\label{tracelevel}
4565
4566\func{}{WXTRACELEVEL}{level, formatString, ...}
4567
2bd25c5a
VZ
4568{\bf NB:} This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
4569
b0fc8832
VZ
4570Calls wxTraceLevel with printf-style variable argument syntax. Output
4571is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
4572The first argument should be the level at which this information is appropriate.
4573It will only be output if the level returned by wxDebugContext::GetLevel is equal to or greater than
4574this value.
4575
b0fc8832
VZ
4576\wxheading{Include files}
4577
4578<wx/memory.h>
4579
84ed77ef 4580
b0fc8832
VZ
4581\membersection{::wxTrace}\label{wxtrace}
4582
4583\func{void}{wxTrace}{\param{const wxString\& }{fmt}, \param{...}{}}
4584
2bd25c5a
VZ
4585{\bf NB:} This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
4586
b0fc8832
VZ
4587Takes printf-style variable argument syntax. Output
4588is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
4589
b0fc8832
VZ
4590\wxheading{Include files}
4591
4592<wx/memory.h>
4593
84ed77ef 4594
b0fc8832
VZ
4595\membersection{::wxTraceLevel}\label{wxtracelevel}
4596
4597\func{void}{wxTraceLevel}{\param{int}{ level}, \param{const wxString\& }{fmt}, \param{...}{}}
4598
2bd25c5a
VZ
4599{\bf NB:} This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
4600
b0fc8832
VZ
4601Takes printf-style variable argument syntax. Output
4602is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
4603The first argument should be the level at which this information is appropriate.
4604It will only be output if the level returned by wxDebugContext::GetLevel is equal to or greater than
4605this value.
4606
b0fc8832
VZ
4607\wxheading{Include files}
4608
4609<wx/memory.h>
4610
84ed77ef
VZ
4611
4612
f6bcfd97
BP
4613\section{Time functions}\label{timefunctions}
4614
26822b76
VZ
4615The functions in this section deal with getting the current time and sleeping
4616for the specified time interval.
f6bcfd97 4617
84ed77ef 4618
f6bcfd97
BP
4619\membersection{::wxGetLocalTime}\label{wxgetlocaltime}
4620
4621\func{long}{wxGetLocalTime}{\void}
4622
4623Returns the number of seconds since local time 00:00:00 Jan 1st 1970.
4624
4625\wxheading{See also}
4626
4627\helpref{wxDateTime::Now}{wxdatetimenow}
4628
4629\wxheading{Include files}
4630
26822b76 4631<wx/stopwatch.h>
f6bcfd97 4632
84ed77ef 4633
f6bcfd97
BP
4634\membersection{::wxGetLocalTimeMillis}\label{wxgetlocaltimemillis}
4635
a9d171bd 4636\func{wxLongLong}{wxGetLocalTimeMillis}{\void}
f6bcfd97
BP
4637
4638Returns the number of milliseconds since local time 00:00:00 Jan 1st 1970.
4639
4640\wxheading{See also}
4641
4642\helpref{wxDateTime::Now}{wxdatetimenow},\\
a9d171bd 4643\helpref{wxLongLong}{wxlonglong}
f6bcfd97
BP
4644
4645\wxheading{Include files}
4646
26822b76 4647<wx/stopwatch.h>
f6bcfd97 4648
84ed77ef 4649
f6bcfd97
BP
4650\membersection{::wxGetUTCTime}\label{wxgetutctime}
4651
4652\func{long}{wxGetUTCTime}{\void}
4653
4654Returns the number of seconds since GMT 00:00:00 Jan 1st 1970.
4655
4656\wxheading{See also}
4657
4658\helpref{wxDateTime::Now}{wxdatetimenow}
4659
4660\wxheading{Include files}
4661
26822b76 4662<wx/stopwatch.h>
f6bcfd97 4663
84ed77ef 4664
08873d36
VZ
4665\membersection{::wxMicroSleep}\label{wxmicrosleep}
4666
4667\func{void}{wxMicroSleep}{\param{unsigned long}{ microseconds}}
4668
4669Sleeps for the specified number of microseconds. The microsecond resolution may
4670not, in fact, be available on all platforms (currently only Unix platforms with
8ea92b4d 4671nanosleep(2) may provide it) in which case this is the same as
08873d36
VZ
4672\helpref{wxMilliSleep}{wxmillisleep}(\arg{microseconds}$/1000$).
4673
4674\wxheading{Include files}
4675
4676<wx/utils.h>
4677
4678
4679\membersection{::wxMilliSleep}\label{wxmillisleep}
4680
4681\func{void}{wxMilliSleep}{\param{unsigned long}{ milliseconds}}
4682
4683Sleeps for the specified number of milliseconds. Notice that usage of this
4684function is encouraged instead of calling usleep(3) directly because the
4685standard usleep() function is not MT safe.
4686
4687\wxheading{Include files}
4688
4689<wx/utils.h>
4690
4691
b0fc8832
VZ
4692\membersection{::wxNow}\label{wxnow}
4693
4694\func{wxString}{wxNow}{\void}
4695
4696Returns a string representing the current date and time.
4697
4698\wxheading{Include files}
4699
4700<wx/utils.h>
4701
84ed77ef 4702
b0fc8832
VZ
4703\membersection{::wxSleep}\label{wxsleep}
4704
4705\func{void}{wxSleep}{\param{int}{ secs}}
4706
4707Sleeps for the specified number of seconds.
4708
4709\wxheading{Include files}
4710
4711<wx/utils.h>
4712
84ed77ef 4713
b0fc8832
VZ
4714\membersection{::wxUsleep}\label{wxusleep}
4715
4716\func{void}{wxUsleep}{\param{unsigned long}{ milliseconds}}
4717
08873d36 4718This function is deprecated because its name is misleading: notice that the
8ea92b4d
WS
4719argument is in milliseconds, not microseconds. Please use either
4720\helpref{wxMilliSleep}{wxmillisleep} or \helpref{wxMicroSleep}{wxmicrosleep}
08873d36 4721depending on the resolution you need.
b0fc8832 4722
84ed77ef
VZ
4723
4724
6fb26ea3
JS
4725\section{Debugging macros and functions}\label{debugmacros}
4726
8f5d9104 4727Useful macros and functions for error checking and defensive programming.
fc2171bd 4728wxWidgets defines three families of the assert-like macros:
8f5d9104
VZ
4729the wxASSERT and wxFAIL macros only do anything if \_\_WXDEBUG\_\_ is defined
4730(in other words, in the debug build) but disappear completely in the release
4731build. On the other hand, the wxCHECK macros stay event in release builds but a
4732check failure doesn't generate any user-visible effects then. Finally, the
4733compile time assertions don't happen during the run-time but result in the
4734compilation error messages if the condition they check fail.
6fb26ea3 4735
954b8ae6
JS
4736\wxheading{Include files}
4737
4738<wx/debug.h>
4739
84ed77ef 4740
6fb26ea3
JS
4741\membersection{::wxOnAssert}\label{wxonassert}
4742
09007669 4743\func{void}{wxOnAssert}{\param{const char *}{fileName}, \param{int}{ lineNumber}, \param{const char *}{func}, \param{const char *}{cond}, \param{const char *}{msg = NULL}}
6fb26ea3 4744
8f5d9104
VZ
4745This function is called whenever one of debugging macros fails (i.e. condition
4746is false in an assertion). It is only defined in the debug mode, in release
4747builds the \helpref{wxCHECK}{wxcheck} failures don't result in anything.
4748
4749To override the default behaviour in the debug builds which is to show the user
4750a dialog asking whether he wants to abort the program, continue or continue
b829bf55 4751ignoring any subsequent assert failures, you may override
e0c8d2d9 4752\helpref{wxApp::OnAssertFailure}{wxapponassertfailure} which is called by this function if
8f5d9104 4753the global application object exists.
6fb26ea3 4754
84ed77ef 4755
6fb26ea3
JS
4756\membersection{wxASSERT}\label{wxassert}
4757
4758\func{}{wxASSERT}{\param{}{condition}}
4759
cc81d32f 4760Assert macro. An error message will be generated if the condition is false in
b207457c
VZ
4761debug mode, but nothing will be done in the release build.
4762
4763Please note that the condition in wxASSERT() should have no side effects
4764because it will not be executed in release mode at all.
4765
8f5d9104
VZ
4766\wxheading{See also}
4767
4768\helpref{wxASSERT\_MSG}{wxassertmsg},\\
4769\helpref{wxCOMPILE\_TIME\_ASSERT}{wxcompiletimeassert}
4770
84ed77ef 4771
8f5d9104
VZ
4772\membersection{wxASSERT\_MIN\_BITSIZE}\label{wxassertminbitsize}
4773
4774\func{}{wxASSERT\_MIN\_BITSIZE}{\param{}{type}, \param{}{size}}
4775
b829bf55 4776This macro results in a
9722642d 4777\helpref{compile time assertion failure}{wxcompiletimeassert} if the size
8f5d9104
VZ
4778of the given type {\it type} is less than {\it size} bits.
4779
4780You may use it like this, for example:
4781
4782\begin{verbatim}
4783 // we rely on the int being able to hold values up to 2^32
4784 wxASSERT_MIN_BITSIZE(int, 32);
4785
4786 // can't work with the platforms using UTF-8 for wchar_t
4787 wxASSERT_MIN_BITSIZE(wchar_t, 16);
4788\end{verbatim}
6fb26ea3 4789
84ed77ef 4790
6fb26ea3
JS
4791\membersection{wxASSERT\_MSG}\label{wxassertmsg}
4792
4793\func{}{wxASSERT\_MSG}{\param{}{condition}, \param{}{msg}}
4794
cc81d32f 4795Assert macro with message. An error message will be generated if the condition is false.
6fb26ea3 4796
8f5d9104
VZ
4797\wxheading{See also}
4798
4799\helpref{wxASSERT}{wxassert},\\
4800\helpref{wxCOMPILE\_TIME\_ASSERT}{wxcompiletimeassert}
4801
84ed77ef 4802
8f5d9104
VZ
4803\membersection{wxCOMPILE\_TIME\_ASSERT}\label{wxcompiletimeassert}
4804
4805\func{}{wxCOMPILE\_TIME\_ASSERT}{\param{}{condition}, \param{}{msg}}
4806
4807Using {\tt wxCOMPILE\_TIME\_ASSERT} results in a compilation error if the
9722642d 4808specified {\it condition} is false. The compiler error message should include
8f5d9104
VZ
4809the {\it msg} identifier - please note that it must be a valid C++ identifier
4810and not a string unlike in the other cases.
4811
b829bf55 4812This macro is mostly useful for testing the expressions involving the
8f5d9104
VZ
4813{\tt sizeof} operator as they can't be tested by the preprocessor but it is
4814sometimes desirable to test them at the compile time.
4815
5b8643ea
VZ
4816Note that this macro internally declares a struct whose name it tries to make
4817unique by using the {\tt \_\_LINE\_\_} in it but it may still not work if you
4818use it on the same line in two different source files. In this case you may
b829bf55 4819either change the line in which either of them appears on or use the
5b8643ea
VZ
4820\helpref{wxCOMPILE\_TIME\_ASSERT2}{wxcompiletimeassert2} macro.
4821
150018ae 4822Also note that Microsoft Visual C++ has a bug which results in compiler errors
cf700088
JS
4823if you use this macro with `Program Database For Edit And Continue'
4824(\texttt{/ZI}) option, so you shouldn't use it (`Program Database'
150018ae
VZ
4825(\texttt{/Zi}) is ok though) for the code making use of this macro.
4826
8f5d9104
VZ
4827\wxheading{See also}
4828
4829\helpref{wxASSERT\_MSG}{wxassertmsg},\\
4830\helpref{wxASSERT\_MIN\_BITSIZE}{wxassertminbitsize}
b207457c 4831
84ed77ef 4832
5b8643ea
VZ
4833\membersection{wxCOMPILE\_TIME\_ASSERT2}\label{wxcompiletimeassert2}
4834
4835\func{}{wxCOMPILE\_TIME\_ASSERT}{\param{}{condition}, \param{}{msg}, \param{}{name}}
4836
b829bf55 4837This macro is identical to \helpref{wxCOMPILE\_TIME\_ASSERT2}{wxcompiletimeassert2}
5b8643ea
VZ
4838except that it allows you to specify a unique {\it name} for the struct
4839internally defined by this macro to avoid getting the compilation errors
4840described \helpref{above}{wxcompiletimeassert}.
4841
84ed77ef 4842
6fb26ea3
JS
4843\membersection{wxFAIL}\label{wxfail}
4844
b207457c 4845\func{}{wxFAIL}{\void}
6fb26ea3
JS
4846
4847Will always generate an assert error if this code is reached (in debug mode).
4848
b207457c
VZ
4849See also: \helpref{wxFAIL\_MSG}{wxfailmsg}
4850
84ed77ef 4851
6fb26ea3
JS
4852\membersection{wxFAIL\_MSG}\label{wxfailmsg}
4853
b207457c 4854\func{}{wxFAIL\_MSG}{\param{}{msg}}
6fb26ea3
JS
4855
4856Will always generate an assert error with specified message if this code is reached (in debug mode).
4857
b207457c
VZ
4858This macro is useful for marking unreachable" code areas, for example
4859it may be used in the "default:" branch of a switch statement if all possible
4860cases are processed above.
4861
8f5d9104
VZ
4862\wxheading{See also}
4863
4864\helpref{wxFAIL}{wxfail}
b207457c 4865
84ed77ef 4866
6fb26ea3
JS
4867\membersection{wxCHECK}\label{wxcheck}
4868
4869\func{}{wxCHECK}{\param{}{condition}, \param{}{retValue}}
4870
4871Checks that the condition is true, returns with the given return value if not (FAILs in debug mode).
4872This check is done even in release mode.
4873
84ed77ef 4874
6fb26ea3
JS
4875\membersection{wxCHECK\_MSG}\label{wxcheckmsg}
4876
4877\func{}{wxCHECK\_MSG}{\param{}{condition}, \param{}{retValue}, \param{}{msg}}
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
154b6b0f 4882This macro may be only used in non-void functions, see also
b207457c
VZ
4883\helpref{wxCHECK\_RET}{wxcheckret}.
4884
84ed77ef 4885
b207457c
VZ
4886\membersection{wxCHECK\_RET}\label{wxcheckret}
4887
4888\func{}{wxCHECK\_RET}{\param{}{condition}, \param{}{msg}}
4889
4890Checks that the condition is true, and returns if not (FAILs with given error
4891message in debug mode). This check is done even in release mode.
4892
ec5d7799 4893This macro should be used in void functions instead of
b207457c
VZ
4894\helpref{wxCHECK\_MSG}{wxcheckmsg}.
4895
84ed77ef 4896
b207457c
VZ
4897\membersection{wxCHECK2}\label{wxcheck2}
4898
4899\func{}{wxCHECK2}{\param{}{condition}, \param{}{operation}}
4900
ec5d7799
RD
4901Checks that the condition is true and \helpref{wxFAIL}{wxfail} and execute
4902{\it operation} if it is not. This is a generalisation of
b207457c
VZ
4903\helpref{wxCHECK}{wxcheck} and may be used when something else than just
4904returning from the function must be done when the {\it condition} is false.
4905
4906This check is done even in release mode.
4907
84ed77ef 4908
b207457c
VZ
4909\membersection{wxCHECK2\_MSG}\label{wxcheck2msg}
4910
4911\func{}{wxCHECK2}{\param{}{condition}, \param{}{operation}, \param{}{msg}}
4912
ec5d7799 4913This is the same as \helpref{wxCHECK2}{wxcheck2}, but
b207457c
VZ
4914\helpref{wxFAIL\_MSG}{wxfailmsg} with the specified {\it msg} is called
4915instead of wxFAIL() if the {\it condition} is false.
4916
84ed77ef 4917
b0fc8832
VZ
4918\membersection{::wxTrap}\label{wxtrap}
4919
4920\func{void}{wxTrap}{\void}
4921
4922In debug mode (when {\tt \_\_WXDEBUG\_\_} is defined) this function generates a
4923debugger exception meaning that the control is passed to the debugger if one is
4924attached to the process. Otherwise the program just terminates abnormally.
4925
4926In release mode this function does nothing.
4927
4928\wxheading{Include files}
4929
4930<wx/debug.h>
4931
a434b43f 4932
84ed77ef 4933
a434b43f
VZ
4934\membersection{::wxIsDebuggerRunning}\label{wxisdebuggerrunning}
4935
4936\func{bool}{wxIsDebuggerRunning}{\void}
4937
c50a4038 4938Returns \true if the program is running under debugger, \false otherwise.
a434b43f 4939
c50a4038
VZ
4940Please note that this function is currently only implemented for Win32 and Mac
4941builds using CodeWarrior and always returns \false elsewhere.
a434b43f
VZ
4942
4943
84ed77ef
VZ
4944
4945
5807634c
VZ
4946\section{Environment access functions}\label{environfunctions}
4947
4948The functions in this section allow to access (get) or change value of
4949environment variables in a portable way. They are currently implemented under
4950Win32 and POSIX-like systems (Unix).
4951
4952% TODO add some stuff about env var inheriting but not propagating upwards (VZ)
4953
4954\wxheading{Include files}
4955
4956<wx/utils.h>
4957
84ed77ef 4958
308978f6 4959\membersection{wxGetenv}\label{wxgetenvmacro}
5807634c
VZ
4960
4961\func{wxChar *}{wxGetEnv}{\param{const wxString\&}{ var}}
4962
308978f6
VZ
4963This is a macro defined as {\tt getenv()} or its wide char version in Unicode
4964mode.
4965
4966Note that under Win32 it may not return correct value for the variables set
4967with \helpref{wxSetEnv}{wxsetenv}, use \helpref{wxGetEnv}{wxgetenv} function
4968instead.
4969
84ed77ef 4970
308978f6
VZ
4971\membersection{wxGetEnv}\label{wxgetenv}
4972
4973\func{bool}{wxGetEnv}{\param{const wxString\&}{ var}, \param{wxString *}{value}}
4974
4975Returns the current value of the environment variable {\it var} in {\it value}.
4976{\it value} may be {\tt NULL} if you just want to know if the variable exists
4977and are not interested in its value.
4978
43e8916f 4979Returns \true if the variable exists, \false otherwise.
5807634c 4980
84ed77ef 4981
5807634c
VZ
4982\membersection{wxSetEnv}\label{wxsetenv}
4983
90a77e64 4984\func{bool}{wxSetEnv}{\param{const wxString\&}{ var}, \param{const wxString\& }{value}}
5807634c
VZ
4985
4986Sets the value of the environment variable {\it var} (adding it if necessary)
4987to {\it value}.
4988
43e8916f 4989Returns \true on success.
5807634c 4990
90a77e64
VS
4991\wxheading{See also}
4992
4993\helpref{wxUnsetEnv}{wxunsetenv}
4994
84ed77ef 4995
5807634c
VZ
4996\membersection{wxUnsetEnv}\label{wxunsetenv}
4997
4998\func{bool}{wxUnsetEnv}{\param{const wxString\&}{ var}}
4999
ec5d7799 5000Removes the variable {\it var} from the environment.
5df6ed1c 5001\helpref{wxGetEnv}{wxgetenv} will return {\tt NULL} after the call to this
5807634c
VZ
5002function.
5003
43e8916f 5004Returns \true on success.
90a77e64
VS
5005
5006\wxheading{See also}
5007
5008\helpref{wxSetEnv}{wxsetenv}
cde76cf2
VZ
5009
5010
5011\section{Atomic operations}\label{atomicoperations}
5012
5013When using multi-threaded applications, it is often required to access or
5014modify memory which is shared between threads. Atomic integer and pointer
5015operations are an efficient way to handle this issue (another, less efficient,
5016way is to use a \helpref{mutex}{wxmutex} or \helpref{critical
5017section}{wxcriticalsection}). A native implementation exists for Windows,
5018Linux, Solaris and Mac OS X, for other OS, a
5019\helpref{wxCriticalSection}{wxcriticalsection} is used to protect the data.
5020
5021One particular application is reference counting (used by so-called smart
5022pointers).
5023
5024You should define your variable with the type wxAtomicInt in order to apply
5025atomic operations to it.
5026
5027\wxheading{Include files}
5028
5029<wx/atomic.h>
5030
5031\membersection{::wxAtomicInc}\label{wxatomicinc}
5032
5033\func{void}{wxAtomicInc}{\param{wxAtomicInt\& }{value}}
5034
5035This function increments \arg{value} in an atomic manner.
5036
5037
5038\membersection{::wxAtomicDec}\label{wxatomicdec}
5039
5040\func{wxInt32}{wxAtomicDec}{\param{wxAtomicInt\& }{value}}
5041
5042This function decrements \arg{value} in an atomic manner.
5043
5044Returns 0 if \arg{value} is 0 after decrementation or any non-zero value (not
5045necessarily equal to the value of the variable) otherwise.
5046
5047