1 \chapter{Functions
}\label{functions
}
2 \setheader{{\it CHAPTER
\thechapter}}{}{}{}{}{{\it CHAPTER
\thechapter}}%
3 \setfooter{\thepage}{}{}{}{}{\thepage}
5 The functions and macros defined in wxWindows are described here: you can
6 either look up a function using the alphabetical listing of them or find it in
7 the corresponding topic.
9 \section{Alphabetical functions and macros list
}
11 \helpref{CLASSINFO
}{classinfo
}\\
12 \helpref{copystring
}{copystring
}\\
13 \helpref{DECLARE
\_ABSTRACT\_CLASS}{declareabstractclass
}\\
14 \helpref{DECLARE
\_APP}{declareapp
}\\
15 \helpref{DECLARE
\_CLASS}{declareclass
}\\
16 \helpref{DECLARE
\_DYNAMIC\_CLASS}{declaredynamicclass
}\\
17 \helpref{IMPLEMENT
\_ABSTRACT\_CLASS2}{implementabstractclass2
}\\
18 \helpref{IMPLEMENT
\_ABSTRACT\_CLASS}{implementabstractclass
}\\
19 \helpref{IMPLEMENT
\_APP}{implementapp
}\\
20 \helpref{IMPLEMENT
\_CLASS2}{implementclass2
}\\
21 \helpref{IMPLEMENT
\_CLASS}{implementclass
}\\
22 \helpref{IMPLEMENT
\_DYNAMIC\_CLASS2}{implementdynamicclass2
}\\
23 \helpref{IMPLEMENT
\_DYNAMIC\_CLASS}{implementdynamicclass
}\\
24 \helpref{WXDEBUG
\_NEW}{debugnew
}\\
25 \helpref{WXTRACELEVEL
}{tracelevel
}\\
26 \helpref{WXTRACE
}{trace
}\\
27 \helpref{wxASSERT
\_MIN\_BITSIZE}{wxassertminbitsize
}\\
28 \helpref{wxASSERT
\_MSG}{wxassertmsg
}\\
29 \helpref{wxASSERT
}{wxassert
}\\
30 \helpref{wxBITMAP
}{wxbitmapmacro
}\\
31 \helpref{wxBeginBusyCursor
}{wxbeginbusycursor
}\\
32 \helpref{wxBell
}{wxbell
}\\
33 \helpref{wxCHECK
}{wxcheck
}\\
34 \helpref{wxCHECK2
\_MSG}{wxcheck2msg
}\\
35 \helpref{wxCHECK2
}{wxcheck2
}\\
36 \helpref{wxCHECK
\_GCC\_VERSION}{wxcheckgccversion
}\\
37 \helpref{wxCHECK
\_MSG}{wxcheckmsg
}\\
38 \helpref{wxCHECK
\_RET}{wxcheckret
}\\
39 \helpref{wxCHECK
\_VERSION}{wxcheckversion
}\\
40 \helpref{wxCHECK
\_W32API\_VERSION}{wxcheckw32apiversion
}\\
41 \helpref{wxClientDisplayRect
}{wxclientdisplayrect
}\\
42 \helpref{wxClipboardOpen
}{functionwxclipboardopen
}\\
43 \helpref{wxCloseClipboard
}{wxcloseclipboard
}\\
44 \helpref{wxColourDisplay
}{wxcolourdisplay
}\\
45 \helpref{wxCOMPILE
\_TIME\_ASSERT}{wxcompiletimeassert
}\\
46 \helpref{wxCOMPILE
\_TIME\_ASSERT2}{wxcompiletimeassert2
}\\
47 \helpref{wxConcatFiles
}{wxconcatfiles
}\\
48 \helpref{wxConstCast
}{wxconstcast
}\\
49 \helpref{wxCopyFile
}{wxcopyfile
}\\
50 \helpref{wxCreateDynamicObject
}{wxcreatedynamicobject
}\\
51 \helpref{wxCreateFileTipProvider
}{wxcreatefiletipprovider
}\\
52 \helpref{wxCRIT
\_SECT\_DECLARE}{wxcritsectdeclare
}\\
53 \helpref{wxCRIT
\_SECT\_DECLARE\_MEMBER}{wxcritsectdeclaremember
}\\
54 \helpref{wxCRIT
\_SECT\_LOCKER}{wxcritsectlocker
}\\
55 \helpref{wxCRITICAL
\_SECTION}{wxcriticalsectionmacro
}\\
% wxcs already taken!
56 \helpref{wxDDECleanUp
}{wxddecleanup
}\\
57 \helpref{wxDDEInitialize
}{wxddeinitialize
}\\
58 \helpref{wxDROP
\_ICON}{wxdropicon
}\\
59 \helpref{wxDebugMsg
}{wxdebugmsg
}\\
60 \helpref{wxDirExists
}{functionwxdirexists
}\\
61 \helpref{wxDirSelector
}{wxdirselector
}\\
62 \helpref{wxDisplayDepth
}{wxdisplaydepth
}\\
63 \helpref{wxDisplaySize
}{wxdisplaysize
}\\
64 \helpref{wxDisplaySizeMM
}{wxdisplaysizemm
}\\
65 \helpref{wxDos2UnixFilename
}{wxdos2unixfilename
}\\
66 \helpref{wxDynamicCastThis
}{wxdynamiccastthis
}\\
67 \helpref{wxDynamicCast
}{wxdynamiccast
}\\
68 \helpref{wxEmptyClipboard
}{wxemptyclipboard
}\\
69 \helpref{wxEnableTopLevelWindows
}{wxenabletoplevelwindows
}\\
70 \helpref{wxEndBusyCursor
}{wxendbusycursor
}\\
71 \helpref{wxENTER
\_CRIT\_SECT}{wxentercritsect
}\\
72 \helpref{wxEntry
}{wxentry
}\\
73 \helpref{wxEnumClipboardFormats
}{wxenumclipboardformats
}\\
74 \helpref{wxError
}{wxerror
}\\
75 \helpref{wxExecute
}{wxexecute
}\\
76 \helpref{wxExit
}{wxexit
}\\
77 \helpref{wxEXPLICIT
}{wxexplicit
}\\
78 \helpref{wxFAIL
\_MSG}{wxfailmsg
}\\
79 \helpref{wxFAIL
}{wxfail
}\\
80 \helpref{wxFatalError
}{wxfatalerror
}\\
81 \helpref{wxFileExists
}{functionwxfileexists
}\\
82 \helpref{wxFileModificationTime
}{wxfilemodificationtime
}\\
83 \helpref{wxFileNameFromPath
}{wxfilenamefrompath
}\\
84 \helpref{wxFileSelector
}{wxfileselector
}\\
85 \helpref{wxFindFirstFile
}{wxfindfirstfile
}\\
86 \helpref{wxFindMenuItemId
}{wxfindmenuitemid
}\\
87 \helpref{wxFindNextFile
}{wxfindnextfile
}\\
88 \helpref{wxFindWindowAtPointer
}{wxfindwindowatpointer
}\\
89 \helpref{wxFindWindowAtPoint
}{wxfindwindowatpoint
}\\
90 \helpref{wxFindWindowByLabel
}{wxfindwindowbylabel
}\\
91 \helpref{wxFindWindowByName
}{wxfindwindowbyname
}\\
92 \helpref{wxFinite
}{wxfinite
}\\
93 \helpref{wxGetActiveWindow
}{wxgetactivewindow
}\\
94 \helpref{wxGetApp
}{wxgetapp
}\\
95 \helpref{wxGetClipboardData
}{wxgetclipboarddata
}\\
96 \helpref{wxGetClipboardFormatName
}{wxgetclipboardformatname
}\\
97 \helpref{wxGetColourFromUser
}{wxgetcolourfromuser
}\\
98 \helpref{wxGetCwd
}{wxgetcwd
}\\
99 \helpref{wxGetDiskSpace
}{wxgetdiskspace
}\\
100 \helpref{wxGetDisplayName
}{wxgetdisplayname
}\\
101 \helpref{wxGetElapsedTime
}{wxgetelapsedtime
}\\
102 \helpref{wxGetEmailAddress
}{wxgetemailaddress
}\\
103 \helpref{wxGetEnv
}{wxgetenv
}\\
104 \helpref{wxGetFontFromUser
}{wxgetfontfromuser
}\\
105 \helpref{wxGetFreeMemory
}{wxgetfreememory
}\\
106 \helpref{wxGetFullHostName
}{wxgetfullhostname
}\\
107 \helpref{wxGetHomeDir
}{wxgethomedir
}\\
108 \helpref{wxGetHostName
}{wxgethostname
}\\
109 \helpref{wxGetLocalTimeMillis
}{wxgetlocaltimemillis
}\\
110 \helpref{wxGetLocalTime
}{wxgetlocaltime
}\\
111 \helpref{wxGetMousePosition
}{wxgetmouseposition
}\\
112 \helpref{wxGetMultipleChoices
}{wxgetmultiplechoices
}\\
113 \helpref{wxGetMultipleChoice
}{wxgetmultiplechoice
}\\
114 \helpref{wxGetNumberFromUser
}{wxgetnumberfromuser
}\\
115 \helpref{wxGetOSDirectory
}{wxgetosdirectory
}\\
116 \helpref{wxGetOsDescription
}{wxgetosdescription
}\\
117 \helpref{wxGetOsVersion
}{wxgetosversion
}\\
118 \helpref{wxGetPasswordFromUser
}{wxgetpasswordfromuser
}\\
119 \helpref{wxGetPrinterCommand
}{wxgetprintercommand
}\\
120 \helpref{wxGetPrinterFile
}{wxgetprinterfile
}\\
121 \helpref{wxGetPrinterMode
}{wxgetprintermode
}\\
122 \helpref{wxGetPrinterOptions
}{wxgetprinteroptions
}\\
123 \helpref{wxGetPrinterOrientation
}{wxgetprinterorientation
}\\
124 \helpref{wxGetPrinterPreviewCommand
}{wxgetprinterpreviewcommand
}\\
125 \helpref{wxGetPrinterScaling
}{wxgetprinterscaling
}\\
126 \helpref{wxGetPrinterTranslation
}{wxgetprintertranslation
}\\
127 \helpref{wxGetProcessId
}{wxgetprocessid
}\\
128 \helpref{wxGetResource
}{wxgetresource
}\\
129 \helpref{wxGetSingleChoiceData
}{wxgetsinglechoicedata
}\\
130 \helpref{wxGetSingleChoiceIndex
}{wxgetsinglechoiceindex
}\\
131 \helpref{wxGetSingleChoice
}{wxgetsinglechoice
}\\
132 \helpref{wxGetTempFileName
}{wxgettempfilename
}\\
133 \helpref{wxGetTextFromUser
}{wxgettextfromuser
}\\
134 \helpref{wxGetTopLevelParent
}{wxgettoplevelparent
}\\
135 \helpref{wxGetTranslation
}{wxgettranslation
}\\
136 \helpref{wxGetUTCTime
}{wxgetutctime
}\\
137 \helpref{wxGetUserHome
}{wxgetuserhome
}\\
138 \helpref{wxGetUserId
}{wxgetuserid
}\\
139 \helpref{wxGetUserName
}{wxgetusername
}\\
140 \helpref{wxGetWorkingDirectory
}{wxgetworkingdirectory
}\\
141 \helpref{wxGetenv
}{wxgetenvmacro
}\\
142 \helpref{wxHandleFatalExceptions
}{wxhandlefatalexceptions
}\\
143 \helpref{wxICON
}{wxiconmacro
}\\
144 \helpref{wxINTXX
\_SWAP\_ALWAYS}{intswapalways
}\\
145 \helpref{wxINTXX
\_SWAP\_ON\_BE}{intswaponbe
}\\
146 \helpref{wxINTXX
\_SWAP\_ON\_LE}{intswaponle
}\\
147 \helpref{wxInitAllImageHandlers
}{wxinitallimagehandlers
}\\
148 \helpref{wxInitialize
}{wxinitialize
}\\
149 \helpref{wxIsAbsolutePath
}{wxisabsolutepath
}\\
150 \helpref{wxIsBusy
}{wxisbusy
}\\
151 \helpref{wxIsClipboardFormatAvailable
}{wxisclipboardformatavailable
}\\
152 \helpref{wxIsDebuggerRunning
}{wxisdebuggerrunning
}\\
153 \helpref{wxIsEmpty
}{wxisempty
}\\
154 \helpref{wxIsMainThread
}{wxismainthread
}\\
155 \helpref{wxIsNaN
}{wxisnan
}\\
156 \helpref{wxIsWild
}{wxiswild
}\\
157 \helpref{wxKill
}{wxkill
}\\
158 \helpref{wxLEAVE
\_CRIT\_SECT}{wxleavecritsect
}\\
159 \helpref{wxLoadUserResource
}{wxloaduserresource
}\\
160 \helpref{wxLogDebug
}{wxlogdebug
}\\
161 \helpref{wxLogError
}{wxlogerror
}\\
162 \helpref{wxLogFatalError
}{wxlogfatalerror
}\\
163 \helpref{wxLogMessage
}{wxlogmessage
}\\
164 \helpref{wxLogStatus
}{wxlogstatus
}\\
165 \helpref{wxLogSysError
}{wxlogsyserror
}\\
166 \helpref{wxLogTrace
}{wxlogtrace
}\\
167 \helpref{wxLogVerbose
}{wxlogverbose
}\\
168 \helpref{wxLogWarning
}{wxlogwarning
}\\
169 \helpref{wxLL
}{wxll
}\\
170 \helpref{wxLongLongFmtSpec
}{wxlonglongfmtspec
}\\
171 \helpref{wxMakeMetafilePlaceable
}{wxmakemetafileplaceable
}\\
172 \helpref{wxMatchWild
}{wxmatchwild
}\\
173 \helpref{wxMessageBox
}{wxmessagebox
}\\
174 \helpref{wxMkdir
}{wxmkdir
}\\
175 \helpref{wxMutexGuiEnter
}{wxmutexguienter
}\\
176 \helpref{wxMutexGuiLeave
}{wxmutexguileave
}\\
177 \helpref{wxNewId
}{wxnewid
}\\
178 \helpref{wxNow
}{wxnow
}\\
179 \helpref{wxOnAssert
}{wxonassert
}\\
180 \helpref{wxOpenClipboard
}{wxopenclipboard
}\\
181 \helpref{wxPathOnly
}{wxpathonly
}\\
182 \helpref{wxPostDelete
}{wxpostdelete
}\\
183 \helpref{wxPostEvent
}{wxpostevent
}\\
184 \helpref{wxRegisterClipboardFormat
}{wxregisterclipboardformat
}\\
185 \helpref{wxRegisterId
}{wxregisterid
}\\
186 \helpref{wxRemoveFile
}{wxremovefile
}\\
187 \helpref{wxRenameFile
}{wxrenamefile
}\\
188 \helpref{wxRmdir
}{wxrmdir
}\\
189 \helpref{wxSafeShowMessage
}{wxsafeshowmessage
}\\
190 \helpref{wxSafeYield
}{wxsafeyield
}\\
191 \helpref{wxSetClipboardData
}{wxsetclipboarddata
}\\
192 \helpref{wxSetCursor
}{wxsetcursor
}\\
193 \helpref{wxSetDisplayName
}{wxsetdisplayname
}\\
194 \helpref{wxSetEnv
}{wxsetenv
}\\
195 \helpref{wxSetPrinterCommand
}{wxsetprintercommand
}\\
196 \helpref{wxSetPrinterFile
}{wxsetprinterfile
}\\
197 \helpref{wxSetPrinterMode
}{wxsetprintermode
}\\
198 \helpref{wxSetPrinterOptions
}{wxsetprinteroptions
}\\
199 \helpref{wxSetPrinterOrientation
}{wxsetprinterorientation
}\\
200 \helpref{wxSetPrinterPreviewCommand
}{wxsetprinterpreviewcommand
}\\
201 \helpref{wxSetPrinterScaling
}{wxsetprinterscaling
}\\
202 \helpref{wxSetPrinterTranslation
}{wxsetprintertranslation
}\\
203 \helpref{wxSetWorkingDirectory
}{wxsetworkingdirectory
}\\
204 \helpref{wxShell
}{wxshell
}\\
205 \helpref{wxShowTip
}{wxshowtip
}\\
206 \helpref{wxShutdown
}{wxshutdown
}\\
207 \helpref{wxSleep
}{wxsleep
}\\
208 \helpref{wxSnprintf
}{wxsnprintf
}\\
209 \helpref{wxSplitPath
}{wxsplitfunction
}\\
210 \helpref{wxStartTimer
}{wxstarttimer
}\\
211 \helpref{wxStaticCast
}{wxstaticcast
}\\
212 \helpref{wxStrcmp
}{wxstrcmp
}\\
213 \helpref{wxStricmp
}{wxstricmp
}\\
214 \helpref{wxStringEq
}{wxstringeq
}\\
215 \helpref{wxStringMatch
}{wxstringmatch
}\\
216 \helpref{wxStripMenuCodes
}{wxstripmenucodes
}\\
217 \helpref{wxStrlen
}{wxstrlen
}\\
218 \helpref{wxSysErrorCode
}{wxsyserrorcode
}\\
219 \helpref{wxSysErrorMsg
}{wxsyserrormsg
}\\
221 \helpref{wxToLower
}{wxtolower
}\\
222 \helpref{wxToUpper
}{wxtoupper
}\\
223 \helpref{wxTraceLevel
}{wxtracelevel
}\\
224 \helpref{wxTrace
}{wxtrace
}\\
225 \helpref{wxTransferFileToStream
}{wxtransferfiletostream
}\\
226 \helpref{wxTransferStreamToFile
}{wxtransferstreamtofile
}\\
227 \helpref{wxTrap
}{wxtrap
}\\
228 \helpref{wxUninitialize
}{wxuninitialize
}\\
229 \helpref{wxUnix2DosFilename
}{wxunix2dosfilename
}\\
230 \helpref{wxUnsetEnv
}{wxunsetenv
}\\
231 \helpref{wxUsleep
}{wxusleep
}\\
232 \helpref{wxVsnprintf
}{wxvsnprintf
}\\
233 \helpref{wxWakeUpIdle
}{wxwakeupidle
}\\
234 \helpref{wxWriteResource
}{wxwriteresource
}\\
235 \helpref{wxYield
}{wxyield
}\\
236 \helpref{\_}{underscore
}\\
237 \helpref{\_T}{underscoret
}
239 \section{Version macros
}\label{versionfunctions
}
241 The following constants are defined in wxWindows:
243 \begin{itemize
}\itemsep=
0pt
244 \item {\tt wxMAJOR
\_VERSION} is the major version of wxWindows
245 \item {\tt wxMINOR
\_VERSION} is the minor version of wxWindows
246 \item {\tt wxRELEASE
\_NUMBER} is the release number
249 For example, the values or these constants for wxWindows
2.1.15 are
2,
1 and
252 Additionally,
{\tt wxVERSION
\_STRING} is a user-readable string containing
253 the full wxWindows version and
{\tt wxVERSION
\_NUMBER} is a combination of the
254 three version numbers above: for
2.1.15, it is
2115 and it is
2200 for
257 \wxheading{Include files
}
259 <wx/version.h> or <wx/defs.h>
261 \membersection{wxCHECK
\_VERSION}\label{wxcheckversion
}
263 \func{bool
}{wxCHECK
\_VERSION}{\param{}{major, minor, release
}}
265 This is a macro which evaluates to true if the current wxWindows version is at
266 least major.minor.release.
268 For example, to test if the program is compiled with wxWindows
2.2 or higher,
269 the following can be done:
273 #if wxCHECK_VERSION(
2,
2,
0)
274 if ( s.StartsWith("foo") )
275 #else // replacement code for old version
276 if ( strncmp(s, "foo",
3) ==
0 )
283 \membersection{wxCHECK
\_GCC\_VERSION}\label{wxcheckgccversion
}
285 \func{bool
}{wxCHECK
\_GCC\_VERSION}{\param{}{major, minor, release
}}
287 Returns $
1$ if the compiler being used to compile the code is GNU C++
288 compiler (g++) version major.minor.release or greater. Otherwise, and also if
289 the compiler is not GNU C++ at all, returns $
0$.
291 \membersection{wxCHECK
\_W32API\_VERSION}\label{wxcheckw32apiversion
}
293 \func{bool
}{wxCHECK
\_GCC\_VERSION}{\param{}{major, minor, release
}}
295 Returns $
1$ if the version of w32api headers used is major.minor.release or
296 greater. Otherwise, and also if we are not compiling with mingw32/cygwin under
297 Win32 at all, returns $
0$.
299 \section{Application initialization and termination
}\label{appinifunctions
}
301 The functions in this section are used on application startup/shutdown and also
302 to control the behaviour of the main event loop of the GUI programs.
304 \membersection{::wxEntry
}\label{wxentry
}
306 This initializes wxWindows in a platform-dependent way. Use this if you
307 are not using the default wxWindows entry code (e.g. main or WinMain). For example,
308 you can initialize wxWindows from an Microsoft Foundation Classes application using
311 \func{void
}{wxEntry
}{\param{HANDLE
}{ hInstance
},
\param{HANDLE
}{ hPrevInstance
},
312 \param{const wxString\&
}{commandLine
},
\param{int
}{ cmdShow
},
\param{bool
}{ enterLoop = true
}}
314 wxWindows initialization under Windows (non-DLL). If
{\it enterLoop
} is false, the
315 function will return immediately after calling wxApp::OnInit. Otherwise, the wxWindows
316 message loop will be entered.
318 \func{void
}{wxEntry
}{\param{HANDLE
}{ hInstance
},
\param{HANDLE
}{ hPrevInstance
},
319 \param{WORD
}{ wDataSegment
},
\param{WORD
}{ wHeapSize
},
\param{const wxString\&
}{ commandLine
}}
321 wxWindows initialization under Windows (for applications constructed as a DLL).
323 \func{int
}{wxEntry
}{\param{int
}{ argc
},
\param{const wxString\& *
}{argv
}}
325 wxWindows initialization under Unix.
329 To clean up wxWindows, call wxApp::OnExit followed by the static function
330 wxApp::CleanUp. For example, if exiting from an MFC application that also uses wxWindows:
333 int CTheApp::ExitInstance()
335 // OnExit isn't called by CleanUp so must be called explicitly.
339 return CWinApp::ExitInstance();
343 \wxheading{Include files
}
348 \membersection{::wxGetApp
}\label{wxgetapp
}
350 \func{wxAppDerivedClass\&
}{wxGetApp
}{\void}
352 This function doesn't exist in wxWindows but it is created by using
353 the
\helpref{IMPLEMENT
\_APP}{implementapp
} macro. Thus, before using it
354 anywhere but in the same module where this macro is used, you must make it
355 available using
\helpref{DECLARE
\_APP}{declareapp
}.
357 The advantage of using this function compared to directly using the global
358 wxTheApp pointer is that the latter is of type
{\tt wxApp *
} and so wouldn't
359 allow you to access the functions specific to your application class but not
360 present in wxApp while wxGetApp() returns the object of the right type.
362 \membersection{::wxHandleFatalExceptions
}\label{wxhandlefatalexceptions
}
364 \func{bool
}{wxHandleFatalExceptions
}{\param{bool
}{ doIt = true
}}
366 If
{\it doIt
} is true, the fatal exceptions (also known as general protection
367 faults under Windows or segmentation violations in the Unix world) will be
368 caught and passed to
\helpref{wxApp::OnFatalException
}{wxapponfatalexception
}.
369 By default, i.e. before this function is called, they will be handled in the
370 normal way which usually just means that the application will be terminated.
371 Calling wxHandleFatalExceptions() with
{\it doIt
} equal to false will restore
372 this default behaviour.
374 \membersection{::wxInitAllImageHandlers
}\label{wxinitallimagehandlers
}
376 \func{void
}{wxInitAllImageHandlers
}{\void}
378 Initializes all available image handlers. For a list of available handlers,
379 see
\helpref{wxImage
}{wximage
}.
383 \helpref{wxImage
}{wximage
},
\helpref{wxImageHandler
}{wximagehandler
}
385 \wxheading{Include files
}
389 \membersection{::wxInitialize
}\label{wxinitialize
}
391 \func{bool
}{wxInitialize
}{\void}
393 This function is used in wxBase only and only if you don't create
394 \helpref{wxApp
}{wxapp
} object at all. In this case you must call it from your
395 {\tt main()
} function before calling any other wxWindows functions.
397 If the function returns
{\tt false
} the initialization could not be performed,
398 in this case the library cannot be used and
399 \helpref{wxUninitialize
}{wxuninitialize
} shouldn't be called neither.
401 This function may be called several times but
402 \helpref{wxUninitialize
}{wxuninitialize
} must be called for each successful
403 call to this function.
405 \wxheading{Include files
}
409 \membersection{::wxSafeYield
}\label{wxsafeyield
}
411 \func{bool
}{wxSafeYield
}{\param{wxWindow*
}{ win = NULL
},
\param{bool
}{
412 onlyIfNeeded = false
}}
414 This function is similar to wxYield, except that it disables the user input to
415 all program windows before calling wxYield and re-enables it again
416 afterwards. If
{\it win
} is not NULL, this window will remain enabled,
417 allowing the implementation of some limited user interaction.
419 Returns the result of the call to
\helpref{::wxYield
}{wxyield
}.
421 \wxheading{Include files
}
425 \membersection{::wxUninitialize
}\label{wxuninitialize
}
427 \func{void
}{wxUninitialize
}{\void}
429 This function is for use in console (wxBase) programs only. It must be called
430 once for each previous successful call to
\helpref{wxInitialize
}{wxinitialize
}.
432 \wxheading{Include files
}
436 \membersection{::wxYield
}\label{wxyield
}
438 \func{bool
}{wxYield
}{\void}
440 Calls
\helpref{wxApp::Yield
}{wxappyield
}.
442 This function is kept only for backwards compatibility. Please use
443 the
\helpref{wxApp::Yield
}{wxappyield
} method instead in any new code.
445 \wxheading{Include files
}
447 <wx/app.h> or <wx/utils.h>
449 \membersection{::wxWakeUpIdle
}\label{wxwakeupidle
}
451 \func{void
}{wxWakeUpIdle
}{\void}
453 This functions wakes up the (internal and platform dependent) idle system, i.e. it
454 will force the system to send an idle event even if the system currently
{\it is
}
455 idle and thus would not send any idle event until after some other event would get
456 sent. This is also useful for sending events between two threads and is used by
457 the corresponding functions
\helpref{::wxPostEvent
}{wxpostevent
} and
458 \helpref{wxEvtHandler::AddPendingEvent
}{wxevthandleraddpendingevent
}.
460 \wxheading{Include files
}
464 \section{Process control functions
}\label{processfunctions
}
466 The functions in this section are used to launch or terminate the other
469 \membersection{::wxExecute
}\label{wxexecute
}
471 \func{long
}{wxExecute
}{\param{const wxString\&
}{command
},
\param{int
}{sync = wxEXEC
\_ASYNC},
\param{wxProcess *
}{callback = NULL
}}
473 \func{long
}{wxExecute
}{\param{char **
}{argv
},
\param{int
}{flags = wxEXEC
\_ASYNC},
\param{wxProcess *
}{callback = NULL
}}
475 \func{long
}{wxExecute
}{\param{const wxString\&
}{command
},
\param{wxArrayString\&
}{output
}}
477 \perlnote{In wxPerl this function only takes the
{\tt command
} argument,
478 and returns a
2-element list
{\tt ( status, output )
}, where
{\tt output
} is
481 \func{long
}{wxExecute
}{\param{const wxString\&
}{command
},
\param{wxArrayString\&
}{output
},
\param{wxArrayString\&
}{errors
}}
483 \perlnote{In wxPerl this function only takes the
{\tt command
} argument,
484 and returns a
3-element list
{\tt ( status, output, errors )
}, where
485 {\tt output
} and
{\tt errors
} are array references.
}
487 Executes another program in Unix or Windows.
489 The first form takes a command string, such as
{\tt "emacs file.txt"
}.
491 The second form takes an array of values: a command, any number of
492 arguments, terminated by NULL.
494 The semantics of the third and fourth versions is different from the first two
495 and is described in more details below.
497 If
{\it flags
} parameter contains
{\tt wxEXEC
\_ASYNC} flag (the default), flow
498 of control immediately returns. If it contains
{\tt wxEXEC
\_SYNC}, the current
499 application waits until the other program has terminated.
501 In the case of synchronous execution, the return value is the exit code of
502 the process (which terminates by the moment the function returns) and will be
503 $-
1$ if the process couldn't be started and typically
0 if the process
504 terminated successfully. Also, while waiting for the process to
505 terminate, wxExecute will call
\helpref{wxYield
}{wxyield
}. The caller
506 should ensure that this can cause no recursion, in the simplest case by
507 calling
\helpref{wxEnableTopLevelWindows(false)
}{wxenabletoplevelwindows
}.
509 For asynchronous execution, however, the return value is the process id and
510 zero value indicates that the command could not be executed. As an added
511 complication, the return value of $-
1$ in this case indicates that we didn't
512 launch a new process, but connected to the running one (this can only happen in
513 case of using DDE under Windows for command execution). In particular, in this,
514 and only this, case the calling code will not get the notification about
517 If callback isn't NULL and if execution is asynchronous,
518 \helpref{wxProcess::OnTerminate
}{wxprocessonterminate
} will be called when
519 the process finishes. Specifying this parameter also allows you to redirect the
520 standard input and/or output of the process being launched by calling
521 \helpref{Redirect
}{wxprocessredirect
}. If the child process IO is redirected,
522 under Windows the process window is not shown by default (this avoids having to
523 flush an unnecessary console for the processes which don't create any windows
524 anyhow) but a
{\tt wxEXEC
\_NOHIDE} flag can be used to prevent this from
525 happening, i.e. with this flag the child process window will be shown normally.
527 Under Unix the flag
{\tt wxEXEC
\_MAKE\_GROUP\_LEADER} may be used to ensure
528 that the new process is a group leader (this will create a new session if
529 needed). Calling
\helpref{wxKill
}{wxkill
} with the argument of -pid where pid
530 is the process ID of the new process will kill this process as well as all of
531 its children (except those which have started their own session).
533 Finally, you may use the third overloaded version of this function to execute
534 a process (always synchronously) and capture its output in the array
535 {\it output
}. The fourth version adds the possibility to additionally capture
536 the messages from standard error output in the
{\it errors
} array.
538 {\bf NB:
} Currently wxExecute() can only be used from the main thread, calling
539 this function from another thread will result in an assert failure in debug
540 build and won't work.
544 \helpref{wxShell
}{wxshell
},
\helpref{wxProcess
}{wxprocess
},
\helpref{Exec sample
}{sampleexec
}.
546 \wxheading{Parameters
}
548 \docparam{command
}{The command to execute and any parameters to pass to it as a
551 \docparam{argv
}{The command to execute should be the first element of this
552 array, any additional ones are the command parameters and the array must be
553 terminated with a NULL pointer.
}
555 \docparam{flags
}{Combination of bit masks
{\tt wxEXEC
\_ASYNC},
556 {\tt wxEXEC
\_SYNC} and
{\tt wxEXEC
\_NOHIDE}}
558 \docparam{callback
}{An optional pointer to
\helpref{wxProcess
}{wxprocess
}}
560 \wxheading{Include files
}
564 \membersection{::wxExit
}\label{wxexit
}
566 \func{void
}{wxExit
}{\void}
568 Exits application after calling
\helpref{wxApp::OnExit
}{wxapponexit
}.
569 Should only be used in an emergency: normally the top-level frame
570 should be deleted (after deleting all other frames) to terminate the
571 application. See
\helpref{wxCloseEvent
}{wxcloseevent
} and
\helpref{wxApp
}{wxapp
}.
573 \wxheading{Include files
}
577 \membersection{::wxKill
}\label{wxkill
}
579 \func{int
}{wxKill
}{\param{long
}{ pid
},
\param{int
}{ sig = wxSIGTERM
},
\param{wxKillError
}{*rc = NULL
}}
581 Equivalent to the Unix kill function: send the given signal
{\it sig
} to the
582 process with PID
{\it pid
}. The valid signal values are
587 wxSIGNONE =
0, // verify if the process exists under Unix
596 wxSIGKILL, // forcefully kill, dangerous!
602 wxSIGTERM // terminate the process gently
606 {\tt wxSIGNONE
},
{\tt wxSIGKILL
} and
{\tt wxSIGTERM
} have the same meaning
607 under both Unix and Windows but all the other signals are equivalent to
608 {\tt wxSIGTERM
} under Windows.
610 Returns
0 on success, -
1 on failure. If
{\it rc
} parameter is not NULL, it will
611 be filled with an element of
{\tt wxKillError
} enum:
616 wxKILL_OK, // no error
617 wxKILL_BAD_SIGNAL, // no such signal
618 wxKILL_ACCESS_DENIED, // permission denied
619 wxKILL_NO_PROCESS, // no such process
620 wxKILL_ERROR // another, unspecified error
626 \helpref{wxProcess::Kill
}{wxprocesskill
},
\rtfsp
627 \helpref{wxProcess::Exists
}{wxprocessexists
},
\rtfsp
628 \helpref{Exec sample
}{sampleexec
}
630 \wxheading{Include files
}
634 \membersection{::wxGetProcessId
}\label{wxgetprocessid
}
636 \func{unsigned long
}{wxGetProcessId
}{\void}
638 Returns the number uniquely identifying the current process in the system.
640 If an error occurs, $
0$ is returned.
642 \wxheading{Include files
}
646 \membersection{::wxShell
}\label{wxshell
}
648 \func{bool
}{wxShell
}{\param{const wxString\&
}{command = NULL
}}
650 Executes a command in an interactive shell window. If no command is
651 specified, then just the shell is spawned.
653 See also
\helpref{wxExecute
}{wxexecute
},
\helpref{Exec sample
}{sampleexec
}.
655 \wxheading{Include files
}
659 \membersection{::wxShutdown
}\label{wxshutdown
}
661 \func{bool
}{wxShutdown
}{\param{wxShutdownFlags
}{flags
}}
663 This function shuts down or reboots the computer depending on the value of the
664 {\it flags
}. Please notice that doing this requires the corresponding access
665 rights (superuser under Unix,
{\tt SE
\_SHUTDOWN} privelege under Windows NT)
666 and that this function is only implemented under Unix and Win32.
668 \wxheading{Parameters
}
670 \docparam{flags
}{Either
{\tt wxSHUTDOWN
\_POWEROFF} or
{\tt wxSHUTDOWN
\_REBOOT}}
674 {\tt true
} on success,
{\tt false
} if an error occured.
676 \wxheading{Include files
}
680 \section{Thread functions
}\label{threadfunctions
}
682 The functions and macros here mainly exist to make it writing the code which
683 may be compiled in multi thread build (
{\tt wxUSE
\_THREADS} $=
1$) as well as
684 in single thread configuration (
{\tt wxUSE
\_THREADS} $=
0$).
686 For example, a static variable must be protected against simultaneous access by
687 multiple threads in the former configuration but in the latter the extra
688 overhead of using the critical section is not needed. To solve this problem,
689 the
\helpref{wxCRITICAL
\_SECTION}{wxcriticalsectionmacro
} macro may be used
690 to create and use the critical section only when needed.
692 \wxheading{Include files
}
698 \helpref{wxThread
}{wxthread
},
\helpref{wxMutex
}{wxmutex
},
\helpref{Multithreading overview
}{wxthreadoverview
}
701 \membersection{wxCRIT
\_SECT\_DECLARE}\label{wxcritsectdeclare
}
703 \func{}{wxCRIT
\_SECT\_DECLARE}{\param{}{cs
}}
705 This macro declares a (static) critical section object named
{\it cs
} if
706 {\tt wxUSE
\_THREADS} is $
1$ and does nothing if it is $
0$.
709 \membersection{wxCRIT
\_SECT\_DECLARE\_MEMBER}\label{wxcritsectdeclaremember
}
711 \func{}{wxCRIT
\_SECT\_DECLARE}{\param{}{cs
}}
713 This macro declares a critical section object named
{\it cs
} if
714 {\tt wxUSE
\_THREADS} is $
1$ and does nothing if it is $
0$. As it doesn't
715 include the
{\tt static
} keyword (unlike
716 \helpref{wxCRIT
\_SECT\_DECLARE}{wxcritsectdeclare
}), it can be used to declare
717 a class or struct member which explains its name.
720 \membersection{wxCRIT
\_SECT\_LOCKER}\label{wxcritsectlocker
}
722 \func{}{wxCRIT
\_SECT\_LOCKER}{\param{}{name
},
\param{}{cs
}}
724 This macro creates a
\helpref{critical section lock
}{wxcriticalsectionlocker
}
725 object named
{\it name
} and associated with the critical section
{\it cs
} if
726 {\tt wxUSE
\_THREADS} is $
1$ and does nothing if it is $
0$.
729 \membersection{wxCRITICAL
\_SECTION}\label{wxcriticalsectionmacro
}
731 \func{}{wxCRITICAL
\_SECTION}{\param{}{name
}}
733 This macro combines
\helpref{wxCRIT
\_SECT\_DECLARE}{wxcritsectdeclare
} and
734 \helpref{wxCRIT
\_SECT\_LOCKER}{wxcritsectlocker
}: it creates a static critical
735 section object and also the lock object associated with it. Because of this, it
736 can be only used inside a function, not at global scope. For example:
741 static int s_counter =
0;
743 wxCRITICAL_SECTION(counter);
749 (note that we suppose that the function is called the first time from the main
750 thread so that the critical section object is initialized correctly by the time
751 other threads start calling it, if this is not the case this approach can
752 {\bf not
} be used and the critical section must be made a global instead).
755 \membersection{wxENTER
\_CRIT\_SECT}\label{wxentercritsect
}
757 \func{}{wxENTER
\_CRIT\_SECT}{\param{wxCriticalSection\&
}{cs
}}
759 This macro is equivalent to
\helpref{cs.Enter()
}{wxcriticalsectionenter
} if
760 {\tt wxUSE
\_THREADS} is $
1$ and does nothing if it is $
0$.
763 \membersection{::wxIsMainThread
}\label{wxismainthread
}
765 \func{bool
}{wxIsMainThread
}{\void}
767 Returns
{\tt true
} if this thread is the main one. Always returns
{\tt true
} if
768 {\tt wxUSE
\_THREADS} is $
0$.
771 \membersection{wxLEAVE
\_CRIT\_SECT}\label{wxleavecritsect
}
773 \func{}{wxLEAVE
\_CRIT\_SECT}{\param{wxCriticalSection\&
}{cs
}}
775 This macro is equivalent to
\helpref{cs.Leave()
}{wxcriticalsectionleave
} if
776 {\tt wxUSE
\_THREADS} is $
1$ and does nothing if it is $
0$.
779 \membersection{::wxMutexGuiEnter
}\label{wxmutexguienter
}
781 \func{void
}{wxMutexGuiEnter
}{\void}
783 This function must be called when any thread other than the main GUI thread
784 wants to get access to the GUI library. This function will block the execution
785 of the calling thread until the main thread (or any other thread holding the
786 main GUI lock) leaves the GUI library and no other thread will enter the GUI
787 library until the calling thread calls
\helpref{::wxMutexGuiLeave()
}{wxmutexguileave
}.
789 Typically, these functions are used like this:
792 void MyThread::Foo(void)
794 // before doing any GUI calls we must ensure that this thread is the only
800 my_window->DrawSomething();
806 Note that under GTK, no creation of top-level windows is allowed in any
807 thread but the main one.
809 This function is only defined on platforms which support preemptive
812 \membersection{::wxMutexGuiLeave
}\label{wxmutexguileave
}
814 \func{void
}{wxMutexGuiLeave
}{\void}
816 See
\helpref{::wxMutexGuiEnter()
}{wxmutexguienter
}.
818 This function is only defined on platforms which support preemptive
821 \section{File functions
}\label{filefunctions
}
823 \wxheading{Include files
}
829 \helpref{wxPathList
}{wxpathlist
}\\
830 \helpref{wxDir
}{wxdir
}\\
831 \helpref{wxFile
}{wxfile
}\\
832 \helpref{wxFileName
}{wxfilename
}
834 \membersection{::wxDirExists
}\label{functionwxdirexists
}
836 \func{bool
}{wxDirExists
}{\param{const wxString\&
}{dirname
}}
838 Returns true if the directory exists.
840 \membersection{::wxDos2UnixFilename
}\label{wxdos2unixfilename
}
842 \func{void
}{wxDos2UnixFilename
}{\param{wxChar *
}{s
}}
844 Converts a DOS to a Unix filename by replacing backslashes with forward
847 \membersection{::wxFileExists
}\label{functionwxfileexists
}
849 \func{bool
}{wxFileExists
}{\param{const wxString\&
}{filename
}}
851 Returns true if the file exists. It also returns true if the file is
854 \membersection{::wxFileModificationTime
}\label{wxfilemodificationtime
}
856 \func{time
\_t}{wxFileModificationTime
}{\param{const wxString\&
}{filename
}}
858 Returns time of last modification of given file.
860 \membersection{::wxFileNameFromPath
}\label{wxfilenamefrompath
}
862 \func{wxString
}{wxFileNameFromPath
}{\param{const wxString\&
}{path
}}
864 \func{char *
}{wxFileNameFromPath
}{\param{char *
}{path
}}
866 {\bf NB:
} This function is obsolete, please use
867 \helpref{wxFileName::SplitPath
}{wxfilenamesplitpath
} instead.
869 Returns the filename for a full path. The second form returns a pointer to
870 temporary storage that should not be deallocated.
872 \membersection{::wxFindFirstFile
}\label{wxfindfirstfile
}
874 \func{wxString
}{wxFindFirstFile
}{\param{const char *
}{spec
},
\param{int
}{ flags =
0}}
876 This function does directory searching; returns the first file
877 that matches the path
{\it spec
}, or the empty string. Use
\helpref{wxFindNextFile
}{wxfindnextfile
} to
878 get the next matching file. Neither will
report the current directory "." or the
879 parent directory "..".
881 {\it spec
} may contain wildcards.
883 {\it flags
} may be wxDIR for restricting the query to directories, wxFILE for files or zero for either.
888 wxString f = wxFindFirstFile("/home/project/*.*");
889 while ( !f.IsEmpty() )
892 f = wxFindNextFile();
896 \membersection{::wxFindNextFile
}\label{wxfindnextfile
}
898 \func{wxString
}{wxFindNextFile
}{\void}
900 Returns the next file that matches the path passed to
\helpref{wxFindFirstFile
}{wxfindfirstfile
}.
902 See
\helpref{wxFindFirstFile
}{wxfindfirstfile
} for an example.
904 \membersection{::wxGetDiskSpace
}\label{wxgetdiskspace
}
906 \func{bool
}{wxGetDiskSpace
}{\param{const wxString\&
}{path
},
\param{wxLongLong
}{*total = NULL
},
\param{wxLongLong
}{*free = NULL
}}
908 This function returns the total number of bytes and number of free bytes on
909 the disk containing the directory
{\it path
} (it should exist). Both
910 {\it total
} and
{\it free
} parameters may be
{\tt NULL
} if the corresponding
911 information is not needed.
915 {\tt true
} on success,
{\tt false
} if an error occured (for example, the
916 directory doesn't exist).
918 \wxheading{Portability
}
920 This function is implemented for Win16 (only for drives less than
2Gb), Win32,
921 Mac OS and generic Unix provided the system has
{\tt statfs()
} function.
923 This function first appeared in wxWindows
2.3.2.
925 \membersection{::wxGetOSDirectory
}\label{wxgetosdirectory
}
927 \func{wxString
}{wxGetOSDirectory
}{\void}
929 Returns the Windows directory under Windows; on other platforms returns the empty string.
931 \membersection{::wxIsAbsolutePath
}\label{wxisabsolutepath
}
933 \func{bool
}{wxIsAbsolutePath
}{\param{const wxString\&
}{filename
}}
935 Returns true if the argument is an absolute filename, i.e. with a slash
936 or drive name at the beginning.
938 \membersection{::wxPathOnly
}\label{wxpathonly
}
940 \func{wxString
}{wxPathOnly
}{\param{const wxString\&
}{path
}}
942 Returns the directory part of the filename.
944 \membersection{::wxUnix2DosFilename
}\label{wxunix2dosfilename
}
946 \func{void
}{wxUnix2DosFilename
}{\param{const wxString\&
}{s
}}
948 Converts a Unix to a DOS filename by replacing forward
949 slashes with backslashes.
951 \membersection{::wxConcatFiles
}\label{wxconcatfiles
}
953 \func{bool
}{wxConcatFiles
}{\param{const wxString\&
}{file1
},
\param{const wxString\&
}{file2
},
954 \param{const wxString\&
}{file3
}}
956 Concatenates
{\it file1
} and
{\it file2
} to
{\it file3
}, returning
959 \membersection{::wxCopyFile
}\label{wxcopyfile
}
961 \func{bool
}{wxCopyFile
}{\param{const wxString\&
}{file1
},
\param{const wxString\&
}{file2
},
\param{bool
}{overwrite = true
}}
963 Copies
{\it file1
} to
{\it file2
}, returning true if successful. If
964 {\it overwrite
} parameter is true (default), the destination file is overwritten
965 if it exists, but if
{\it overwrite
} is false, the functions fails in this
968 \membersection{::wxGetCwd
}\label{wxgetcwd
}
970 \func{wxString
}{wxGetCwd
}{\void}
972 Returns a string containing the current (or working) directory.
974 \membersection{::wxGetWorkingDirectory
}\label{wxgetworkingdirectory
}
976 \func{wxString
}{wxGetWorkingDirectory
}{\param{char *
}{buf=NULL
},
\param{int
}{sz=
1000}}
978 {\bf NB:
} This function is obsolete: use
\helpref{wxGetCwd
}{wxgetcwd
} instead.
980 Copies the current working directory into the buffer if supplied, or
981 copies the working directory into new storage (which you must delete yourself)
982 if the buffer is NULL.
984 {\it sz
} is the size of the buffer if supplied.
986 \membersection{::wxGetTempFileName
}\label{wxgettempfilename
}
988 \func{char *
}{wxGetTempFileName
}{\param{const wxString\&
}{prefix
},
\param{char *
}{buf=NULL
}}
990 \func{bool
}{wxGetTempFileName
}{\param{const wxString\&
}{prefix
},
\param{wxString\&
}{buf
}}
992 %% Makes a temporary filename based on {\it prefix}, opens and closes the file,
993 %% and places the name in {\it buf}. If {\it buf} is NULL, new store
994 %% is allocated for the temporary filename using {\it new}.
996 %% Under Windows, the filename will include the drive and name of the
997 %% directory allocated for temporary files (usually the contents of the
998 %% TEMP variable). Under Unix, the {\tt /tmp} directory is used.
1000 %% It is the application's responsibility to create and delete the file.
1002 {\bf NB:
} These functions are obsolete, please use
\rtfsp
1003 \helpref{wxFileName::CreateTempFileName
}{wxfilenamecreatetempfilename
}\rtfsp
1006 \membersection{::wxIsWild
}\label{wxiswild
}
1008 \func{bool
}{wxIsWild
}{\param{const wxString\&
}{pattern
}}
1010 Returns true if the pattern contains wildcards. See
\helpref{wxMatchWild
}{wxmatchwild
}.
1012 \membersection{::wxMatchWild
}\label{wxmatchwild
}
1014 \func{bool
}{wxMatchWild
}{\param{const wxString\&
}{pattern
},
\param{const wxString\&
}{text
},
\param{bool
}{ dot
\_special}}
1016 Returns true if the
{\it pattern
}\/ matches the
{\it text
}\/; if
{\it
1017 dot
\_special}\/ is true, filenames beginning with a dot are not matched
1018 with wildcard characters. See
\helpref{wxIsWild
}{wxiswild
}.
1020 \membersection{::wxMkdir
}\label{wxmkdir
}
1022 \func{bool
}{wxMkdir
}{\param{const wxString\&
}{dir
},
\param{int
}{perm =
0777}}
1024 Makes the directory
{\it dir
}, returning true if successful.
1026 {\it perm
} is the access mask for the directory for the systems on which it is
1027 supported (Unix) and doesn't have effect for the other ones.
1029 \membersection{::wxRemoveFile
}\label{wxremovefile
}
1031 \func{bool
}{wxRemoveFile
}{\param{const wxString\&
}{file
}}
1033 Removes
{\it file
}, returning true if successful.
1035 \membersection{::wxRenameFile
}\label{wxrenamefile
}
1037 \func{bool
}{wxRenameFile
}{\param{const wxString\&
}{file1
},
\param{const wxString\&
}{file2
}}
1039 Renames
{\it file1
} to
{\it file2
}, returning true if successful.
1041 \membersection{::wxRmdir
}\label{wxrmdir
}
1043 \func{bool
}{wxRmdir
}{\param{const wxString\&
}{dir
},
\param{int
}{ flags=
0}}
1045 Removes the directory
{\it dir
}, returning true if successful. Does not work under VMS.
1047 The
{\it flags
} parameter is reserved for future use.
1049 \membersection{::wxSetWorkingDirectory
}\label{wxsetworkingdirectory
}
1051 \func{bool
}{wxSetWorkingDirectory
}{\param{const wxString\&
}{dir
}}
1053 Sets the current working directory, returning true if the operation succeeded.
1054 Under MS Windows, the current drive is also changed if
{\it dir
} contains a drive specification.
1056 \membersection{::wxSplitPath
}\label{wxsplitfunction
}
1058 \func{void
}{wxSplitPath
}{\param{const char *
}{ fullname
},
\param{wxString *
}{ path
},
\param{wxString *
}{ name
},
\param{wxString *
}{ ext
}}
1060 {\bf NB:
} This function is obsolete, please use
1061 \helpref{wxFileName::SplitPath
}{wxfilenamesplitpath
} instead.
1063 This function splits a full file name into components: the path (including possible disk/drive
1064 specification under Windows), the base name and the extension. Any of the output parameters
1065 (
{\it path
},
{\it name
} or
{\it ext
}) may be NULL if you are not interested in the value of
1066 a particular component.
1068 wxSplitPath() will correctly handle filenames with both DOS and Unix path separators under
1069 Windows, however it will not consider backslashes as path separators under Unix (where backslash
1070 is a valid character in a filename).
1072 On entry,
{\it fullname
} should be non-NULL (it may be empty though).
1074 On return,
{\it path
} contains the file path (without the trailing separator),
{\it name
}
1075 contains the file name and
{\it ext
} contains the file extension without leading dot. All
1076 three of them may be empty if the corresponding component is. The old contents of the
1077 strings pointed to by these parameters will be overwritten in any case (if the pointers
1080 \membersection{::wxTransferFileToStream
}\label{wxtransferfiletostream
}
1082 \func{bool
}{wxTransferFileToStream
}{\param{const wxString\&
}{filename
},
\param{ostream\&
}{stream
}}
1084 Copies the given file to
{\it stream
}. Useful when converting an old application to
1085 use streams (within the
document/view framework, for example).
1087 \wxheading{Include files
}
1091 \membersection{::wxTransferStreamToFile
}\label{wxtransferstreamtofile
}
1093 \func{bool
}{wxTransferStreamToFile
}{\param{istream\&
}{stream
} \param{const wxString\&
}{filename
}}
1095 Copies the given stream to the file
{\it filename
}. Useful when converting an old application to
1096 use streams (within the
document/view framework, for example).
1098 \wxheading{Include files
}
1102 \section{Network, user and OS functions
}\label{networkfunctions
}
1104 The functions in this section are used to retrieve information about the
1105 current computer and/or user characteristics.
1107 \membersection{::wxGetFreeMemory
}\label{wxgetfreememory
}
1109 \func{long
}{wxGetFreeMemory
}{\void}
1111 Returns the amount of free memory in bytes under environments which
1112 support it, and -
1 if not supported. Currently, it is supported only
1113 under Windows, Linux and Solaris.
1115 \wxheading{Include files
}
1119 \membersection{::wxGetFullHostName
}\label{wxgetfullhostname
}
1121 \func{wxString
}{wxGetFullHostName
}{\void}
1123 Returns the FQDN (fully qualified domain host name) or an empty string on
1126 \wxheading{See also
}
1128 \helpref{wxGetHostName
}{wxgethostname
}
1130 \wxheading{Include files
}
1134 \membersection{::wxGetEmailAddress
}\label{wxgetemailaddress
}
1136 \func{bool
}{wxGetEmailAddress
}{\param{const wxString\&
}{buf
},
\param{int
}{sz
}}
1138 Copies the user's email address into the supplied buffer, by
1139 concatenating the values returned by
\helpref{wxGetFullHostName
}{wxgetfullhostname
}\rtfsp
1140 and
\helpref{wxGetUserId
}{wxgetuserid
}.
1142 Returns true if successful, false otherwise.
1144 \wxheading{Include files
}
1148 \membersection{::wxGetHomeDir
}\label{wxgethomedir
}
1150 \func{wxString
}{wxGetHomeDir
}{\void}
1152 Return the (current) user's home directory.
1154 \wxheading{See also
}
1156 \helpref{wxGetUserHome
}{wxgetuserhome
}
1158 \wxheading{Include files
}
1162 \membersection{::wxGetHostName
}\label{wxgethostname
}
1164 \func{wxString
}{wxGetHostName
}{\void}
1166 \func{bool
}{wxGetHostName
}{\param{char *
}{buf
},
\param{int
}{sz
}}
1168 Copies the current host machine's name into the supplied buffer. Please note
1169 that the returned name is
{\it not
} fully qualified, i.e. it does not include
1172 Under Windows or NT, this function first looks in the environment
1173 variable SYSTEM
\_NAME; if this is not found, the entry
{\bf HostName
}\rtfsp
1174 in the
{\bf wxWindows
} section of the WIN.INI file is tried.
1176 The first variant of this function returns the hostname if successful or an
1177 empty string otherwise. The second (deprecated) function returns true
1178 if successful, false otherwise.
1180 \wxheading{See also
}
1182 \helpref{wxGetFullHostName
}{wxgetfullhostname
}
1184 \wxheading{Include files
}
1188 \membersection{::wxGetUserId
}\label{wxgetuserid
}
1190 \func{wxString
}{wxGetUserId
}{\void}
1192 \func{bool
}{wxGetUserId
}{\param{char *
}{buf
},
\param{int
}{sz
}}
1194 This function returns the "user id" also known as "login name" under Unix i.e.
1195 something like "jsmith". It uniquely identifies the current user (on this system).
1197 Under Windows or NT, this function first looks in the environment
1198 variables USER and LOGNAME; if neither of these is found, the entry
{\bf UserId
}\rtfsp
1199 in the
{\bf wxWindows
} section of the WIN.INI file is tried.
1201 The first variant of this function returns the login name if successful or an
1202 empty string otherwise. The second (deprecated) function returns true
1203 if successful, false otherwise.
1205 \wxheading{See also
}
1207 \helpref{wxGetUserName
}{wxgetusername
}
1209 \wxheading{Include files
}
1213 \membersection{::wxGetOsDescription
}\label{wxgetosdescription
}
1215 \func{wxString
}{wxGetOsDescription
}{\void}
1217 Returns the string containing the description of the current platform in a
1218 user-readable form. For example, this function may return strings like
1219 {\tt Windows NT Version
4.0} or
{\tt Linux
2.2.2 i386
}.
1221 \wxheading{See also
}
1223 \helpref{::wxGetOsVersion
}{wxgetosversion
}
1225 \wxheading{Include files
}
1229 \membersection{::wxGetOsVersion
}\label{wxgetosversion
}
1231 \func{int
}{wxGetOsVersion
}{\param{int *
}{major = NULL
},
\param{int *
}{minor = NULL
}}
1233 Gets operating system version information.
1235 \begin{twocollist
}\itemsep=
0pt
1236 \twocolitemruled{Platform
}{Return types
}
1237 \twocolitem{Mac OS
}{Return value is wxMAC when compiled with CodeWarrior under Mac OS
8.x/
9.x and Mac OS X, wxMAC
\_DARWIN when compiled with the Apple Developer Tools under Mac OS X.
1239 Both
{\it major
} and
{\it minor
} have to be looked at as hexadecimal numbers. So System
10.2.4 returns
0x10, resp
16 for
{\it major
} and
0x24, resp
36 for
{\it minor
}.
}
1240 \twocolitem{GTK
}{Return value is wxGTK, For GTK
1.0,
{\it major
} is
1,
{\it minor
} is
0.
}
1241 \twocolitem{Motif
}{Return value is wxMOTIF
\_X,
{\it major
} is X version,
{\it minor
} is X revision.
}
1242 \twocolitem{OS/
2}{Return value is wxOS2
\_PM.
}
1243 \twocolitem{Windows
3.1}{Return value is wxWINDOWS,
{\it major
} is
3,
{\it minor
} is
1.
}
1244 \twocolitem{Windows NT/
2000}{Return value is wxWINDOWS
\_NT, version is returned in
{\it major
} and
{\it minor
}}
1245 \twocolitem{Windows
98}{Return value is wxWIN95,
{\it major
} is
4,
{\it minor
} is
1 or greater.
}
1246 \twocolitem{Windows
95}{Return value is wxWIN95,
{\it major
} is
4,
{\it minor
} is
0.
}
1247 \twocolitem{Win32s (Windows
3.1)
}{Return value is wxWIN32S,
{\it major
} is
3,
{\it minor
} is
1.
}
1248 \twocolitem{Watcom C++
386 supervisor mode (Windows
3.1)
}{Return value is wxWIN386,
{\it major
} is
3,
{\it minor
} is
1.
}
1251 \wxheading{See also
}
1253 \helpref{::wxGetOsDescription
}{wxgetosdescription
}
1255 \wxheading{Include files
}
1259 \membersection{::wxGetUserHome
}\label{wxgetuserhome
}
1261 \func{const wxChar *
}{wxGetUserHome
}{\param{const wxString\&
}{user = ""
}}
1263 Returns the home directory for the given user. If the username is empty
1264 (default value), this function behaves like
1265 \helpref{wxGetHomeDir
}{wxgethomedir
}.
1267 \wxheading{Include files
}
1271 \membersection{::wxGetUserName
}\label{wxgetusername
}
1273 \func{wxString
}{wxGetUserName
}{\void}
1275 \func{bool
}{wxGetUserName
}{\param{char *
}{buf
},
\param{int
}{sz
}}
1277 This function returns the full user name (something like "Mr. John Smith").
1279 Under Windows or NT, this function looks for the entry
{\bf UserName
}\rtfsp
1280 in the
{\bf wxWindows
} section of the WIN.INI file. If PenWindows
1281 is running, the entry
{\bf Current
} in the section
{\bf User
} of
1282 the PENWIN.INI file is used.
1284 The first variant of this function returns the user name if successful or an
1285 empty string otherwise. The second (deprecated) function returns
{\tt true
}
1286 if successful,
{\tt false
} otherwise.
1288 \wxheading{See also
}
1290 \helpref{wxGetUserId
}{wxgetuserid
}
1292 \wxheading{Include files
}
1296 \section{String functions
}
1298 \membersection{::copystring
}\label{copystring
}
1300 \func{char *
}{copystring
}{\param{const char *
}{s
}}
1302 Makes a copy of the string
{\it s
} using the C++ new operator, so it can be
1303 deleted with the
{\it delete
} operator.
1305 This function is deprecated, use
\helpref{wxString
}{wxstring
} class instead.
1307 \membersection{::wxGetTranslation
}\label{wxgettranslation
}
1309 \func{const char *
}{wxGetTranslation
}{\param{const char *
}{str
}}
1311 This function returns the translation of string
{\it str
} in the current
1312 \helpref{locale
}{wxlocale
}. If the string is not found in any of the loaded
1313 message catalogs (see
\helpref{internationalization overview
}{internationalization
}), the
1314 original string is returned. In debug build, an error message is logged -- this
1315 should help to find the strings which were not yet translated. As this function
1316 is used very often, an alternative (and also common in Unix world) syntax is
1317 provided: the
\helpref{\_()
}{underscore
} macro is defined to do the same thing
1318 as wxGetTranslation.
1320 \membersection{::wxIsEmpty
}\label{wxisempty
}
1322 \func{bool
}{wxIsEmpty
}{\param{const char *
}{ p
}}
1324 Returns
{\tt true
} if the pointer is either
{\tt NULL
} or points to an empty
1325 string,
{\tt false
} otherwise.
1327 \membersection{::wxStrcmp
}\label{wxstrcmp
}
1329 \func{int
}{wxStrcmp
}{\param{const char *
}{p1
},
\param{const char *
}{p2
}}
1331 Returns a negative value,
0, or positive value if
{\it p1
} is less than, equal
1332 to or greater than
{\it p2
}. The comparison is case-sensitive.
1334 This function complements the standard C function
{\it stricmp()
} which performs
1335 case-insensitive comparison.
1337 \membersection{::wxStricmp
}\label{wxstricmp
}
1339 \func{int
}{wxStricmp
}{\param{const char *
}{p1
},
\param{const char *
}{p2
}}
1341 Returns a negative value,
0, or positive value if
{\it p1
} is less than, equal
1342 to or greater than
{\it p2
}. The comparison is case-insensitive.
1344 This function complements the standard C function
{\it strcmp()
} which performs
1345 case-sensitive comparison.
1347 \membersection{::wxStringMatch
}\label{wxstringmatch
}
1349 \func{bool
}{wxStringMatch
}{\param{const wxString\&
}{s1
},
\param{const wxString\&
}{s2
},\\
1350 \param{bool
}{ subString = true
},
\param{bool
}{ exact = false
}}
1352 {\bf NB:
} This function is obsolete, use
\helpref{wxString::Find
}{wxstringfind
} instead.
1354 Returns
{\tt true
} if the substring
{\it s1
} is found within
{\it s2
},
1355 ignoring case if
{\it exact
} is false. If
{\it subString
} is
{\tt false
},
1356 no substring matching is done.
1358 \membersection{::wxStringEq
}\label{wxstringeq
}
1360 \func{bool
}{wxStringEq
}{\param{const wxString\&
}{s1
},
\param{const wxString\&
}{s2
}}
1362 {\bf NB:
} This function is obsolete, use
\helpref{wxString
}{wxstring
} instead.
1367 #define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) ==
0))
1370 \membersection{::wxStrlen
}\label{wxstrlen
}
1372 \func{size
\_t}{wxStrlen
}{\param{const char *
}{ p
}}
1374 This is a safe version of standard function
{\it strlen()
}: it does exactly the
1375 same thing (i.e. returns the length of the string) except that it returns
0 if
1376 {\it p
} is the
{\tt NULL
} pointer.
1378 \membersection{::wxSnprintf
}\label{wxsnprintf
}
1380 \func{int
}{wxSnprintf
}{\param{wxChar *
}{buf
},
\param{size
\_t }{len
},
\param{const wxChar *
}{format
},
\param{}{...
}}
1382 This function replaces the dangerous standard function
{\tt sprintf()
} and is
1383 like
{\tt snprintf()
} available on some platforms. The only difference with
1384 sprintf() is that an additional argument - buffer size - is taken and the
1385 buffer is never overflowed.
1387 Returns the number of characters copied to the buffer or -
1 if there is not
1390 \wxheading{See also
}
1392 \helpref{wxVsnprintf
}{wxvsnprintf
},
\helpref{wxString::Printf
}{wxstringprintf
}
1394 \membersection{wxT
}\label{wxt
}
1396 \func{wxChar
}{wxT
}{\param{char
}{ch
}}
1398 \func{const wxChar *
}{wxT
}{\param{const char *
}{s
}}
1400 wxT() is a macro which can be used with character and string literals (in other
1401 words,
{\tt 'x'
} or
{\tt "foo"
}) to automatically convert them to Unicode in
1402 Unicode build configuration. Please see the
1403 \helpref{Unicode overview
}{unicode
} for more information.
1405 This macro is simply returns the value passed to it without changes in ASCII
1406 build. In fact, its definition is:
1409 #define wxT(x) L ## x
1415 \membersection{wxTRANSLATE
}\label{wxtranslate
}
1417 \func{const wxChar *
}{wxTRANSLATE
}{\param{const char *
}{s
}}
1419 This macro doesn't do anything in the program code -- it simply expands to the
1420 value of its argument (expand in Unicode build where it is equivalent to
1421 \helpref{wxT
}{wxt
} which makes it unnecessary to use both wxTRANSLATE and wxT
1422 with the same string which would be really unreadable).
1424 However it does have a purpose and it is to mark the literal strings for the
1425 extraction into the message catalog created by
{\tt xgettext
} program. Usually
1426 this is achieved using
\helpref{\_()
}{underscore
} but that macro not only marks
1427 the string for extraction but also expands into
1428 \helpref{wxGetTranslation
}{wxgettranslation
} function call which means that it
1429 cannot be used in some situations, notably for the static arrays
1432 Here is an example which should make it more clear: suppose that you have a
1433 static array of strings containing the weekday names and which have to be
1434 translated (note that it is a bad example, really, as
1435 \helpref{wxDateTime
}{wxdatetime
} already can be used to get the localized week
1436 day names already). If you write
1438 static const wxChar * const weekdays
[] =
{ _("Mon"), ..., _("Sun")
};
1440 // use weekdays
[n
] as usual
1442 the code wouldn't compile because the function calls are forbidden in the array
1443 initializer. So instead you should do
1445 static const wxChar * const weekdays
[] =
{ wxTRANSLATE("Mon"), ..., wxTRANSLATE("Sun")
};
1447 // use wxGetTranslation(weekdays
[n
])
1451 Note that although the code
{\bf would
} compile if you simply omit
1452 wxTRANSLATE() in the above, it wouldn't work as expected because there would be
1453 no translations for the weekday names in the program message catalog and
1454 wxGetTranslation wouldn't find them.
1457 \membersection{::wxToLower
}\label{wxtolower
}
1459 \func{char
}{wxToLower
}{\param{char
}{ch
}}
1461 Converts the character to lower case. This is implemented as a macro for efficiency.
1463 \wxheading{Include files
}
1467 \membersection{::wxToUpper
}\label{wxtoupper
}
1469 \func{char
}{wxToUpper
}{\param{char
}{ch
}}
1471 Converts the character to upper case. This is implemented as a macro for efficiency.
1473 \wxheading{Include files
}
1477 \membersection{::wxVsnprintf
}\label{wxvsnprintf
}
1479 \func{int
}{wxVsnprintf
}{\param{wxChar *
}{buf
},
\param{size
\_t }{len
},
\param{const wxChar *
}{format
},
\param{va
\_list }{argPtr
}}
1481 The same as
\helpref{wxSnprintf
}{wxsnprintf
} but takes a
{\tt va
\_list }
1482 argument instead of arbitrary number of parameters.
1484 \wxheading{See also
}
1486 \helpref{wxSnprintf
}{wxsnprintf
},
\helpref{wxString::PrintfV
}{wxstringprintfv
}
1489 \membersection{\_}\label{underscore
}
1491 \func{const wxChar *
}{\_}{\param{const char *
}{s
}}
1493 This macro expands into a call to
\helpref{wxGetTranslation
}{wxgettranslation
}
1494 function, so it marks the message for the extraction by
{\tt xgettext
} just as
1495 \helpref{wxTRANSLATE
}{wxtranslate
} does, but also returns the translation of
1496 the string for the current locale during execution.
1498 Don't confuse this macro with
\helpref{\_T()
}{underscoret
}!
1501 \membersection{\_T}\label{underscoret
}
1503 \func{wxChar
}{\_T}{\param{char
}{ch
}}
1505 \func{const wxChar *
}{\_T}{\param{const wxChar
}{ch
}}
1507 This macro is exactly the same as
\helpref{wxT
}{wxt
} and is defined in
1508 wxWindows simply because it may be more intuitive for Windows programmers as
1509 the standard Win32 headers also define it (as well as yet another name for the
1510 same macro which is
{\tt \_TEXT()
}).
1512 Don't confuse this macro with
\helpref{\_()
}{underscore
}!
1514 \membersection{\_}\label{underscore
}
1516 \section{Dialog functions
}\label{dialogfunctions
}
1518 Below are a number of convenience functions for getting input from the
1519 user or displaying messages. Note that in these functions the last three
1520 parameters are optional. However, it is recommended to pass a parent frame
1521 parameter, or (in MS Windows or Motif) the wrong window frame may be brought to
1522 the front when the dialog box is popped up.
1524 \membersection{::wxBeginBusyCursor
}\label{wxbeginbusycursor
}
1526 \func{void
}{wxBeginBusyCursor
}{\param{wxCursor *
}{cursor = wxHOURGLASS
\_CURSOR}}
1528 Changes the cursor to the given cursor for all windows in the application.
1529 Use
\helpref{wxEndBusyCursor
}{wxendbusycursor
} to revert the cursor back
1530 to its previous state. These two calls can be nested, and a counter
1531 ensures that only the outer calls take effect.
1533 See also
\helpref{wxIsBusy
}{wxisbusy
},
\helpref{wxBusyCursor
}{wxbusycursor
}.
1535 \wxheading{Include files
}
1539 \membersection{::wxBell
}\label{wxbell
}
1541 \func{void
}{wxBell
}{\void}
1543 Ring the system bell.
1545 \wxheading{Include files
}
1549 \membersection{::wxCreateFileTipProvider
}\label{wxcreatefiletipprovider
}
1551 \func{wxTipProvider *
}{wxCreateFileTipProvider
}{\param{const wxString\&
}{filename
},
1552 \param{size
\_t }{currentTip
}}
1554 This function creates a
\helpref{wxTipProvider
}{wxtipprovider
} which may be
1555 used with
\helpref{wxShowTip
}{wxshowtip
}.
1557 \docparam{filename
}{The name of the file containing the tips, one per line
}
1558 \docparam{currentTip
}{The index of the first tip to show - normally this index
1559 is remembered between the
2 program runs.
}
1561 \wxheading{See also
}
1563 \helpref{Tips overview
}{tipsoverview
}
1565 \wxheading{Include files
}
1569 \membersection{::wxDirSelector
}\label{wxdirselector
}
1571 \func{wxString
}{wxDirSelector
}{\param{const wxString\&
}{message = wxDirSelectorPromptStr
},\\
1572 \param{const wxString\&
}{default
\_path = ""
},\\
1573 \param{long
}{style =
0},
\param{const wxPoint\&
}{pos = wxDefaultPosition
},\\
1574 \param{wxWindow *
}{parent = NULL
}}
1576 Pops up a directory selector dialog. The arguments have the same meaning as
1577 those of wxDirDialog::wxDirDialog(). The message is displayed at the top,
1578 and the default
\_path, if specified, is set as the initial selection.
1580 The application must check for an empty return value (if the user pressed
1581 Cancel). For example:
1584 const wxString& dir = wxDirSelector("Choose a folder");
1591 \wxheading{Include files
}
1595 \membersection{::wxFileSelector
}\label{wxfileselector
}
1597 \func{wxString
}{wxFileSelector
}{\param{const wxString\&
}{message
},
\param{const wxString\&
}{default
\_path = ""
},\\
1598 \param{const wxString\&
}{default
\_filename = ""
},
\param{const wxString\&
}{default
\_extension = ""
},\\
1599 \param{const wxString\&
}{wildcard = ``*.*''
},
\param{int
}{flags =
0},
\param{wxWindow *
}{parent = ""
},\\
1600 \param{int
}{ x = -
1},
\param{int
}{ y = -
1}}
1602 Pops up a file selector box. In Windows, this is the common file selector
1603 dialog. In X, this is a file selector box with the same functionality.
1604 The path and filename are distinct elements of a full file pathname.
1605 If path is empty, the current directory will be used. If filename is empty,
1606 no default filename will be supplied. The wildcard determines what files
1607 are displayed in the file selector, and file extension supplies a type
1608 extension for the required filename. Flags may be a combination of wxOPEN,
1609 wxSAVE, wxOVERWRITE
\_PROMPT, wxHIDE
\_READONLY, wxFILE
\_MUST\_EXIST, wxMULTIPLE or
0.
1611 Both the Unix and Windows versions implement a wildcard filter. Typing a
1612 filename containing wildcards
(*, ?) in the filename text item, and
1613 clicking on Ok, will result in only those files matching the pattern being
1616 The wildcard may be a specification for multiple types of file
1617 with a description for each, such as:
1620 "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
1623 The application must check for an empty return value (the user pressed
1624 Cancel). For example:
1627 wxString filename = wxFileSelector("Choose a file to open");
1628 if ( !filename.empty() )
1630 // work with the file
1633 //else: cancelled by user
1636 \wxheading{Include files}
1640 \membersection{::wxEndBusyCursor}\label{wxendbusycursor}
1642 \func{void}{wxEndBusyCursor}{\void}
1644 Changes the cursor back to the original cursor, for all windows in the application.
1645 Use with \helpref{wxBeginBusyCursor}{wxbeginbusycursor}.
1647 See also \helpref{wxIsBusy}{wxisbusy}, \helpref{wxBusyCursor}{wxbusycursor}.
1649 \wxheading{Include files}
1653 \membersection{::wxGetColourFromUser}\label{wxgetcolourfromuser}
1655 \func{wxColour}{wxGetColourFromUser}{\param{wxWindow *}{parent}, \param{const wxColour\& }{colInit}}
1657 Shows the colour selection dialog and returns the colour selected by user or
1658 invalid colour (use \helpref{wxColour::Ok}{wxcolourok} to test whether a colour
1659 is valid) if the dialog was cancelled.
1661 \wxheading{Parameters}
1663 \docparam{parent}{The parent window for the colour selection dialog}
1665 \docparam{colInit}{If given, this will be the colour initially selected in the dialog.}
1667 \wxheading{Include files}
1671 \membersection{::wxGetFontFromUser}\label{wxgetfontfromuser}
1673 \func{wxFont}{wxGetFontFromUser}{\param{wxWindow *}{parent}, \param{const wxFont\& }{fontInit}}
1675 Shows the font selection dialog and returns the font selected by user or
1676 invalid font (use \helpref{wxFont::Ok}{wxfontok} to test whether a font
1677 is valid) if the dialog was cancelled.
1679 \wxheading{Parameters}
1681 \docparam{parent}{The parent window for the font selection dialog}
1683 \docparam{fontInit}{If given, this will be the font initially selected in the dialog.}
1685 \wxheading{Include files}
1690 \membersection{::wxGetMultipleChoices}\label{wxgetmultiplechoices}
1692 \func{size\_t}{wxGetMultipleChoices}{\\
1693 \param{wxArrayInt\& }{selections},\\
1694 \param{const wxString\& }{message},\\
1695 \param{const wxString\& }{caption},\\
1696 \param{const wxArrayString\& }{aChoices},\\
1697 \param{wxWindow *}{parent = NULL},\\
1698 \param{int}{ x = -1}, \param{int}{ y = -1},\\
1699 \param{bool}{ centre = true},\\
1700 \param{int }{width=150}, \param{int }{height=200}}
1702 \func{size\_t}{wxGetMultipleChoices}{\\
1703 \param{wxArrayInt\& }{selections},\\
1704 \param{const wxString\& }{message},\\
1705 \param{const wxString\& }{caption},\\
1706 \param{int}{ n}, \param{const wxString\& }{choices[]},\\
1707 \param{wxWindow *}{parent = NULL},\\
1708 \param{int}{ x = -1}, \param{int}{ y = -1},\\
1709 \param{bool}{ centre = true},\\
1710 \param{int }{width=150}, \param{int }{height=200}}
1712 Pops up a dialog box containing a message, OK/Cancel buttons and a
1713 multiple-selection listbox. The user may choose an arbitrary (including 0)
1714 number of items in the listbox whose indices will be returned in
1715 {\it selection} array. The initial contents of this array will be used to
1716 select the items when the dialog is shown.
1718 You may pass the list of strings to choose from either using {\it choices}
1719 which is an array of {\it n} strings for the listbox or by using a single
1720 {\it aChoices} parameter of type \helpref{wxArrayString}{wxarraystring}.
1722 If {\it centre} is true, the message text (which may include new line
1723 characters) is centred; if false, the message is left-justified.
1725 \wxheading{Include files}
1729 \perlnote{In wxPerl there is just an array reference in place of {\tt n}
1730 and {\tt choices}, and no {\tt selections} parameter; the function
1731 returns an array containing the user selections.}
1733 \membersection{::wxGetNumberFromUser}\label{wxgetnumberfromuser}
1735 \func{long}{wxGetNumberFromUser}{
1736 \param{const wxString\& }{message},
1737 \param{const wxString\& }{prompt},
1738 \param{const wxString\& }{caption},
1739 \param{long }{value},
1740 \param{long }{min = 0},
1741 \param{long }{max = 100},
1742 \param{wxWindow *}{parent = NULL},
1743 \param{const wxPoint\& }{pos = wxDefaultPosition}}
1745 Shows a dialog asking the user for numeric input. The dialogs title is set to
1746 {\it caption}, it contains a (possibly) multiline {\it message} above the
1747 single line {\it prompt} and the zone for entering the number.
1749 The number entered must be in the range {\it min}..{\it max} (both of which
1750 should be positive) and {\it value} is the initial value of it. If the user
1751 enters an invalid value or cancels the dialog, the function will return -1.
1753 Dialog is centered on its {\it parent} unless an explicit position is given in
1756 \wxheading{Include files}
1760 \membersection{::wxGetPasswordFromUser}\label{wxgetpasswordfromuser}
1762 \func{wxString}{wxGetTextFromUser}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Input text"},\\
1763 \param{const wxString\& }{default\_value = ``"}, \param{wxWindow *}{parent = NULL}}
1765 Similar to \helpref{wxGetTextFromUser}{wxgettextfromuser} but the text entered
1766 in the dialog is not shown on screen but replaced with stars. This is intended
1767 to be used for entering passwords as the function name implies.
1769 \wxheading{Include files}
1773 \membersection{::wxGetTextFromUser}\label{wxgettextfromuser}
1775 \func{wxString}{wxGetTextFromUser}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Input text"},\\
1776 \param{const wxString\& }{default\_value = ``"}, \param{wxWindow *}{parent = NULL},\\
1777 \param{int}{ x = -1}, \param{int}{ y = -1}, \param{bool}{ centre = true}}
1779 Pop up a dialog box with title set to {\it caption}, {\it message}, and a
1780 \rtfsp{\it default\_value}. The user may type in text and press OK to return this text,
1781 or press Cancel to return the empty string.
1783 If {\it centre} is true, the message text (which may include new line characters)
1784 is centred; if false, the message is left-justified.
1786 \wxheading{Include files}
1790 \membersection{::wxGetMultipleChoice}\label{wxgetmultiplechoice}
1792 \func{int}{wxGetMultipleChoice}{\param{const wxString\& }{message}, \param{const wxString\& }{caption}, \param{int}{ n}, \param{const wxString\& }{choices[]},\\
1793 \param{int }{nsel}, \param{int *}{selection},
1794 \param{wxWindow *}{parent = NULL}, \param{int}{ x = -1}, \param{int}{ y = -1},\\
1795 \param{bool}{ centre = true}, \param{int }{width=150}, \param{int }{height=200}}
1797 Pops up a dialog box containing a message, OK/Cancel buttons and a multiple-selection
1798 listbox. The user may choose one or more item(s) and press OK or Cancel.
1800 The number of initially selected choices, and array of the selected indices,
1801 are passed in; this array will contain the user selections on exit, with
1802 the function returning the number of selections. {\it selection} must be
1803 as big as the number of choices, in case all are selected.
1805 If Cancel is pressed, -1 is returned.
1807 {\it choices} is an array of {\it n} strings for the listbox.
1809 If {\it centre} is true, the message text (which may include new line characters)
1810 is centred; if false, the message is left-justified.
1812 \wxheading{Include files}
1816 \membersection{::wxGetSingleChoice}\label{wxgetsinglechoice}
1818 \func{wxString}{wxGetSingleChoice}{\param{const wxString\& }{message},\\
1819 \param{const wxString\& }{caption},\\
1820 \param{const wxArrayString\& }{aChoices},\\
1821 \param{wxWindow *}{parent = NULL},\\
1822 \param{int}{ x = -1}, \param{int}{ y = -1},\\
1823 \param{bool}{ centre = true},\\
1824 \param{int }{width=150}, \param{int }{height=200}}
1826 \func{wxString}{wxGetSingleChoice}{\param{const wxString\& }{message},\\
1827 \param{const wxString\& }{caption},\\
1828 \param{int}{ n}, \param{const wxString\& }{choices[]},\\
1829 \param{wxWindow *}{parent = NULL},\\
1830 \param{int}{ x = -1}, \param{int}{ y = -1},\\
1831 \param{bool}{ centre = true},\\
1832 \param{int }{width=150}, \param{int }{height=200}}
1834 Pops up a dialog box containing a message, OK/Cancel buttons and a
1835 single-selection listbox. The user may choose an item and press OK to return a
1836 string or Cancel to return the empty string. Use
1837 \helpref{wxGetSingleChoiceIndex}{wxgetsinglechoiceindex} if empty string is a
1838 valid choice and if you want to be able to detect pressing Cancel reliably.
1840 You may pass the list of strings to choose from either using {\it choices}
1841 which is an array of {\it n} strings for the listbox or by using a single
1842 {\it aChoices} parameter of type \helpref{wxArrayString}{wxarraystring}.
1844 If {\it centre} is true, the message text (which may include new line
1845 characters) is centred; if false, the message is left-justified.
1847 \wxheading{Include files}
1851 \perlnote{In wxPerl there is just an array reference in place of {\tt n}
1854 \membersection{::wxGetSingleChoiceIndex}\label{wxgetsinglechoiceindex}
1856 \func{int}{wxGetSingleChoiceIndex}{\param{const wxString\& }{message},\\
1857 \param{const wxString\& }{caption},\\
1858 \param{const wxArrayString\& }{aChoices},\\
1859 \param{wxWindow *}{parent = NULL}, \param{int}{ x = -1}, \param{int}{ y = -1},\\
1860 \param{bool}{ centre = true}, \param{int }{width=150}, \param{int }{height=200}}
1862 \func{int}{wxGetSingleChoiceIndex}{\param{const wxString\& }{message},\\
1863 \param{const wxString\& }{caption},\\
1864 \param{int}{ n}, \param{const wxString\& }{choices[]},\\
1865 \param{wxWindow *}{parent = NULL}, \param{int}{ x = -1}, \param{int}{ y = -1},\\
1866 \param{bool}{ centre = true}, \param{int }{width=150}, \param{int }{height=200}}
1868 As {\bf wxGetSingleChoice} but returns the index representing the selected
1869 string. If the user pressed cancel, -1 is returned.
1871 \wxheading{Include files}
1875 \perlnote{In wxPerl there is just an array reference in place of {\tt n}
1878 \membersection{::wxGetSingleChoiceData}\label{wxgetsinglechoicedata}
1880 \func{wxString}{wxGetSingleChoiceData}{\param{const wxString\& }{message},\\
1881 \param{const wxString\& }{caption},\\
1882 \param{const wxArrayString\& }{aChoices},\\
1883 \param{const wxString\& }{client\_data[]},\\
1884 \param{wxWindow *}{parent = NULL},\\
1885 \param{int}{ x = -1}, \param{int}{ y = -1},\\
1886 \param{bool}{ centre = true}, \param{int }{width=150}, \param{int }{height=200}}
1888 \func{wxString}{wxGetSingleChoiceData}{\param{const wxString\& }{message},\\
1889 \param{const wxString\& }{caption},\\
1890 \param{int}{ n}, \param{const wxString\& }{choices[]},\\
1891 \param{const wxString\& }{client\_data[]},\\
1892 \param{wxWindow *}{parent = NULL},\\
1893 \param{int}{ x = -1}, \param{int}{ y = -1},\\
1894 \param{bool}{ centre = true}, \param{int }{width=150}, \param{int }{height=200}}
1896 As {\bf wxGetSingleChoice} but takes an array of client data pointers
1897 corresponding to the strings, and returns one of these pointers or NULL if
1898 Cancel was pressed. The {\it client\_data} array must have the same number of
1899 elements as {\it choices} or {\it aChoices}!
1901 \wxheading{Include files}
1905 \perlnote{In wxPerl there is just an array reference in place of {\tt n}
1906 and {\tt choices}, and the client data array must have the
1907 same length as the choices array.}
1909 \membersection{::wxIsBusy}\label{wxisbusy}
1911 \func{bool}{wxIsBusy}{\void}
1913 Returns true if between two \helpref{wxBeginBusyCursor}{wxbeginbusycursor} and\rtfsp
1914 \helpref{wxEndBusyCursor}{wxendbusycursor} calls.
1916 See also \helpref{wxBusyCursor}{wxbusycursor}.
1918 \wxheading{Include files}
1922 \membersection{::wxMessageBox}\label{wxmessagebox}
1924 \func{int}{wxMessageBox}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Message"}, \param{int}{ style = wxOK},\\
1925 \param{wxWindow *}{parent = NULL}, \param{int}{ x = -1}, \param{int}{ y = -1}}
1927 General purpose message dialog. {\it style} may be a bit list of the
1928 following identifiers:
1930 \begin{twocollist}\itemsep=0pt
1931 \twocolitem{wxYES\_NO}{Puts Yes and No buttons on the message box. May be combined with
1933 \twocolitem{wxCANCEL}{Puts a Cancel button on the message box. May be combined with
1935 \twocolitem{wxOK}{Puts an Ok button on the message box. May be combined with wxCANCEL.}
1936 \twocolitem{wxICON\_EXCLAMATION}{Displays an exclamation mark symbol.}
1937 \twocolitem{wxICON\_HAND}{Displays an error symbol.}
1938 \twocolitem{wxICON\_ERROR}{Displays an error symbol - the same as wxICON\_HAND.}
1939 \twocolitem{wxICON\_QUESTION}{Displays a question mark symbol.}
1940 \twocolitem{wxICON\_INFORMATION}{Displays an information symbol.}
1943 The return value is one of: wxYES, wxNO, wxCANCEL, wxOK.
1949 int answer = wxMessageBox("Quit program?", "Confirm",
1950 wxYES_NO | wxCANCEL, main_frame);
1951 if (answer == wxYES)
1956 {\it message} may contain newline characters, in which case the
1957 message will be split into separate lines, to cater for large messages.
1959 \wxheading{Include files}
1963 \membersection{::wxShowTip}\label{wxshowtip}
1965 \func{bool}{wxShowTip}{\param{wxWindow *}{parent},
1966 \param{wxTipProvider *}{tipProvider},
1967 \param{bool }{showAtStartup = true}}
1969 This function shows a "startup tip" to the user. The return value is the
1970 state of the ``Show tips at startup'' checkbox.
1972 \docparam{parent}{The parent window for the modal dialog}
1974 \docparam{tipProvider}{An object which is used to get the text of the tips.
1975 It may be created with the \helpref{wxCreateFileTipProvider}{wxcreatefiletipprovider} function.}
1977 \docparam{showAtStartup}{Should be true if startup tips are shown, false
1978 otherwise. This is used as the initial value for "Show tips at startup"
1979 checkbox which is shown in the tips dialog.}
1981 \wxheading{See also}
1983 \helpref{Tips overview}{tipsoverview}
1985 \wxheading{Include files}
1990 \section{Math functions}
1992 \wxheading{Include files}
1996 \membersection{wxFinite}\label{wxfinite}
1998 \func{int}{wxFinite}{\param{double }{x}}
2000 Returns a non-zero value if {\it x} is neither infinite or NaN (not a number),
2001 returns 0 otherwise.
2003 \membersection{wxIsNaN}\label{wxisnan}
2005 \func{bool}{wxIsNaN}{\param{double }{x}}
2007 Returns a non-zero value if {\it x} is NaN (not a number), returns 0
2011 \section{GDI functions}\label{gdifunctions}
2013 The following are relevant to the GDI (Graphics Device Interface).
2015 \wxheading{Include files}
2019 \membersection{wxBITMAP}\label{wxbitmapmacro}
2021 \func{}{wxBITMAP}{bitmapName}
2023 This macro loads a bitmap from either application resources (on the platforms
2024 for which they exist, i.e. Windows and OS2) or from an XPM file. It allows to
2025 avoid using {\tt \#ifdef}s when creating bitmaps.
2027 \wxheading{See also}
2029 \helpref{Bitmaps and icons overview}{wxbitmapoverview},
2030 \helpref{wxICON}{wxiconmacro}
2032 \wxheading{Include files}
2036 \membersection{::wxClientDisplayRect}\label{wxclientdisplayrect}
2038 \func{void}{wxClientDisplayRect}{\param{int *}{x}, \param{int *}{y},
2039 \param{int *}{width}, \param{int *}{height}}
2041 \func{wxRect}{wxGetClientDisplayRect}{\void}
2043 Returns the dimensions of the work area on the display. On Windows
2044 this means the area not covered by the taskbar, etc. Other platforms
2045 are currently defaulting to the whole display until a way is found to
2046 provide this info for all window managers, etc.
2048 \membersection{::wxColourDisplay}\label{wxcolourdisplay}
2050 \func{bool}{wxColourDisplay}{\void}
2052 Returns true if the display is colour, false otherwise.
2054 \membersection{::wxDisplayDepth}\label{wxdisplaydepth}
2056 \func{int}{wxDisplayDepth}{\void}
2058 Returns the depth of the display (a value of 1 denotes a monochrome display).
2060 \membersection{::wxDisplaySize}\label{wxdisplaysize}
2062 \func{void}{wxDisplaySize}{\param{int *}{width}, \param{int *}{height}}
2064 \func{wxSize}{wxGetDisplaySize}{\void}
2066 Returns the display size in pixels.
2068 \membersection{::wxDisplaySizeMM}\label{wxdisplaysizemm}
2070 \func{void}{wxDisplaySizeMM}{\param{int *}{width}, \param{int *}{height}}
2072 \func{wxSize}{wxGetDisplaySizeMM}{\void}
2074 Returns the display size in millimeters.
2076 \membersection{::wxDROP\_ICON}\label{wxdropicon}
2078 \func{wxIconOrCursor}{wxDROP\_ICON}{\param{const char *}{name}}
2080 This macro creates either a cursor (MSW) or an icon (elsewhere) with the given
2081 name. Under MSW, the cursor is loaded from the resource file and the icon is
2082 loaded from XPM file under other platforms.
2084 This macro should be used with
2085 \helpref{wxDropSource constructor}{wxdropsourcewxdropsource}.
2087 \wxheading{Include files}
2091 \membersection{wxICON}\label{wxiconmacro}
2093 \func{}{wxICON}{iconName}
2095 This macro loads an icon from either application resources (on the platforms
2096 for which they exist, i.e. Windows and OS2) or from an XPM file. It allows to
2097 avoid using {\tt \#ifdef}s when creating icons.
2099 \wxheading{See also}
2101 \helpref{Bitmaps and icons overview}{wxbitmapoverview},
2102 \helpref{wxBITMAP}{wxbitmapmacro}
2104 \wxheading{Include files}
2108 \membersection{::wxMakeMetafilePlaceable}\label{wxmakemetafileplaceable}
2110 \func{bool}{wxMakeMetafilePlaceable}{\param{const wxString\& }{filename}, \param{int }{minX}, \param{int }{minY},
2111 \param{int }{maxX}, \param{int }{maxY}, \param{float }{scale=1.0}}
2113 Given a filename for an existing, valid metafile (as constructed using \helpref{wxMetafileDC}{wxmetafiledc})
2114 makes it into a placeable metafile by prepending a header containing the given
2115 bounding box. The bounding box may be obtained from a device context after drawing
2116 into it, using the functions wxDC::MinX, wxDC::MinY, wxDC::MaxX and wxDC::MaxY.
2118 In addition to adding the placeable metafile header, this function adds
2119 the equivalent of the following code to the start of the metafile data:
2122 SetMapMode(dc, MM_ANISOTROPIC);
2123 SetWindowOrg(dc, minX, minY);
2124 SetWindowExt(dc, maxX - minX, maxY - minY);
2127 This simulates the wxMM\_TEXT mapping mode, which wxWindows assumes.
2129 Placeable metafiles may be imported by many Windows applications, and can be
2130 used in RTF (Rich Text Format) files.
2132 {\it scale} allows the specification of scale for the metafile.
2134 This function is only available under Windows.
2136 \membersection{::wxSetCursor}\label{wxsetcursor}
2138 \func{void}{wxSetCursor}{\param{wxCursor *}{cursor}}
2140 Globally sets the cursor; only has an effect in Windows and GTK.
2141 See also \helpref{wxCursor}{wxcursor}, \helpref{wxWindow::SetCursor}{wxwindowsetcursor}.
2143 \section{Printer settings}\label{printersettings}
2145 {\bf NB:} These routines are obsolete and should no longer be used!
2147 The following functions are used to control PostScript printing. Under
2148 Windows, PostScript output can only be sent to a file.
2150 \wxheading{Include files}
2154 \membersection{::wxGetPrinterCommand}\label{wxgetprintercommand}
2156 \func{wxString}{wxGetPrinterCommand}{\void}
2158 Gets the printer command used to print a file. The default is {\tt lpr}.
2160 \membersection{::wxGetPrinterFile}\label{wxgetprinterfile}
2162 \func{wxString}{wxGetPrinterFile}{\void}
2164 Gets the PostScript output filename.
2166 \membersection{::wxGetPrinterMode}\label{wxgetprintermode}
2168 \func{int}{wxGetPrinterMode}{\void}
2170 Gets the printing mode controlling where output is sent (PS\_PREVIEW, PS\_FILE or PS\_PRINTER).
2171 The default is PS\_PREVIEW.
2173 \membersection{::wxGetPrinterOptions}\label{wxgetprinteroptions}
2175 \func{wxString}{wxGetPrinterOptions}{\void}
2177 Gets the additional options for the print command (e.g. specific printer). The default is nothing.
2179 \membersection{::wxGetPrinterOrientation}\label{wxgetprinterorientation}
2181 \func{int}{wxGetPrinterOrientation}{\void}
2183 Gets the orientation (PS\_PORTRAIT or PS\_LANDSCAPE). The default is PS\_PORTRAIT.
2185 \membersection{::wxGetPrinterPreviewCommand}\label{wxgetprinterpreviewcommand}
2187 \func{wxString}{wxGetPrinterPreviewCommand}{\void}
2189 Gets the command used to view a PostScript file. The default depends on the platform.
2191 \membersection{::wxGetPrinterScaling}\label{wxgetprinterscaling}
2193 \func{void}{wxGetPrinterScaling}{\param{float *}{x}, \param{float *}{y}}
2195 Gets the scaling factor for PostScript output. The default is 1.0, 1.0.
2197 \membersection{::wxGetPrinterTranslation}\label{wxgetprintertranslation}
2199 \func{void}{wxGetPrinterTranslation}{\param{float *}{x}, \param{float *}{y}}
2201 Gets the translation (from the top left corner) for PostScript output. The default is 0.0, 0.0.
2203 \membersection{::wxSetPrinterCommand}\label{wxsetprintercommand}
2205 \func{void}{wxSetPrinterCommand}{\param{const wxString\& }{command}}
2207 Sets the printer command used to print a file. The default is {\tt lpr}.
2209 \membersection{::wxSetPrinterFile}\label{wxsetprinterfile}
2211 \func{void}{wxSetPrinterFile}{\param{const wxString\& }{filename}}
2213 Sets the PostScript output filename.
2215 \membersection{::wxSetPrinterMode}\label{wxsetprintermode}
2217 \func{void}{wxSetPrinterMode}{\param{int }{mode}}
2219 Sets the printing mode controlling where output is sent (PS\_PREVIEW, PS\_FILE or PS\_PRINTER).
2220 The default is PS\_PREVIEW.
2222 \membersection{::wxSetPrinterOptions}\label{wxsetprinteroptions}
2224 \func{void}{wxSetPrinterOptions}{\param{const wxString\& }{options}}
2226 Sets the additional options for the print command (e.g. specific printer). The default is nothing.
2228 \membersection{::wxSetPrinterOrientation}\label{wxsetprinterorientation}
2230 \func{void}{wxSetPrinterOrientation}{\param{int}{ orientation}}
2232 Sets the orientation (PS\_PORTRAIT or PS\_LANDSCAPE). The default is PS\_PORTRAIT.
2234 \membersection{::wxSetPrinterPreviewCommand}\label{wxsetprinterpreviewcommand}
2236 \func{void}{wxSetPrinterPreviewCommand}{\param{const wxString\& }{command}}
2238 Sets the command used to view a PostScript file. The default depends on the platform.
2240 \membersection{::wxSetPrinterScaling}\label{wxsetprinterscaling}
2242 \func{void}{wxSetPrinterScaling}{\param{float }{x}, \param{float }{y}}
2244 Sets the scaling factor for PostScript output. The default is 1.0, 1.0.
2246 \membersection{::wxSetPrinterTranslation}\label{wxsetprintertranslation}
2248 \func{void}{wxSetPrinterTranslation}{\param{float }{x}, \param{float }{y}}
2250 Sets the translation (from the top left corner) for PostScript output. The default is 0.0, 0.0.
2252 \section{Clipboard functions}\label{clipsboard}
2254 These clipboard functions are implemented for Windows only. The use of these functions
2255 is deprecated and the code is no longer maintained. Use the \helpref{wxClipboard}{wxclipboard}
2258 \wxheading{Include files}
2262 \membersection{::wxClipboardOpen}\label{functionwxclipboardopen}
2264 \func{bool}{wxClipboardOpen}{\void}
2266 Returns true if this application has already opened the clipboard.
2268 \membersection{::wxCloseClipboard}\label{wxcloseclipboard}
2270 \func{bool}{wxCloseClipboard}{\void}
2272 Closes the clipboard to allow other applications to use it.
2274 \membersection{::wxEmptyClipboard}\label{wxemptyclipboard}
2276 \func{bool}{wxEmptyClipboard}{\void}
2278 Empties the clipboard.
2280 \membersection{::wxEnumClipboardFormats}\label{wxenumclipboardformats}
2282 \func{int}{wxEnumClipboardFormats}{\param{int}{dataFormat}}
2284 Enumerates the formats found in a list of available formats that belong
2285 to the clipboard. Each call to this function specifies a known
2286 available format; the function returns the format that appears next in
2289 {\it dataFormat} specifies a known format. If this parameter is zero,
2290 the function returns the first format in the list.
2292 The return value specifies the next known clipboard data format if the
2293 function is successful. It is zero if the {\it dataFormat} parameter specifies
2294 the last format in the list of available formats, or if the clipboard
2297 Before it enumerates the formats function, an application must open the clipboard by using the
2298 wxOpenClipboard function.
2300 \membersection{::wxGetClipboardData}\label{wxgetclipboarddata}
2302 \func{wxObject *}{wxGetClipboardData}{\param{int}{dataFormat}}
2304 Gets data from the clipboard.
2306 {\it dataFormat} may be one of:
2308 \begin{itemize}\itemsep=0pt
2309 \item wxCF\_TEXT or wxCF\_OEMTEXT: returns a pointer to new memory containing a null-terminated text string.
2310 \item wxCF\_BITMAP: returns a new wxBitmap.
2313 The clipboard must have previously been opened for this call to succeed.
2315 \membersection{::wxGetClipboardFormatName}\label{wxgetclipboardformatname}
2317 \func{bool}{wxGetClipboardFormatName}{\param{int}{dataFormat}, \param{const wxString\& }{formatName}, \param{int}{maxCount}}
2319 Gets the name of a registered clipboard format, and puts it into the buffer {\it formatName} which is of maximum
2320 length {\it maxCount}. {\it dataFormat} must not specify a predefined clipboard format.
2322 \membersection{::wxIsClipboardFormatAvailable}\label{wxisclipboardformatavailable}
2324 \func{bool}{wxIsClipboardFormatAvailable}{\param{int}{dataFormat}}
2326 Returns true if the given data format is available on the clipboard.
2328 \membersection{::wxOpenClipboard}\label{wxopenclipboard}
2330 \func{bool}{wxOpenClipboard}{\void}
2332 Opens the clipboard for passing data to it or getting data from it.
2334 \membersection{::wxRegisterClipboardFormat}\label{wxregisterclipboardformat}
2336 \func{int}{wxRegisterClipboardFormat}{\param{const wxString\& }{formatName}}
2338 Registers the clipboard data format name and returns an identifier.
2340 \membersection{::wxSetClipboardData}\label{wxsetclipboarddata}
2342 \func{bool}{wxSetClipboardData}{\param{int}{dataFormat}, \param{wxObject *}{data}, \param{int}{width}, \param{int}{height}}
2344 Passes data to the clipboard.
2346 {\it dataFormat} may be one of:
2348 \begin{itemize}\itemsep=0pt
2349 \item wxCF\_TEXT or wxCF\_OEMTEXT: {\it data} is a null-terminated text string.
2350 \item wxCF\_BITMAP: {\it data} is a wxBitmap.
2351 \item wxCF\_DIB: {\it data} is a wxBitmap. The bitmap is converted to a DIB (device independent bitmap).
2352 \item wxCF\_METAFILE: {\it data} is a wxMetafile. {\it width} and {\it height} are used to give recommended dimensions.
2355 The clipboard must have previously been opened for this call to succeed.
2357 \section{Miscellaneous functions}\label{miscellany}
2359 \membersection{wxEXPLICIT}\label{wxexplicit}
2361 {\tt wxEXPLICIT} is a macro which expands to the C++ {\tt explicit} keyword if
2362 the compiler supports it or nothing otherwise. Thus, it can be used even in the
2363 code which might have to be compiled with an old compiler without support for
2364 this language feature but still take advantage of it when it is available.
2366 \membersection{wxLL}\label{wxll}
2368 \func{wxLongLong\_t}{wxLL}{\param{}{number}}
2370 This macro is defined for the platforms with a native 64 bit integer type and
2371 allows to define 64 bit compile time constants:
2375 wxLongLong_t ll = wxLL(0x1234567890abcdef);
2379 \wxheading{Include files}
2383 \membersection{wxLongLongFmtSpec}\label{wxlonglongfmtspec}
2385 This macro is defined to contain the {\tt printf()} format specifier using
2386 which 64 bit integer numbers (i.e. those of type {\tt wxLongLong\_t}) can be
2387 printed. Example of using it:
2391 wxLongLong_t ll = wxLL(0x1234567890abcdef);
2392 printf("Long long = %" wxLongLongFmtSpec "x\n", ll);
2396 \wxheading{See also}
2398 \helpref{wxLL}{wxll}
2400 \wxheading{Include files}
2404 \membersection{::wxNewId}\label{wxnewid}
2406 \func{long}{wxNewId}{\void}
2408 Generates an integer identifier unique to this run of the program.
2410 \wxheading{Include files}
2414 \membersection{::wxRegisterId}\label{wxregisterid}
2416 \func{void}{wxRegisterId}{\param{long}{ id}}
2418 Ensures that ids subsequently generated by {\bf NewId} do not clash with
2421 \wxheading{Include files}
2425 \membersection{::wxDDECleanUp}\label{wxddecleanup}
2427 \func{void}{wxDDECleanUp}{\void}
2429 Called when wxWindows exits, to clean up the DDE system. This no longer needs to be
2430 called by the application.
2432 See also \helpref{wxDDEInitialize}{wxddeinitialize}.
2434 \wxheading{Include files}
2438 \membersection{::wxDDEInitialize}\label{wxddeinitialize}
2440 \func{void}{wxDDEInitialize}{\void}
2442 Initializes the DDE system. May be called multiple times without harm.
2444 This no longer needs to be called by the application: it will be called
2445 by wxWindows if necessary.
2447 See also \helpref{wxDDEServer}{wxddeserver}, \helpref{wxDDEClient}{wxddeclient}, \helpref{wxDDEConnection}{wxddeconnection},
2448 \helpref{wxDDECleanUp}{wxddecleanup}.
2450 \wxheading{Include files}
2454 \membersection{::wxEnableTopLevelWindows}\label{wxenabletoplevelwindows}
2456 \func{void}{wxEnableTopLevelWindow}{\param{bool}{ enable = true}}
2458 This function enables or disables all top level windows. It is used by
2459 \helpref{::wxSafeYield}{wxsafeyield}.
2461 \wxheading{Include files}
2465 \membersection{::wxFindMenuItemId}\label{wxfindmenuitemid}
2467 \func{int}{wxFindMenuItemId}{\param{wxFrame *}{frame}, \param{const wxString\& }{menuString}, \param{const wxString\& }{itemString}}
2469 Find a menu item identifier associated with the given frame's menu bar.
2471 \wxheading{Include files}
2475 \membersection{::wxFindWindowByLabel}\label{wxfindwindowbylabel}
2477 \func{wxWindow *}{wxFindWindowByLabel}{\param{const wxString\& }{label}, \param{wxWindow *}{parent=NULL}}
2479 {\bf NB:} This function is obsolete, please use
2480 \helpref{wxWindow::FindWindowByLabel}{wxwindowfindwindowbylabel} instead.
2482 Find a window by its label. Depending on the type of window, the label may be a window title
2483 or panel item label. If {\it parent} is NULL, the search will start from all top-level
2484 frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.
2485 The search is recursive in both cases.
2487 \wxheading{Include files}
2491 \membersection{::wxFindWindowByName}\label{wxfindwindowbyname}
2493 \func{wxWindow *}{wxFindWindowByName}{\param{const wxString\& }{name}, \param{wxWindow *}{parent=NULL}}
2495 {\bf NB:} This function is obsolete, please use
2496 \helpref{wxWindow::FindWindowByName}{wxwindowfindwindowbyname} instead.
2498 Find a window by its name (as given in a window constructor or {\bf Create} function call).
2499 If {\it parent} is NULL, the search will start from all top-level
2500 frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.
2501 The search is recursive in both cases.
2503 If no such named window is found, {\bf wxFindWindowByLabel} is called.
2505 \wxheading{Include files}
2509 \membersection{::wxFindWindowAtPoint}\label{wxfindwindowatpoint}
2511 \func{wxWindow *}{wxFindWindowAtPoint}{\param{const wxPoint\& }{pt}}
2513 Find the deepest window at the given mouse position in screen coordinates,
2514 returning the window if found, or NULL if not.
2516 \membersection{::wxFindWindowAtPointer}\label{wxfindwindowatpointer}
2518 \func{wxWindow *}{wxFindWindowAtPointer}{\param{wxPoint\& }{pt}}
2520 Find the deepest window at the mouse pointer position, returning the window
2521 and current pointer position in screen coordinates.
2523 \membersection{::wxGetActiveWindow}\label{wxgetactivewindow}
2525 \func{wxWindow *}{wxGetActiveWindow}{\void}
2527 Gets the currently active window (Windows only).
2529 \wxheading{Include files}
2533 \membersection{::wxGetDisplayName}\label{wxgetdisplayname}
2535 \func{wxString}{wxGetDisplayName}{\void}
2537 Under X only, returns the current display name. See also \helpref{wxSetDisplayName}{wxsetdisplayname}.
2539 \wxheading{Include files}
2543 \membersection{::wxGetMousePosition}\label{wxgetmouseposition}
2545 \func{wxPoint}{wxGetMousePosition}{\void}
2547 Returns the mouse position in screen coordinates.
2549 \wxheading{Include files}
2553 \membersection{::wxGetResource}\label{wxgetresource}
2555 \func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
2556 \param{const wxString\& *}{value}, \param{const wxString\& }{file = NULL}}
2558 \func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
2559 \param{float *}{value}, \param{const wxString\& }{file = NULL}}
2561 \func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
2562 \param{long *}{value}, \param{const wxString\& }{file = NULL}}
2564 \func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
2565 \param{int *}{value}, \param{const wxString\& }{file = NULL}}
2567 Gets a resource value from the resource database (for example, WIN.INI, or
2568 .Xdefaults). If {\it file} is NULL, WIN.INI or .Xdefaults is used,
2569 otherwise the specified file is used.
2571 Under X, if an application class (wxApp::GetClassName) has been defined,
2572 it is appended to the string /usr/lib/X11/app-defaults/ to try to find
2573 an applications default file when merging all resource databases.
2575 The reason for passing the result in an argument is that it
2576 can be convenient to define a default value, which gets overridden
2577 if the value exists in the resource file. It saves a separate
2578 test for that resource's existence, and it also allows
2579 the overloading of the function for different types.
2581 See also \helpref{wxWriteResource}{wxwriteresource}, \helpref{wxConfigBase}{wxconfigbase}.
2583 \wxheading{Include files}
2587 \membersection{::wxGetTopLevelParent}\label{wxgettoplevelparent}
2589 \func{wxWindow *}{wxGetTopLevelParent}{\param{wxWindow }{*win}}
2591 Returns the first top level parent of the given window, or in other words, the
2592 frame or dialog containing it, or {\tt NULL}.
2594 \wxheading{Include files}
2598 \membersection{::wxLoadUserResource}\label{wxloaduserresource}
2600 \func{wxString}{wxLoadUserResource}{\param{const wxString\& }{resourceName}, \param{const wxString\& }{resourceType=``TEXT"}}
2602 Loads a user-defined Windows resource as a string. If the resource is found, the function creates
2603 a new character array and copies the data into it. A pointer to this data is returned. If unsuccessful, NULL is returned.
2605 The resource must be defined in the {\tt .rc} file using the following syntax:
2608 myResource TEXT file.ext
2611 where {\tt file.ext} is a file that the resource compiler can find.
2613 This function is available under Windows only.
2615 \wxheading{Include files}
2619 \membersection{::wxPostDelete}\label{wxpostdelete}
2621 \func{void}{wxPostDelete}{\param{wxObject *}{object}}
2623 Tells the system to delete the specified object when
2624 all other events have been processed. In some environments, it is
2625 necessary to use this instead of deleting a frame directly with the
2626 delete operator, because some GUIs will still send events to a deleted window.
2628 Now obsolete: use \helpref{wxWindow::Close}{wxwindowclose} instead.
2630 \wxheading{Include files}
2634 \membersection{::wxPostEvent}\label{wxpostevent}
2636 \func{void}{wxPostEvent}{\param{wxEvtHandler *}{dest}, \param{wxEvent\& }{event}}
2638 In a GUI application, this function posts {\it event} to the specified {\it dest}
2639 object using \helpref{wxEvtHandler::AddPendingEvent}{wxevthandleraddpendingevent}.
2640 Otherwise, it dispatches {\it event} immediately using
2641 \helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent}.
2642 See the respective documentation for details (and caveats).
2644 \wxheading{Include files}
2648 \membersection{::wxSetDisplayName}\label{wxsetdisplayname}
2650 \func{void}{wxSetDisplayName}{\param{const wxString\& }{displayName}}
2652 Under X only, sets the current display name. This is the X host and display name such
2653 as ``colonsay:0.0", and the function indicates which display should be used for creating
2654 windows from this point on. Setting the display within an application allows multiple
2655 displays to be used.
2657 See also \helpref{wxGetDisplayName}{wxgetdisplayname}.
2659 \wxheading{Include files}
2663 \membersection{::wxStripMenuCodes}\label{wxstripmenucodes}
2665 \func{wxString}{wxStripMenuCodes}{\param{const wxString\& }{in}}
2667 \func{void}{wxStripMenuCodes}{\param{char *}{in}, \param{char *}{out}}
2669 {\bf NB:} This function is obsolete, please use
2670 \helpref{wxMenuItem::GetLabelFromText}{wxmenuitemgetlabelfromtext} instead.
2672 Strips any menu codes from {\it in} and places the result
2673 in {\it out} (or returns the new string, in the first form).
2675 Menu codes include \& (mark the next character with an underline
2676 as a keyboard shortkey in Windows and Motif) and $\backslash$t (tab in Windows).
2678 \wxheading{Include files}
2682 \membersection{::wxWriteResource}\label{wxwriteresource}
2684 \func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
2685 \param{const wxString\& }{value}, \param{const wxString\& }{file = NULL}}
2687 \func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
2688 \param{float }{value}, \param{const wxString\& }{file = NULL}}
2690 \func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
2691 \param{long }{value}, \param{const wxString\& }{file = NULL}}
2693 \func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
2694 \param{int }{value}, \param{const wxString\& }{file = NULL}}
2696 Writes a resource value into the resource database (for example, WIN.INI, or
2697 .Xdefaults). If {\it file} is NULL, WIN.INI or .Xdefaults is used,
2698 otherwise the specified file is used.
2700 Under X, the resource databases are cached until the internal function
2701 \rtfsp{\bf wxFlushResources} is called automatically on exit, when
2702 all updated resource databases are written to their files.
2704 Note that it is considered bad manners to write to the .Xdefaults
2705 file under Unix, although the WIN.INI file is fair game under Windows.
2707 See also \helpref{wxGetResource}{wxgetresource}, \helpref{wxConfigBase}{wxconfigbase}.
2709 \wxheading{Include files}
2713 \section{Byte order macros}\label{byteordermacros}
2715 The endian-ness issues (that is the difference between big-endian and
2716 little-endian architectures) are important for the portable programs working
2717 with the external binary data (for example, data files or data coming from
2718 network) which is usually in some fixed, platform-independent format. The
2719 macros are helpful for transforming the data to the correct format.
2721 \membersection{wxINTXX\_SWAP\_ALWAYS}\label{intswapalways}
2723 \func{wxInt32}{wxINT32\_SWAP\_ALWAYS}{\param{wxInt32 }{value}}
2725 \func{wxUint32}{wxUINT32\_SWAP\_ALWAYS}{\param{wxUint32 }{value}}
2727 \func{wxInt16}{wxINT16\_SWAP\_ALWAYS}{\param{wxInt16 }{value}}
2729 \func{wxUint16}{wxUINT16\_SWAP\_ALWAYS}{\param{wxUint16 }{value}}
2731 These macros will swap the bytes of the {\it value} variable from little
2732 endian to big endian or vice versa unconditionally, i.e. independently of the
2735 \membersection{wxINTXX\_SWAP\_ON\_BE}\label{intswaponbe}
2737 \func{wxInt32}{wxINT32\_SWAP\_ON\_BE}{\param{wxInt32 }{value}}
2739 \func{wxUint32}{wxUINT32\_SWAP\_ON\_BE}{\param{wxUint32 }{value}}
2741 \func{wxInt16}{wxINT16\_SWAP\_ON\_BE}{\param{wxInt16 }{value}}
2743 \func{wxUint16}{wxUINT16\_SWAP\_ON\_BE}{\param{wxUint16 }{value}}
2745 This macro will swap the bytes of the {\it value} variable from little
2746 endian to big endian or vice versa if the program is compiled on a
2747 big-endian architecture (such as Sun work stations). If the program has
2748 been compiled on a little-endian architecture, the value will be unchanged.
2750 Use these macros to read data from and write data to a file that stores
2751 data in little-endian (for example Intel i386) format.
2753 \membersection{wxINTXX\_SWAP\_ON\_LE}\label{intswaponle}
2755 \func{wxInt32}{wxINT32\_SWAP\_ON\_LE}{\param{wxInt32 }{value}}
2757 \func{wxUint32}{wxUINT32\_SWAP\_ON\_LE}{\param{wxUint32 }{value}}
2759 \func{wxInt16}{wxINT16\_SWAP\_ON\_LE}{\param{wxInt16 }{value}}
2761 \func{wxUint16}{wxUINT16\_SWAP\_ON\_LE}{\param{wxUint16 }{value}}
2763 This macro will swap the bytes of the {\it value} variable from little
2764 endian to big endian or vice versa if the program is compiled on a
2765 little-endian architecture (such as Intel PCs). If the program has
2766 been compiled on a big-endian architecture, the value will be unchanged.
2768 Use these macros to read data from and write data to a file that stores
2769 data in big-endian format.
2771 \section{RTTI functions}\label{rttimacros}
2773 wxWindows uses its own RTTI ("run-time type identification") system which
2774 predates the current standard C++ RTTI and so is kept for backwards
2775 compatibility reasons but also because it allows some things which the
2776 standard RTTI doesn't directly support (such as creating a class from its
2779 The standard C++ RTTI can be used in the user code without any problems and in
2780 general you shouldn't need to use the functions and the macros in this section
2781 unless you are thinking of modifying or adding any wxWindows classes.
2783 \wxheading{See also}
2785 \helpref{RTTI overview}{runtimeclassoverview}
2787 \membersection{CLASSINFO}\label{classinfo}
2789 \func{wxClassInfo *}{CLASSINFO}{className}
2791 Returns a pointer to the wxClassInfo object associated with this class.
2793 \wxheading{Include files}
2797 \membersection{DECLARE\_ABSTRACT\_CLASS}\label{declareabstractclass}
2799 \func{}{DECLARE\_ABSTRACT\_CLASS}{className}
2801 Used inside a class declaration to declare that the class should be
2802 made known to the class hierarchy, but objects of this class cannot be created
2803 dynamically. The same as DECLARE\_CLASS.
2808 class wxCommand: public wxObject
2810 DECLARE_ABSTRACT_CLASS(wxCommand)
2819 \wxheading{Include files}
2823 \membersection{DECLARE\_APP}\label{declareapp}
2825 \func{}{DECLARE\_APP}{className}
2827 This is used in headers to create a forward declaration of the
2828 \helpref{wxGetApp}{wxgetapp} function implemented by
2829 \helpref{IMPLEMENT\_APP}{implementapp}. It creates the declaration
2830 {\tt className\& wxGetApp(void)}.
2838 \wxheading{Include files}
2842 \membersection{DECLARE\_CLASS}\label{declareclass}
2844 \func{}{DECLARE\_CLASS}{className}
2846 Used inside a class declaration to declare that the class should be
2847 made known to the class hierarchy, but objects of this class cannot be created
2848 dynamically. The same as DECLARE\_ABSTRACT\_CLASS.
2850 \wxheading{Include files}
2854 \membersection{DECLARE\_DYNAMIC\_CLASS}\label{declaredynamicclass}
2856 \func{}{DECLARE\_DYNAMIC\_CLASS}{className}
2858 Used inside a class declaration to declare that the objects of this class should be dynamically
2859 creatable from run-time type information.
2864 class wxFrame: public wxWindow
2866 DECLARE_DYNAMIC_CLASS(wxFrame)
2869 const wxString& frameTitle;
2875 \wxheading{Include files}
2879 \membersection{IMPLEMENT\_ABSTRACT\_CLASS}\label{implementabstractclass}
2881 \func{}{IMPLEMENT\_ABSTRACT\_CLASS}{className, baseClassName}
2883 Used in a C++ implementation file to complete the declaration of
2884 a class that has run-time type information. The same as IMPLEMENT\_CLASS.
2889 IMPLEMENT_ABSTRACT_CLASS(wxCommand, wxObject)
2891 wxCommand::wxCommand(void)
2897 \wxheading{Include files}
2901 \membersection{IMPLEMENT\_ABSTRACT\_CLASS2}\label{implementabstractclass2}
2903 \func{}{IMPLEMENT\_ABSTRACT\_CLASS2}{className, baseClassName1, baseClassName2}
2905 Used in a C++ implementation file to complete the declaration of
2906 a class that has run-time type information and two base classes. The same as IMPLEMENT\_CLASS2.
2908 \wxheading{Include files}
2912 \membersection{IMPLEMENT\_APP}\label{implementapp}
2914 \func{}{IMPLEMENT\_APP}{className}
2916 This is used in the application class implementation file to make the application class known to
2917 wxWindows for dynamic construction. You use this instead of
2928 IMPLEMENT_APP(MyApp)
2931 See also \helpref{DECLARE\_APP}{declareapp}.
2933 \wxheading{Include files}
2937 \membersection{IMPLEMENT\_CLASS}\label{implementclass}
2939 \func{}{IMPLEMENT\_CLASS}{className, baseClassName}
2941 Used in a C++ implementation file to complete the declaration of
2942 a class that has run-time type information. The same as IMPLEMENT\_ABSTRACT\_CLASS.
2944 \wxheading{Include files}
2948 \membersection{IMPLEMENT\_CLASS2}\label{implementclass2}
2950 \func{}{IMPLEMENT\_CLASS2}{className, baseClassName1, baseClassName2}
2952 Used in a C++ implementation file to complete the declaration of a
2953 class that has run-time type information and two base classes. The
2954 same as IMPLEMENT\_ABSTRACT\_CLASS2.
2956 \wxheading{Include files}
2960 \membersection{IMPLEMENT\_DYNAMIC\_CLASS}\label{implementdynamicclass}
2962 \func{}{IMPLEMENT\_DYNAMIC\_CLASS}{className, baseClassName}
2964 Used in a C++ implementation file to complete the declaration of
2965 a class that has run-time type information, and whose instances
2966 can be created dynamically.
2971 IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
2973 wxFrame::wxFrame(void)
2979 \wxheading{Include files}
2983 \membersection{IMPLEMENT\_DYNAMIC\_CLASS2}\label{implementdynamicclass2}
2985 \func{}{IMPLEMENT\_DYNAMIC\_CLASS2}{className, baseClassName1, baseClassName2}
2987 Used in a C++ implementation file to complete the declaration of
2988 a class that has run-time type information, and whose instances
2989 can be created dynamically. Use this for classes derived from two
2992 \wxheading{Include files}
2996 \membersection{wxConstCast}\label{wxconstcast}
2998 \func{classname *}{wxConstCast}{ptr, classname}
3000 This macro expands into {\tt const\_cast<classname *>(ptr)} if the compiler
3001 supports {\it const\_cast} or into an old, C-style cast, otherwise.
3003 \wxheading{See also}
3005 \helpref{wxDynamicCast}{wxdynamiccast}\\
3006 \helpref{wxStaticCast}{wxstaticcast}
3008 \membersection{::wxCreateDynamicObject}\label{wxcreatedynamicobject}
3010 \func{wxObject *}{wxCreateDynamicObject}{\param{const wxString\& }{className}}
3012 Creates and returns an object of the given class, if the class has been
3013 registered with the dynamic class system using DECLARE... and IMPLEMENT... macros.
3015 \membersection{WXDEBUG\_NEW}\label{debugnew}
3017 \func{}{WXDEBUG\_NEW}{arg}
3019 This is defined in debug mode to be call the redefined new operator
3020 with filename and line number arguments. The definition is:
3023 #define WXDEBUG_NEW new(__FILE__,__LINE__)
3026 In non-debug mode, this is defined as the normal new operator.
3028 \wxheading{Include files}
3032 \membersection{wxDynamicCast}\label{wxdynamiccast}
3034 \func{classname *}{wxDynamicCast}{ptr, classname}
3036 This macro returns the pointer {\it ptr} cast to the type {\it classname *} if
3037 the pointer is of this type (the check is done during the run-time) or
3038 {\tt NULL} otherwise. Usage of this macro is preferred over obsoleted
3039 wxObject::IsKindOf() function.
3041 The {\it ptr} argument may be {\tt NULL}, in which case {\tt NULL} will be
3047 wxWindow *win = wxWindow::FindFocus();
3048 wxTextCtrl *text = wxDynamicCast(win, wxTextCtrl);
3051 // a text control has the focus...
3055 // no window has the focus or it is not a text control
3059 \wxheading{See also}
3061 \helpref{RTTI overview}{runtimeclassoverview}\\
3062 \helpref{wxDynamicCastThis}{wxdynamiccastthis}\\
3063 \helpref{wxConstCast}{wxconstcast}\\
3064 \helpref{wxStatiicCast}{wxstaticcast}
3066 \membersection{wxDynamicCastThis}\label{wxdynamiccastthis}
3068 \func{classname *}{wxDynamicCastThis}{classname}
3070 This macro is equivalent to {\tt wxDynamicCast(this, classname)} but the
3071 latter provokes spurious compilation warnings from some compilers (because it
3072 tests whether {\tt this} pointer is non {\tt NULL} which is always true), so
3073 this macro should be used to avoid them.
3075 \wxheading{See also}
3077 \helpref{wxDynamicCast}{wxdynamiccast}
3079 \membersection{wxStaticCast}\label{wxstaticcast}
3081 \func{classname *}{wxStaticCast}{ptr, classname}
3083 This macro checks that the cast is valid in debug mode (an assert failure will
3084 result if {\tt wxDynamicCast(ptr, classname) == NULL}) and then returns the
3085 result of executing an equivalent of {\tt static\_cast<classname *>(ptr)}.
3087 \helpref{wxDynamicCast}{wxdynamiccast}\\
3088 \helpref{wxConstCast}{wxconstcast}
3090 \section{Log functions}\label{logfunctions}
3092 These functions provide a variety of logging functions: see \helpref{Log classes overview}{wxlogoverview} for
3093 further information. The functions use (implicitly) the currently active log
3094 target, so their descriptions here may not apply if the log target is not the
3095 standard one (installed by wxWindows in the beginning of the program).
3097 \wxheading{Include files}
3101 \membersection{::wxDebugMsg}\label{wxdebugmsg}
3103 \func{void}{wxDebugMsg}{\param{const wxString\& }{fmt}, \param{...}{}}
3105 {\bf NB:} This function is now obsolete, replaced by \helpref{Log
3106 functions}{logfunctions} and \helpref{wxLogDebug}{wxlogdebug} in particular.
3108 Display a debugging message; under Windows, this will appear on the
3109 debugger command window, and under Unix, it will be written to standard
3112 The syntax is identical to {\bf printf}: pass a format string and a
3113 variable list of arguments.
3115 {\bf Tip:} under Windows, if your application crashes before the
3116 message appears in the debugging window, put a wxYield call after
3117 each wxDebugMsg call. wxDebugMsg seems to be broken under WIN32s
3118 (at least for Watcom C++): preformat your messages and use OutputDebugString
3121 \wxheading{Include files}
3125 \membersection{::wxError}\label{wxerror}
3127 \func{void}{wxError}{\param{const wxString\& }{msg}, \param{const wxString\& }{title = "wxWindows Internal Error"}}
3129 {\bf NB:} This function is now obsolete, please use \helpref{wxLogError}{wxlogerror}
3132 Displays {\it msg} and continues. This writes to standard error under
3133 Unix, and pops up a message box under Windows. Used for internal
3134 wxWindows errors. See also \helpref{wxFatalError}{wxfatalerror}.
3136 \wxheading{Include files}
3140 \membersection{::wxFatalError}\label{wxfatalerror}
3142 \func{void}{wxFatalError}{\param{const wxString\& }{msg}, \param{const wxString\& }{title = "wxWindows Fatal Error"}}
3144 {\bf NB:} This function is now obsolete, please use
3145 \helpref{wxLogFatalError}{wxlogfatalerror} instead.
3147 Displays {\it msg} and exits. This writes to standard error under Unix,
3148 and pops up a message box under Windows. Used for fatal internal
3149 wxWindows errors. See also \helpref{wxError}{wxerror}.
3151 \wxheading{Include files}
3155 \membersection{::wxLogError}\label{wxlogerror}
3157 \func{void}{wxLogError}{\param{const char *}{formatString}, \param{...}{}}
3159 \func{void}{wxVLogError}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3161 The functions to use for error messages, i.e. the messages that must be shown
3162 to the user. The default processing is to pop up a message box to inform the
3165 \membersection{::wxLogFatalError}\label{wxlogfatalerror}
3167 \func{void}{wxLogFatalError}{\param{const char *}{formatString}, \param{...}{}}
3169 \func{void}{wxVLogFatalError}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3171 Like \helpref{wxLogError}{wxlogerror}, but also
3172 terminates the program with the exit code 3. Using {\it abort()} standard
3173 function also terminates the program with this exit code.
3175 \membersection{::wxLogWarning}\label{wxlogwarning}
3177 \func{void}{wxLogWarning}{\param{const char *}{formatString}, \param{...}{}}
3179 \func{void}{wxVLogWarning}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3181 For warnings - they are also normally shown to the user, but don't interrupt
3184 \membersection{::wxLogMessage}\label{wxlogmessage}
3186 \func{void}{wxLogMessage}{\param{const char *}{formatString}, \param{...}{}}
3188 \func{void}{wxVLogMessage}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3190 For all normal, informational messages. They also appear in a message box by
3191 default (but it can be changed). Notice that the standard behaviour is to not
3192 show informational messages if there are any errors later - the logic being
3193 that the later error messages make the informational messages preceding them
3196 \membersection{::wxLogVerbose}\label{wxlogverbose}
3198 \func{void}{wxLogVerbose}{\param{const char *}{formatString}, \param{...}{}}
3200 \func{void}{wxVLogVerbose}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3202 For verbose output. Normally, it is suppressed, but
3203 might be activated if the user wishes to know more details about the program
3204 progress (another, but possibly confusing name for the same function is {\bf wxLogInfo}).
3206 \membersection{::wxLogStatus}\label{wxlogstatus}
3208 \func{void}{wxLogStatus}{\param{wxFrame *}{frame}, \param{const char *}{formatString}, \param{...}{}}
3210 \func{void}{wxVLogStatus}{\param{wxFrame *}{frame}, \param{const char *}{formatString}, \param{va\_list }{argPtr}}
3212 \func{void}{wxLogStatus}{\param{const char *}{formatString}, \param{...}{}}
3214 \func{void}{wxVLogStatus}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3216 Messages logged by these functions will appear in the statusbar of the {\it
3217 frame} or of the top level application window by default (i.e. when using
3218 the second version of the functions).
3220 If the target frame doesn't have a statusbar, the message will be lost.
3222 \membersection{::wxLogSysError}\label{wxlogsyserror}
3224 \func{void}{wxLogSysError}{\param{const char *}{formatString}, \param{...}{}}
3226 \func{void}{wxVLogSysError}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3228 Mostly used by wxWindows itself, but might be handy for logging errors after
3229 system call (API function) failure. It logs the specified message text as well
3230 as the last system error code ({\it errno} or {\it ::GetLastError()} depending
3231 on the platform) and the corresponding error message. The second form
3232 of this function takes the error code explicitly as the first argument.
3234 \wxheading{See also}
3236 \helpref{wxSysErrorCode}{wxsyserrorcode},
3237 \helpref{wxSysErrorMsg}{wxsyserrormsg}
3239 \membersection{::wxLogDebug}\label{wxlogdebug}
3241 \func{void}{wxLogDebug}{\param{const char *}{formatString}, \param{...}{}}
3243 \func{void}{wxVLogDebug}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3245 The right functions for debug output. They only do something in debug
3246 mode (when the preprocessor symbol \_\_WXDEBUG\_\_ is defined) and expand to
3247 nothing in release mode (otherwise).
3249 \membersection{::wxLogTrace}\label{wxlogtrace}
3251 \func{void}{wxLogTrace}{\param{const char *}{formatString}, \param{...}{}}
3253 \func{void}{wxVLogTrace}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3255 \func{void}{wxLogTrace}{\param{const char *}{mask}, \param{const char *}{formatString}, \param{...}{}}
3257 \func{void}{wxVLogTrace}{\param{const char *}{mask}, \param{const char *}{formatString}, \param{va\_list }{argPtr}}
3259 \func{void}{wxLogTrace}{\param{wxTraceMask}{ mask}, \param{const char *}{formatString}, \param{...}{}}
3261 \func{void}{wxVLogTrace}{\param{wxTraceMask}{ mask}, \param{const char *}{formatString}, \param{va\_list }{argPtr}}
3263 As {\bf wxLogDebug}, trace functions only do something in debug build and
3264 expand to nothing in the release one. The reason for making
3265 it a separate function from it is that usually there are a lot of trace
3266 messages, so it might make sense to separate them from other debug messages.
3268 The trace messages also usually can be separated into different categories and
3269 the second and third versions of this function only log the message if the
3270 {\it mask} which it has is currently enabled in \helpref{wxLog}{wxlog}. This
3271 allows to selectively trace only some operations and not others by changing
3272 the value of the trace mask (possible during the run-time).
3274 For the second function (taking a string mask), the message is logged only if
3275 the mask has been previously enabled by the call to
3276 \helpref{AddTraceMask}{wxlogaddtracemask}. The predefined string trace masks
3277 used by wxWindows are:
3279 \begin{itemize}\itemsep=0pt
3280 \item wxTRACE\_MemAlloc: trace memory allocation (new/delete)
3281 \item wxTRACE\_Messages: trace window messages/X callbacks
3282 \item wxTRACE\_ResAlloc: trace GDI resource allocation
3283 \item wxTRACE\_RefCount: trace various ref counting operations
3284 \item wxTRACE\_OleCalls: trace OLE method calls (Win32 only)
3287 The third version of the function only logs the message if all the bit
3288 corresponding to the {\it mask} are set in the wxLog trace mask which can be
3289 set by \helpref{SetTraceMask}{wxlogsettracemask}. This version is less
3290 flexible than the previous one because it doesn't allow defining the user
3291 trace masks easily - this is why it is deprecated in favour of using string
3294 \begin{itemize}\itemsep=0pt
3295 \item wxTraceMemAlloc: trace memory allocation (new/delete)
3296 \item wxTraceMessages: trace window messages/X callbacks
3297 \item wxTraceResAlloc: trace GDI resource allocation
3298 \item wxTraceRefCount: trace various ref counting operations
3299 \item wxTraceOleCalls: trace OLE method calls (Win32 only)
3302 \membersection{::wxSafeShowMessage}\label{wxsafeshowmessage}
3304 \func{void}{wxSafeShowMessage}{\param{const wxString\& }{title}, \param{const wxString\& }{text}}
3306 This function shows a message to the user in a safe way and should be safe to
3307 call even before the application has been initialized or if it is currently in
3308 some other strange state (for example, about to crash). Under Windows this
3309 function shows a message box using a native dialog instead of
3310 \helpref{wxMessageBox}{wxmessagebox} (which might be unsafe to call), elsewhere
3311 it simply prints the message to the standard output using the title as prefix.
3313 \wxheading{Parameters}
3315 \docparam{title}{The title of the message box shown to the user or the prefix
3316 of the message string}
3318 \docparam{text}{The text to show to the user}
3320 \wxheading{See also}
3322 \helpref{wxLogFatalError}{wxlogfatalerror}
3324 \wxheading{Include files}
3328 \membersection{::wxSysErrorCode}\label{wxsyserrorcode}
3330 \func{unsigned long}{wxSysErrorCode}{\void}
3332 Returns the error code from the last system call. This function uses
3333 {\tt errno} on Unix platforms and {\tt GetLastError} under Win32.
3335 \wxheading{See also}
3337 \helpref{wxSysErrorMsg}{wxsyserrormsg},
3338 \helpref{wxLogSysError}{wxlogsyserror}
3340 \membersection{::wxSysErrorMsg}\label{wxsyserrormsg}
3342 \func{const wxChar *}{wxSysErrorMsg}{\param{unsigned long }{errCode = 0}}
3344 Returns the error message corresponding to the given system error code. If
3345 {\it errCode} is $0$ (default), the last error code (as returned by
3346 \helpref{wxSysErrorCode}{wxsyserrorcode}) is used.
3348 \wxheading{See also}
3350 \helpref{wxSysErrorCode}{wxsyserrorcode},
3351 \helpref{wxLogSysError}{wxlogsyserror}
3353 \membersection{WXTRACE}\label{trace}
3355 \wxheading{Include files}
3359 \func{}{WXTRACE}{formatString, ...}
3361 {\bf NB:} This macro is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
3363 Calls wxTrace with printf-style variable argument syntax. Output
3364 is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
3366 \wxheading{Include files}
3370 \membersection{WXTRACELEVEL}\label{tracelevel}
3372 \func{}{WXTRACELEVEL}{level, formatString, ...}
3374 {\bf NB:} This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
3376 Calls wxTraceLevel with printf-style variable argument syntax. Output
3377 is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
3378 The first argument should be the level at which this information is appropriate.
3379 It will only be output if the level returned by wxDebugContext::GetLevel is equal to or greater than
3382 \wxheading{Include files}
3386 \membersection{::wxTrace}\label{wxtrace}
3388 \func{void}{wxTrace}{\param{const wxString\& }{fmt}, \param{...}{}}
3390 {\bf NB:} This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
3392 Takes printf-style variable argument syntax. Output
3393 is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
3395 \wxheading{Include files}
3399 \membersection{::wxTraceLevel}\label{wxtracelevel}
3401 \func{void}{wxTraceLevel}{\param{int}{ level}, \param{const wxString\& }{fmt}, \param{...}{}}
3403 {\bf NB:} This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
3405 Takes printf-style variable argument syntax. Output
3406 is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
3407 The first argument should be the level at which this information is appropriate.
3408 It will only be output if the level returned by wxDebugContext::GetLevel is equal to or greater than
3411 \wxheading{Include files}
3415 \section{Time functions}\label{timefunctions}
3417 The functions in this section deal with getting the current time and
3418 starting/stopping the global timers. Please note that the timer functions are
3419 deprecated because they work with one global timer only and
3420 \helpref{wxTimer}{wxtimer} and/or \helpref{wxStopWatch}{wxstopwatch} classes
3421 should be used instead. For retrieving the current time, you may also use
3422 \helpref{wxDateTime::Now}{wxdatetimenow} or
3423 \helpref{wxDateTime::UNow}{wxdatetimeunow} methods.
3425 \membersection{::wxGetElapsedTime}\label{wxgetelapsedtime}
3427 \func{long}{wxGetElapsedTime}{\param{bool}{ resetTimer = true}}
3429 Gets the time in milliseconds since the last \helpref{::wxStartTimer}{wxstarttimer}.
3431 If {\it resetTimer} is true (the default), the timer is reset to zero
3434 See also \helpref{wxTimer}{wxtimer}.
3436 \wxheading{Include files}
3440 \membersection{::wxGetLocalTime}\label{wxgetlocaltime}
3442 \func{long}{wxGetLocalTime}{\void}
3444 Returns the number of seconds since local time 00:00:00 Jan 1st 1970.
3446 \wxheading{See also}
3448 \helpref{wxDateTime::Now}{wxdatetimenow}
3450 \wxheading{Include files}
3454 \membersection{::wxGetLocalTimeMillis}\label{wxgetlocaltimemillis}
3456 \func{wxLongLong}{wxGetLocalTimeMillis}{\void}
3458 Returns the number of milliseconds since local time 00:00:00 Jan 1st 1970.
3460 \wxheading{See also}
3462 \helpref{wxDateTime::Now}{wxdatetimenow},\\
3463 \helpref{wxLongLong}{wxlonglong}
3465 \wxheading{Include files}
3469 \membersection{::wxGetUTCTime}\label{wxgetutctime}
3471 \func{long}{wxGetUTCTime}{\void}
3473 Returns the number of seconds since GMT 00:00:00 Jan 1st 1970.
3475 \wxheading{See also}
3477 \helpref{wxDateTime::Now}{wxdatetimenow}
3479 \wxheading{Include files}
3483 \membersection{::wxNow}\label{wxnow}
3485 \func{wxString}{wxNow}{\void}
3487 Returns a string representing the current date and time.
3489 \wxheading{Include files}
3493 \membersection{::wxSleep}\label{wxsleep}
3495 \func{void}{wxSleep}{\param{int}{ secs}}
3497 Sleeps for the specified number of seconds.
3499 \wxheading{Include files}
3503 \membersection{::wxStartTimer}\label{wxstarttimer}
3505 \func{void}{wxStartTimer}{\void}
3507 Starts a stopwatch; use \helpref{::wxGetElapsedTime}{wxgetelapsedtime} to get the elapsed time.
3509 See also \helpref{wxTimer}{wxtimer}.
3511 \wxheading{Include files}
3515 \membersection{::wxUsleep}\label{wxusleep}
3517 \func{void}{wxUsleep}{\param{unsigned long}{ milliseconds}}
3519 Sleeps for the specified number of milliseconds. Notice that usage of this
3520 function is encouraged instead of calling usleep(3) directly because the
3521 standard usleep() function is not MT safe.
3523 \wxheading{Include files}
3527 \section{Debugging macros and functions}\label{debugmacros}
3529 Useful macros and functions for error checking and defensive programming.
3530 wxWindows defines three families of the assert-like macros:
3531 the wxASSERT and wxFAIL macros only do anything if \_\_WXDEBUG\_\_ is defined
3532 (in other words, in the debug build) but disappear completely in the release
3533 build. On the other hand, the wxCHECK macros stay event in release builds but a
3534 check failure doesn't generate any user-visible effects then. Finally, the
3535 compile time assertions don't happen during the run-time but result in the
3536 compilation error messages if the condition they check fail.
3538 \wxheading{Include files}
3542 \membersection{::wxOnAssert}\label{wxonassert}
3544 \func{void}{wxOnAssert}{\param{const char *}{fileName}, \param{int}{ lineNumber}, \param{const char *}{cond}, \param{const char *}{msg = NULL}}
3546 This function is called whenever one of debugging macros fails (i.e. condition
3547 is false in an assertion). It is only defined in the debug mode, in release
3548 builds the \helpref{wxCHECK}{wxcheck} failures don't result in anything.
3550 To override the default behaviour in the debug builds which is to show the user
3551 a dialog asking whether he wants to abort the program, continue or continue
3552 ignoring any subsequent assert failures, you may override
3553 \helpref{wxApp::OnAssert}{wxapponassert} which is called by this function if
3554 the global application object exists.
3556 \membersection{wxASSERT}\label{wxassert}
3558 \func{}{wxASSERT}{\param{}{condition}}
3560 Assert macro. An error message will be generated if the condition is false in
3561 debug mode, but nothing will be done in the release build.
3563 Please note that the condition in wxASSERT() should have no side effects
3564 because it will not be executed in release mode at all.
3566 \wxheading{See also}
3568 \helpref{wxASSERT\_MSG}{wxassertmsg},\\
3569 \helpref{wxCOMPILE\_TIME\_ASSERT}{wxcompiletimeassert}
3571 \membersection{wxASSERT\_MIN\_BITSIZE}\label{wxassertminbitsize}
3573 \func{}{wxASSERT\_MIN\_BITSIZE}{\param{}{type}, \param{}{size}}
3575 This macro results in a
3576 \helpref{compile time assertion failure}{wxcompiletimeassert} if the size
3577 of the given type {\it type} is less than {\it size} bits.
3579 You may use it like this, for example:
3582 // we rely on the int being able to hold values up to 2^32
3583 wxASSERT_MIN_BITSIZE(int, 32);
3585 // can't work with the platforms using UTF-8 for wchar_t
3586 wxASSERT_MIN_BITSIZE(wchar_t, 16);
3589 \membersection{wxASSERT\_MSG}\label{wxassertmsg}
3591 \func{}{wxASSERT\_MSG}{\param{}{condition}, \param{}{msg}}
3593 Assert macro with message. An error message will be generated if the condition is false.
3595 \wxheading{See also}
3597 \helpref{wxASSERT}{wxassert},\\
3598 \helpref{wxCOMPILE\_TIME\_ASSERT}{wxcompiletimeassert}
3600 \membersection{wxCOMPILE\_TIME\_ASSERT}\label{wxcompiletimeassert}
3602 \func{}{wxCOMPILE\_TIME\_ASSERT}{\param{}{condition}, \param{}{msg}}
3604 Using {\tt wxCOMPILE\_TIME\_ASSERT} results in a compilation error if the
3605 specified {\it condition} is false. The compiler error message should include
3606 the {\it msg} identifier - please note that it must be a valid C++ identifier
3607 and not a string unlike in the other cases.
3609 This macro is mostly useful for testing the expressions involving the
3610 {\tt sizeof} operator as they can't be tested by the preprocessor but it is
3611 sometimes desirable to test them at the compile time.
3613 Note that this macro internally declares a struct whose name it tries to make
3614 unique by using the {\tt \_\_LINE\_\_} in it but it may still not work if you
3615 use it on the same line in two different source files. In this case you may
3616 either change the line in which either of them appears on or use the
3617 \helpref{wxCOMPILE\_TIME\_ASSERT2}{wxcompiletimeassert2} macro.
3619 \wxheading{See also}
3621 \helpref{wxASSERT\_MSG}{wxassertmsg},\\
3622 \helpref{wxASSERT\_MIN\_BITSIZE}{wxassertminbitsize}
3624 \membersection{wxCOMPILE\_TIME\_ASSERT2}\label{wxcompiletimeassert2}
3626 \func{}{wxCOMPILE\_TIME\_ASSERT}{\param{}{condition}, \param{}{msg}, \param{}{name}}
3628 This macro is identical to \helpref{wxCOMPILE\_TIME\_ASSERT2}{wxcompiletimeassert2}
3629 except that it allows you to specify a unique {\it name} for the struct
3630 internally defined by this macro to avoid getting the compilation errors
3631 described \helpref{above}{wxcompiletimeassert}.
3633 \membersection{wxFAIL}\label{wxfail}
3635 \func{}{wxFAIL}{\void}
3637 Will always generate an assert error if this code is reached (in debug mode).
3639 See also: \helpref{wxFAIL\_MSG}{wxfailmsg}
3641 \membersection{wxFAIL\_MSG}\label{wxfailmsg}
3643 \func{}{wxFAIL\_MSG}{\param{}{msg}}
3645 Will always generate an assert error with specified message if this code is reached (in debug mode).
3647 This macro is useful for marking unreachable" code areas, for example
3648 it may be used in the "default:" branch of a switch statement if all possible
3649 cases are processed above.
3651 \wxheading{See also}
3653 \helpref{wxFAIL}{wxfail}
3655 \membersection{wxCHECK}\label{wxcheck}
3657 \func{}{wxCHECK}{\param{}{condition}, \param{}{retValue}}
3659 Checks that the condition is true, returns with the given return value if not (FAILs in debug mode).
3660 This check is done even in release mode.
3662 \membersection{wxCHECK\_MSG}\label{wxcheckmsg}
3664 \func{}{wxCHECK\_MSG}{\param{}{condition}, \param{}{retValue}, \param{}{msg}}
3666 Checks that the condition is true, returns with the given return value if not (FAILs in debug mode).
3667 This check is done even in release mode.
3669 This macro may be only used in non void functions, see also
3670 \helpref{wxCHECK\_RET}{wxcheckret}.
3672 \membersection{wxCHECK\_RET}\label{wxcheckret}
3674 \func{}{wxCHECK\_RET}{\param{}{condition}, \param{}{msg}}
3676 Checks that the condition is true, and returns if not (FAILs with given error
3677 message in debug mode). This check is done even in release mode.
3679 This macro should be used in void functions instead of
3680 \helpref{wxCHECK\_MSG}{wxcheckmsg}.
3682 \membersection{wxCHECK2}\label{wxcheck2}
3684 \func{}{wxCHECK2}{\param{}{condition}, \param{}{operation}}
3686 Checks that the condition is true and \helpref{wxFAIL}{wxfail} and execute
3687 {\it operation} if it is not. This is a generalisation of
3688 \helpref{wxCHECK}{wxcheck} and may be used when something else than just
3689 returning from the function must be done when the {\it condition} is false.
3691 This check is done even in release mode.
3693 \membersection{wxCHECK2\_MSG}\label{wxcheck2msg}
3695 \func{}{wxCHECK2}{\param{}{condition}, \param{}{operation}, \param{}{msg}}
3697 This is the same as \helpref{wxCHECK2}{wxcheck2}, but
3698 \helpref{wxFAIL\_MSG}{wxfailmsg} with the specified {\it msg} is called
3699 instead of wxFAIL() if the {\it condition} is false.
3701 \membersection{::wxTrap}\label{wxtrap}
3703 \func{void}{wxTrap}{\void}
3705 In debug mode (when {\tt \_\_WXDEBUG\_\_} is defined) this function generates a
3706 debugger exception meaning that the control is passed to the debugger if one is
3707 attached to the process. Otherwise the program just terminates abnormally.
3709 In release mode this function does nothing.
3711 \wxheading{Include files}
3716 \membersection{::wxIsDebuggerRunning}\label{wxisdebuggerrunning}
3718 \func{bool}{wxIsDebuggerRunning}{\void}
3720 Returns {\tt true} if the program is running under debugger, {\tt false}
3723 Please note that this function is currently only implemented for Mac builds
3724 using CodeWarrior and always returns {\tt false} elsewhere.
3727 \section{Environment access functions}\label{environfunctions}
3729 The functions in this section allow to access (get) or change value of
3730 environment variables in a portable way. They are currently implemented under
3731 Win32 and POSIX-like systems (Unix).
3733 % TODO add some stuff about env var inheriting but not propagating upwards (VZ)
3735 \wxheading{Include files}
3739 \membersection{wxGetenv}\label{wxgetenvmacro}
3741 \func{wxChar *}{wxGetEnv}{\param{const wxString\&}{ var}}
3743 This is a macro defined as {\tt getenv()} or its wide char version in Unicode
3746 Note that under Win32 it may not return correct value for the variables set
3747 with \helpref{wxSetEnv}{wxsetenv}, use \helpref{wxGetEnv}{wxgetenv} function
3750 \membersection{wxGetEnv}\label{wxgetenv}
3752 \func{bool}{wxGetEnv}{\param{const wxString\&}{ var}, \param{wxString *}{value}}
3754 Returns the current value of the environment variable {\it var} in {\it value}.
3755 {\it value} may be {\tt NULL} if you just want to know if the variable exists
3756 and are not interested in its value.
3758 Returns {\tt true} if the variable exists, {\tt false} otherwise.
3760 \membersection{wxSetEnv}\label{wxsetenv}
3762 \func{bool}{wxSetEnv}{\param{const wxString\&}{ var}, \param{const wxChar *}{value}}
3764 Sets the value of the environment variable {\it var} (adding it if necessary)
3767 Returns {\tt true} on success.
3769 \membersection{wxUnsetEnv}\label{wxunsetenv}
3771 \func{bool}{wxUnsetEnv}{\param{const wxString\&}{ var}}
3773 Removes the variable {\it var} from the environment.
3774 \helpref{wxGetEnv}{wxgetenv} will return {\tt NULL} after the call to this
3777 Returns {\tt true} on success.