]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/function.tex
added wxLocale::IsAvailable() (extended patch 1547191)
[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
412a5c57
VZ
1749Note that if \texttt{wxUSE_PRINTF_POS_PARAMS} is set to 1, then this function supports
1750positional arguments (see \helpref{wxString::Printf}{wxstringprintf} for more information).
1751However other functions of the same family (wxPrintf, wxSprintf, wxFprintf, wxVfprintf,
1752wxVfprintf, wxVprintf, wxVsprintf) currently do not to support positional parameters
1753even when \texttt{wxUSE_PRINTF_POS_PARAMS} is 1.
1754
e12be2f7 1755\wxheading{See also}
c50f1fb9 1756
b0fc8832 1757\helpref{wxSnprintf}{wxsnprintf}, \helpref{wxString::PrintfV}{wxstringprintfv}
c50f1fb9 1758
0bbe4e29 1759
84ed77ef 1760
0bbe4e29
VZ
1761\membersection{\_}\label{underscore}
1762
1763\func{const wxChar *}{\_}{\param{const char *}{s}}
1764
8ea92b4d 1765This macro expands into a call to \helpref{wxGetTranslation}{wxgettranslation}
0bbe4e29
VZ
1766function, so it marks the message for the extraction by {\tt xgettext} just as
1767\helpref{wxTRANSLATE}{wxtranslate} does, but also returns the translation of
1768the string for the current locale during execution.
1769
1770Don't confuse this macro with \helpref{\_T()}{underscoret}!
1771
84ed77ef 1772
15d06954
VZ
1773\membersection{wxPLURAL}\label{wxplural}
1774
1775\func{const wxChar *}{wxPLURAL}{\param{const char *}{sing}, \param{const char *}{plur}, \param{size\_t}{n}}
1776
1777This macro is identical to \helpref{\_()}{underscore} but for the plural variant
1778of \helpref{wxGetTranslation}{wxgettranslation}.
1779
1780
0bbe4e29
VZ
1781\membersection{\_T}\label{underscoret}
1782
1783\func{wxChar}{\_T}{\param{char }{ch}}
1784
1785\func{const wxChar *}{\_T}{\param{const wxChar }{ch}}
1786
1787This macro is exactly the same as \helpref{wxT}{wxt} and is defined in
fc2171bd 1788wxWidgets simply because it may be more intuitive for Windows programmers as
0bbe4e29
VZ
1789the standard Win32 headers also define it (as well as yet another name for the
1790same macro which is {\tt \_TEXT()}).
1791
1792Don't confuse this macro with \helpref{\_()}{underscore}!
1793
84ed77ef
VZ
1794
1795
b0fc8832 1796\section{Dialog functions}\label{dialogfunctions}
c50f1fb9 1797
b0fc8832
VZ
1798Below are a number of convenience functions for getting input from the
1799user or displaying messages. Note that in these functions the last three
1800parameters are optional. However, it is recommended to pass a parent frame
1801parameter, or (in MS Windows or Motif) the wrong window frame may be brought to
1802the front when the dialog box is popped up.
c50f1fb9 1803
84ed77ef 1804
b0fc8832 1805\membersection{::wxBeginBusyCursor}\label{wxbeginbusycursor}
a660d684 1806
b0fc8832
VZ
1807\func{void}{wxBeginBusyCursor}{\param{wxCursor *}{cursor = wxHOURGLASS\_CURSOR}}
1808
1809Changes the cursor to the given cursor for all windows in the application.
1810Use \helpref{wxEndBusyCursor}{wxendbusycursor} to revert the cursor back
1811to its previous state. These two calls can be nested, and a counter
1812ensures that only the outer calls take effect.
1813
1814See also \helpref{wxIsBusy}{wxisbusy}, \helpref{wxBusyCursor}{wxbusycursor}.
a660d684 1815
954b8ae6
JS
1816\wxheading{Include files}
1817
b0fc8832 1818<wx/utils.h>
954b8ae6 1819
84ed77ef 1820
b0fc8832 1821\membersection{::wxBell}\label{wxbell}
ec5d7799 1822
b0fc8832 1823\func{void}{wxBell}{\void}
ec5d7799 1824
b0fc8832 1825Ring the system bell.
ec5d7799 1826
b0fc8832 1827\wxheading{Include files}
ec5d7799 1828
b0fc8832 1829<wx/utils.h>
a660d684 1830
84ed77ef 1831
b0fc8832 1832\membersection{::wxCreateFileTipProvider}\label{wxcreatefiletipprovider}
a660d684 1833
b0fc8832
VZ
1834\func{wxTipProvider *}{wxCreateFileTipProvider}{\param{const wxString\& }{filename},
1835 \param{size\_t }{currentTip}}
a660d684 1836
b0fc8832
VZ
1837This function creates a \helpref{wxTipProvider}{wxtipprovider} which may be
1838used with \helpref{wxShowTip}{wxshowtip}.
a660d684 1839
b0fc8832
VZ
1840\docparam{filename}{The name of the file containing the tips, one per line}
1841\docparam{currentTip}{The index of the first tip to show - normally this index
1842is remembered between the 2 program runs.}
a660d684 1843
b0fc8832 1844\wxheading{See also}
a660d684 1845
b0fc8832 1846\helpref{Tips overview}{tipsoverview}
904a68b6 1847
b0fc8832 1848\wxheading{Include files}
904a68b6 1849
b0fc8832 1850<wx/tipdlg.h>
904a68b6 1851
84ed77ef 1852
b0fc8832 1853\membersection{::wxDirSelector}\label{wxdirselector}
904a68b6 1854
b0fc8832
VZ
1855\func{wxString}{wxDirSelector}{\param{const wxString\& }{message = wxDirSelectorPromptStr},\\
1856 \param{const wxString\& }{default\_path = ""},\\
1857 \param{long }{style = 0}, \param{const wxPoint\& }{pos = wxDefaultPosition},\\
1858 \param{wxWindow *}{parent = NULL}}
904a68b6 1859
b0fc8832
VZ
1860Pops up a directory selector dialog. The arguments have the same meaning as
1861those of wxDirDialog::wxDirDialog(). The message is displayed at the top,
1862and the default\_path, if specified, is set as the initial selection.
904a68b6 1863
b0fc8832
VZ
1864The application must check for an empty return value (if the user pressed
1865Cancel). For example:
904a68b6 1866
b0fc8832
VZ
1867\begin{verbatim}
1868const wxString& dir = wxDirSelector("Choose a folder");
1869if ( !dir.empty() )
1870{
1871 ...
1872}
1873\end{verbatim}
904a68b6 1874
b0fc8832 1875\wxheading{Include files}
a660d684 1876
b0fc8832 1877<wx/dirdlg.h>
a660d684 1878
84ed77ef 1879
b0fc8832 1880\membersection{::wxFileSelector}\label{wxfileselector}
a660d684 1881
b0fc8832
VZ
1882\func{wxString}{wxFileSelector}{\param{const wxString\& }{message}, \param{const wxString\& }{default\_path = ""},\\
1883 \param{const wxString\& }{default\_filename = ""}, \param{const wxString\& }{default\_extension = ""},\\
cf700088 1884 \param{const wxString\& }{wildcard = "*.*"}, \param{int }{flags = 0}, \param{wxWindow *}{parent = NULL},\\
b0fc8832 1885 \param{int}{ x = -1}, \param{int}{ y = -1}}
a660d684 1886
b0fc8832
VZ
1887Pops up a file selector box. In Windows, this is the common file selector
1888dialog. In X, this is a file selector box with the same functionality.
1889The path and filename are distinct elements of a full file pathname.
1890If path is empty, the current directory will be used. If filename is empty,
1891no default filename will be supplied. The wildcard determines what files
1892are displayed in the file selector, and file extension supplies a type
1893extension for the required filename. Flags may be a combination of wxOPEN,
9b38386f
VZ
1894wxSAVE, wxOVERWRITE\_PROMPT or wxFILE\_MUST\_EXIST. Note that wxMULTIPLE
1895can only be used with \helpref{wxFileDialog}{wxfiledialog} and not here as this
1896function only returns a single file name.
a660d684 1897
b0fc8832
VZ
1898Both the Unix and Windows versions implement a wildcard filter. Typing a
1899filename containing wildcards (*, ?) in the filename text item, and
1900clicking on Ok, will result in only those files matching the pattern being
1901displayed.
a660d684 1902
b0fc8832
VZ
1903The wildcard may be a specification for multiple types of file
1904with a description for each, such as:
a660d684 1905
b0fc8832
VZ
1906\begin{verbatim}
1907 "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
1908\end{verbatim}
a660d684 1909
b0fc8832
VZ
1910The application must check for an empty return value (the user pressed
1911Cancel). For example:
a660d684 1912
b0fc8832 1913\begin{verbatim}
f0f12073
VZ
1914wxString filename = wxFileSelector("Choose a file to open");
1915if ( !filename.empty() )
b0fc8832 1916{
f0f12073
VZ
1917 // work with the file
1918 ...
b0fc8832 1919}
f0f12073 1920//else: cancelled by user
b0fc8832 1921\end{verbatim}
a660d684 1922
b0fc8832 1923\wxheading{Include files}
a660d684 1924
b0fc8832 1925<wx/filedlg.h>
a660d684 1926
84ed77ef 1927
b0fc8832 1928\membersection{::wxEndBusyCursor}\label{wxendbusycursor}
a660d684 1929
b0fc8832 1930\func{void}{wxEndBusyCursor}{\void}
f53561f1 1931
b0fc8832
VZ
1932Changes the cursor back to the original cursor, for all windows in the application.
1933Use with \helpref{wxBeginBusyCursor}{wxbeginbusycursor}.
1934
1935See also \helpref{wxIsBusy}{wxisbusy}, \helpref{wxBusyCursor}{wxbusycursor}.
a660d684 1936
954b8ae6
JS
1937\wxheading{Include files}
1938
b0fc8832 1939<wx/utils.h>
954b8ae6 1940
84ed77ef 1941
b0fc8832 1942\membersection{::wxGetColourFromUser}\label{wxgetcolourfromuser}
a660d684 1943
f14d6dd1 1944\func{wxColour}{wxGetColourFromUser}{\param{wxWindow *}{parent}, \param{const wxColour\& }{colInit}, \param{const wxString\& }{caption = wxEmptyString}}
a660d684 1945
b0fc8832
VZ
1946Shows the colour selection dialog and returns the colour selected by user or
1947invalid colour (use \helpref{wxColour::Ok}{wxcolourok} to test whether a colour
1948is valid) if the dialog was cancelled.
a660d684 1949
b0fc8832 1950\wxheading{Parameters}
a660d684 1951
b0fc8832 1952\docparam{parent}{The parent window for the colour selection dialog}
a660d684 1953
b0fc8832 1954\docparam{colInit}{If given, this will be the colour initially selected in the dialog.}
a660d684 1955
f14d6dd1
JS
1956\docparam{caption}{If given, this will be used for the dialog caption.}
1957
b0fc8832 1958\wxheading{Include files}
a660d684 1959
b0fc8832 1960<wx/colordlg.h>
a660d684 1961
84ed77ef 1962
d741c583
VZ
1963\membersection{::wxGetFontFromUser}\label{wxgetfontfromuser}
1964
f14d6dd1 1965\func{wxFont}{wxGetFontFromUser}{\param{wxWindow *}{parent}, \param{const wxFont\& }{fontInit}, \param{const wxString\& }{caption = wxEmptyString}}
d741c583
VZ
1966
1967Shows the font selection dialog and returns the font selected by user or
1968invalid font (use \helpref{wxFont::Ok}{wxfontok} to test whether a font
1969is valid) if the dialog was cancelled.
1970
1971\wxheading{Parameters}
1972
65d877d2 1973\docparam{parent}{The parent window for the font selection dialog}
d741c583
VZ
1974
1975\docparam{fontInit}{If given, this will be the font initially selected in the dialog.}
1976
f14d6dd1
JS
1977\docparam{caption}{If given, this will be used for the dialog caption.}
1978
d741c583
VZ
1979\wxheading{Include files}
1980
1981<wx/fontdlg.h>
1982
1983
84ed77ef 1984
b0fc8832 1985\membersection{::wxGetMultipleChoices}\label{wxgetmultiplechoices}
a660d684 1986
b0fc8832
VZ
1987\func{size\_t}{wxGetMultipleChoices}{\\
1988 \param{wxArrayInt\& }{selections},\\
1989 \param{const wxString\& }{message},\\
1990 \param{const wxString\& }{caption},\\
1991 \param{const wxArrayString\& }{aChoices},\\
1992 \param{wxWindow *}{parent = NULL},\\
1993 \param{int}{ x = -1}, \param{int}{ y = -1},\\
cc81d32f 1994 \param{bool}{ centre = true},\\
b0fc8832 1995 \param{int }{width=150}, \param{int }{height=200}}
a660d684 1996
b0fc8832
VZ
1997\func{size\_t}{wxGetMultipleChoices}{\\
1998 \param{wxArrayInt\& }{selections},\\
1999 \param{const wxString\& }{message},\\
2000 \param{const wxString\& }{caption},\\
2001 \param{int}{ n}, \param{const wxString\& }{choices[]},\\
2002 \param{wxWindow *}{parent = NULL},\\
2003 \param{int}{ x = -1}, \param{int}{ y = -1},\\
cc81d32f 2004 \param{bool}{ centre = true},\\
b0fc8832 2005 \param{int }{width=150}, \param{int }{height=200}}
a660d684 2006
b0fc8832
VZ
2007Pops up a dialog box containing a message, OK/Cancel buttons and a
2008multiple-selection listbox. The user may choose an arbitrary (including 0)
2009number of items in the listbox whose indices will be returned in
2010{\it selection} array. The initial contents of this array will be used to
2011select the items when the dialog is shown.
a660d684 2012
b0fc8832
VZ
2013You may pass the list of strings to choose from either using {\it choices}
2014which is an array of {\it n} strings for the listbox or by using a single
2015{\it aChoices} parameter of type \helpref{wxArrayString}{wxarraystring}.
a660d684 2016
cc81d32f
VS
2017If {\it centre} is true, the message text (which may include new line
2018characters) is centred; if false, the message is left-justified.
a660d684 2019
b0fc8832 2020\wxheading{Include files}
a660d684 2021
b0fc8832 2022<wx/choicdlg.h>
a660d684 2023
b0fc8832
VZ
2024\perlnote{In wxPerl there is just an array reference in place of {\tt n}
2025and {\tt choices}, and no {\tt selections} parameter; the function
2026returns an array containing the user selections.}
a660d684 2027
84ed77ef 2028
b0fc8832 2029\membersection{::wxGetNumberFromUser}\label{wxgetnumberfromuser}
a660d684 2030
b0fc8832
VZ
2031\func{long}{wxGetNumberFromUser}{
2032 \param{const wxString\& }{message},
2033 \param{const wxString\& }{prompt},
2034 \param{const wxString\& }{caption},
2035 \param{long }{value},
2036 \param{long }{min = 0},
2037 \param{long }{max = 100},
2038 \param{wxWindow *}{parent = NULL},
2039 \param{const wxPoint\& }{pos = wxDefaultPosition}}
a660d684 2040
b0fc8832
VZ
2041Shows a dialog asking the user for numeric input. The dialogs title is set to
2042{\it caption}, it contains a (possibly) multiline {\it message} above the
2043single line {\it prompt} and the zone for entering the number.
a660d684 2044
b0fc8832
VZ
2045The number entered must be in the range {\it min}..{\it max} (both of which
2046should be positive) and {\it value} is the initial value of it. If the user
2047enters an invalid value or cancels the dialog, the function will return -1.
a660d684 2048
b0fc8832
VZ
2049Dialog is centered on its {\it parent} unless an explicit position is given in
2050{\it pos}.
a660d684 2051
b0fc8832 2052\wxheading{Include files}
a660d684 2053
bc253a97 2054<wx/numdlg.h>
a660d684 2055
84ed77ef 2056
b0fc8832 2057\membersection{::wxGetPasswordFromUser}\label{wxgetpasswordfromuser}
a660d684 2058
57dd96a6
KH
2059\func{wxString}{wxGetPasswordFromUser}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Input text"},\\
2060 \param{const wxString\& }{default\_value = ``"}, \param{wxWindow *}{parent = NULL},\\
2061 \param{int}{ x = wxDefaultCoord}, \param{int}{ y = wxDefaultCoord}, \param{bool}{ centre = true}}
a660d684 2062
b0fc8832
VZ
2063Similar to \helpref{wxGetTextFromUser}{wxgettextfromuser} but the text entered
2064in the dialog is not shown on screen but replaced with stars. This is intended
2065to be used for entering passwords as the function name implies.
a660d684 2066
b0fc8832 2067\wxheading{Include files}
a660d684 2068
b0fc8832 2069<wx/textdlg.h>
a660d684 2070
84ed77ef 2071
b0fc8832 2072\membersection{::wxGetTextFromUser}\label{wxgettextfromuser}
a660d684 2073
b0fc8832
VZ
2074\func{wxString}{wxGetTextFromUser}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Input text"},\\
2075 \param{const wxString\& }{default\_value = ``"}, \param{wxWindow *}{parent = NULL},\\
57dd96a6 2076 \param{int}{ x = wxDefaultCoord}, \param{int}{ y = wxDefaultCoord}, \param{bool}{ centre = true}}
a660d684 2077
b0fc8832
VZ
2078Pop up a dialog box with title set to {\it caption}, {\it message}, and a
2079\rtfsp{\it default\_value}. The user may type in text and press OK to return this text,
2080or press Cancel to return the empty string.
a660d684 2081
cc81d32f
VS
2082If {\it centre} is true, the message text (which may include new line characters)
2083is centred; if false, the message is left-justified.
a660d684 2084
b0fc8832 2085\wxheading{Include files}
a660d684 2086
b0fc8832 2087<wx/textdlg.h>
a660d684 2088
84ed77ef 2089
b0fc8832 2090\membersection{::wxGetMultipleChoice}\label{wxgetmultiplechoice}
a660d684 2091
b0fc8832
VZ
2092\func{int}{wxGetMultipleChoice}{\param{const wxString\& }{message}, \param{const wxString\& }{caption}, \param{int}{ n}, \param{const wxString\& }{choices[]},\\
2093 \param{int }{nsel}, \param{int *}{selection},
2094 \param{wxWindow *}{parent = NULL}, \param{int}{ x = -1}, \param{int}{ y = -1},\\
cc81d32f 2095 \param{bool}{ centre = true}, \param{int }{width=150}, \param{int }{height=200}}
a660d684 2096
b0fc8832
VZ
2097Pops up a dialog box containing a message, OK/Cancel buttons and a multiple-selection
2098listbox. The user may choose one or more item(s) and press OK or Cancel.
a660d684 2099
b0fc8832
VZ
2100The number of initially selected choices, and array of the selected indices,
2101are passed in; this array will contain the user selections on exit, with
2102the function returning the number of selections. {\it selection} must be
2103as big as the number of choices, in case all are selected.
a660d684 2104
b0fc8832 2105If Cancel is pressed, -1 is returned.
a660d684 2106
b0fc8832 2107{\it choices} is an array of {\it n} strings for the listbox.
a660d684 2108
cc81d32f
VS
2109If {\it centre} is true, the message text (which may include new line characters)
2110is centred; if false, the message is left-justified.
a660d684 2111
b0fc8832 2112\wxheading{Include files}
a660d684 2113
b0fc8832 2114<wx/choicdlg.h>
a660d684 2115
84ed77ef 2116
b0fc8832 2117\membersection{::wxGetSingleChoice}\label{wxgetsinglechoice}
a660d684 2118
b0fc8832
VZ
2119\func{wxString}{wxGetSingleChoice}{\param{const wxString\& }{message},\\
2120 \param{const wxString\& }{caption},\\
2121 \param{const wxArrayString\& }{aChoices},\\
2122 \param{wxWindow *}{parent = NULL},\\
2123 \param{int}{ x = -1}, \param{int}{ y = -1},\\
cc81d32f 2124 \param{bool}{ centre = true},\\
b0fc8832 2125 \param{int }{width=150}, \param{int }{height=200}}
a660d684 2126
b0fc8832
VZ
2127\func{wxString}{wxGetSingleChoice}{\param{const wxString\& }{message},\\
2128 \param{const wxString\& }{caption},\\
2129 \param{int}{ n}, \param{const wxString\& }{choices[]},\\
2130 \param{wxWindow *}{parent = NULL},\\
2131 \param{int}{ x = -1}, \param{int}{ y = -1},\\
cc81d32f 2132 \param{bool}{ centre = true},\\
b0fc8832 2133 \param{int }{width=150}, \param{int }{height=200}}
a660d684 2134
b0fc8832
VZ
2135Pops up a dialog box containing a message, OK/Cancel buttons and a
2136single-selection listbox. The user may choose an item and press OK to return a
2137string or Cancel to return the empty string. Use
2138\helpref{wxGetSingleChoiceIndex}{wxgetsinglechoiceindex} if empty string is a
2139valid choice and if you want to be able to detect pressing Cancel reliably.
a660d684 2140
b0fc8832
VZ
2141You may pass the list of strings to choose from either using {\it choices}
2142which is an array of {\it n} strings for the listbox or by using a single
2143{\it aChoices} parameter of type \helpref{wxArrayString}{wxarraystring}.
a660d684 2144
cc81d32f
VS
2145If {\it centre} is true, the message text (which may include new line
2146characters) is centred; if false, the message is left-justified.
a660d684 2147
954b8ae6
JS
2148\wxheading{Include files}
2149
b0fc8832 2150<wx/choicdlg.h>
954b8ae6 2151
b0fc8832
VZ
2152\perlnote{In wxPerl there is just an array reference in place of {\tt n}
2153and {\tt choices}.}
a660d684 2154
84ed77ef 2155
b0fc8832 2156\membersection{::wxGetSingleChoiceIndex}\label{wxgetsinglechoiceindex}
a660d684 2157
b0fc8832
VZ
2158\func{int}{wxGetSingleChoiceIndex}{\param{const wxString\& }{message},\\
2159 \param{const wxString\& }{caption},\\
2160 \param{const wxArrayString\& }{aChoices},\\
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
2164\func{int}{wxGetSingleChoiceIndex}{\param{const wxString\& }{message},\\
2165 \param{const wxString\& }{caption},\\
2166 \param{int}{ n}, \param{const wxString\& }{choices[]},\\
2167 \param{wxWindow *}{parent = NULL}, \param{int}{ x = -1}, \param{int}{ y = -1},\\
cc81d32f 2168 \param{bool}{ centre = true}, \param{int }{width=150}, \param{int }{height=200}}
a660d684 2169
b0fc8832
VZ
2170As {\bf wxGetSingleChoice} but returns the index representing the selected
2171string. If the user pressed cancel, -1 is returned.
a660d684 2172
b0fc8832 2173\wxheading{Include files}
a660d684 2174
b0fc8832 2175<wx/choicdlg.h>
a660d684 2176
b0fc8832
VZ
2177\perlnote{In wxPerl there is just an array reference in place of {\tt n}
2178and {\tt choices}.}
a660d684 2179
84ed77ef 2180
b0fc8832 2181\membersection{::wxGetSingleChoiceData}\label{wxgetsinglechoicedata}
a660d684 2182
b0fc8832
VZ
2183\func{wxString}{wxGetSingleChoiceData}{\param{const wxString\& }{message},\\
2184 \param{const wxString\& }{caption},\\
2185 \param{const wxArrayString\& }{aChoices},\\
2186 \param{const wxString\& }{client\_data[]},\\
2187 \param{wxWindow *}{parent = NULL},\\
2188 \param{int}{ x = -1}, \param{int}{ y = -1},\\
cc81d32f 2189 \param{bool}{ centre = true}, \param{int }{width=150}, \param{int }{height=200}}
a660d684 2190
b0fc8832
VZ
2191\func{wxString}{wxGetSingleChoiceData}{\param{const wxString\& }{message},\\
2192 \param{const wxString\& }{caption},\\
2193 \param{int}{ n}, \param{const wxString\& }{choices[]},\\
2194 \param{const wxString\& }{client\_data[]},\\
2195 \param{wxWindow *}{parent = NULL},\\
2196 \param{int}{ x = -1}, \param{int}{ y = -1},\\
cc81d32f 2197 \param{bool}{ centre = true}, \param{int }{width=150}, \param{int }{height=200}}
a660d684 2198
b0fc8832
VZ
2199As {\bf wxGetSingleChoice} but takes an array of client data pointers
2200corresponding to the strings, and returns one of these pointers or NULL if
2201Cancel was pressed. The {\it client\_data} array must have the same number of
2202elements as {\it choices} or {\it aChoices}!
a660d684 2203
b0fc8832 2204\wxheading{Include files}
a660d684 2205
b0fc8832 2206<wx/choicdlg.h>
a660d684 2207
b0fc8832
VZ
2208\perlnote{In wxPerl there is just an array reference in place of {\tt n}
2209and {\tt choices}, and the client data array must have the
2210same length as the choices array.}
a660d684 2211
84ed77ef 2212
b0fc8832 2213\membersection{::wxIsBusy}\label{wxisbusy}
a660d684 2214
b0fc8832 2215\func{bool}{wxIsBusy}{\void}
a660d684 2216
cc81d32f 2217Returns true if between two \helpref{wxBeginBusyCursor}{wxbeginbusycursor} and\rtfsp
b0fc8832 2218\helpref{wxEndBusyCursor}{wxendbusycursor} calls.
a660d684 2219
b0fc8832 2220See also \helpref{wxBusyCursor}{wxbusycursor}.
a660d684 2221
b0fc8832 2222\wxheading{Include files}
a660d684 2223
b0fc8832 2224<wx/utils.h>
a660d684 2225
84ed77ef 2226
b0fc8832 2227\membersection{::wxMessageBox}\label{wxmessagebox}
a660d684 2228
dc0cecbc 2229\func{int}{wxMessageBox}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Message"}, \param{int}{ style = wxOK},\\
b0fc8832 2230 \param{wxWindow *}{parent = NULL}, \param{int}{ x = -1}, \param{int}{ y = -1}}
a660d684 2231
b0fc8832
VZ
2232General purpose message dialog. {\it style} may be a bit list of the
2233following identifiers:
a660d684 2234
b0fc8832
VZ
2235\begin{twocollist}\itemsep=0pt
2236\twocolitem{wxYES\_NO}{Puts Yes and No buttons on the message box. May be combined with
2237wxCANCEL.}
0a6f92b8 2238\twocolitem{wxCANCEL}{Puts a Cancel button on the message box. May only be combined with
b0fc8832
VZ
2239wxYES\_NO or wxOK.}
2240\twocolitem{wxOK}{Puts an Ok button on the message box. May be combined with wxCANCEL.}
b0fc8832
VZ
2241\twocolitem{wxICON\_EXCLAMATION}{Displays an exclamation mark symbol.}
2242\twocolitem{wxICON\_HAND}{Displays an error symbol.}
2243\twocolitem{wxICON\_ERROR}{Displays an error symbol - the same as wxICON\_HAND.}
2244\twocolitem{wxICON\_QUESTION}{Displays a question mark symbol.}
2245\twocolitem{wxICON\_INFORMATION}{Displays an information symbol.}
2246\end{twocollist}
a660d684 2247
b0fc8832 2248The return value is one of: wxYES, wxNO, wxCANCEL, wxOK.
a660d684 2249
b0fc8832 2250For example:
a660d684 2251
b0fc8832
VZ
2252\begin{verbatim}
2253 ...
2254 int answer = wxMessageBox("Quit program?", "Confirm",
2255 wxYES_NO | wxCANCEL, main_frame);
2256 if (answer == wxYES)
933b675e 2257 main_frame->Close();
b0fc8832
VZ
2258 ...
2259\end{verbatim}
a660d684 2260
b0fc8832
VZ
2261{\it message} may contain newline characters, in which case the
2262message will be split into separate lines, to cater for large messages.
a660d684 2263
b0fc8832 2264\wxheading{Include files}
a660d684 2265
b0fc8832 2266<wx/msgdlg.h>
a660d684 2267
84ed77ef 2268
b0fc8832 2269\membersection{::wxShowTip}\label{wxshowtip}
a660d684 2270
b0fc8832
VZ
2271\func{bool}{wxShowTip}{\param{wxWindow *}{parent},
2272 \param{wxTipProvider *}{tipProvider},
cc81d32f 2273 \param{bool }{showAtStartup = true}}
a660d684 2274
7975104d 2275This function shows a "startup tip" to the user. The return value is the
cf700088 2276state of the `Show tips at startup' checkbox.
a660d684 2277
b0fc8832 2278\docparam{parent}{The parent window for the modal dialog}
a660d684 2279
b0fc8832
VZ
2280\docparam{tipProvider}{An object which is used to get the text of the tips.
2281It may be created with the \helpref{wxCreateFileTipProvider}{wxcreatefiletipprovider} function.}
a660d684 2282
cc81d32f 2283\docparam{showAtStartup}{Should be true if startup tips are shown, false
b0fc8832
VZ
2284otherwise. This is used as the initial value for "Show tips at startup"
2285checkbox which is shown in the tips dialog.}
a660d684 2286
b0fc8832 2287\wxheading{See also}
a660d684 2288
b0fc8832 2289\helpref{Tips overview}{tipsoverview}
a660d684 2290
b0fc8832 2291\wxheading{Include files}
f6bcfd97 2292
b0fc8832 2293<wx/tipdlg.h>
f6bcfd97 2294
a02afd14 2295
84ed77ef
VZ
2296
2297
569ef72a 2298\section{Math functions}\label{mathfunctions}
a02afd14
VZ
2299
2300\wxheading{Include files}
2301
2302<wx/math.h>
2303
84ed77ef 2304
a02afd14
VZ
2305\membersection{wxFinite}\label{wxfinite}
2306
2307\func{int}{wxFinite}{\param{double }{x}}
2308
8ea92b4d 2309Returns a non-zero value if {\it x} is neither infinite or NaN (not a number),
a02afd14
VZ
2310returns 0 otherwise.
2311
84ed77ef 2312
a02afd14
VZ
2313\membersection{wxIsNaN}\label{wxisnan}
2314
2315\func{bool}{wxIsNaN}{\param{double }{x}}
2316
2317Returns a non-zero value if {\it x} is NaN (not a number), returns 0
2318otherwise.
2319
2320
84ed77ef
VZ
2321
2322
b0fc8832 2323\section{GDI functions}\label{gdifunctions}
f6bcfd97 2324
b0fc8832 2325The following are relevant to the GDI (Graphics Device Interface).
f6bcfd97
BP
2326
2327\wxheading{Include files}
2328
b0fc8832 2329<wx/gdicmn.h>
f6bcfd97 2330
84ed77ef 2331
b0fc8832 2332\membersection{wxBITMAP}\label{wxbitmapmacro}
a660d684 2333
b0fc8832 2334\func{}{wxBITMAP}{bitmapName}
a660d684 2335
b0fc8832
VZ
2336This macro loads a bitmap from either application resources (on the platforms
2337for which they exist, i.e. Windows and OS2) or from an XPM file. It allows to
2338avoid using {\tt \#ifdef}s when creating bitmaps.
a660d684 2339
b0fc8832 2340\wxheading{See also}
954b8ae6 2341
b0fc8832
VZ
2342\helpref{Bitmaps and icons overview}{wxbitmapoverview},
2343\helpref{wxICON}{wxiconmacro}
a660d684 2344
b0fc8832 2345\wxheading{Include files}
954b8ae6 2346
b0fc8832 2347<wx/gdicmn.h>
a660d684 2348
84ed77ef 2349
b0fc8832 2350\membersection{::wxClientDisplayRect}\label{wxclientdisplayrect}
a660d684 2351
b0fc8832
VZ
2352\func{void}{wxClientDisplayRect}{\param{int *}{x}, \param{int *}{y},
2353\param{int *}{width}, \param{int *}{height}}
954b8ae6 2354
b0fc8832 2355\func{wxRect}{wxGetClientDisplayRect}{\void}
954b8ae6 2356
b0fc8832
VZ
2357Returns the dimensions of the work area on the display. On Windows
2358this means the area not covered by the taskbar, etc. Other platforms
2359are currently defaulting to the whole display until a way is found to
2360provide this info for all window managers, etc.
a660d684 2361
84ed77ef 2362
b0fc8832 2363\membersection{::wxColourDisplay}\label{wxcolourdisplay}
a660d684 2364
b0fc8832 2365\func{bool}{wxColourDisplay}{\void}
a660d684 2366
cc81d32f 2367Returns true if the display is colour, false otherwise.
a660d684 2368
84ed77ef 2369
b0fc8832 2370\membersection{::wxDisplayDepth}\label{wxdisplaydepth}
954b8ae6 2371
b0fc8832 2372\func{int}{wxDisplayDepth}{\void}
954b8ae6 2373
b0fc8832 2374Returns the depth of the display (a value of 1 denotes a monochrome display).
a660d684 2375
84ed77ef 2376
b0fc8832 2377\membersection{::wxDisplaySize}\label{wxdisplaysize}
a660d684 2378
b0fc8832 2379\func{void}{wxDisplaySize}{\param{int *}{width}, \param{int *}{height}}
a660d684 2380
b0fc8832 2381\func{wxSize}{wxGetDisplaySize}{\void}
a660d684 2382
b0fc8832 2383Returns the display size in pixels.
a660d684 2384
84ed77ef 2385
b0fc8832 2386\membersection{::wxDisplaySizeMM}\label{wxdisplaysizemm}
a660d684 2387
b0fc8832 2388\func{void}{wxDisplaySizeMM}{\param{int *}{width}, \param{int *}{height}}
a660d684 2389
b0fc8832 2390\func{wxSize}{wxGetDisplaySizeMM}{\void}
a660d684 2391
b0fc8832 2392Returns the display size in millimeters.
e2a6f233 2393
84ed77ef 2394
b0fc8832 2395\membersection{::wxDROP\_ICON}\label{wxdropicon}
e2a6f233 2396
b0fc8832 2397\func{wxIconOrCursor}{wxDROP\_ICON}{\param{const char *}{name}}
e2a6f233 2398
b0fc8832
VZ
2399This macro creates either a cursor (MSW) or an icon (elsewhere) with the given
2400name. Under MSW, the cursor is loaded from the resource file and the icon is
2401loaded from XPM file under other platforms.
2402
2403This macro should be used with
2404\helpref{wxDropSource constructor}{wxdropsourcewxdropsource}.
e2a6f233 2405
954b8ae6
JS
2406\wxheading{Include files}
2407
b0fc8832 2408<wx/dnd.h>
954b8ae6 2409
84ed77ef 2410
b0fc8832 2411\membersection{wxICON}\label{wxiconmacro}
e2a6f233 2412
b0fc8832 2413\func{}{wxICON}{iconName}
e2a6f233 2414
b0fc8832
VZ
2415This macro loads an icon from either application resources (on the platforms
2416for which they exist, i.e. Windows and OS2) or from an XPM file. It allows to
2417avoid using {\tt \#ifdef}s when creating icons.
e2a6f233 2418
b0fc8832 2419\wxheading{See also}
e2a6f233 2420
b0fc8832
VZ
2421\helpref{Bitmaps and icons overview}{wxbitmapoverview},
2422\helpref{wxBITMAP}{wxbitmapmacro}
e2a6f233 2423
954b8ae6
JS
2424\wxheading{Include files}
2425
b0fc8832 2426<wx/gdicmn.h>
a660d684 2427
84ed77ef 2428
b0fc8832 2429\membersection{::wxMakeMetafilePlaceable}\label{wxmakemetafileplaceable}
de6019fb 2430
b0fc8832
VZ
2431\func{bool}{wxMakeMetafilePlaceable}{\param{const wxString\& }{filename}, \param{int }{minX}, \param{int }{minY},
2432 \param{int }{maxX}, \param{int }{maxY}, \param{float }{scale=1.0}}
a660d684 2433
b0fc8832
VZ
2434Given a filename for an existing, valid metafile (as constructed using \helpref{wxMetafileDC}{wxmetafiledc})
2435makes it into a placeable metafile by prepending a header containing the given
2436bounding box. The bounding box may be obtained from a device context after drawing
2437into it, using the functions wxDC::MinX, wxDC::MinY, wxDC::MaxX and wxDC::MaxY.
a660d684 2438
b0fc8832
VZ
2439In addition to adding the placeable metafile header, this function adds
2440the equivalent of the following code to the start of the metafile data:
a660d684 2441
b0fc8832
VZ
2442\begin{verbatim}
2443 SetMapMode(dc, MM_ANISOTROPIC);
2444 SetWindowOrg(dc, minX, minY);
2445 SetWindowExt(dc, maxX - minX, maxY - minY);
2446\end{verbatim}
6fb26ea3 2447
fc2171bd 2448This simulates the wxMM\_TEXT mapping mode, which wxWidgets assumes.
954b8ae6 2449
b0fc8832
VZ
2450Placeable metafiles may be imported by many Windows applications, and can be
2451used in RTF (Rich Text Format) files.
954b8ae6 2452
b0fc8832 2453{\it scale} allows the specification of scale for the metafile.
a660d684 2454
b0fc8832 2455This function is only available under Windows.
a660d684 2456
84ed77ef 2457
b0fc8832 2458\membersection{::wxSetCursor}\label{wxsetcursor}
a660d684 2459
b0fc8832 2460\func{void}{wxSetCursor}{\param{wxCursor *}{cursor}}
954b8ae6 2461
b0fc8832
VZ
2462Globally sets the cursor; only has an effect in Windows and GTK.
2463See also \helpref{wxCursor}{wxcursor}, \helpref{wxWindow::SetCursor}{wxwindowsetcursor}.
954b8ae6 2464
84ed77ef
VZ
2465
2466
b0fc8832 2467\section{Printer settings}\label{printersettings}
8e193f38 2468
2bd25c5a 2469{\bf NB:} These routines are obsolete and should no longer be used!
8e193f38 2470
b0fc8832
VZ
2471The following functions are used to control PostScript printing. Under
2472Windows, PostScript output can only be sent to a file.
8e193f38
VZ
2473
2474\wxheading{Include files}
2475
b0fc8832 2476<wx/dcps.h>
a660d684 2477
84ed77ef 2478
b0fc8832 2479\membersection{::wxGetPrinterCommand}\label{wxgetprintercommand}
a660d684 2480
b0fc8832 2481\func{wxString}{wxGetPrinterCommand}{\void}
a660d684 2482
b0fc8832 2483Gets the printer command used to print a file. The default is {\tt lpr}.
a660d684 2484
84ed77ef 2485
b0fc8832 2486\membersection{::wxGetPrinterFile}\label{wxgetprinterfile}
a660d684 2487
b0fc8832 2488\func{wxString}{wxGetPrinterFile}{\void}
a660d684 2489
b0fc8832 2490Gets the PostScript output filename.
a660d684 2491
84ed77ef 2492
b0fc8832 2493\membersection{::wxGetPrinterMode}\label{wxgetprintermode}
a660d684 2494
b0fc8832 2495\func{int}{wxGetPrinterMode}{\void}
954b8ae6 2496
b0fc8832
VZ
2497Gets the printing mode controlling where output is sent (PS\_PREVIEW, PS\_FILE or PS\_PRINTER).
2498The default is PS\_PREVIEW.
954b8ae6 2499
84ed77ef 2500
b0fc8832 2501\membersection{::wxGetPrinterOptions}\label{wxgetprinteroptions}
954b8ae6 2502
b0fc8832 2503\func{wxString}{wxGetPrinterOptions}{\void}
954b8ae6 2504
b0fc8832 2505Gets the additional options for the print command (e.g. specific printer). The default is nothing.
954b8ae6 2506
84ed77ef 2507
b0fc8832 2508\membersection{::wxGetPrinterOrientation}\label{wxgetprinterorientation}
954b8ae6 2509
b0fc8832 2510\func{int}{wxGetPrinterOrientation}{\void}
a660d684 2511
b0fc8832 2512Gets the orientation (PS\_PORTRAIT or PS\_LANDSCAPE). The default is PS\_PORTRAIT.
a660d684 2513
84ed77ef 2514
b0fc8832 2515\membersection{::wxGetPrinterPreviewCommand}\label{wxgetprinterpreviewcommand}
8e193f38 2516
b0fc8832 2517\func{wxString}{wxGetPrinterPreviewCommand}{\void}
a660d684 2518
b0fc8832 2519Gets the command used to view a PostScript file. The default depends on the platform.
954b8ae6 2520
84ed77ef 2521
b0fc8832 2522\membersection{::wxGetPrinterScaling}\label{wxgetprinterscaling}
954b8ae6 2523
b0fc8832 2524\func{void}{wxGetPrinterScaling}{\param{float *}{x}, \param{float *}{y}}
a660d684 2525
b0fc8832 2526Gets the scaling factor for PostScript output. The default is 1.0, 1.0.
a660d684 2527
84ed77ef 2528
b0fc8832 2529\membersection{::wxGetPrinterTranslation}\label{wxgetprintertranslation}
a660d684 2530
b0fc8832 2531\func{void}{wxGetPrinterTranslation}{\param{float *}{x}, \param{float *}{y}}
954b8ae6 2532
b0fc8832 2533Gets the translation (from the top left corner) for PostScript output. The default is 0.0, 0.0.
954b8ae6 2534
84ed77ef 2535
b0fc8832 2536\membersection{::wxSetPrinterCommand}\label{wxsetprintercommand}
a660d684 2537
b0fc8832 2538\func{void}{wxSetPrinterCommand}{\param{const wxString\& }{command}}
a660d684 2539
b0fc8832 2540Sets the printer command used to print a file. The default is {\tt lpr}.
a660d684 2541
84ed77ef 2542
b0fc8832 2543\membersection{::wxSetPrinterFile}\label{wxsetprinterfile}
cd6ce4a9 2544
b0fc8832 2545\func{void}{wxSetPrinterFile}{\param{const wxString\& }{filename}}
f6bcfd97 2546
b0fc8832 2547Sets the PostScript output filename.
a660d684 2548
84ed77ef 2549
b0fc8832 2550\membersection{::wxSetPrinterMode}\label{wxsetprintermode}
a660d684 2551
b0fc8832 2552\func{void}{wxSetPrinterMode}{\param{int }{mode}}
a660d684 2553
b0fc8832
VZ
2554Sets the printing mode controlling where output is sent (PS\_PREVIEW, PS\_FILE or PS\_PRINTER).
2555The default is PS\_PREVIEW.
cd6ce4a9 2556
84ed77ef 2557
b0fc8832 2558\membersection{::wxSetPrinterOptions}\label{wxsetprinteroptions}
a660d684 2559
b0fc8832 2560\func{void}{wxSetPrinterOptions}{\param{const wxString\& }{options}}
e6045e08 2561
b0fc8832 2562Sets the additional options for the print command (e.g. specific printer). The default is nothing.
a660d684 2563
84ed77ef 2564
b0fc8832 2565\membersection{::wxSetPrinterOrientation}\label{wxsetprinterorientation}
eafc087e 2566
b0fc8832 2567\func{void}{wxSetPrinterOrientation}{\param{int}{ orientation}}
cd6ce4a9 2568
b0fc8832 2569Sets the orientation (PS\_PORTRAIT or PS\_LANDSCAPE). The default is PS\_PORTRAIT.
a660d684 2570
84ed77ef 2571
b0fc8832 2572\membersection{::wxSetPrinterPreviewCommand}\label{wxsetprinterpreviewcommand}
954b8ae6 2573
b0fc8832 2574\func{void}{wxSetPrinterPreviewCommand}{\param{const wxString\& }{command}}
954b8ae6 2575
b0fc8832 2576Sets the command used to view a PostScript file. The default depends on the platform.
a660d684 2577
84ed77ef 2578
b0fc8832 2579\membersection{::wxSetPrinterScaling}\label{wxsetprinterscaling}
a660d684 2580
b0fc8832 2581\func{void}{wxSetPrinterScaling}{\param{float }{x}, \param{float }{y}}
a660d684 2582
b0fc8832 2583Sets the scaling factor for PostScript output. The default is 1.0, 1.0.
954b8ae6 2584
84ed77ef 2585
b0fc8832 2586\membersection{::wxSetPrinterTranslation}\label{wxsetprintertranslation}
954b8ae6 2587
b0fc8832 2588\func{void}{wxSetPrinterTranslation}{\param{float }{x}, \param{float }{y}}
a660d684 2589
b0fc8832 2590Sets the translation (from the top left corner) for PostScript output. The default is 0.0, 0.0.
a660d684 2591
84ed77ef
VZ
2592
2593
b0fc8832
VZ
2594\section{Clipboard functions}\label{clipsboard}
2595
2596These clipboard functions are implemented for Windows only. The use of these functions
2597is deprecated and the code is no longer maintained. Use the \helpref{wxClipboard}{wxclipboard}
2598class instead.
a660d684 2599
954b8ae6
JS
2600\wxheading{Include files}
2601
b0fc8832 2602<wx/clipbrd.h>
954b8ae6 2603
84ed77ef 2604
f4fcc291 2605\membersection{::wxClipboardOpen}\label{functionwxclipboardopen}
a660d684 2606
b0fc8832 2607\func{bool}{wxClipboardOpen}{\void}
a660d684 2608
cc81d32f 2609Returns true if this application has already opened the clipboard.
a660d684 2610
84ed77ef 2611
b0fc8832 2612\membersection{::wxCloseClipboard}\label{wxcloseclipboard}
954b8ae6 2613
b0fc8832 2614\func{bool}{wxCloseClipboard}{\void}
954b8ae6 2615
b0fc8832 2616Closes the clipboard to allow other applications to use it.
a660d684 2617
84ed77ef 2618
b0fc8832 2619\membersection{::wxEmptyClipboard}\label{wxemptyclipboard}
a660d684 2620
b0fc8832 2621\func{bool}{wxEmptyClipboard}{\void}
a660d684 2622
b0fc8832 2623Empties the clipboard.
954b8ae6 2624
84ed77ef 2625
b0fc8832 2626\membersection{::wxEnumClipboardFormats}\label{wxenumclipboardformats}
954b8ae6 2627
e7dfcb8e 2628\func{int}{wxEnumClipboardFormats}{\param{int}{ dataFormat}}
a660d684 2629
b0fc8832
VZ
2630Enumerates the formats found in a list of available formats that belong
2631to the clipboard. Each call to this function specifies a known
2632available format; the function returns the format that appears next in
2633the list.
a660d684 2634
b0fc8832
VZ
2635{\it dataFormat} specifies a known format. If this parameter is zero,
2636the function returns the first format in the list.
a660d684 2637
b0fc8832
VZ
2638The return value specifies the next known clipboard data format if the
2639function is successful. It is zero if the {\it dataFormat} parameter specifies
2640the last format in the list of available formats, or if the clipboard
2641is not open.
a660d684 2642
b0fc8832
VZ
2643Before it enumerates the formats function, an application must open the clipboard by using the
2644wxOpenClipboard function.
954b8ae6 2645
84ed77ef 2646
b0fc8832 2647\membersection{::wxGetClipboardData}\label{wxgetclipboarddata}
954b8ae6 2648
e7dfcb8e 2649\func{wxObject *}{wxGetClipboardData}{\param{int}{ dataFormat}}
26a80c22 2650
b0fc8832 2651Gets data from the clipboard.
26a80c22 2652
b0fc8832 2653{\it dataFormat} may be one of:
26a80c22 2654
b0fc8832
VZ
2655\begin{itemize}\itemsep=0pt
2656\item wxCF\_TEXT or wxCF\_OEMTEXT: returns a pointer to new memory containing a null-terminated text string.
2657\item wxCF\_BITMAP: returns a new wxBitmap.
2658\end{itemize}
26a80c22 2659
b0fc8832 2660The clipboard must have previously been opened for this call to succeed.
26a80c22 2661
84ed77ef 2662
b0fc8832 2663\membersection{::wxGetClipboardFormatName}\label{wxgetclipboardformatname}
26a80c22 2664
e7dfcb8e 2665\func{bool}{wxGetClipboardFormatName}{\param{int}{ dataFormat}, \param{const wxString\& }{formatName}, \param{int}{ maxCount}}
a660d684 2666
b0fc8832
VZ
2667Gets the name of a registered clipboard format, and puts it into the buffer {\it formatName} which is of maximum
2668length {\it maxCount}. {\it dataFormat} must not specify a predefined clipboard format.
a660d684 2669
84ed77ef 2670
b0fc8832 2671\membersection{::wxIsClipboardFormatAvailable}\label{wxisclipboardformatavailable}
a660d684 2672
e7dfcb8e 2673\func{bool}{wxIsClipboardFormatAvailable}{\param{int}{ dataFormat}}
954b8ae6 2674
cc81d32f 2675Returns true if the given data format is available on the clipboard.
954b8ae6 2676
84ed77ef 2677
b0fc8832 2678\membersection{::wxOpenClipboard}\label{wxopenclipboard}
a660d684 2679
b0fc8832 2680\func{bool}{wxOpenClipboard}{\void}
a660d684 2681
b0fc8832 2682Opens the clipboard for passing data to it or getting data from it.
a660d684 2683
84ed77ef 2684
b0fc8832 2685\membersection{::wxRegisterClipboardFormat}\label{wxregisterclipboardformat}
954b8ae6 2686
b0fc8832 2687\func{int}{wxRegisterClipboardFormat}{\param{const wxString\& }{formatName}}
954b8ae6 2688
b0fc8832 2689Registers the clipboard data format name and returns an identifier.
a660d684 2690
84ed77ef 2691
b0fc8832 2692\membersection{::wxSetClipboardData}\label{wxsetclipboarddata}
a660d684 2693
e7dfcb8e 2694\func{bool}{wxSetClipboardData}{\param{int}{ dataFormat}, \param{wxObject*}{ data}, \param{int}{ width}, \param{int}{ height}}
c51deffc 2695
b0fc8832 2696Passes data to the clipboard.
c51deffc 2697
b0fc8832 2698{\it dataFormat} may be one of:
a660d684 2699
b0fc8832
VZ
2700\begin{itemize}\itemsep=0pt
2701\item wxCF\_TEXT or wxCF\_OEMTEXT: {\it data} is a null-terminated text string.
2702\item wxCF\_BITMAP: {\it data} is a wxBitmap.
2703\item wxCF\_DIB: {\it data} is a wxBitmap. The bitmap is converted to a DIB (device independent bitmap).
2704\item wxCF\_METAFILE: {\it data} is a wxMetafile. {\it width} and {\it height} are used to give recommended dimensions.
2705\end{itemize}
954b8ae6 2706
b0fc8832 2707The clipboard must have previously been opened for this call to succeed.
954b8ae6 2708
4104ed92 2709
b0fc8832 2710\section{Miscellaneous functions}\label{miscellany}
a660d684 2711
84ed77ef 2712
3c595496
VZ
2713\membersection{wxCONCAT}\label{wxconcat}
2714
2715\func{}{wxCONCAT}{\param{}{x}, \param{}{y}}
2716
2717This macro returns the concatenation of two tokens \arg{x} and \arg{y}.
2718
2719
4104ed92
VZ
2720\membersection{wxDYNLIB\_FUNCTION}\label{wxdynlibfunction}
2721
2722\func{}{wxDYNLIB\_FUNCTION}{\param{}{type}, \param{}{name}, \param{}{dynlib}}
2723
8ea92b4d 2724When loading a function from a DLL you always have to cast the returned
b325f27f 2725{\tt void *} pointer to the correct type and, even more annoyingly, you have to
4104ed92
VZ
2726repeat this type twice if you want to declare and define a function pointer all
2727in one line
2728
2729This macro makes this slightly less painful by allowing you to specify the
2730type only once, as the first parameter, and creating a variable of this type
2731named after the function but with {\tt pfn} prefix and initialized with the
8ea92b4d 2732function \arg{name} from the \helpref{wxDynamicLibrary}{wxdynamiclibrary}
4104ed92
VZ
2733\arg{dynlib}.
2734
2735\wxheading{Parameters}
2736
2737\docparam{type}{the type of the function}
2738
2739\docparam{name}{the name of the function to load, not a string (without quotes,
2740it is quoted automatically by the macro)}
2741
2742\docparam{dynlib}{the library to load the function from}
2743
2744
84ed77ef 2745
986ecc86
VZ
2746\membersection{wxEXPLICIT}\label{wxexplicit}
2747
2748{\tt wxEXPLICIT} is a macro which expands to the C++ {\tt explicit} keyword if
2749the compiler supports it or nothing otherwise. Thus, it can be used even in the
2750code which might have to be compiled with an old compiler without support for
2751this language feature but still take advantage of it when it is available.
2752
84ed77ef 2753
f52d9e92
VZ
2754\membersection{::wxGetKeyState}\label{wxgetkeystate}
2755
1751226c 2756\func{bool}{wxGetKeyState}{\param{wxKeyCode }{key}}
f52d9e92 2757
44353523
VZ
2758For normal keys, returns \true if the specified key is currently down.
2759
2760For togglable keys (Caps Lock, Num Lock and Scroll Lock), returns
2761\true if the key is toggled such that its LED indicator is lit. There is
2762currently no way to test whether togglable keys are up or down.
2763
2764Even though there are virtual key codes defined for mouse buttons, they
2765cannot be used with this function currently.
f52d9e92
VZ
2766
2767\wxheading{Include files}
2768
2769<wx/utils.h>
2770
2771
2b5f62a0
VZ
2772\membersection{wxLL}\label{wxll}
2773
2774\func{wxLongLong\_t}{wxLL}{\param{}{number}}
2775
2776This macro is defined for the platforms with a native 64 bit integer type and
2777allows to define 64 bit compile time constants:
2778
2779\begin{verbatim}
2780 #ifdef wxLongLong_t
2781 wxLongLong_t ll = wxLL(0x1234567890abcdef);
2782 #endif
2783\end{verbatim}
2784
2785\wxheading{Include files}
2786
2787<wx/longlong.h>
2788
84ed77ef
VZ
2789\wxheading{See also}
2790
2791\helpref{wxULL}{wxull}, \helpref{wxLongLong}{wxlonglong}
2792
2793
2b5f62a0
VZ
2794\membersection{wxLongLongFmtSpec}\label{wxlonglongfmtspec}
2795
2796This macro is defined to contain the {\tt printf()} format specifier using
2797which 64 bit integer numbers (i.e. those of type {\tt wxLongLong\_t}) can be
2798printed. Example of using it:
2799
2800\begin{verbatim}
2801 #ifdef wxLongLong_t
2802 wxLongLong_t ll = wxLL(0x1234567890abcdef);
2803 printf("Long long = %" wxLongLongFmtSpec "x\n", ll);
2804 #endif
2805\end{verbatim}
2806
2807\wxheading{See also}
2808
2809\helpref{wxLL}{wxll}
2810
2811\wxheading{Include files}
2812
2813<wx/longlong.h>
2814
84ed77ef 2815
b0fc8832 2816\membersection{::wxNewId}\label{wxnewid}
a660d684 2817
b0fc8832
VZ
2818\func{long}{wxNewId}{\void}
2819
2820Generates an integer identifier unique to this run of the program.
a660d684 2821
954b8ae6
JS
2822\wxheading{Include files}
2823
2824<wx/utils.h>
2825
84ed77ef 2826
1a64b24d
VZ
2827\membersection{wxON\_BLOCK\_EXIT}\label{wxonblockexit}
2828
2829\func{}{wxON\_BLOCK\_EXIT0}{\param{}{func}}
2830\func{}{wxON\_BLOCK\_EXIT1}{\param{}{func}, \param{}{p1}}
2831\func{}{wxON\_BLOCK\_EXIT2}{\param{}{func}, \param{}{p1}, \param{}{p2}}
2832
2833This family of macros allows to ensure that the global function \arg{func}
2834with 0, 1, 2 or more parameters (up to some implementaton-defined limit) is
2835executed on scope exit, whether due to a normal function return or because an
2836exception has been thrown. A typical example of its usage:
2837\begin{verbatim}
2838 void *buf = malloc(size);
2839 wxON_BLOCK_EXIT1(free, buf);
2840\end{verbatim}
2841
2842Please see the original article by Andrei Alexandrescu and Petru Marginean
2843published in December 2000 issue of \emph{C/C++ Users Journal} for more
2844details.
2845
2846\wxheading{Include files}
2847
2848<wx/scopeguard.h>
2849
2850\wxheading{See also}
2851
2852\helpref{wxON\_BLOCK\_EXIT\_OBJ}{wxonblockexitobj}
2853
2854
2855\membersection{wxON\_BLOCK\_EXIT\_OBJ}\label{wxonblockexitobj}
2856
2857\func{}{wxON\_BLOCK\_EXIT\_OBJ0}{\param{}{obj}, \param{}{method}}
2858\func{}{wxON\_BLOCK\_EXIT\_OBJ1}{\param{}{obj}, \param{}{method}, \param{}{p1}}
2859\func{}{wxON\_BLOCK\_EXIT\_OBJ2}{\param{}{obj}, \param{}{method}, \param{}{p1}, \param{}{p2}}
2860
ce045aed 2861This family of macros is similar to \helpref{wxON\_BLOCK\_EXIT}{wxonblockexit}
1a64b24d
VZ
2862but calls a method of the given object instead of a free function.
2863
2864\wxheading{Include files}
2865
2866<wx/scopeguard.h>
2867
2868
b0fc8832 2869\membersection{::wxRegisterId}\label{wxregisterid}
a660d684 2870
b0fc8832 2871\func{void}{wxRegisterId}{\param{long}{ id}}
a660d684 2872
b0fc8832
VZ
2873Ensures that ids subsequently generated by {\bf NewId} do not clash with
2874the given {\bf id}.
a660d684 2875
954b8ae6
JS
2876\wxheading{Include files}
2877
2878<wx/utils.h>
2879
84ed77ef 2880
b0fc8832 2881\membersection{::wxDDECleanUp}\label{wxddecleanup}
bdc72a22 2882
b0fc8832 2883\func{void}{wxDDECleanUp}{\void}
bdc72a22 2884
fc2171bd 2885Called when wxWidgets exits, to clean up the DDE system. This no longer needs to be
b0fc8832 2886called by the application.
bdc72a22 2887
b0fc8832 2888See also \helpref{wxDDEInitialize}{wxddeinitialize}.
bdc72a22
VZ
2889
2890\wxheading{Include files}
2891
b0fc8832 2892<wx/dde.h>
a660d684 2893
84ed77ef 2894
b0fc8832 2895\membersection{::wxDDEInitialize}\label{wxddeinitialize}
a660d684 2896
b0fc8832 2897\func{void}{wxDDEInitialize}{\void}
a660d684 2898
b0fc8832 2899Initializes the DDE system. May be called multiple times without harm.
a660d684 2900
b0fc8832 2901This no longer needs to be called by the application: it will be called
fc2171bd 2902by wxWidgets if necessary.
bdc72a22 2903
d2c2afc9 2904See also \helpref{wxDDEServer}{wxddeserver}, \helpref{wxDDEClient}{wxddeclient}, \helpref{wxDDEConnection}{wxddeconnection},\rtfsp
b0fc8832 2905\helpref{wxDDECleanUp}{wxddecleanup}.
bdc72a22 2906
954b8ae6
JS
2907\wxheading{Include files}
2908
b0fc8832 2909<wx/dde.h>
a660d684 2910
84ed77ef 2911
b0fc8832 2912\membersection{::wxEnableTopLevelWindows}\label{wxenabletoplevelwindows}
a660d684 2913
08890e27 2914\func{void}{wxEnableTopLevelWindows}{\param{bool}{ enable = true}}
a660d684 2915
b0fc8832
VZ
2916This function enables or disables all top level windows. It is used by
2917\helpref{::wxSafeYield}{wxsafeyield}.
a660d684 2918
954b8ae6
JS
2919\wxheading{Include files}
2920
2921<wx/utils.h>
2922
84ed77ef 2923
b0fc8832 2924\membersection{::wxFindMenuItemId}\label{wxfindmenuitemid}
a660d684 2925
b0fc8832 2926\func{int}{wxFindMenuItemId}{\param{wxFrame *}{frame}, \param{const wxString\& }{menuString}, \param{const wxString\& }{itemString}}
a660d684 2927
b0fc8832 2928Find a menu item identifier associated with the given frame's menu bar.
a660d684 2929
954b8ae6
JS
2930\wxheading{Include files}
2931
2932<wx/utils.h>
2933
84ed77ef 2934
b0fc8832 2935\membersection{::wxFindWindowByLabel}\label{wxfindwindowbylabel}
c51deffc 2936
b0fc8832 2937\func{wxWindow *}{wxFindWindowByLabel}{\param{const wxString\& }{label}, \param{wxWindow *}{parent=NULL}}
c51deffc 2938
b829bf55 2939{\bf NB:} This function is obsolete, please use
146ba0fe
VZ
2940\helpref{wxWindow::FindWindowByLabel}{wxwindowfindwindowbylabel} instead.
2941
b0fc8832
VZ
2942Find a window by its label. Depending on the type of window, the label may be a window title
2943or panel item label. If {\it parent} is NULL, the search will start from all top-level
2944frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.
2945The search is recursive in both cases.
c51deffc
VZ
2946
2947\wxheading{Include files}
2948
2949<wx/utils.h>
2950
84ed77ef 2951
b0fc8832
VZ
2952\membersection{::wxFindWindowByName}\label{wxfindwindowbyname}
2953
2954\func{wxWindow *}{wxFindWindowByName}{\param{const wxString\& }{name}, \param{wxWindow *}{parent=NULL}}
a660d684 2955
b829bf55 2956{\bf NB:} This function is obsolete, please use
146ba0fe
VZ
2957\helpref{wxWindow::FindWindowByName}{wxwindowfindwindowbyname} instead.
2958
b0fc8832
VZ
2959Find a window by its name (as given in a window constructor or {\bf Create} function call).
2960If {\it parent} is NULL, the search will start from all top-level
2961frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.
2962The search is recursive in both cases.
a660d684 2963
b0fc8832 2964If no such named window is found, {\bf wxFindWindowByLabel} is called.
a660d684 2965
954b8ae6
JS
2966\wxheading{Include files}
2967
2968<wx/utils.h>
2969
84ed77ef 2970
b0fc8832 2971\membersection{::wxFindWindowAtPoint}\label{wxfindwindowatpoint}
6787e41e 2972
b0fc8832 2973\func{wxWindow *}{wxFindWindowAtPoint}{\param{const wxPoint\& }{pt}}
6787e41e 2974
b0fc8832
VZ
2975Find the deepest window at the given mouse position in screen coordinates,
2976returning the window if found, or NULL if not.
4d01e583 2977
84ed77ef 2978
b0fc8832 2979\membersection{::wxFindWindowAtPointer}\label{wxfindwindowatpointer}
4d01e583 2980
b0fc8832 2981\func{wxWindow *}{wxFindWindowAtPointer}{\param{wxPoint\& }{pt}}
4d01e583 2982
b0fc8832
VZ
2983Find the deepest window at the mouse pointer position, returning the window
2984and current pointer position in screen coordinates.
4d01e583 2985
84ed77ef 2986
b0fc8832 2987\membersection{::wxGetActiveWindow}\label{wxgetactivewindow}
4d01e583 2988
b0fc8832 2989\func{wxWindow *}{wxGetActiveWindow}{\void}
4d01e583 2990
33de8c70
VZ
2991Gets the currently active window (implemented for MSW and GTK only currently,
2992always returns \NULL in the other ports).
4d01e583 2993
b0fc8832 2994\wxheading{Include files}
4d01e583 2995
b0fc8832 2996<wx/windows.h>
4d01e583 2997
84ed77ef 2998
8ea92b4d
WS
2999\membersection{::wxGetBatteryState}\label{wxgetbatterystate}
3000
3001\func{wxBatteryState}{wxGetBatteryState}{\void}
3002
bb772a8e
RN
3003Returns battery state as one of \texttt{wxBATTERY\_NORMAL\_STATE},
3004\texttt{wxBATTERY\_LOW\_STATE}, \texttt{wxBATTERY\_CRITICAL\_STATE},
3005\texttt{wxBATTERY\_SHUTDOWN\_STATE} or \texttt{wxBATTERY\_UNKNOWN\_STATE}.
3006\texttt{wxBATTERY\_UNKNOWN\_STATE} is also the default on platforms where
3032b7b5 3007this feature is not implemented (currently everywhere but MS Windows).
8ea92b4d
WS
3008
3009\wxheading{Include files}
3010
3011<wx/utils.h>
3012
3013
b0fc8832 3014\membersection{::wxGetDisplayName}\label{wxgetdisplayname}
4d01e583 3015
b0fc8832 3016\func{wxString}{wxGetDisplayName}{\void}
4d01e583 3017
b0fc8832 3018Under X only, returns the current display name. See also \helpref{wxSetDisplayName}{wxsetdisplayname}.
4d01e583
VZ
3019
3020\wxheading{Include files}
3021
b0fc8832 3022<wx/utils.h>
4d01e583 3023
84ed77ef 3024
8ea92b4d
WS
3025\membersection{::wxGetPowerType}\label{wxgetpowertype}
3026
3027\func{wxPowerType}{wxGetPowerType}{\void}
3028
bb772a8e
RN
3029Returns the type of power source as one of \texttt{wxPOWER\_SOCKET},
3030\texttt{wxPOWER\_BATTERY} or \texttt{wxPOWER\_UNKNOWN}.
3031\texttt{wxPOWER\_UNKNOWN} is also the default on platforms where this
3032b7b5 3032feature is not implemented (currently everywhere but MS Windows).
8ea92b4d
WS
3033
3034\wxheading{Include files}
3035
3036<wx/utils.h>
3037
3038
b0fc8832 3039\membersection{::wxGetMousePosition}\label{wxgetmouseposition}
4d01e583 3040
b0fc8832 3041\func{wxPoint}{wxGetMousePosition}{\void}
4d01e583 3042
b0fc8832 3043Returns the mouse position in screen coordinates.
4d01e583
VZ
3044
3045\wxheading{Include files}
3046
3047<wx/utils.h>
3048
84ed77ef 3049
7dd40b6f
RD
3050\membersection{::wxGetMouseState}\label{wxgetmousestate}
3051
3052\func{wxMouseState}{wxGetMouseState}{\void}
3053
3054Returns the current state of the mouse. Returns a wxMouseState
3055instance that contains the current position of the mouse pointer in
3056screen coordinants, as well as boolean values indicating the up/down
3057status of the mouse buttons and the modifier keys.
3058
3059\wxheading{Include files}
3060
3061<wx/utils.h>
3062
3063wxMouseState has the following interface:
3064
3065\begin{verbatim}
3066class wxMouseState
3067{
3068public:
3069 wxMouseState();
3070
3071 wxCoord GetX();
3072 wxCoord GetY();
3073
3074 bool LeftDown();
3075 bool MiddleDown();
3076 bool RightDown();
3077
3078 bool ControlDown();
3079 bool ShiftDown();
3080 bool AltDown();
3081 bool MetaDown();
3082 bool CmdDown();
3083
3084 void SetX(wxCoord x);
3085 void SetY(wxCoord y);
3086
3087 void SetLeftDown(bool down);
3088 void SetMiddleDown(bool down);
3089 void SetRightDown(bool down);
e0c8d2d9 3090
7dd40b6f
RD
3091 void SetControlDown(bool down);
3092 void SetShiftDown(bool down);
3093 void SetAltDown(bool down);
3094 void SetMetaDown(bool down);
3095};
3096\end{verbatim}
3097
3098
b0fc8832 3099\membersection{::wxGetResource}\label{wxgetresource}
a660d684 3100
b0fc8832
VZ
3101\func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
3102 \param{const wxString\& *}{value}, \param{const wxString\& }{file = NULL}}
a660d684 3103
b0fc8832
VZ
3104\func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
3105 \param{float *}{value}, \param{const wxString\& }{file = NULL}}
a660d684 3106
b0fc8832
VZ
3107\func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
3108 \param{long *}{value}, \param{const wxString\& }{file = NULL}}
50567b69 3109
b0fc8832
VZ
3110\func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
3111 \param{int *}{value}, \param{const wxString\& }{file = NULL}}
50567b69 3112
b0fc8832
VZ
3113Gets a resource value from the resource database (for example, WIN.INI, or
3114.Xdefaults). If {\it file} is NULL, WIN.INI or .Xdefaults is used,
3115otherwise the specified file is used.
50567b69 3116
b0fc8832
VZ
3117Under X, if an application class (wxApp::GetClassName) has been defined,
3118it is appended to the string /usr/lib/X11/app-defaults/ to try to find
3119an applications default file when merging all resource databases.
50567b69 3120
b0fc8832
VZ
3121The reason for passing the result in an argument is that it
3122can be convenient to define a default value, which gets overridden
3123if the value exists in the resource file. It saves a separate
3124test for that resource's existence, and it also allows
3125the overloading of the function for different types.
50567b69 3126
b0fc8832 3127See also \helpref{wxWriteResource}{wxwriteresource}, \helpref{wxConfigBase}{wxconfigbase}.
a660d684 3128
954b8ae6 3129\wxheading{Include files}
a660d684 3130
954b8ae6 3131<wx/utils.h>
a660d684 3132
84ed77ef 3133
634629fa
WS
3134\membersection{::wxGetStockLabel}\label{wxgetstocklabel}
3135
fbfb8bcc 3136\func{wxString}{wxGetStockLabel}{\param{wxWindowID }{id}, \param{bool }{withCodes = true}, \param{const wxString\& }{accelerator = wxEmptyString}}
634629fa
WS
3137
3138Returns label that should be used for given {\it id} element.
3139
3140\wxheading{Parameters}
3141
3142\docparam{id}{given id of the \helpref{wxMenuItem}{wxmenuitem}, \helpref{wxButton}{wxbutton}, \helpref{wxToolBar}{wxtoolbar} tool, etc.}
3143
3144\docparam{withCodes}{if false then strip accelerator code from the label;
3145usefull for getting labels without accelerator char code like for toolbar tooltip or
3146under platforms without traditional keyboard like smartphones}
3147
3148\docparam{accelerator}{optional accelerator string automatically added to label; useful
3149for building labels for \helpref{wxMenuItem}{wxmenuitem}}
3150
3151\wxheading{Include files}
3152
3153<wx/stockitem.h>
3154
3155
33b494d6
VZ
3156\membersection{::wxGetTopLevelParent}\label{wxgettoplevelparent}
3157
3158\func{wxWindow *}{wxGetTopLevelParent}{\param{wxWindow }{*win}}
3159
3160Returns the first top level parent of the given window, or in other words, the
3161frame or dialog containing it, or {\tt NULL}.
3162
3163\wxheading{Include files}
3164
3165<wx/window.h>
3166
84ed77ef 3167
498a1eeb
RN
3168\membersection{::wxLaunchDefaultBrowser}\label{wxlaunchdefaultbrowser}
3169
42d0df00 3170\func{bool}{wxLaunchDefaultBrowser}{\param{const wxString\& }{url}, \param{int }{flags = $0$}}
498a1eeb 3171
ce045aed 3172Open the \arg{url} in user's default browser. If \arg{flags} parameter contains
42d0df00
VZ
3173\texttt{wxBROWSER\_NEW\_WINDOW} flag, a new window is opened for the URL
3174(currently this is only supported under Windows).
498a1eeb 3175
42d0df00 3176Returns \true if the application was successfully launched.
498a1eeb
RN
3177
3178\wxheading{Include files}
3179
3180<wx/utils.h>
3181
42d0df00 3182
a660d684
KB
3183\membersection{::wxLoadUserResource}\label{wxloaduserresource}
3184
3185\func{wxString}{wxLoadUserResource}{\param{const wxString\& }{resourceName}, \param{const wxString\& }{resourceType=``TEXT"}}
3186
3187Loads a user-defined Windows resource as a string. If the resource is found, the function creates
3188a new character array and copies the data into it. A pointer to this data is returned. If unsuccessful, NULL is returned.
3189
3190The resource must be defined in the {\tt .rc} file using the following syntax:
3191
3192\begin{verbatim}
3193myResource TEXT file.ext
3194\end{verbatim}
3195
3196where {\tt file.ext} is a file that the resource compiler can find.
3197
a660d684
KB
3198This function is available under Windows only.
3199
954b8ae6
JS
3200\wxheading{Include files}
3201
3202<wx/utils.h>
3203
84ed77ef 3204
a660d684
KB
3205\membersection{::wxPostDelete}\label{wxpostdelete}
3206
3207\func{void}{wxPostDelete}{\param{wxObject *}{object}}
3208
954b8ae6 3209Tells the system to delete the specified object when
a660d684
KB
3210all other events have been processed. In some environments, it is
3211necessary to use this instead of deleting a frame directly with the
954b8ae6 3212delete operator, because some GUIs will still send events to a deleted window.
a660d684
KB
3213
3214Now obsolete: use \helpref{wxWindow::Close}{wxwindowclose} instead.
3215
954b8ae6
JS
3216\wxheading{Include files}
3217
3218<wx/utils.h>
3219
84ed77ef 3220
8e193f38
VZ
3221\membersection{::wxPostEvent}\label{wxpostevent}
3222
3223\func{void}{wxPostEvent}{\param{wxEvtHandler *}{dest}, \param{wxEvent\& }{event}}
3224
9a9e73f6
RR
3225In a GUI application, this function posts {\it event} to the specified {\it dest}
3226object using \helpref{wxEvtHandler::AddPendingEvent}{wxevthandleraddpendingevent}.
3227Otherwise, it dispatches {\it event} immediately using
3228\helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent}.
3229See the respective documentation for details (and caveats).
8e193f38
VZ
3230
3231\wxheading{Include files}
3232
3233<wx/app.h>
3234
84ed77ef 3235
a660d684
KB
3236\membersection{::wxSetDisplayName}\label{wxsetdisplayname}
3237
3238\func{void}{wxSetDisplayName}{\param{const wxString\& }{displayName}}
3239
3240Under X only, sets the current display name. This is the X host and display name such
3241as ``colonsay:0.0", and the function indicates which display should be used for creating
3242windows from this point on. Setting the display within an application allows multiple
3243displays to be used.
3244
3245See also \helpref{wxGetDisplayName}{wxgetdisplayname}.
3246
954b8ae6
JS
3247\wxheading{Include files}
3248
3249<wx/utils.h>
3250
84ed77ef 3251
b0fc8832 3252\membersection{::wxStripMenuCodes}\label{wxstripmenucodes}
a660d684 3253
74639764 3254\func{wxString}{wxStripMenuCodes}{\param{const wxString\& }{str}, \param{int }{flags = wxStrip\_All}}
8a2c6ef8 3255
74639764 3256Strips any menu codes from \arg{str} and returns the result.
a660d684 3257
74639764
VZ
3258By default, the functions strips both the mnemonics character (\texttt{'\&'})
3259which is used to indicate a keyboard shortkey, and the accelerators, which are
3260used only in the menu items and are separated from the main text by the
3261\texttt{$\backslash$t} (TAB) character. By using \arg{flags} of
3262\texttt{wxStrip\_Mnemonics} or \texttt{wxStrip\_Accel} to strip only the former
3263or the latter part, respectively.
8a2c6ef8 3264
8bb6b2c0
VZ
3265Notice that in most cases
3266\helpref{wxMenuItem::GetLabelFromText}{wxmenuitemgetlabelfromtext} or
74639764 3267\helpref{wxControl::GetLabelText}{wxcontrolgetlabeltext} can be used instead.
a660d684 3268
954b8ae6
JS
3269\wxheading{Include files}
3270
3271<wx/utils.h>
3272
84ed77ef 3273
7261746a 3274\membersection{wxSUPPRESS\_GCC\_PRIVATE\_DTOR\_WARNING}\label{wxsuppressgccprivatedtorwarning}
b47f1f95
VZ
3275
3276\func{}{wxSUPPRESS\_GCC\_PRIVATE\_DTOR\_WARNING}{\param{}{name}}
3277
3278GNU C++ compiler gives a warning for any class whose destructor is private
3279unless it has a friend. This warning may sometimes be useful but it doesn't
3280make sense for reference counted class which always delete themselves (hence
3281destructor should be private) but don't necessarily have any friends, so this
3282macro is provided to disable the warning in such case. The \arg{name} parameter
3283should be the name of the class but is only used to construct a unique friend
3284class name internally. Example of using the macro:
3285
3286\begin{verbatim}
3287 class RefCounted
3288 {
3289 public:
3290 RefCounted() { m_nRef = 1; }
3291 void IncRef() { m_nRef++ ; }
3292 void DecRef() { if ( !--m_nRef ) delete this; }
3293
3294 private:
3295 ~RefCounted() { }
3296
3297 wxSUPPRESS_GCC_PRIVATE_DTOR(RefCounted)
3298 };
3299\end{verbatim}
3300
3301Notice that there should be no semicolon after this macro.
3302
3303
84ed77ef
VZ
3304\membersection{wxULL}\label{wxull}
3305
3306\func{wxLongLong\_t}{wxULL}{\param{}{number}}
3307
3308This macro is defined for the platforms with a native 64 bit integer type and
3309allows to define unsigned 64 bit compile time constants:
3310
3311\begin{verbatim}
3312 #ifdef wxLongLong_t
3313 unsigned wxLongLong_t ll = wxULL(0x1234567890abcdef);
3314 #endif
3315\end{verbatim}
3316
3317\wxheading{Include files}
3318
3319<wx/longlong.h>
3320
3321\wxheading{See also}
3322
3323\helpref{wxLL}{wxll}, \helpref{wxLongLong}{wxlonglong}
3324
3325
d85cfb37
VZ
3326\membersection{wxVaCopy}\label{wxvacopy}
3327
e7dfcb8e 3328\func{void}{wxVaCopy}{\param{va\_list }{argptrDst}, \param{va\_list}{ argptrSrc}}
d85cfb37
VZ
3329
3330This macro is the same as the standard C99 \texttt{va\_copy} for the compilers
3331which support it or its replacement for those that don't. It must be used to
3332preserve the value of a \texttt{va\_list} object if you need to use it after
3333passing it to another function because it can be modified by the latter.
3334
8ea92b4d 3335As with \texttt{va\_start}, each call to \texttt{wxVaCopy} must have a matching
d85cfb37
VZ
3336\texttt{va\_end}.
3337
3338
a660d684
KB
3339\membersection{::wxWriteResource}\label{wxwriteresource}
3340
3341\func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
3342 \param{const wxString\& }{value}, \param{const wxString\& }{file = NULL}}
3343
3344\func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
3345 \param{float }{value}, \param{const wxString\& }{file = NULL}}
3346
3347\func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
3348 \param{long }{value}, \param{const wxString\& }{file = NULL}}
3349
3350\func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
3351 \param{int }{value}, \param{const wxString\& }{file = NULL}}
3352
3353Writes a resource value into the resource database (for example, WIN.INI, or
3354.Xdefaults). If {\it file} is NULL, WIN.INI or .Xdefaults is used,
3355otherwise the specified file is used.
3356
3357Under X, the resource databases are cached until the internal function
b0fc8832
VZ
3358\rtfsp{\bf wxFlushResources} is called automatically on exit, when
3359all updated resource databases are written to their files.
8a293590 3360
b0fc8832
VZ
3361Note that it is considered bad manners to write to the .Xdefaults
3362file under Unix, although the WIN.INI file is fair game under Windows.
8a293590 3363
b0fc8832 3364See also \helpref{wxGetResource}{wxgetresource}, \helpref{wxConfigBase}{wxconfigbase}.
8a293590
RR
3365
3366\wxheading{Include files}
3367
b0fc8832 3368<wx/utils.h>
8a293590 3369
84ed77ef 3370
fd05688e
VZ
3371\membersection{\_\_WXFUNCTION\_\_}\label{wxfunction}
3372
3373\func{}{\_\_WXFUNCTION\_\_}{\void}
3374
3375This macro expands to the name of the current function if the compiler supports
3376any of \texttt{\_\_FUNCTION\_\_}, \texttt{\_\_func\_\_} or equivalent variables
3377or macros or to \NULL if none of them is available.
3378
3379
84ed77ef 3380
81c9effa 3381\section{Byte order macros}\label{byteordermacros}
a660d684 3382
b0fc8832
VZ
3383The endian-ness issues (that is the difference between big-endian and
3384little-endian architectures) are important for the portable programs working
3385with the external binary data (for example, data files or data coming from
3386network) which is usually in some fixed, platform-independent format. The
3387macros are helpful for transforming the data to the correct format.
a660d684 3388
84ed77ef 3389
0180dad6
RR
3390\membersection{wxINTXX\_SWAP\_ALWAYS}\label{intswapalways}
3391
3392\func{wxInt32}{wxINT32\_SWAP\_ALWAYS}{\param{wxInt32 }{value}}
3393
3394\func{wxUint32}{wxUINT32\_SWAP\_ALWAYS}{\param{wxUint32 }{value}}
3395
3396\func{wxInt16}{wxINT16\_SWAP\_ALWAYS}{\param{wxInt16 }{value}}
3397
3398\func{wxUint16}{wxUINT16\_SWAP\_ALWAYS}{\param{wxUint16 }{value}}
3399
b0fc8832
VZ
3400These macros will swap the bytes of the {\it value} variable from little
3401endian to big endian or vice versa unconditionally, i.e. independently of the
3402current platform.
0180dad6 3403
84ed77ef 3404
0180dad6
RR
3405\membersection{wxINTXX\_SWAP\_ON\_BE}\label{intswaponbe}
3406
3407\func{wxInt32}{wxINT32\_SWAP\_ON\_BE}{\param{wxInt32 }{value}}
3408
3409\func{wxUint32}{wxUINT32\_SWAP\_ON\_BE}{\param{wxUint32 }{value}}
3410
3411\func{wxInt16}{wxINT16\_SWAP\_ON\_BE}{\param{wxInt16 }{value}}
3412
3413\func{wxUint16}{wxUINT16\_SWAP\_ON\_BE}{\param{wxUint16 }{value}}
3414
3415This macro will swap the bytes of the {\it value} variable from little
3416endian to big endian or vice versa if the program is compiled on a
ec5d7799 3417big-endian architecture (such as Sun work stations). If the program has
0180dad6
RR
3418been compiled on a little-endian architecture, the value will be unchanged.
3419
ec5d7799 3420Use these macros to read data from and write data to a file that stores
b0fc8832 3421data in little-endian (for example Intel i386) format.
0180dad6 3422
84ed77ef 3423
0180dad6
RR
3424\membersection{wxINTXX\_SWAP\_ON\_LE}\label{intswaponle}
3425
3426\func{wxInt32}{wxINT32\_SWAP\_ON\_LE}{\param{wxInt32 }{value}}
3427
3428\func{wxUint32}{wxUINT32\_SWAP\_ON\_LE}{\param{wxUint32 }{value}}
3429
3430\func{wxInt16}{wxINT16\_SWAP\_ON\_LE}{\param{wxInt16 }{value}}
3431
3432\func{wxUint16}{wxUINT16\_SWAP\_ON\_LE}{\param{wxUint16 }{value}}
3433
3434This macro will swap the bytes of the {\it value} variable from little
3435endian to big endian or vice versa if the program is compiled on a
ec5d7799 3436little-endian architecture (such as Intel PCs). If the program has
0180dad6
RR
3437been compiled on a big-endian architecture, the value will be unchanged.
3438
ec5d7799 3439Use these macros to read data from and write data to a file that stores
b0fc8832
VZ
3440data in big-endian format.
3441
84ed77ef
VZ
3442
3443
f4fcc291 3444\section{RTTI functions}\label{rttimacros}
b0fc8832 3445
fc2171bd 3446wxWidgets uses its own RTTI ("run-time type identification") system which
b0fc8832 3447predates the current standard C++ RTTI and so is kept for backwards
2edb0bde 3448compatibility reasons but also because it allows some things which the
b0fc8832
VZ
3449standard RTTI doesn't directly support (such as creating a class from its
3450name).
3451
3452The standard C++ RTTI can be used in the user code without any problems and in
3453general you shouldn't need to use the functions and the macros in this section
fc2171bd 3454unless you are thinking of modifying or adding any wxWidgets classes.
b0fc8832
VZ
3455
3456\wxheading{See also}
3457
3458\helpref{RTTI overview}{runtimeclassoverview}
0180dad6 3459
84ed77ef 3460
a660d684
KB
3461\membersection{CLASSINFO}\label{classinfo}
3462
3463\func{wxClassInfo *}{CLASSINFO}{className}
3464
3465Returns a pointer to the wxClassInfo object associated with this class.
3466
954b8ae6
JS
3467\wxheading{Include files}
3468
3469<wx/object.h>
3470
84ed77ef 3471
b0fc8832 3472\membersection{DECLARE\_ABSTRACT\_CLASS}\label{declareabstractclass}
a660d684
KB
3473
3474\func{}{DECLARE\_ABSTRACT\_CLASS}{className}
3475
3476Used inside a class declaration to declare that the class should be
3477made known to the class hierarchy, but objects of this class cannot be created
3478dynamically. The same as DECLARE\_CLASS.
3479
3480Example:
3481
3482\begin{verbatim}
3483class wxCommand: public wxObject
3484{
3485 DECLARE_ABSTRACT_CLASS(wxCommand)
3486
3487 private:
3488 ...
3489 public:
3490 ...
3491};
3492\end{verbatim}
3493
954b8ae6
JS
3494\wxheading{Include files}
3495
3496<wx/object.h>
3497
84ed77ef 3498
a660d684
KB
3499\membersection{DECLARE\_APP}\label{declareapp}
3500
3501\func{}{DECLARE\_APP}{className}
3502
8ea92b4d
WS
3503This is used in headers to create a forward declaration of the
3504\helpref{wxGetApp}{wxgetapp} function implemented by
3505\helpref{IMPLEMENT\_APP}{implementapp}. It creates the declaration
749caeeb 3506{\tt className\& wxGetApp(void)}.
a660d684
KB
3507
3508Example:
3509
3510\begin{verbatim}
3511 DECLARE_APP(MyApp)
3512\end{verbatim}
3513
954b8ae6
JS
3514\wxheading{Include files}
3515
3516<wx/app.h>
3517
84ed77ef 3518
b0fc8832 3519\membersection{DECLARE\_CLASS}\label{declareclass}
a660d684
KB
3520
3521\func{}{DECLARE\_CLASS}{className}
3522
3523Used inside a class declaration to declare that the class should be
3524made known to the class hierarchy, but objects of this class cannot be created
3525dynamically. The same as DECLARE\_ABSTRACT\_CLASS.
3526
954b8ae6
JS
3527\wxheading{Include files}
3528
3529<wx/object.h>
3530
84ed77ef 3531
b0fc8832 3532\membersection{DECLARE\_DYNAMIC\_CLASS}\label{declaredynamicclass}
a660d684
KB
3533
3534\func{}{DECLARE\_DYNAMIC\_CLASS}{className}
3535
f3886d37
VZ
3536Used inside a class declaration to make the class known to wxWidgets RTTI
3537system and also declare that the objects of this class should be dynamically
3538creatable from run-time type information. Notice that this implies that the
ce045aed 3539class should have a default constructor, if this is not the case consider using
f3886d37 3540\helpref{DECLARE\_CLASS}{declareclass}.
a660d684
KB
3541
3542Example:
3543
3544\begin{verbatim}
3545class wxFrame: public wxWindow
3546{
3547 DECLARE_DYNAMIC_CLASS(wxFrame)
3548
3549 private:
2b5f62a0 3550 const wxString& frameTitle;
a660d684
KB
3551 public:
3552 ...
3553};
3554\end{verbatim}
3555
954b8ae6
JS
3556\wxheading{Include files}
3557
3558<wx/object.h>
3559
84ed77ef 3560
b0fc8832 3561\membersection{IMPLEMENT\_ABSTRACT\_CLASS}\label{implementabstractclass}
a660d684
KB
3562
3563\func{}{IMPLEMENT\_ABSTRACT\_CLASS}{className, baseClassName}
3564
3565Used in a C++ implementation file to complete the declaration of
3566a class that has run-time type information. The same as IMPLEMENT\_CLASS.
3567
3568Example:
3569
3570\begin{verbatim}
3571IMPLEMENT_ABSTRACT_CLASS(wxCommand, wxObject)
3572
3573wxCommand::wxCommand(void)
3574{
3575...
3576}
3577\end{verbatim}
3578
954b8ae6
JS
3579\wxheading{Include files}
3580
3581<wx/object.h>
3582
84ed77ef 3583
b0fc8832 3584\membersection{IMPLEMENT\_ABSTRACT\_CLASS2}\label{implementabstractclass2}
a660d684
KB
3585
3586\func{}{IMPLEMENT\_ABSTRACT\_CLASS2}{className, baseClassName1, baseClassName2}
3587
3588Used in a C++ implementation file to complete the declaration of
3589a class that has run-time type information and two base classes. The same as IMPLEMENT\_CLASS2.
3590
954b8ae6
JS
3591\wxheading{Include files}
3592
3593<wx/object.h>
3594
84ed77ef 3595
a660d684
KB
3596\membersection{IMPLEMENT\_APP}\label{implementapp}
3597
3598\func{}{IMPLEMENT\_APP}{className}
3599
3600This is used in the application class implementation file to make the application class known to
fc2171bd 3601wxWidgets for dynamic construction. You use this instead of
a660d684
KB
3602
3603Old form:
3604
3605\begin{verbatim}
3606 MyApp myApp;
3607\end{verbatim}
3608
3609New form:
3610
3611\begin{verbatim}
3612 IMPLEMENT_APP(MyApp)
3613\end{verbatim}
3614
3615See also \helpref{DECLARE\_APP}{declareapp}.
3616
954b8ae6
JS
3617\wxheading{Include files}
3618
3619<wx/app.h>
3620
84ed77ef 3621
b0fc8832 3622\membersection{IMPLEMENT\_CLASS}\label{implementclass}
a660d684
KB
3623
3624\func{}{IMPLEMENT\_CLASS}{className, baseClassName}
3625
3626Used in a C++ implementation file to complete the declaration of
3627a class that has run-time type information. The same as IMPLEMENT\_ABSTRACT\_CLASS.
3628
954b8ae6
JS
3629\wxheading{Include files}
3630
3631<wx/object.h>
3632
84ed77ef 3633
b0fc8832 3634\membersection{IMPLEMENT\_CLASS2}\label{implementclass2}
a660d684
KB
3635
3636\func{}{IMPLEMENT\_CLASS2}{className, baseClassName1, baseClassName2}
3637
3638Used in a C++ implementation file to complete the declaration of a
3639class that has run-time type information and two base classes. The
3640same as IMPLEMENT\_ABSTRACT\_CLASS2.
3641
954b8ae6
JS
3642\wxheading{Include files}
3643
3644<wx/object.h>
3645
84ed77ef 3646
b0fc8832 3647\membersection{IMPLEMENT\_DYNAMIC\_CLASS}\label{implementdynamicclass}
a660d684
KB
3648
3649\func{}{IMPLEMENT\_DYNAMIC\_CLASS}{className, baseClassName}
3650
3651Used in a C++ implementation file to complete the declaration of
3652a class that has run-time type information, and whose instances
3653can be created dynamically.
3654
3655Example:
3656
3657\begin{verbatim}
3658IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
3659
3660wxFrame::wxFrame(void)
3661{
3662...
3663}
3664\end{verbatim}
3665
954b8ae6
JS
3666\wxheading{Include files}
3667
3668<wx/object.h>
3669
84ed77ef 3670
b0fc8832 3671\membersection{IMPLEMENT\_DYNAMIC\_CLASS2}\label{implementdynamicclass2}
a660d684
KB
3672
3673\func{}{IMPLEMENT\_DYNAMIC\_CLASS2}{className, baseClassName1, baseClassName2}
3674
3675Used in a C++ implementation file to complete the declaration of
3676a class that has run-time type information, and whose instances
3677can be created dynamically. Use this for classes derived from two
3678base classes.
3679
954b8ae6
JS
3680\wxheading{Include files}
3681
3682<wx/object.h>
3683
84ed77ef 3684
f6bcfd97
BP
3685\membersection{wxConstCast}\label{wxconstcast}
3686
f7637829 3687\func{classname *}{wxConstCast}{ptr, classname}
f6bcfd97
BP
3688
3689This macro expands into {\tt const\_cast<classname *>(ptr)} if the compiler
3690supports {\it const\_cast} or into an old, C-style cast, otherwise.
3691
3692\wxheading{See also}
3693
f29fe169 3694\helpref{wx\_const\_cast}{wxconstcastraw}\\
f6bcfd97
BP
3695\helpref{wxDynamicCast}{wxdynamiccast}\\
3696\helpref{wxStaticCast}{wxstaticcast}
3697
84ed77ef 3698
b0fc8832
VZ
3699\membersection{::wxCreateDynamicObject}\label{wxcreatedynamicobject}
3700
3701\func{wxObject *}{wxCreateDynamicObject}{\param{const wxString\& }{className}}
3702
3703Creates and returns an object of the given class, if the class has been
3704registered with the dynamic class system using DECLARE... and IMPLEMENT... macros.
3705
84ed77ef 3706
34636400
VZ
3707\membersection{WXDEBUG\_NEW}\label{debugnew}
3708
3709\func{}{WXDEBUG\_NEW}{arg}
3710
3711This is defined in debug mode to be call the redefined new operator
3712with filename and line number arguments. The definition is:
3713
3714\begin{verbatim}
3715#define WXDEBUG_NEW new(__FILE__,__LINE__)
3716\end{verbatim}
3717
3718In non-debug mode, this is defined as the normal new operator.
3719
3720\wxheading{Include files}
3721
3722<wx/object.h>
3723
84ed77ef 3724
34636400
VZ
3725\membersection{wxDynamicCast}\label{wxdynamiccast}
3726
f7637829 3727\func{classname *}{wxDynamicCast}{ptr, classname}
34636400
VZ
3728
3729This macro returns the pointer {\it ptr} cast to the type {\it classname *} if
8a7f3379 3730the pointer is of this type (the check is done during the run-time) or
f7637829
VZ
3731{\tt NULL} otherwise. Usage of this macro is preferred over obsoleted
3732wxObject::IsKindOf() function.
34636400 3733
f7637829
VZ
3734The {\it ptr} argument may be {\tt NULL}, in which case {\tt NULL} will be
3735returned.
34636400
VZ
3736
3737Example:
3738
3739\begin{verbatim}
3740 wxWindow *win = wxWindow::FindFocus();
3741 wxTextCtrl *text = wxDynamicCast(win, wxTextCtrl);
3742 if ( text )
3743 {
3744 // a text control has the focus...
3745 }
3746 else
3747 {
f6bcfd97 3748 // no window has the focus or it is not a text control
34636400
VZ
3749 }
3750\end{verbatim}
3751
3752\wxheading{See also}
3753
f6bcfd97 3754\helpref{RTTI overview}{runtimeclassoverview}\\
f7637829 3755\helpref{wxDynamicCastThis}{wxdynamiccastthis}\\
f6bcfd97 3756\helpref{wxConstCast}{wxconstcast}\\
330be534 3757\helpref{wxStaticCast}{wxstaticcast}
34636400 3758
84ed77ef 3759
f7637829
VZ
3760\membersection{wxDynamicCastThis}\label{wxdynamiccastthis}
3761
3762\func{classname *}{wxDynamicCastThis}{classname}
3763
3764This macro is equivalent to {\tt wxDynamicCast(this, classname)} but the
3765latter provokes spurious compilation warnings from some compilers (because it
154b6b0f 3766tests whether {\tt this} pointer is non-{\tt NULL} which is always true), so
f7637829
VZ
3767this macro should be used to avoid them.
3768
3769\wxheading{See also}
3770
3771\helpref{wxDynamicCast}{wxdynamiccast}
3772
84ed77ef 3773
f6bcfd97
BP
3774\membersection{wxStaticCast}\label{wxstaticcast}
3775
f7637829 3776\func{classname *}{wxStaticCast}{ptr, classname}
f6bcfd97
BP
3777
3778This macro checks that the cast is valid in debug mode (an assert failure will
3779result if {\tt wxDynamicCast(ptr, classname) == NULL}) and then returns the
3780result of executing an equivalent of {\tt static\_cast<classname *>(ptr)}.
3781
f29fe169
VZ
3782\wxheading{See also}
3783
3784\helpref{wx\_static\_cast}{wxstaticcastraw}\\
f6bcfd97
BP
3785\helpref{wxDynamicCast}{wxdynamiccast}\\
3786\helpref{wxConstCast}{wxconstcast}
3787
84ed77ef 3788
f29fe169
VZ
3789\membersection{wx\_const\_cast}\label{wxconstcastraw}
3790
3791\func{T}{wx\_const\_cast}{T, x}
3792
8ea92b4d 3793Same as \texttt{const\_cast<T>(x)} if the compiler supports const cast or
f29fe169
VZ
3794\texttt{(T)x} for old compilers. Unlike \helpref{wxConstCast}{wxconstcast},
3795the cast it to the type \arg{T} and not to \texttt{T *} and also the order of
3796arguments is the same as for the standard cast.
3797
3798\wxheading{See also}
3799
8c8d66c5
VZ
3800\helpref{wx\_reinterpret\_cast}{wxreinterpretcastraw},\\
3801\helpref{wx\_static\_cast}{wxstaticcastraw}
3802
3803
3804\membersection{wx\_reinterpret\_cast}\label{wxreinterpretcastraw}
3805
3806\func{T}{wx\_reinterpret\_cast}{T, x}
3807
8ea92b4d 3808Same as \texttt{reinterpret\_cast<T>(x)} if the compiler supports reinterpret cast or
8c8d66c5
VZ
3809\texttt{(T)x} for old compilers.
3810
3811\wxheading{See also}
3812
3813\helpref{wx\_const\_cast}{wxconstcastraw},\\
3814\helpref{wx\_static\_cast}{wxstaticcastraw}
f29fe169
VZ
3815
3816
3817\membersection{wx\_static\_cast}\label{wxstaticcastraw}
3818
3819\func{T}{wx\_static\_cast}{T, x}
3820
8ea92b4d 3821Same as \texttt{static\_cast<T>(x)} if the compiler supports static cast or
f29fe169
VZ
3822\texttt{(T)x} for old compilers. Unlike \helpref{wxStaticCast}{wxstaticcast},
3823there are no checks being done and the meaning of the macro arguments is exactly
3824the same as for the standard static cast, i.e. \arg{T} is the full type name and
3825star is not appended to it.
3826
3827\wxheading{See also}
3828
8c8d66c5 3829\helpref{wx\_const\_cast}{wxconstcastraw},\\
e6b2a3b3
VZ
3830\helpref{wx\_reinterpret\_cast}{wxreinterpretcastraw},\\
3831\helpref{wx\_truncate\_cast}{wxtruncatecast}
3832
3833
3834\membersection{wx\_truncate\_cast}\label{wxtruncatecast}
3835
3836\func{T}{wx\_truncate\_cast}{T, x}
f29fe169 3837
e6b2a3b3
VZ
3838This case doesn't correspond to any standard cast but exists solely to make
3839casts which possibly result in a truncation of an integer value more readable.
3840
3841\wxheading{See also}
3842
3843\helpref{wx\_static\_cast}{wxstaticcastraw}
f29fe169 3844
84ed77ef 3845
6fb26ea3
JS
3846\section{Log functions}\label{logfunctions}
3847
3848These functions provide a variety of logging functions: see \helpref{Log classes overview}{wxlogoverview} for
f68586e5
VZ
3849further information. The functions use (implicitly) the currently active log
3850target, so their descriptions here may not apply if the log target is not the
fc2171bd 3851standard one (installed by wxWidgets in the beginning of the program).
6fb26ea3 3852
954b8ae6
JS
3853\wxheading{Include files}
3854
3855<wx/log.h>
3856
84ed77ef 3857
b0fc8832
VZ
3858\membersection{::wxDebugMsg}\label{wxdebugmsg}
3859
3860\func{void}{wxDebugMsg}{\param{const wxString\& }{fmt}, \param{...}{}}
3861
2bd25c5a
VZ
3862{\bf NB:} This function is now obsolete, replaced by \helpref{Log
3863functions}{logfunctions} and \helpref{wxLogDebug}{wxlogdebug} in particular.
b0fc8832
VZ
3864
3865Display a debugging message; under Windows, this will appear on the
3866debugger command window, and under Unix, it will be written to standard
3867error.
3868
3869The syntax is identical to {\bf printf}: pass a format string and a
3870variable list of arguments.
3871
3872{\bf Tip:} under Windows, if your application crashes before the
3873message appears in the debugging window, put a wxYield call after
3874each wxDebugMsg call. wxDebugMsg seems to be broken under WIN32s
3875(at least for Watcom C++): preformat your messages and use OutputDebugString
3876instead.
3877
b0fc8832
VZ
3878\wxheading{Include files}
3879
3880<wx/utils.h>
3881
84ed77ef 3882
b0fc8832
VZ
3883\membersection{::wxError}\label{wxerror}
3884
fc2171bd 3885\func{void}{wxError}{\param{const wxString\& }{msg}, \param{const wxString\& }{title = "wxWidgets Internal Error"}}
b0fc8832 3886
b829bf55 3887{\bf NB:} This function is now obsolete, please use \helpref{wxLogError}{wxlogerror}
b0fc8832
VZ
3888instead.
3889
3890Displays {\it msg} and continues. This writes to standard error under
3891Unix, and pops up a message box under Windows. Used for internal
fc2171bd 3892wxWidgets errors. See also \helpref{wxFatalError}{wxfatalerror}.
b0fc8832
VZ
3893
3894\wxheading{Include files}
3895
3896<wx/utils.h>
3897
84ed77ef 3898
b0fc8832
VZ
3899\membersection{::wxFatalError}\label{wxfatalerror}
3900
fc2171bd 3901\func{void}{wxFatalError}{\param{const wxString\& }{msg}, \param{const wxString\& }{title = "wxWidgets Fatal Error"}}
b0fc8832 3902
b829bf55 3903{\bf NB:} This function is now obsolete, please use
b0fc8832
VZ
3904\helpref{wxLogFatalError}{wxlogfatalerror} instead.
3905
3906Displays {\it msg} and exits. This writes to standard error under Unix,
3907and pops up a message box under Windows. Used for fatal internal
fc2171bd 3908wxWidgets errors. See also \helpref{wxError}{wxerror}.
b0fc8832
VZ
3909
3910\wxheading{Include files}
3911
3912<wx/utils.h>
3913
84ed77ef 3914
6fb26ea3
JS
3915\membersection{::wxLogError}\label{wxlogerror}
3916
7ac13b21 3917\func{void}{wxLogError}{\param{const char *}{formatString}, \param{...}{}}
6fb26ea3 3918
1d63fd6b
GD
3919\func{void}{wxVLogError}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3920
ea44a631 3921The functions to use for error messages, i.e. the messages that must be shown
f68586e5
VZ
3922to the user. The default processing is to pop up a message box to inform the
3923user about it.
6fb26ea3 3924
84ed77ef 3925
6fb26ea3
JS
3926\membersection{::wxLogFatalError}\label{wxlogfatalerror}
3927
7ac13b21 3928\func{void}{wxLogFatalError}{\param{const char *}{formatString}, \param{...}{}}
6fb26ea3 3929
1d63fd6b
GD
3930\func{void}{wxVLogFatalError}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3931
6fb26ea3
JS
3932Like \helpref{wxLogError}{wxlogerror}, but also
3933terminates the program with the exit code 3. Using {\it abort()} standard
3934function also terminates the program with this exit code.
3935
84ed77ef 3936
6fb26ea3
JS
3937\membersection{::wxLogWarning}\label{wxlogwarning}
3938
7ac13b21 3939\func{void}{wxLogWarning}{\param{const char *}{formatString}, \param{...}{}}
6fb26ea3 3940
1d63fd6b
GD
3941\func{void}{wxVLogWarning}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3942
f68586e5
VZ
3943For warnings - they are also normally shown to the user, but don't interrupt
3944the program work.
6fb26ea3 3945
84ed77ef 3946
6fb26ea3
JS
3947\membersection{::wxLogMessage}\label{wxlogmessage}
3948
7ac13b21 3949\func{void}{wxLogMessage}{\param{const char *}{formatString}, \param{...}{}}
6fb26ea3 3950
1d63fd6b
GD
3951\func{void}{wxVLogMessage}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3952
ea44a631 3953For all normal, informational messages. They also appear in a message box by
8004cd7a 3954default (but it can be changed).
84ed77ef 3955
6fb26ea3
JS
3956\membersection{::wxLogVerbose}\label{wxlogverbose}
3957
7ac13b21
GT
3958\func{void}{wxLogVerbose}{\param{const char *}{formatString}, \param{...}{}}
3959
1d63fd6b 3960\func{void}{wxVLogVerbose}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
6fb26ea3 3961
f6bcfd97 3962For verbose output. Normally, it is suppressed, but
6fb26ea3
JS
3963might be activated if the user wishes to know more details about the program
3964progress (another, but possibly confusing name for the same function is {\bf wxLogInfo}).
3965
84ed77ef 3966
6fb26ea3
JS
3967\membersection{::wxLogStatus}\label{wxlogstatus}
3968
7ac13b21 3969\func{void}{wxLogStatus}{\param{wxFrame *}{frame}, \param{const char *}{formatString}, \param{...}{}}
f68586e5 3970
1d63fd6b 3971\func{void}{wxVLogStatus}{\param{wxFrame *}{frame}, \param{const char *}{formatString}, \param{va\_list }{argPtr}}
7ac13b21
GT
3972
3973\func{void}{wxLogStatus}{\param{const char *}{formatString}, \param{...}{}}
6fb26ea3 3974
1d63fd6b
GD
3975\func{void}{wxVLogStatus}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3976
ea44a631 3977Messages logged by these functions will appear in the statusbar of the {\it
f68586e5 3978frame} or of the top level application window by default (i.e. when using
ea44a631 3979the second version of the functions).
f68586e5
VZ
3980
3981If the target frame doesn't have a statusbar, the message will be lost.
6fb26ea3 3982
84ed77ef 3983
6fb26ea3
JS
3984\membersection{::wxLogSysError}\label{wxlogsyserror}
3985
7ac13b21
GT
3986\func{void}{wxLogSysError}{\param{const char *}{formatString}, \param{...}{}}
3987
1d63fd6b 3988\func{void}{wxVLogSysError}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
6fb26ea3 3989
fc2171bd 3990Mostly used by wxWidgets itself, but might be handy for logging errors after
f68586e5
VZ
3991system call (API function) failure. It logs the specified message text as well
3992as the last system error code ({\it errno} or {\it ::GetLastError()} depending
3993on the platform) and the corresponding error message. The second form
f6bcfd97 3994of this function takes the error code explicitly as the first argument.
6fb26ea3 3995
6d516e09
VZ
3996\wxheading{See also}
3997
3998\helpref{wxSysErrorCode}{wxsyserrorcode},
3999\helpref{wxSysErrorMsg}{wxsyserrormsg}
4000
84ed77ef 4001
6fb26ea3
JS
4002\membersection{::wxLogDebug}\label{wxlogdebug}
4003
7ac13b21
GT
4004\func{void}{wxLogDebug}{\param{const char *}{formatString}, \param{...}{}}
4005
1d63fd6b 4006\func{void}{wxVLogDebug}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
6fb26ea3 4007
ea44a631
GD
4008The right functions for debug output. They only do something in debug
4009mode (when the preprocessor symbol \_\_WXDEBUG\_\_ is defined) and expand to
f68586e5 4010nothing in release mode (otherwise).
6fb26ea3 4011
84ed77ef 4012
6fb26ea3
JS
4013\membersection{::wxLogTrace}\label{wxlogtrace}
4014
7ac13b21 4015\func{void}{wxLogTrace}{\param{const char *}{formatString}, \param{...}{}}
1d63fd6b
GD
4016
4017\func{void}{wxVLogTrace}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
6fb26ea3 4018
f68586e5 4019\func{void}{wxLogTrace}{\param{const char *}{mask}, \param{const char *}{formatString}, \param{...}{}}
7ac13b21 4020
1d63fd6b 4021\func{void}{wxVLogTrace}{\param{const char *}{mask}, \param{const char *}{formatString}, \param{va\_list }{argPtr}}
f68586e5
VZ
4022
4023\func{void}{wxLogTrace}{\param{wxTraceMask}{ mask}, \param{const char *}{formatString}, \param{...}{}}
7ac13b21 4024
1d63fd6b 4025\func{void}{wxVLogTrace}{\param{wxTraceMask}{ mask}, \param{const char *}{formatString}, \param{va\_list }{argPtr}}
f68586e5
VZ
4026
4027As {\bf wxLogDebug}, trace functions only do something in debug build and
4028expand to nothing in the release one. The reason for making
4029it a separate function from it is that usually there are a lot of trace
4030messages, so it might make sense to separate them from other debug messages.
4031
4032The trace messages also usually can be separated into different categories and
ec5d7799 4033the second and third versions of this function only log the message if the
f68586e5
VZ
4034{\it mask} which it has is currently enabled in \helpref{wxLog}{wxlog}. This
4035allows to selectively trace only some operations and not others by changing
4036the value of the trace mask (possible during the run-time).
4037
4038For the second function (taking a string mask), the message is logged only if
ec5d7799 4039the mask has been previously enabled by the call to
6f97a409
VS
4040\helpref{AddTraceMask}{wxlogaddtracemask} or by setting
4041\helpref{{\tt WXTRACE} environment variable}{envvars}.
4042The predefined string trace masks
fc2171bd 4043used by wxWidgets are:
f68586e5
VZ
4044
4045\begin{itemize}\itemsep=0pt
4046\item wxTRACE\_MemAlloc: trace memory allocation (new/delete)
4047\item wxTRACE\_Messages: trace window messages/X callbacks
4048\item wxTRACE\_ResAlloc: trace GDI resource allocation
4049\item wxTRACE\_RefCount: trace various ref counting operations
4050\item wxTRACE\_OleCalls: trace OLE method calls (Win32 only)
4051\end{itemize}
6fb26ea3 4052
f70c0443
WS
4053{\bf Caveats:} since both the mask and the format string are strings,
4054this might lead to function signature confusion in some cases:
4055if you intend to call the format string only version of wxLogTrace,
4056then 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.
4057In this case you'll unfortunately have to avoid having two leading
3980000c 4058string parameters, e.g. by adding a bogus integer (with its \%d format string).
f70c0443
WS
4059
4060The third version of the function only logs the message if all the bits
f68586e5
VZ
4061corresponding to the {\it mask} are set in the wxLog trace mask which can be
4062set by \helpref{SetTraceMask}{wxlogsettracemask}. This version is less
4063flexible than the previous one because it doesn't allow defining the user
4064trace masks easily - this is why it is deprecated in favour of using string
4065trace masks.
6fb26ea3
JS
4066
4067\begin{itemize}\itemsep=0pt
4068\item wxTraceMemAlloc: trace memory allocation (new/delete)
4069\item wxTraceMessages: trace window messages/X callbacks
4070\item wxTraceResAlloc: trace GDI resource allocation
4071\item wxTraceRefCount: trace various ref counting operations
f68586e5 4072\item wxTraceOleCalls: trace OLE method calls (Win32 only)
6fb26ea3
JS
4073\end{itemize}
4074
84ed77ef 4075
c11d62a6
VZ
4076\membersection{::wxSafeShowMessage}\label{wxsafeshowmessage}
4077
4078\func{void}{wxSafeShowMessage}{\param{const wxString\& }{title}, \param{const wxString\& }{text}}
4079
4080This function shows a message to the user in a safe way and should be safe to
4081call even before the application has been initialized or if it is currently in
4082some other strange state (for example, about to crash). Under Windows this
b829bf55 4083function shows a message box using a native dialog instead of
c11d62a6
VZ
4084\helpref{wxMessageBox}{wxmessagebox} (which might be unsafe to call), elsewhere
4085it simply prints the message to the standard output using the title as prefix.
4086
4087\wxheading{Parameters}
4088
4089\docparam{title}{The title of the message box shown to the user or the prefix
4090of the message string}
4091
4092\docparam{text}{The text to show to the user}
4093
4094\wxheading{See also}
4095
4096\helpref{wxLogFatalError}{wxlogfatalerror}
4097
4098\wxheading{Include files}
4099
4100<wx/log.h>
4101
84ed77ef 4102
6d516e09
VZ
4103\membersection{::wxSysErrorCode}\label{wxsyserrorcode}
4104
4105\func{unsigned long}{wxSysErrorCode}{\void}
4106
4107Returns the error code from the last system call. This function uses
4108{\tt errno} on Unix platforms and {\tt GetLastError} under Win32.
4109
4110\wxheading{See also}
4111
4112\helpref{wxSysErrorMsg}{wxsyserrormsg},
4113\helpref{wxLogSysError}{wxlogsyserror}
4114
84ed77ef 4115
6d516e09
VZ
4116\membersection{::wxSysErrorMsg}\label{wxsyserrormsg}
4117
4118\func{const wxChar *}{wxSysErrorMsg}{\param{unsigned long }{errCode = 0}}
4119
ec5d7799
RD
4120Returns the error message corresponding to the given system error code. If
4121{\it errCode} is $0$ (default), the last error code (as returned by
6d516e09
VZ
4122\helpref{wxSysErrorCode}{wxsyserrorcode}) is used.
4123
4124\wxheading{See also}
4125
4126\helpref{wxSysErrorCode}{wxsyserrorcode},
4127\helpref{wxLogSysError}{wxlogsyserror}
4128
84ed77ef 4129
b0fc8832
VZ
4130\membersection{WXTRACE}\label{trace}
4131
4132\wxheading{Include files}
4133
4134<wx/object.h>
4135
4136\func{}{WXTRACE}{formatString, ...}
4137
2bd25c5a
VZ
4138{\bf NB:} This macro is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
4139
b0fc8832
VZ
4140Calls wxTrace with printf-style variable argument syntax. Output
4141is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
4142
b0fc8832
VZ
4143\wxheading{Include files}
4144
4145<wx/memory.h>
4146
84ed77ef 4147
b0fc8832
VZ
4148\membersection{WXTRACELEVEL}\label{tracelevel}
4149
4150\func{}{WXTRACELEVEL}{level, formatString, ...}
4151
2bd25c5a
VZ
4152{\bf NB:} This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
4153
b0fc8832
VZ
4154Calls wxTraceLevel with printf-style variable argument syntax. Output
4155is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
4156The first argument should be the level at which this information is appropriate.
4157It will only be output if the level returned by wxDebugContext::GetLevel is equal to or greater than
4158this value.
4159
b0fc8832
VZ
4160\wxheading{Include files}
4161
4162<wx/memory.h>
4163
84ed77ef 4164
b0fc8832
VZ
4165\membersection{::wxTrace}\label{wxtrace}
4166
4167\func{void}{wxTrace}{\param{const wxString\& }{fmt}, \param{...}{}}
4168
2bd25c5a
VZ
4169{\bf NB:} This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
4170
b0fc8832
VZ
4171Takes printf-style variable argument syntax. Output
4172is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
4173
b0fc8832
VZ
4174\wxheading{Include files}
4175
4176<wx/memory.h>
4177
84ed77ef 4178
b0fc8832
VZ
4179\membersection{::wxTraceLevel}\label{wxtracelevel}
4180
4181\func{void}{wxTraceLevel}{\param{int}{ level}, \param{const wxString\& }{fmt}, \param{...}{}}
4182
2bd25c5a
VZ
4183{\bf NB:} This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
4184
b0fc8832
VZ
4185Takes printf-style variable argument syntax. Output
4186is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
4187The first argument should be the level at which this information is appropriate.
4188It will only be output if the level returned by wxDebugContext::GetLevel is equal to or greater than
4189this value.
4190
b0fc8832
VZ
4191\wxheading{Include files}
4192
4193<wx/memory.h>
4194
84ed77ef
VZ
4195
4196
f6bcfd97
BP
4197\section{Time functions}\label{timefunctions}
4198
4199The functions in this section deal with getting the current time and
4200starting/stopping the global timers. Please note that the timer functions are
ec5d7799 4201deprecated because they work with one global timer only and
f6bcfd97 4202\helpref{wxTimer}{wxtimer} and/or \helpref{wxStopWatch}{wxstopwatch} classes
ec5d7799
RD
4203should be used instead. For retrieving the current time, you may also use
4204\helpref{wxDateTime::Now}{wxdatetimenow} or
f6bcfd97
BP
4205\helpref{wxDateTime::UNow}{wxdatetimeunow} methods.
4206
84ed77ef 4207
f6bcfd97
BP
4208\membersection{::wxGetElapsedTime}\label{wxgetelapsedtime}
4209
cc81d32f 4210\func{long}{wxGetElapsedTime}{\param{bool}{ resetTimer = true}}
f6bcfd97
BP
4211
4212Gets the time in milliseconds since the last \helpref{::wxStartTimer}{wxstarttimer}.
4213
cc81d32f 4214If {\it resetTimer} is true (the default), the timer is reset to zero
f6bcfd97
BP
4215by this call.
4216
4217See also \helpref{wxTimer}{wxtimer}.
4218
4219\wxheading{Include files}
4220
4221<wx/timer.h>
4222
84ed77ef 4223
f6bcfd97
BP
4224\membersection{::wxGetLocalTime}\label{wxgetlocaltime}
4225
4226\func{long}{wxGetLocalTime}{\void}
4227
4228Returns the number of seconds since local time 00:00:00 Jan 1st 1970.
4229
4230\wxheading{See also}
4231
4232\helpref{wxDateTime::Now}{wxdatetimenow}
4233
4234\wxheading{Include files}
4235
4236<wx/timer.h>
4237
84ed77ef 4238
f6bcfd97
BP
4239\membersection{::wxGetLocalTimeMillis}\label{wxgetlocaltimemillis}
4240
a9d171bd 4241\func{wxLongLong}{wxGetLocalTimeMillis}{\void}
f6bcfd97
BP
4242
4243Returns the number of milliseconds since local time 00:00:00 Jan 1st 1970.
4244
4245\wxheading{See also}
4246
4247\helpref{wxDateTime::Now}{wxdatetimenow},\\
a9d171bd 4248\helpref{wxLongLong}{wxlonglong}
f6bcfd97
BP
4249
4250\wxheading{Include files}
4251
4252<wx/timer.h>
4253
84ed77ef 4254
f6bcfd97
BP
4255\membersection{::wxGetUTCTime}\label{wxgetutctime}
4256
4257\func{long}{wxGetUTCTime}{\void}
4258
4259Returns the number of seconds since GMT 00:00:00 Jan 1st 1970.
4260
4261\wxheading{See also}
4262
4263\helpref{wxDateTime::Now}{wxdatetimenow}
4264
4265\wxheading{Include files}
4266
4267<wx/timer.h>
4268
84ed77ef 4269
08873d36
VZ
4270\membersection{::wxMicroSleep}\label{wxmicrosleep}
4271
4272\func{void}{wxMicroSleep}{\param{unsigned long}{ microseconds}}
4273
4274Sleeps for the specified number of microseconds. The microsecond resolution may
4275not, in fact, be available on all platforms (currently only Unix platforms with
8ea92b4d 4276nanosleep(2) may provide it) in which case this is the same as
08873d36
VZ
4277\helpref{wxMilliSleep}{wxmillisleep}(\arg{microseconds}$/1000$).
4278
4279\wxheading{Include files}
4280
4281<wx/utils.h>
4282
4283
4284\membersection{::wxMilliSleep}\label{wxmillisleep}
4285
4286\func{void}{wxMilliSleep}{\param{unsigned long}{ milliseconds}}
4287
4288Sleeps for the specified number of milliseconds. Notice that usage of this
4289function is encouraged instead of calling usleep(3) directly because the
4290standard usleep() function is not MT safe.
4291
4292\wxheading{Include files}
4293
4294<wx/utils.h>
4295
4296
b0fc8832
VZ
4297\membersection{::wxNow}\label{wxnow}
4298
4299\func{wxString}{wxNow}{\void}
4300
4301Returns a string representing the current date and time.
4302
4303\wxheading{Include files}
4304
4305<wx/utils.h>
4306
84ed77ef 4307
b0fc8832
VZ
4308\membersection{::wxSleep}\label{wxsleep}
4309
4310\func{void}{wxSleep}{\param{int}{ secs}}
4311
4312Sleeps for the specified number of seconds.
4313
4314\wxheading{Include files}
4315
4316<wx/utils.h>
4317
84ed77ef 4318
f6bcfd97
BP
4319\membersection{::wxStartTimer}\label{wxstarttimer}
4320
4321\func{void}{wxStartTimer}{\void}
4322
4323Starts a stopwatch; use \helpref{::wxGetElapsedTime}{wxgetelapsedtime} to get the elapsed time.
4324
4325See also \helpref{wxTimer}{wxtimer}.
4326
4327\wxheading{Include files}
4328
4329<wx/timer.h>
4330
84ed77ef 4331
b0fc8832
VZ
4332\membersection{::wxUsleep}\label{wxusleep}
4333
4334\func{void}{wxUsleep}{\param{unsigned long}{ milliseconds}}
4335
08873d36 4336This function is deprecated because its name is misleading: notice that the
8ea92b4d
WS
4337argument is in milliseconds, not microseconds. Please use either
4338\helpref{wxMilliSleep}{wxmillisleep} or \helpref{wxMicroSleep}{wxmicrosleep}
08873d36 4339depending on the resolution you need.
b0fc8832 4340
84ed77ef
VZ
4341
4342
6fb26ea3
JS
4343\section{Debugging macros and functions}\label{debugmacros}
4344
8f5d9104 4345Useful macros and functions for error checking and defensive programming.
fc2171bd 4346wxWidgets defines three families of the assert-like macros:
8f5d9104
VZ
4347the wxASSERT and wxFAIL macros only do anything if \_\_WXDEBUG\_\_ is defined
4348(in other words, in the debug build) but disappear completely in the release
4349build. On the other hand, the wxCHECK macros stay event in release builds but a
4350check failure doesn't generate any user-visible effects then. Finally, the
4351compile time assertions don't happen during the run-time but result in the
4352compilation error messages if the condition they check fail.
6fb26ea3 4353
954b8ae6
JS
4354\wxheading{Include files}
4355
4356<wx/debug.h>
4357
84ed77ef 4358
6fb26ea3
JS
4359\membersection{::wxOnAssert}\label{wxonassert}
4360
09007669 4361\func{void}{wxOnAssert}{\param{const char *}{fileName}, \param{int}{ lineNumber}, \param{const char *}{func}, \param{const char *}{cond}, \param{const char *}{msg = NULL}}
6fb26ea3 4362
8f5d9104
VZ
4363This function is called whenever one of debugging macros fails (i.e. condition
4364is false in an assertion). It is only defined in the debug mode, in release
4365builds the \helpref{wxCHECK}{wxcheck} failures don't result in anything.
4366
4367To override the default behaviour in the debug builds which is to show the user
4368a dialog asking whether he wants to abort the program, continue or continue
b829bf55 4369ignoring any subsequent assert failures, you may override
e0c8d2d9 4370\helpref{wxApp::OnAssertFailure}{wxapponassertfailure} which is called by this function if
8f5d9104 4371the global application object exists.
6fb26ea3 4372
84ed77ef 4373
6fb26ea3
JS
4374\membersection{wxASSERT}\label{wxassert}
4375
4376\func{}{wxASSERT}{\param{}{condition}}
4377
cc81d32f 4378Assert macro. An error message will be generated if the condition is false in
b207457c
VZ
4379debug mode, but nothing will be done in the release build.
4380
4381Please note that the condition in wxASSERT() should have no side effects
4382because it will not be executed in release mode at all.
4383
8f5d9104
VZ
4384\wxheading{See also}
4385
4386\helpref{wxASSERT\_MSG}{wxassertmsg},\\
4387\helpref{wxCOMPILE\_TIME\_ASSERT}{wxcompiletimeassert}
4388
84ed77ef 4389
8f5d9104
VZ
4390\membersection{wxASSERT\_MIN\_BITSIZE}\label{wxassertminbitsize}
4391
4392\func{}{wxASSERT\_MIN\_BITSIZE}{\param{}{type}, \param{}{size}}
4393
b829bf55 4394This macro results in a
9722642d 4395\helpref{compile time assertion failure}{wxcompiletimeassert} if the size
8f5d9104
VZ
4396of the given type {\it type} is less than {\it size} bits.
4397
4398You may use it like this, for example:
4399
4400\begin{verbatim}
4401 // we rely on the int being able to hold values up to 2^32
4402 wxASSERT_MIN_BITSIZE(int, 32);
4403
4404 // can't work with the platforms using UTF-8 for wchar_t
4405 wxASSERT_MIN_BITSIZE(wchar_t, 16);
4406\end{verbatim}
6fb26ea3 4407
84ed77ef 4408
6fb26ea3
JS
4409\membersection{wxASSERT\_MSG}\label{wxassertmsg}
4410
4411\func{}{wxASSERT\_MSG}{\param{}{condition}, \param{}{msg}}
4412
cc81d32f 4413Assert macro with message. An error message will be generated if the condition is false.
6fb26ea3 4414
8f5d9104
VZ
4415\wxheading{See also}
4416
4417\helpref{wxASSERT}{wxassert},\\
4418\helpref{wxCOMPILE\_TIME\_ASSERT}{wxcompiletimeassert}
4419
84ed77ef 4420
8f5d9104
VZ
4421\membersection{wxCOMPILE\_TIME\_ASSERT}\label{wxcompiletimeassert}
4422
4423\func{}{wxCOMPILE\_TIME\_ASSERT}{\param{}{condition}, \param{}{msg}}
4424
4425Using {\tt wxCOMPILE\_TIME\_ASSERT} results in a compilation error if the
9722642d 4426specified {\it condition} is false. The compiler error message should include
8f5d9104
VZ
4427the {\it msg} identifier - please note that it must be a valid C++ identifier
4428and not a string unlike in the other cases.
4429
b829bf55 4430This macro is mostly useful for testing the expressions involving the
8f5d9104
VZ
4431{\tt sizeof} operator as they can't be tested by the preprocessor but it is
4432sometimes desirable to test them at the compile time.
4433
5b8643ea
VZ
4434Note that this macro internally declares a struct whose name it tries to make
4435unique by using the {\tt \_\_LINE\_\_} in it but it may still not work if you
4436use it on the same line in two different source files. In this case you may
b829bf55 4437either change the line in which either of them appears on or use the
5b8643ea
VZ
4438\helpref{wxCOMPILE\_TIME\_ASSERT2}{wxcompiletimeassert2} macro.
4439
150018ae 4440Also note that Microsoft Visual C++ has a bug which results in compiler errors
cf700088
JS
4441if you use this macro with `Program Database For Edit And Continue'
4442(\texttt{/ZI}) option, so you shouldn't use it (`Program Database'
150018ae
VZ
4443(\texttt{/Zi}) is ok though) for the code making use of this macro.
4444
8f5d9104
VZ
4445\wxheading{See also}
4446
4447\helpref{wxASSERT\_MSG}{wxassertmsg},\\
4448\helpref{wxASSERT\_MIN\_BITSIZE}{wxassertminbitsize}
b207457c 4449
84ed77ef 4450
5b8643ea
VZ
4451\membersection{wxCOMPILE\_TIME\_ASSERT2}\label{wxcompiletimeassert2}
4452
4453\func{}{wxCOMPILE\_TIME\_ASSERT}{\param{}{condition}, \param{}{msg}, \param{}{name}}
4454
b829bf55 4455This macro is identical to \helpref{wxCOMPILE\_TIME\_ASSERT2}{wxcompiletimeassert2}
5b8643ea
VZ
4456except that it allows you to specify a unique {\it name} for the struct
4457internally defined by this macro to avoid getting the compilation errors
4458described \helpref{above}{wxcompiletimeassert}.
4459
84ed77ef 4460
6fb26ea3
JS
4461\membersection{wxFAIL}\label{wxfail}
4462
b207457c 4463\func{}{wxFAIL}{\void}
6fb26ea3
JS
4464
4465Will always generate an assert error if this code is reached (in debug mode).
4466
b207457c
VZ
4467See also: \helpref{wxFAIL\_MSG}{wxfailmsg}
4468
84ed77ef 4469
6fb26ea3
JS
4470\membersection{wxFAIL\_MSG}\label{wxfailmsg}
4471
b207457c 4472\func{}{wxFAIL\_MSG}{\param{}{msg}}
6fb26ea3
JS
4473
4474Will always generate an assert error with specified message if this code is reached (in debug mode).
4475
b207457c
VZ
4476This macro is useful for marking unreachable" code areas, for example
4477it may be used in the "default:" branch of a switch statement if all possible
4478cases are processed above.
4479
8f5d9104
VZ
4480\wxheading{See also}
4481
4482\helpref{wxFAIL}{wxfail}
b207457c 4483
84ed77ef 4484
6fb26ea3
JS
4485\membersection{wxCHECK}\label{wxcheck}
4486
4487\func{}{wxCHECK}{\param{}{condition}, \param{}{retValue}}
4488
4489Checks that the condition is true, returns with the given return value if not (FAILs in debug mode).
4490This check is done even in release mode.
4491
84ed77ef 4492
6fb26ea3
JS
4493\membersection{wxCHECK\_MSG}\label{wxcheckmsg}
4494
4495\func{}{wxCHECK\_MSG}{\param{}{condition}, \param{}{retValue}, \param{}{msg}}
4496
4497Checks that the condition is true, returns with the given return value if not (FAILs in debug mode).
4498This check is done even in release mode.
4499
154b6b0f 4500This macro may be only used in non-void functions, see also
b207457c
VZ
4501\helpref{wxCHECK\_RET}{wxcheckret}.
4502
84ed77ef 4503
b207457c
VZ
4504\membersection{wxCHECK\_RET}\label{wxcheckret}
4505
4506\func{}{wxCHECK\_RET}{\param{}{condition}, \param{}{msg}}
4507
4508Checks that the condition is true, and returns if not (FAILs with given error
4509message in debug mode). This check is done even in release mode.
4510
ec5d7799 4511This macro should be used in void functions instead of
b207457c
VZ
4512\helpref{wxCHECK\_MSG}{wxcheckmsg}.
4513
84ed77ef 4514
b207457c
VZ
4515\membersection{wxCHECK2}\label{wxcheck2}
4516
4517\func{}{wxCHECK2}{\param{}{condition}, \param{}{operation}}
4518
ec5d7799
RD
4519Checks that the condition is true and \helpref{wxFAIL}{wxfail} and execute
4520{\it operation} if it is not. This is a generalisation of
b207457c
VZ
4521\helpref{wxCHECK}{wxcheck} and may be used when something else than just
4522returning from the function must be done when the {\it condition} is false.
4523
4524This check is done even in release mode.
4525
84ed77ef 4526
b207457c
VZ
4527\membersection{wxCHECK2\_MSG}\label{wxcheck2msg}
4528
4529\func{}{wxCHECK2}{\param{}{condition}, \param{}{operation}, \param{}{msg}}
4530
ec5d7799 4531This is the same as \helpref{wxCHECK2}{wxcheck2}, but
b207457c
VZ
4532\helpref{wxFAIL\_MSG}{wxfailmsg} with the specified {\it msg} is called
4533instead of wxFAIL() if the {\it condition} is false.
4534
84ed77ef 4535
b0fc8832
VZ
4536\membersection{::wxTrap}\label{wxtrap}
4537
4538\func{void}{wxTrap}{\void}
4539
4540In debug mode (when {\tt \_\_WXDEBUG\_\_} is defined) this function generates a
4541debugger exception meaning that the control is passed to the debugger if one is
4542attached to the process. Otherwise the program just terminates abnormally.
4543
4544In release mode this function does nothing.
4545
4546\wxheading{Include files}
4547
4548<wx/debug.h>
4549
a434b43f 4550
84ed77ef 4551
a434b43f
VZ
4552\membersection{::wxIsDebuggerRunning}\label{wxisdebuggerrunning}
4553
4554\func{bool}{wxIsDebuggerRunning}{\void}
4555
c50a4038 4556Returns \true if the program is running under debugger, \false otherwise.
a434b43f 4557
c50a4038
VZ
4558Please note that this function is currently only implemented for Win32 and Mac
4559builds using CodeWarrior and always returns \false elsewhere.
a434b43f
VZ
4560
4561
84ed77ef
VZ
4562
4563
5807634c
VZ
4564\section{Environment access functions}\label{environfunctions}
4565
4566The functions in this section allow to access (get) or change value of
4567environment variables in a portable way. They are currently implemented under
4568Win32 and POSIX-like systems (Unix).
4569
4570% TODO add some stuff about env var inheriting but not propagating upwards (VZ)
4571
4572\wxheading{Include files}
4573
4574<wx/utils.h>
4575
84ed77ef 4576
308978f6 4577\membersection{wxGetenv}\label{wxgetenvmacro}
5807634c
VZ
4578
4579\func{wxChar *}{wxGetEnv}{\param{const wxString\&}{ var}}
4580
308978f6
VZ
4581This is a macro defined as {\tt getenv()} or its wide char version in Unicode
4582mode.
4583
4584Note that under Win32 it may not return correct value for the variables set
4585with \helpref{wxSetEnv}{wxsetenv}, use \helpref{wxGetEnv}{wxgetenv} function
4586instead.
4587
84ed77ef 4588
308978f6
VZ
4589\membersection{wxGetEnv}\label{wxgetenv}
4590
4591\func{bool}{wxGetEnv}{\param{const wxString\&}{ var}, \param{wxString *}{value}}
4592
4593Returns the current value of the environment variable {\it var} in {\it value}.
4594{\it value} may be {\tt NULL} if you just want to know if the variable exists
4595and are not interested in its value.
4596
43e8916f 4597Returns \true if the variable exists, \false otherwise.
5807634c 4598
84ed77ef 4599
5807634c
VZ
4600\membersection{wxSetEnv}\label{wxsetenv}
4601
4602\func{bool}{wxSetEnv}{\param{const wxString\&}{ var}, \param{const wxChar *}{value}}
4603
4604Sets the value of the environment variable {\it var} (adding it if necessary)
4605to {\it value}.
4606
43e8916f 4607Returns \true on success.
5807634c 4608
84ed77ef 4609
5807634c
VZ
4610\membersection{wxUnsetEnv}\label{wxunsetenv}
4611
4612\func{bool}{wxUnsetEnv}{\param{const wxString\&}{ var}}
4613
ec5d7799 4614Removes the variable {\it var} from the environment.
5df6ed1c 4615\helpref{wxGetEnv}{wxgetenv} will return {\tt NULL} after the call to this
5807634c
VZ
4616function.
4617
43e8916f 4618Returns \true on success.