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