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