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