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