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