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