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