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