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