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