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