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