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