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