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{wxCHECK2
\_MSG}{wxcheck2msg
}\\
34 \helpref{wxCHECK2
}{wxcheck2
}\\
35 \helpref{wxCHECK
\_MSG}{wxcheckmsg
}\\
36 \helpref{wxCHECK
\_RET}{wxcheckret
}\\
37 \helpref{wxCHECK
\_VERSION}{wxcheckversion
}\\
38 \helpref{wxCHECK
}{wxcheck
}\\
39 \helpref{wxClientDisplayRect
}{wxclientdisplayrect
}\\
40 \helpref{wxClipboardOpen
}{wxclipboardopen
}\\
41 \helpref{wxCloseClipboard
}{wxcloseclipboard
}\\
42 \helpref{wxColourDisplay
}{wxcolourdisplay
}\\
43 \helpref{wxCOMPILE
\_TIME\_ASSERT}{wxcompiletimeassert
}\\
44 \helpref{wxConcatFiles
}{wxconcatfiles
}\\
45 \helpref{wxConstCast
}{wxconstcast
}\\
46 \helpref{wxCopyFile
}{wxcopyfile
}\\
47 \helpref{wxCreateDynamicObject
}{wxcreatedynamicobject
}\\
48 \helpref{wxCreateFileTipProvider
}{wxcreatefiletipprovider
}\\
49 \helpref{wxDDECleanUp
}{wxddecleanup
}\\
50 \helpref{wxDDEInitialize
}{wxddeinitialize
}\\
51 \helpref{wxDROP
\_ICON}{wxdropicon
}\\
52 \helpref{wxDebugMsg
}{wxdebugmsg
}\\
53 \helpref{wxDirExists
}{wxdirexists
}\\
54 \helpref{wxDirSelector
}{wxdirselector
}\\
55 \helpref{wxDisplayDepth
}{wxdisplaydepth
}\\
56 \helpref{wxDisplaySizeMM
}{wxdisplaysizemm
}\\
57 \helpref{wxDisplaySize
}{wxdisplaysize
}\\
58 \helpref{wxDisplaySize
}{wxdisplaysize
}\\
59 \helpref{wxDos2UnixFilename
}{wxdos2unixfilename
}\\
60 \helpref{wxDynamicCastThis
}{wxdynamiccastthis
}\\
61 \helpref{wxDynamicCast
}{wxdynamiccast
}\\
62 \helpref{wxEmptyClipboard
}{wxemptyclipboard
}\\
63 \helpref{wxEnableTopLevelWindows
}{wxenabletoplevelwindows
}\\
64 \helpref{wxEndBusyCursor
}{wxendbusycursor
}\\
65 \helpref{wxEntry
}{wxentry
}\\
66 \helpref{wxEnumClipboardFormats
}{wxenumclipboardformats
}\\
67 \helpref{wxError
}{wxerror
}\\
68 \helpref{wxExecute
}{wxexecute
}\\
69 \helpref{wxExit
}{wxexit
}\\
70 \helpref{wxFAIL
\_MSG}{wxfailmsg
}\\
71 \helpref{wxFAIL
}{wxfail
}\\
72 \helpref{wxFatalError
}{wxfatalerror
}\\
73 \helpref{wxFileExists
}{wxfileexists
}\\
74 \helpref{wxFileModificationTime
}{wxfilemodificationtime
}\\
75 \helpref{wxFileNameFromPath
}{wxfilenamefrompath
}\\
76 \helpref{wxFileSelector
}{wxfileselector
}\\
77 \helpref{wxFindFirstFile
}{wxfindfirstfile
}\\
78 \helpref{wxFindMenuItemId
}{wxfindmenuitemid
}\\
79 \helpref{wxFindNextFile
}{wxfindnextfile
}\\
80 \helpref{wxFindWindowAtPointer
}{wxfindwindowatpointer
}\\
81 \helpref{wxFindWindowAtPoint
}{wxfindwindowatpoint
}\\
82 \helpref{wxFindWindowByLabel
}{wxfindwindowbylabel
}\\
83 \helpref{wxFindWindowByName
}{wxfindwindowbyname
}\\
84 \helpref{wxGetActiveWindow
}{wxgetactivewindow
}\\
85 \helpref{wxGetClipboardData
}{wxgetclipboarddata
}\\
86 \helpref{wxGetClipboardFormatName
}{wxgetclipboardformatname
}\\
87 \helpref{wxGetColourFromUser
}{wxgetcolourfromuser
}\\
88 \helpref{wxGetCwd
}{wxgetcwd
}\\
89 \helpref{wxGetDiskSpace
}{wxgetdiskspace
}\\
90 \helpref{wxGetDisplayName
}{wxgetdisplayname
}\\
91 \helpref{wxGetElapsedTime
}{wxgetelapsedtime
}\\
92 \helpref{wxGetEmailAddress
}{wxgetemailaddress
}\\
93 \helpref{wxGetEnv
}{wxgetenv
}\\
94 \helpref{wxGetFontFromUser
}{wxgetfontfromuser
}\\
95 \helpref{wxGetFreeMemory
}{wxgetfreememory
}\\
96 \helpref{wxGetFullHostName
}{wxgetfullhostname
}\\
97 \helpref{wxGetHomeDir
}{wxgethomedir
}\\
98 \helpref{wxGetHostName
}{wxgethostname
}\\
99 \helpref{wxGetLocalTimeMillis
}{wxgetlocaltimemillis
}\\
100 \helpref{wxGetLocalTime
}{wxgetlocaltime
}\\
101 \helpref{wxGetMousePosition
}{wxgetmouseposition
}\\
102 \helpref{wxGetMultipleChoices
}{wxgetmultiplechoices
}\\
103 \helpref{wxGetMultipleChoice
}{wxgetmultiplechoice
}\\
104 \helpref{wxGetNumberFromUser
}{wxgetnumberfromuser
}\\
105 \helpref{wxGetOSDirectory
}{wxgetosdirectory
}\\
106 \helpref{wxGetOsDescription
}{wxgetosdescription
}\\
107 \helpref{wxGetOsVersion
}{wxgetosversion
}\\
108 \helpref{wxGetPasswordFromUser
}{wxgetpasswordfromuser
}\\
109 \helpref{wxGetPrinterCommand
}{wxgetprintercommand
}\\
110 \helpref{wxGetPrinterFile
}{wxgetprinterfile
}\\
111 \helpref{wxGetPrinterMode
}{wxgetprintermode
}\\
112 \helpref{wxGetPrinterOptions
}{wxgetprinteroptions
}\\
113 \helpref{wxGetPrinterOrientation
}{wxgetprinterorientation
}\\
114 \helpref{wxGetPrinterPreviewCommand
}{wxgetprinterpreviewcommand
}\\
115 \helpref{wxGetPrinterScaling
}{wxgetprinterscaling
}\\
116 \helpref{wxGetPrinterTranslation
}{wxgetprintertranslation
}\\
117 \helpref{wxGetResource
}{wxgetresource
}\\
118 \helpref{wxGetSingleChoiceData
}{wxgetsinglechoicedata
}\\
119 \helpref{wxGetSingleChoiceIndex
}{wxgetsinglechoiceindex
}\\
120 \helpref{wxGetSingleChoice
}{wxgetsinglechoice
}\\
121 \helpref{wxGetTempFileName
}{wxgettempfilename
}\\
122 \helpref{wxGetTextFromUser
}{wxgettextfromuser
}\\
123 \helpref{wxGetTranslation
}{wxgettranslation
}\\
124 \helpref{wxGetUTCTime
}{wxgetutctime
}\\
125 \helpref{wxGetUserHome
}{wxgetuserhome
}\\
126 \helpref{wxGetUserId
}{wxgetuserid
}\\
127 \helpref{wxGetUserName
}{wxgetusername
}\\
128 \helpref{wxGetWorkingDirectory
}{wxgetworkingdirectory
}\\
129 \helpref{wxGetenv
}{wxgetenvmacro
}\\
130 \helpref{wxHandleFatalExceptions
}{wxhandlefatalexceptions
}\\
131 \helpref{wxICON
}{wxiconmacro
}\\
132 \helpref{wxINTXX
\_SWAP\_ALWAYS}{intswapalways
}\\
133 \helpref{wxINTXX
\_SWAP\_ON\_BE}{intswaponbe
}\\
134 \helpref{wxINTXX
\_SWAP\_ON\_LE}{intswaponle
}\\
135 \helpref{wxInitAllImageHandlers
}{wxinitallimagehandlers
}\\
136 \helpref{wxInitialize
}{wxinitialize
}\\
137 \helpref{wxIsAbsolutePath
}{wxisabsolutepath
}\\
138 \helpref{wxIsBusy
}{wxisbusy
}\\
139 \helpref{wxIsClipboardFormatAvailable
}{wxisclipboardformatavailable
}\\
140 \helpref{wxIsEmpty
}{wxisempty
}\\
141 \helpref{wxIsWild
}{wxiswild
}\\
142 \helpref{wxKill
}{wxkill
}\\
143 \helpref{wxLoadUserResource
}{wxloaduserresource
}\\
144 \helpref{wxLogDebug
}{wxlogdebug
}\\
145 \helpref{wxLogError
}{wxlogerror
}\\
146 \helpref{wxLogFatalError
}{wxlogfatalerror
}\\
147 \helpref{wxLogMessage
}{wxlogmessage
}\\
148 \helpref{wxLogStatus
}{wxlogstatus
}\\
149 \helpref{wxLogSysError
}{wxlogsyserror
}\\
150 \helpref{wxLogTrace
}{wxlogtrace
}\\
151 \helpref{wxLogVerbose
}{wxlogverbose
}\\
152 \helpref{wxLogWarning
}{wxlogwarning
}\\
153 \helpref{wxMakeMetafilePlaceable
}{wxmakemetafileplaceable
}\\
154 \helpref{wxMatchWild
}{wxmatchwild
}\\
155 \helpref{wxMessageBox
}{wxmessagebox
}\\
156 \helpref{wxMkdir
}{wxmkdir
}\\
157 \helpref{wxMutexGuiEnter
}{wxmutexguienter
}\\
158 \helpref{wxMutexGuiLeave
}{wxmutexguileave
}\\
159 \helpref{wxNewId
}{wxnewid
}\\
160 \helpref{wxNow
}{wxnow
}\\
161 \helpref{wxOnAssert
}{wxonassert
}\\
162 \helpref{wxOpenClipboard
}{wxopenclipboard
}\\
163 \helpref{wxPathOnly
}{wxpathonly
}\\
164 \helpref{wxPostDelete
}{wxpostdelete
}\\
165 \helpref{wxPostEvent
}{wxpostevent
}\\
166 \helpref{wxRegisterClipboardFormat
}{wxregisterclipboardformat
}\\
167 \helpref{wxRegisterId
}{wxregisterid
}\\
168 \helpref{wxRemoveFile
}{wxremovefile
}\\
169 \helpref{wxRenameFile
}{wxrenamefile
}\\
170 \helpref{wxResourceAddIdentifier
}{wxresourceaddidentifier
}\\
171 \helpref{wxResourceClear
}{wxresourceclear
}\\
172 \helpref{wxResourceCreateBitmap
}{wxresourcecreatebitmap
}\\
173 \helpref{wxResourceCreateIcon
}{wxresourcecreateicon
}\\
174 \helpref{wxResourceCreateMenuBar
}{wxresourcecreatemenubar
}\\
175 \helpref{wxResourceGetIdentifier
}{wxresourcegetidentifier
}\\
176 \helpref{wxResourceParseData
}{wxresourcedata
}\\
177 \helpref{wxResourceParseFile
}{wxresourceparsefile
}\\
178 \helpref{wxResourceParseString
}{wxresourceparsestring
}\\
179 \helpref{wxResourceRegisterBitmapData
}{registerbitmapdata
}\\
180 \helpref{wxResourceRegisterIconData
}{wxresourceregistericondata
}\\
181 \helpref{wxRmdir
}{wxrmdir
}\\
182 \helpref{wxSafeYield
}{wxsafeyield
}\\
183 \helpref{wxSetClipboardData
}{wxsetclipboarddata
}\\
184 \helpref{wxSetCursor
}{wxsetcursor
}\\
185 \helpref{wxSetDisplayName
}{wxsetdisplayname
}\\
186 \helpref{wxSetEnv
}{wxsetenv
}\\
187 \helpref{wxSetPrinterCommand
}{wxsetprintercommand
}\\
188 \helpref{wxSetPrinterFile
}{wxsetprinterfile
}\\
189 \helpref{wxSetPrinterMode
}{wxsetprintermode
}\\
190 \helpref{wxSetPrinterOptions
}{wxsetprinteroptions
}\\
191 \helpref{wxSetPrinterOrientation
}{wxsetprinterorientation
}\\
192 \helpref{wxSetPrinterPreviewCommand
}{wxsetprinterpreviewcommand
}\\
193 \helpref{wxSetPrinterScaling
}{wxsetprinterscaling
}\\
194 \helpref{wxSetPrinterTranslation
}{wxsetprintertranslation
}\\
195 \helpref{wxSetWorkingDirectory
}{wxsetworkingdirectory
}\\
196 \helpref{wxShell
}{wxshell
}\\
197 \helpref{wxShowTip
}{wxshowtip
}\\
198 \helpref{wxSleep
}{wxsleep
}\\
199 \helpref{wxSnprintf
}{wxsnprintf
}\\
200 \helpref{wxSplitPath
}{wxsplitfunction
}\\
201 \helpref{wxStartTimer
}{wxstarttimer
}\\
202 \helpref{wxStaticCast
}{wxstaticcast
}\\
203 \helpref{wxStricmp
}{wxstricmp
}\\
204 \helpref{wxStringEq
}{wxstringeq
}\\
205 \helpref{wxStringMatch
}{wxstringmatch
}\\
206 \helpref{wxStripMenuCodes
}{wxstripmenucodes
}\\
207 \helpref{wxStrlen
}{wxstrlen
}\\
208 \helpref{wxSysErrorCode
}{wxsyserrorcode
}\\
209 \helpref{wxSysErrorMsg
}{wxsyserrormsg
}\\
210 \helpref{wxToLower
}{wxtolower
}\\
211 \helpref{wxToUpper
}{wxtoupper
}\\
212 \helpref{wxTraceLevel
}{wxtracelevel
}\\
213 \helpref{wxTrace
}{wxtrace
}\\
214 \helpref{wxTransferFileToStream
}{wxtransferfiletostream
}\\
215 \helpref{wxTransferStreamToFile
}{wxtransferstreamtofile
}\\
216 \helpref{wxTrap
}{wxtrap
}\\
217 \helpref{wxUninitialize
}{wxuninitialize
}\\
218 \helpref{wxUnix2DosFilename
}{wxunix2dosfilename
}\\
219 \helpref{wxUnsetEnv
}{wxunsetenv
}\\
220 \helpref{wxUsleep
}{wxusleep
}\\
221 \helpref{wxVsnprintf
}{wxvsnprintf
}\\
222 \helpref{wxWakeUpIdle
}{wxwakeupidle
}\\
223 \helpref{wxWriteResource
}{wxwriteresource
}\\
224 \helpref{wxYield
}{wxyield
}
226 \section{Version macros
}\label{versionfunctions
}
228 The following constants are defined in wxWindows:
230 \begin{itemize
}\itemsep=
0pt
231 \item {\tt wxMAJOR
\_VERSION} is the major version of wxWindows
232 \item {\tt wxMINOR
\_VERSION} is the minor version of wxWindows
233 \item {\tt wxRELEASE
\_NUMBER} is the release number
236 For example, the values or these constants for wxWindows
2.1.15 are
2,
1 and
239 Additionally,
{\tt wxVERSION
\_STRING} is a user-readable string containing
240 the full wxWindows version and
{\tt wxVERSION
\_NUMBER} is a combination of the
241 three version numbers above: for
2.1.15, it is
2115 and it is
2200 for
244 \wxheading{Include files
}
246 <wx/version.h> or <wx/defs.h>
248 \membersection{wxCHECK
\_VERSION}\label{wxcheckversion
}
250 \func{bool
}{wxCHECK
\_VERSION}{\param{}{major, minor, release
}}
252 This is a macro which evaluates to true if the current wxWindows version is at
253 least major.minor.release.
255 For example, to test if the program is compiled with wxWindows
2.2 or higher,
256 the following can be done:
260 #if wxCHECK_VERSION(
2,
2,
0)
261 if ( s.StartsWith("foo") )
262 #else // replacement code for old version
263 if ( strncmp(s, "foo",
3) ==
0 )
270 \section{Application initialization and termination
}\label{appinifunctions
}
272 The functions in this section are used on application startup/shutdown and also
273 to control the behaviour of the main event loop of the GUI programs.
275 \membersection{::wxEntry
}\label{wxentry
}
277 This initializes wxWindows in a platform-dependent way. Use this if you
278 are not using the default wxWindows entry code (e.g. main or WinMain). For example,
279 you can initialize wxWindows from an Microsoft Foundation Classes application using
282 \func{void
}{wxEntry
}{\param{HANDLE
}{ hInstance
},
\param{HANDLE
}{ hPrevInstance
},
283 \param{const wxString\&
}{commandLine
},
\param{int
}{ cmdShow
},
\param{bool
}{ enterLoop = TRUE
}}
285 wxWindows initialization under Windows (non-DLL). If
{\it enterLoop
} is FALSE, the
286 function will return immediately after calling wxApp::OnInit. Otherwise, the wxWindows
287 message loop will be entered.
289 \func{void
}{wxEntry
}{\param{HANDLE
}{ hInstance
},
\param{HANDLE
}{ hPrevInstance
},
290 \param{WORD
}{ wDataSegment
},
\param{WORD
}{ wHeapSize
},
\param{const wxString\&
}{ commandLine
}}
292 wxWindows initialization under Windows (for applications constructed as a DLL).
294 \func{int
}{wxEntry
}{\param{int
}{ argc
},
\param{const wxString\& *
}{argv
}}
296 wxWindows initialization under Unix.
300 To clean up wxWindows, call wxApp::OnExit followed by the static function
301 wxApp::CleanUp. For example, if exiting from an MFC application that also uses wxWindows:
304 int CTheApp::ExitInstance()
306 // OnExit isn't called by CleanUp so must be called explicitly.
310 return CWinApp::ExitInstance();
314 \wxheading{Include files
}
318 \membersection{::wxHandleFatalExceptions
}\label{wxhandlefatalexceptions
}
320 \func{bool
}{wxHandleFatalExceptions
}{\param{bool
}{ doIt = TRUE
}}
322 If
{\it doIt
} is TRUE, the fatal exceptions (also known as general protection
323 faults under Windows or segmentation violations in the Unix world) will be
324 caught and passed to
\helpref{wxApp::OnFatalException
}{wxapponfatalexception
}.
325 By default, i.e. before this function is called, they will be handled in the
326 normal way which usually just means that the application will be terminated.
327 Calling wxHandleFatalExceptions() with
{\it doIt
} equal to FALSE will restore
328 this default behaviour.
330 \membersection{::wxInitAllImageHandlers
}\label{wxinitallimagehandlers
}
332 \func{void
}{wxInitAllImageHandlers
}{\void}
334 Initializes all available image handlers. For a list of available handlers,
335 see
\helpref{wxImage
}{wximage
}.
339 \helpref{wxImage
}{wximage
},
\helpref{wxImageHandler
}{wximagehandler
}
341 \wxheading{Include files
}
345 \membersection{::wxInitialize
}\label{wxinitialize
}
347 \func{bool
}{wxInitialize
}{\void}
349 This function is used in wxBase only and only if you don't create
350 \helpref{wxApp
}{wxapp
} object at all. In this case you must call it from your
351 {\tt main()
} function before calling any other wxWindows functions.
353 If the function returns
{\tt FALSE
} the initialization could not be performed,
354 in this case the library cannot be used and
355 \helpref{wxUninitialize
}{wxuninitialize
} shouldn't be called neither.
357 This function may be called several times but
358 \helpref{wxUninitialize
}{wxuninitialize
} must be called for each successful
359 call to this function.
361 \wxheading{Include files
}
365 \membersection{::wxSafeYield
}\label{wxsafeyield
}
367 \func{bool
}{wxSafeYield
}{\param{wxWindow*
}{ win = NULL
}}
369 This function is similar to wxYield, except that it disables the user input to
370 all program windows before calling wxYield and re-enables it again
371 afterwards. If
{\it win
} is not NULL, this window will remain enabled,
372 allowing the implementation of some limited user interaction.
374 Returns the result of the call to
\helpref{::wxYield
}{wxyield
}.
376 \wxheading{Include files
}
380 \membersection{::wxUninitialize
}\label{wxuninitialize
}
382 \func{void
}{wxUninitialize
}{\void}
384 This function is for use in console (wxBase) programs only. It must be called
385 once for each previous successful call to
\helpref{wxInitialize
}{wxinitialize
}.
387 \wxheading{Include files
}
391 \membersection{::wxYield
}\label{wxyield
}
393 \func{bool
}{wxYield
}{\void}
395 Calls
\helpref{wxApp::Yield
}{wxappyield
}.
397 This function is kept only for backwards compatibility, please use
398 \helpref{wxApp::Yield
}{wxappyield
}method instead in any new code.
400 \wxheading{Include files
}
402 <wx/app.h> or <wx/utils.h>
404 \membersection{::wxWakeUpIdle
}\label{wxwakeupidle
}
406 \func{void
}{wxWakeUpIdle
}{\void}
408 This functions wakes up the (internal and platform dependent) idle system, i.e. it
409 will force the system to send an idle event even if the system currently
{\it is
}
410 idle and thus would not send any idle event until after some other event would get
411 sent. This is also useful for sending events between two threads and is used by
412 the corresponding functions
\helpref{::wxPostEvent
}{wxpostevent
} and
413 \helpref{wxEvtHandler::AddPendingEvent
}{wxevthandleraddpendingevent
}.
415 \wxheading{Include files
}
419 \section{Process control functions
}\label{processfunctions
}
421 The functions in this section are used to launch or terminate the other
424 \membersection{::wxExecute
}\label{wxexecute
}
426 \func{long
}{wxExecute
}{\param{const wxString\&
}{command
},
\param{bool
}{sync = FALSE
},
\param{wxProcess *
}{callback = NULL
}}
428 \func{long
}{wxExecute
}{\param{char **
}{argv
},
\param{bool
}{sync = FALSE
},
\param{wxProcess *
}{callback = NULL
}}
430 \func{long
}{wxExecute
}{\param{const wxString\&
}{command
},
\param{wxArrayString\&
}{output
}}
432 \func{long
}{wxExecute
}{\param{const wxString\&
}{command
},
\param{wxArrayString\&
}{output
},
\param{wxArrayString\&
}{errors
}}
434 Executes another program in Unix or Windows.
436 The first form takes a command string, such as
{\tt "emacs file.txt"
}.
438 The second form takes an array of values: a command, any number of
439 arguments, terminated by NULL.
441 The semantics of the third and fourth versions is different from the first two
442 and is described in more details below.
444 If
{\it sync
} is FALSE (the default), flow of control immediately returns.
445 If TRUE, the current application waits until the other program has terminated.
447 In the case of synchronous execution, the return value is the exit code of
448 the process (which terminates by the moment the function returns) and will be
449 $-
1$ if the process couldn't be started and typically
0 if the process
450 terminated successfully. Also, while waiting for the process to
451 terminate, wxExecute will call
\helpref{wxYield
}{wxyield
}. The caller
452 should ensure that this can cause no recursion, in the simplest case by
453 calling
\helpref{wxEnableTopLevelWindows(FALSE)
}{wxenabletoplevelwindows
}.
455 For asynchronous execution, however, the return value is the process id and
456 zero value indicates that the command could not be executed. As an added
457 complication, the return value of $-
1$ in this case indicattes that we didn't
458 launch a new process, but connected to the running one (this can only happen in
459 case of using DDE under Windows for command execution). In particular, in this,
460 and only this, case the calling code will not get the notification about
463 If callback isn't NULL and if execution is asynchronous (note that callback
464 parameter can not be non-NULL for synchronous execution),
465 \helpref{wxProcess::OnTerminate
}{wxprocessonterminate
} will be called when
466 the process finishes.
468 Finally, you may use the third overloaded version of this function to execute
469 a process (always synchronously) and capture its output in the array
470 {\it output
}. The fourth version adds the possibility to additionally capture
471 the messages from standard error output in the
{\it errors
} array.
473 See also
\helpref{wxShell
}{wxshell
},
\helpref{wxProcess
}{wxprocess
},
474 \helpref{Exec sample
}{sampleexec
}.
476 \wxheading{Include files
}
480 \membersection{::wxExit
}\label{wxexit
}
482 \func{void
}{wxExit
}{\void}
484 Exits application after calling
\helpref{wxApp::OnExit
}{wxapponexit
}.
485 Should only be used in an emergency: normally the top-level frame
486 should be deleted (after deleting all other frames) to terminate the
487 application. See
\helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
} and
\helpref{wxApp
}{wxapp
}.
489 \wxheading{Include files
}
493 \membersection{::wxKill
}\label{wxkill
}
495 \func{int
}{wxKill
}{\param{long
}{ pid
},
\param{int
}{ sig = wxSIGTERM
},
\param{wxKillError
}{*rc = NULL
}}
497 Equivalent to the Unix kill function: send the given signal
{\it sig
} to the
498 process with PID
{\it pid
}. The valud signal values are
503 wxSIGNONE =
0, // verify if the process exists under Unix
512 wxSIGKILL, // forcefully kill, dangerous!
518 wxSIGTERM // terminate the process gently
522 {\tt wxSIGNONE
},
{\tt wxSIGKILL
} and
{\tt wxSIGTERM
} have the same meaning
523 under both Unix and Windows but all the other signals are equivalent to
524 {\tt wxSIGTERM
} under Windows.
526 Returns
0 on success, -
1 on failure. If
{\it rc
} parameter is not NULL, it will
527 be filled with an element of
{\tt wxKillError
} enum:
532 wxKILL_OK, // no error
533 wxKILL_BAD_SIGNAL, // no such signal
534 wxKILL_ACCESS_DENIED, // permission denied
535 wxKILL_NO_PROCESS, // no such process
536 wxKILL_ERROR // another, unspecified error
542 \helpref{wxProcess::Kill
}{wxprocesskill
},
\rtfsp
543 \helpref{wxProcess::Exists
}{wxprocessexists
},
\rtfsp
544 \helpref{Exec sample
}{sampleexec
}
546 \wxheading{Include files
}
550 \membersection{::wxShell
}\label{wxshell
}
552 \func{bool
}{wxShell
}{\param{const wxString\&
}{command = NULL
}}
554 Executes a command in an interactive shell window. If no command is
555 specified, then just the shell is spawned.
557 See also
\helpref{wxExecute
}{wxexecute
},
\helpref{Exec sample
}{sampleexec
}.
559 \wxheading{Include files
}
564 \section{Thread functions
}\label{threadfunctions
}
566 \wxheading{Include files
}
572 \helpref{wxThread
}{wxthread
},
\helpref{wxMutex
}{wxmutex
},
\helpref{Multithreading overview
}{wxthreadoverview
}
574 \membersection{::wxMutexGuiEnter
}\label{wxmutexguienter
}
576 \func{void
}{wxMutexGuiEnter
}{\void}
578 This function must be called when any thread other than the main GUI thread
579 wants to get access to the GUI library. This function will block the execution
580 of the calling thread until the main thread (or any other thread holding the
581 main GUI lock) leaves the GUI library and no other thread will enter the GUI
582 library until the calling thread calls
\helpref{::wxMutexGuiLeave()
}{wxmutexguileave
}.
584 Typically, these functions are used like this:
587 void MyThread::Foo(void)
589 // before doing any GUI calls we must ensure that this thread is the only
595 my_window->DrawSomething();
601 Note that under GTK, no creation of top-level windows is allowed in any
602 thread but the main one.
604 This function is only defined on platforms which support preemptive
607 \membersection{::wxMutexGuiLeave
}\label{wxmutexguileave
}
609 \func{void
}{wxMutexGuiLeave
}{\void}
611 See
\helpref{::wxMutexGuiEnter()
}{wxmutexguienter
}.
613 This function is only defined on platforms which support preemptive
616 \section{File functions
}\label{filefunctions
}
618 \wxheading{Include files
}
624 \helpref{wxPathList
}{wxpathlist
}\\
625 \helpref{wxDir
}{wxdir
}\\
626 \helpref{wxFile
}{wxfile
}\\
627 \helpref{wxFileName
}{wxfilename
}
629 \membersection{::wxDirExists
}\label{wxdirexists
}
631 \func{bool
}{wxDirExists
}{\param{const wxString\&
}{dirname
}}
633 Returns TRUE if the directory exists.
635 \membersection{::wxDos2UnixFilename
}\label{wxdos2unixfilename
}
637 \func{void
}{wxDos2UnixFilename
}{\param{wxChar *
}{s
}}
639 Converts a DOS to a Unix filename by replacing backslashes with forward
642 \membersection{::wxFileExists
}\label{wxfileexists
}
644 \func{bool
}{wxFileExists
}{\param{const wxString\&
}{filename
}}
646 Returns TRUE if the file exists. It also returns TRUE if the file is
649 \membersection{::wxFileModificationTime
}\label{wxfilemodificationtime
}
651 \func{time
\_t}{wxFileModificationTime
}{\param{const wxString\&
}{filename
}}
653 Returns time of last modification of given file.
655 \membersection{::wxFileNameFromPath
}\label{wxfilenamefrompath
}
657 \func{wxString
}{wxFileNameFromPath
}{\param{const wxString\&
}{path
}}
659 \func{char *
}{wxFileNameFromPath
}{\param{char *
}{path
}}
661 Returns the filename for a full path. The second form returns a pointer to
662 temporary storage that should not be deallocated.
664 \membersection{::wxFindFirstFile
}\label{wxfindfirstfile
}
666 \func{wxString
}{wxFindFirstFile
}{\param{const char *
}{spec
},
\param{int
}{ flags =
0}}
668 This function does directory searching; returns the first file
669 that matches the path
{\it spec
}, or the empty string. Use
\helpref{wxFindNextFile
}{wxfindnextfile
} to
670 get the next matching file. Neither will
report the current directory "." or the
671 parent directory "..".
673 {\it spec
} may contain wildcards.
675 {\it flags
} may be wxDIR for restricting the query to directories, wxFILE for files or zero for either.
680 wxString f = wxFindFirstFile("/home/project/*.*");
681 while ( !f.IsEmpty() )
684 f = wxFindNextFile();
688 \membersection{::wxFindNextFile
}\label{wxfindnextfile
}
690 \func{wxString
}{wxFindNextFile
}{\void}
692 Returns the next file that matches the path passed to
\helpref{wxFindFirstFile
}{wxfindfirstfile
}.
694 See
\helpref{wxFindFirstFile
}{wxfindfirstfile
} for an example.
696 \membersection{::wxGetDiskSpace
}\label{wxgetdiskspace
}
698 \func{bool
}{wxGetDiskSpace
}{\param{const wxString\&
}{path
},
\param{wxLongLong
}{*total = NULL
},
\param{wxLongLong
}{*free = NULL
}}
700 This function returns the total number of bytes and number of free bytes on
701 the disk containing the directory
{\it path
} (it should exist). Both
702 {\it total
} and
{\it free
} parameters may be
{\tt NULL
} if the corresponding
703 information is not needed.
707 {\tt TRUE
} on success,
{\tt FALSE
} if an error occured (for example, the
708 directory doesn't exist).
710 \wxheading{Portability
}
712 This function is implemented for Win16 (only for drives less than
2Gb), Win32,
713 Mac OS and generic Unix provided the system has
{\tt statfs()
} function.
715 This function first appeared in wxWindows
2.3.2.
717 \membersection{::wxGetOSDirectory
}\label{wxgetosdirectory
}
719 \func{wxString
}{wxGetOSDirectory
}{\void}
721 Returns the Windows directory under Windows; on other platforms returns the empty string.
723 \membersection{::wxIsAbsolutePath
}\label{wxisabsolutepath
}
725 \func{bool
}{wxIsAbsolutePath
}{\param{const wxString\&
}{filename
}}
727 Returns TRUE if the argument is an absolute filename, i.e. with a slash
728 or drive name at the beginning.
730 \membersection{::wxPathOnly
}\label{wxpathonly
}
732 \func{wxString
}{wxPathOnly
}{\param{const wxString\&
}{path
}}
734 Returns the directory part of the filename.
736 \membersection{::wxUnix2DosFilename
}\label{wxunix2dosfilename
}
738 \func{void
}{wxUnix2DosFilename
}{\param{const wxString\&
}{s
}}
740 Converts a Unix to a DOS filename by replacing forward
741 slashes with backslashes.
743 \membersection{::wxConcatFiles
}\label{wxconcatfiles
}
745 \func{bool
}{wxConcatFiles
}{\param{const wxString\&
}{file1
},
\param{const wxString\&
}{file2
},
746 \param{const wxString\&
}{file3
}}
748 Concatenates
{\it file1
} and
{\it file2
} to
{\it file3
}, returning
751 \membersection{::wxCopyFile
}\label{wxcopyfile
}
753 \func{bool
}{wxCopyFile
}{\param{const wxString\&
}{file1
},
\param{const wxString\&
}{file2
},
\param{bool
}{overwrite = TRUE
}}
755 Copies
{\it file1
} to
{\it file2
}, returning TRUE if successful. If
756 {\it overwrite
} parameter is TRUE (default), the destination file is overwritten
757 if it exists, but if
{\it overwrite
} is FALSE, the functions failes in this
760 \membersection{::wxGetCwd
}\label{wxgetcwd
}
762 \func{wxString
}{wxGetCwd
}{\void}
764 Returns a string containing the current (or working) directory.
766 \membersection{::wxGetWorkingDirectory
}\label{wxgetworkingdirectory
}
768 \func{wxString
}{wxGetWorkingDirectory
}{\param{char *
}{buf=NULL
},
\param{int
}{sz=
1000}}
770 This function is obsolete: use
\helpref{wxGetCwd
}{wxgetcwd
} instead.
772 Copies the current working directory into the buffer if supplied, or
773 copies the working directory into new storage (which you must delete yourself)
774 if the buffer is NULL.
776 {\it sz
} is the size of the buffer if supplied.
778 \membersection{::wxGetTempFileName
}\label{wxgettempfilename
}
780 \func{char *
}{wxGetTempFileName
}{\param{const wxString\&
}{prefix
},
\param{char *
}{buf=NULL
}}
782 \func{bool
}{wxGetTempFileName
}{\param{const wxString\&
}{prefix
},
\param{wxString\&
}{buf
}}
784 %% Makes a temporary filename based on {\it prefix}, opens and closes the file,
785 %% and places the name in {\it buf}. If {\it buf} is NULL, new store
786 %% is allocated for the temporary filename using {\it new}.
788 %% Under Windows, the filename will include the drive and name of the
789 %% directory allocated for temporary files (usually the contents of the
790 %% TEMP variable). Under Unix, the {\tt /tmp} directory is used.
792 %% It is the application's responsibility to create and delete the file.
794 These functions are obsolete, please use
\rtfsp
795 \helpref{wxFileName::CreateTempFileName
}{wxfilenamecreatetempfilename
}\rtfsp
798 \membersection{::wxIsWild
}\label{wxiswild
}
800 \func{bool
}{wxIsWild
}{\param{const wxString\&
}{pattern
}}
802 Returns TRUE if the pattern contains wildcards. See
\helpref{wxMatchWild
}{wxmatchwild
}.
804 \membersection{::wxMatchWild
}\label{wxmatchwild
}
806 \func{bool
}{wxMatchWild
}{\param{const wxString\&
}{pattern
},
\param{const wxString\&
}{text
},
\param{bool
}{ dot
\_special}}
808 Returns TRUE if the
{\it pattern
}\/ matches the
{\it text
}\/; if
{\it
809 dot
\_special}\/ is TRUE, filenames beginning with a dot are not matched
810 with wildcard characters. See
\helpref{wxIsWild
}{wxiswild
}.
812 \membersection{::wxMkdir
}\label{wxmkdir
}
814 \func{bool
}{wxMkdir
}{\param{const wxString\&
}{dir
},
\param{int
}{perm =
0777}}
816 Makes the directory
{\it dir
}, returning TRUE if successful.
818 {\it perm
} is the access mask for the directory for the systems on which it is
819 supported (Unix) and doesn't have effect for the other ones.
821 \membersection{::wxRemoveFile
}\label{wxremovefile
}
823 \func{bool
}{wxRemoveFile
}{\param{const wxString\&
}{file
}}
825 Removes
{\it file
}, returning TRUE if successful.
827 \membersection{::wxRenameFile
}\label{wxrenamefile
}
829 \func{bool
}{wxRenameFile
}{\param{const wxString\&
}{file1
},
\param{const wxString\&
}{file2
}}
831 Renames
{\it file1
} to
{\it file2
}, returning TRUE if successful.
833 \membersection{::wxRmdir
}\label{wxrmdir
}
835 \func{bool
}{wxRmdir
}{\param{const wxString\&
}{dir
},
\param{int
}{ flags=
0}}
837 Removes the directory
{\it dir
}, returning TRUE if successful. Does not work under VMS.
839 The
{\it flags
} parameter is reserved for future use.
841 \membersection{::wxSetWorkingDirectory
}\label{wxsetworkingdirectory
}
843 \func{bool
}{wxSetWorkingDirectory
}{\param{const wxString\&
}{dir
}}
845 Sets the current working directory, returning TRUE if the operation succeeded.
846 Under MS Windows, the current drive is also changed if
{\it dir
} contains a drive specification.
848 \membersection{::wxSplitPath
}\label{wxsplitfunction
}
850 \func{void
}{wxSplitPath
}{\param{const char *
}{ fullname
},
\param{wxString *
}{ path
},
\param{wxString *
}{ name
},
\param{wxString *
}{ ext
}}
852 This function splits a full file name into components: the path (including possible disk/drive
853 specification under Windows), the base name and the extension. Any of the output parameters
854 (
{\it path
},
{\it name
} or
{\it ext
}) may be NULL if you are not interested in the value of
855 a particular component.
857 wxSplitPath() will correctly handle filenames with both DOS and Unix path separators under
858 Windows, however it will not consider backslashes as path separators under Unix (where backslash
859 is a valid character in a filename).
861 On entry,
{\it fullname
} should be non-NULL (it may be empty though).
863 On return,
{\it path
} contains the file path (without the trailing separator),
{\it name
}
864 contains the file name and
{\it ext
} contains the file extension without leading dot. All
865 three of them may be empty if the corresponding component is. The old contents of the
866 strings pointed to by these parameters will be overwritten in any case (if the pointers
869 \membersection{::wxTransferFileToStream
}\label{wxtransferfiletostream
}
871 \func{bool
}{wxTransferFileToStream
}{\param{const wxString\&
}{filename
},
\param{ostream\&
}{stream
}}
873 Copies the given file to
{\it stream
}. Useful when converting an old application to
874 use streams (within the
document/view framework, for example).
876 \wxheading{Include files
}
880 \membersection{::wxTransferStreamToFile
}\label{wxtransferstreamtofile
}
882 \func{bool
}{wxTransferStreamToFile
}{\param{istream\&
}{stream
} \param{const wxString\&
}{filename
}}
884 Copies the given stream to the file
{\it filename
}. Useful when converting an old application to
885 use streams (within the
document/view framework, for example).
887 \wxheading{Include files
}
891 \section{Network, user and OS functions
}\label{networkfunctions
}
893 The functions in this section are used to retrieve information about the
894 current computer and/or user characteristics.
896 \membersection{::wxGetFreeMemory
}\label{wxgetfreememory
}
898 \func{long
}{wxGetFreeMemory
}{\void}
900 Returns the amount of free memory in bytes under environments which
901 support it, and -
1 if not supported. Currently, it is supported only
902 under Windows, Linux and Solaris.
904 \wxheading{Include files
}
908 \membersection{::wxGetFullHostName
}\label{wxgetfullhostname
}
910 \func{wxString
}{wxGetFullHostName
}{\void}
912 Returns the FQDN (fully qualified domain host name) or an empty string on
917 \helpref{wxGetHostName
}{wxgethostname
}
919 \wxheading{Include files
}
923 \membersection{::wxGetEmailAddress
}\label{wxgetemailaddress
}
925 \func{bool
}{wxGetEmailAddress
}{\param{const wxString\&
}{buf
},
\param{int
}{sz
}}
927 Copies the user's email address into the supplied buffer, by
928 concatenating the values returned by
\helpref{wxGetFullHostName
}{wxgetfullhostname
}\rtfsp
929 and
\helpref{wxGetUserId
}{wxgetuserid
}.
931 Returns TRUE if successful, FALSE otherwise.
933 \wxheading{Include files
}
937 \membersection{::wxGetHomeDir
}\label{wxgethomedir
}
939 \func{wxString
}{wxGetHomeDir
}{\void}
941 Return the (current) user's home directory.
945 \helpref{wxGetUserHome
}{wxgetuserhome
}
947 \wxheading{Include files
}
951 \membersection{::wxGetHostName
}\label{wxgethostname
}
953 \func{wxString
}{wxGetHostName
}{\void}
955 \func{bool
}{wxGetHostName
}{\param{char *
}{buf
},
\param{int
}{sz
}}
957 Copies the current host machine's name into the supplied buffer. Please note
958 that the returned name is
{\it not
} fully qualified, i.e. it does not include
961 Under Windows or NT, this function first looks in the environment
962 variable SYSTEM
\_NAME; if this is not found, the entry
{\bf HostName
}\rtfsp
963 in the
{\bf wxWindows
} section of the WIN.INI file is tried.
965 The first variant of this function returns the hostname if successful or an
966 empty string otherwise. The second (deprecated) function returns TRUE
967 if successful, FALSE otherwise.
971 \helpref{wxGetFullHostName
}{wxgetfullhostname
}
973 \wxheading{Include files
}
977 \membersection{::wxGetUserId
}\label{wxgetuserid
}
979 \func{wxString
}{wxGetUserId
}{\void}
981 \func{bool
}{wxGetUserId
}{\param{char *
}{buf
},
\param{int
}{sz
}}
983 This function returns the "user id" also known as "login name" under Unix i.e.
984 something like "jsmith". It uniquely identifies the current user (on this system).
986 Under Windows or NT, this function first looks in the environment
987 variables USER and LOGNAME; if neither of these is found, the entry
{\bf UserId
}\rtfsp
988 in the
{\bf wxWindows
} section of the WIN.INI file is tried.
990 The first variant of this function returns the login name if successful or an
991 empty string otherwise. The second (deprecated) function returns TRUE
992 if successful, FALSE otherwise.
996 \helpref{wxGetUserName
}{wxgetusername
}
998 \wxheading{Include files
}
1002 \membersection{::wxGetOsDescription
}\label{wxgetosdescription
}
1004 \func{wxString
}{wxGetOsDescription
}{\void}
1006 Returns the string containing the description of the current platform in a
1007 user-readable form. For example, this function may return strings like
1008 {\tt Windows NT Version
4.0} or
{\tt Linux
2.2.2 i386
}.
1010 \wxheading{See also
}
1012 \helpref{::wxGetOsVersion
}{wxgetosversion
}
1014 \wxheading{Include files
}
1018 \membersection{::wxGetOsVersion
}\label{wxgetosversion
}
1020 \func{int
}{wxGetOsVersion
}{\param{int *
}{major = NULL
},
\param{int *
}{minor = NULL
}}
1022 Gets operating system version information.
1024 \begin{twocollist
}\itemsep=
0pt
1025 \twocolitemruled{Platform
}{Return types
}
1026 \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.
}
1027 \twocolitem{GTK
}{Return value is wxGTK, For GTK
1.0,
{\it major
} is
1,
{\it minor
} is
0.
}
1028 \twocolitem{Motif
}{Return value is wxMOTIF
\_X,
{\it major
} is X version,
{\it minor
} is X revision.
}
1029 \twocolitem{OS/
2}{Return value is wxOS2
\_PM.
}
1030 \twocolitem{Windows
3.1}{Return value is wxWINDOWS,
{\it major
} is
3,
{\it minor
} is
1.
}
1031 \twocolitem{Windows NT/
2000}{Return value is wxWINDOWS
\_NT, version is returned in
{\it major
} and
{\it minor
}}
1032 \twocolitem{Windows
98}{Return value is wxWIN95,
{\it major
} is
4,
{\it minor
} is
1 or greater.
}
1033 \twocolitem{Windows
95}{Return value is wxWIN95,
{\it major
} is
4,
{\it minor
} is
0.
}
1034 \twocolitem{Win32s (Windows
3.1)
}{Return value is wxWIN32S,
{\it major
} is
3,
{\it minor
} is
1.
}
1035 \twocolitem{Watcom C++
386 supervisor mode (Windows
3.1)
}{Return value is wxWIN386,
{\it major
} is
3,
{\it minor
} is
1.
}
1038 \wxheading{See also
}
1040 \helpref{::wxGetOsDescription
}{wxgetosdescription
}
1042 \wxheading{Include files
}
1046 \membersection{::wxGetUserHome
}\label{wxgetuserhome
}
1048 \func{const wxChar *
}{wxGetUserHome
}{\param{const wxString\&
}{user = ""
}}
1050 Returns the home directory for the given user. If the username is empty
1051 (default value), this function behaves like
1052 \helpref{wxGetHomeDir
}{wxgethomedir
}.
1054 \wxheading{Include files
}
1058 \membersection{::wxGetUserName
}\label{wxgetusername
}
1060 \func{wxString
}{wxGetUserName
}{\void}
1062 \func{bool
}{wxGetUserName
}{\param{char *
}{buf
},
\param{int
}{sz
}}
1064 This function returns the full user name (something like "Mr. John Smith").
1066 Under Windows or NT, this function looks for the entry
{\bf UserName
}\rtfsp
1067 in the
{\bf wxWindows
} section of the WIN.INI file. If PenWindows
1068 is running, the entry
{\bf Current
} in the section
{\bf User
} of
1069 the PENWIN.INI file is used.
1071 The first variant of this function returns the user name if successful or an
1072 empty string otherwise. The second (deprecated) function returns
{\tt TRUE
}
1073 if successful,
{\tt FALSE
} otherwise.
1075 \wxheading{See also
}
1077 \helpref{wxGetUserId
}{wxgetuserid
}
1079 \wxheading{Include files
}
1083 \section{String functions
}
1085 \membersection{::copystring
}\label{copystring
}
1087 \func{char *
}{copystring
}{\param{const char *
}{s
}}
1089 Makes a copy of the string
{\it s
} using the C++ new operator, so it can be
1090 deleted with the
{\it delete
} operator.
1092 This function is deprecated, use
\helpref{wxString
}{wxstring
} class instead.
1094 \membersection{::wxIsEmpty
}\label{wxisempty
}
1096 \func{bool
}{wxIsEmpty
}{\param{const char *
}{ p
}}
1098 Returns
{\tt TRUE
} if the pointer is either
{\tt NULL
} or points to an empty
1099 string,
{\tt FALSE
} otherwise.
1101 \membersection{::wxStricmp
}\label{wxstricmp
}
1103 \func{int
}{wxStricmp
}{\param{const char *
}{p1
},
\param{const char *
}{p2
}}
1105 Returns a negative value,
0, or positive value if
{\it p1
} is less than, equal
1106 to or greater than
{\it p2
}. The comparison is case-insensitive.
1108 This function complements the standard C function
{\it strcmp()
} which performs
1109 case-sensitive comparison.
1111 \membersection{::wxStringMatch
}\label{wxstringmatch
}
1113 \func{bool
}{wxStringMatch
}{\param{const wxString\&
}{s1
},
\param{const wxString\&
}{s2
},\\
1114 \param{bool
}{ subString = TRUE
},
\param{bool
}{ exact = FALSE
}}
1116 Returns
{\tt TRUE
} if the substring
{\it s1
} is found within
{\it s2
},
1117 ignoring case if
{\it exact
} is FALSE. If
{\it subString
} is
{\tt FALSE
},
1118 no substring matching is done.
1120 This function is obsolete, use
\helpref{wxString::Find
}{wxstringfind
} instead.
1122 \membersection{::wxStringEq
}\label{wxstringeq
}
1124 \func{bool
}{wxStringEq
}{\param{const wxString\&
}{s1
},
\param{const wxString\&
}{s2
}}
1129 #define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) ==
0))
1132 This function is obsolete, use
\helpref{wxString
}{wxstring
} instead.
1134 \membersection{::wxStrlen
}\label{wxstrlen
}
1136 \func{size
\_t}{wxStrlen
}{\param{const char *
}{ p
}}
1138 This is a safe version of standard function
{\it strlen()
}: it does exactly the
1139 same thing (i.e. returns the length of the string) except that it returns
0 if
1140 {\it p
} is the
{\tt NULL
} pointer.
1142 \membersection{::wxGetTranslation
}\label{wxgettranslation
}
1144 \func{const char *
}{wxGetTranslation
}{\param{const char *
}{str
}}
1146 This function returns the translation of string
{\it str
} in the current
1147 \helpref{locale
}{wxlocale
}. If the string is not found in any of the loaded
1148 message catalogs (see
\helpref{internationalization overview
}{internationalization
}), the
1149 original string is returned. In debug build, an error message is logged - this
1150 should help to find the strings which were not yet translated. As this function
1151 is used very often, an alternative syntax is provided: the
\_() macro is
1152 defined as wxGetTranslation().
1154 \membersection{::wxSnprintf
}\label{wxsnprintf
}
1156 \func{int
}{wxSnprintf
}{\param{wxChar *
}{buf
},
\param{size
\_t }{len
},
\param{const wxChar *
}{format
},
\param{}{...
}}
1158 This function replaces the dangerous standard function
{\tt sprintf()
} and is
1159 like
{\tt snprintf()
} available on some platforms. The only difference with
1160 sprintf() is that an additional argument - buffer size - is taken and the
1161 buffer is never overflowed.
1163 Returns the number of characters copied to the buffer or -
1 if there is not
1166 \wxheading{See also
}
1168 \helpref{wxVsnprintf
}{wxvsnprintf
},
\helpref{wxString::Printf
}{wxstringprintf
}
1170 \membersection{::wxToLower
}\label{wxtolower
}
1172 \func{char
}{wxToLower
}{\param{char
}{ch
}}
1174 Converts the character to lower case. This is implemented as a macro for efficiency.
1176 \wxheading{Include files
}
1180 \membersection{::wxToUpper
}\label{wxtoupper
}
1182 \func{char
}{wxToUpper
}{\param{char
}{ch
}}
1184 Converts the character to upper case. This is implemented as a macro for efficiency.
1186 \wxheading{Include files
}
1190 \membersection{::wxVsnprintf
}\label{wxvsnprintf
}
1192 \func{int
}{wxVsnprintf
}{\param{wxChar *
}{buf
},
\param{size
\_t }{len
},
\param{const wxChar *
}{format
},
\param{va
\_list }{argPtr
}}
1194 The same as
\helpref{wxSnprintf
}{wxsnprintf
} but takes a
{\tt va
\_list }
1195 argument instead of arbitrary number of parameters.
1197 \wxheading{See also
}
1199 \helpref{wxSnprintf
}{wxsnprintf
},
\helpref{wxString::PrintfV
}{wxstringprintfv
}
1201 \section{Dialog functions
}\label{dialogfunctions
}
1203 Below are a number of convenience functions for getting input from the
1204 user or displaying messages. Note that in these functions the last three
1205 parameters are optional. However, it is recommended to pass a parent frame
1206 parameter, or (in MS Windows or Motif) the wrong window frame may be brought to
1207 the front when the dialog box is popped up.
1209 \membersection{::wxBeginBusyCursor
}\label{wxbeginbusycursor
}
1211 \func{void
}{wxBeginBusyCursor
}{\param{wxCursor *
}{cursor = wxHOURGLASS
\_CURSOR}}
1213 Changes the cursor to the given cursor for all windows in the application.
1214 Use
\helpref{wxEndBusyCursor
}{wxendbusycursor
} to revert the cursor back
1215 to its previous state. These two calls can be nested, and a counter
1216 ensures that only the outer calls take effect.
1218 See also
\helpref{wxIsBusy
}{wxisbusy
},
\helpref{wxBusyCursor
}{wxbusycursor
}.
1220 \wxheading{Include files
}
1224 \membersection{::wxBell
}\label{wxbell
}
1226 \func{void
}{wxBell
}{\void}
1228 Ring the system bell.
1230 \wxheading{Include files
}
1234 \membersection{::wxCreateFileTipProvider
}\label{wxcreatefiletipprovider
}
1236 \func{wxTipProvider *
}{wxCreateFileTipProvider
}{\param{const wxString\&
}{filename
},
1237 \param{size
\_t }{currentTip
}}
1239 This function creates a
\helpref{wxTipProvider
}{wxtipprovider
} which may be
1240 used with
\helpref{wxShowTip
}{wxshowtip
}.
1242 \docparam{filename
}{The name of the file containing the tips, one per line
}
1243 \docparam{currentTip
}{The index of the first tip to show - normally this index
1244 is remembered between the
2 program runs.
}
1246 \wxheading{See also
}
1248 \helpref{Tips overview
}{tipsoverview
}
1250 \wxheading{Include files
}
1254 \membersection{::wxDirSelector
}\label{wxdirselector
}
1256 \func{wxString
}{wxDirSelector
}{\param{const wxString\&
}{message = wxDirSelectorPromptStr
},\\
1257 \param{const wxString\&
}{default
\_path = ""
},\\
1258 \param{long
}{style =
0},
\param{const wxPoint\&
}{pos = wxDefaultPosition
},\\
1259 \param{wxWindow *
}{parent = NULL
}}
1261 Pops up a directory selector dialog. The arguments have the same meaning as
1262 those of wxDirDialog::wxDirDialog(). The message is displayed at the top,
1263 and the default
\_path, if specified, is set as the initial selection.
1265 The application must check for an empty return value (if the user pressed
1266 Cancel). For example:
1269 const wxString& dir = wxDirSelector("Choose a folder");
1276 \wxheading{Include files
}
1280 \membersection{::wxFileSelector
}\label{wxfileselector
}
1282 \func{wxString
}{wxFileSelector
}{\param{const wxString\&
}{message
},
\param{const wxString\&
}{default
\_path = ""
},\\
1283 \param{const wxString\&
}{default
\_filename = ""
},
\param{const wxString\&
}{default
\_extension = ""
},\\
1284 \param{const wxString\&
}{wildcard = ``*.*''
},
\param{int
}{flags =
0},
\param{wxWindow *
}{parent = ""
},\\
1285 \param{int
}{ x = -
1},
\param{int
}{ y = -
1}}
1287 Pops up a file selector box. In Windows, this is the common file selector
1288 dialog. In X, this is a file selector box with the same functionality.
1289 The path and filename are distinct elements of a full file pathname.
1290 If path is empty, the current directory will be used. If filename is empty,
1291 no default filename will be supplied. The wildcard determines what files
1292 are displayed in the file selector, and file extension supplies a type
1293 extension for the required filename. Flags may be a combination of wxOPEN,
1294 wxSAVE, wxOVERWRITE
\_PROMPT, wxHIDE
\_READONLY, wxFILE
\_MUST\_EXIST, wxMULTIPLE or
0.
1296 Both the Unix and Windows versions implement a wildcard filter. Typing a
1297 filename containing wildcards
(*, ?) in the filename text item, and
1298 clicking on Ok, will result in only those files matching the pattern being
1301 The wildcard may be a specification for multiple types of file
1302 with a description for each, such as:
1305 "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
1308 The application must check for an empty return value (the user pressed
1309 Cancel). For example:
1312 const wxString& s = wxFileSelector("Choose a file to open");
1319 \wxheading{Include files}
1323 \membersection{::wxEndBusyCursor}\label{wxendbusycursor}
1325 \func{void}{wxEndBusyCursor}{\void}
1327 Changes the cursor back to the original cursor, for all windows in the application.
1328 Use with \helpref{wxBeginBusyCursor}{wxbeginbusycursor}.
1330 See also \helpref{wxIsBusy}{wxisbusy}, \helpref{wxBusyCursor}{wxbusycursor}.
1332 \wxheading{Include files}
1336 \membersection{::wxGetColourFromUser}\label{wxgetcolourfromuser}
1338 \func{wxColour}{wxGetColourFromUser}{\param{wxWindow *}{parent}, \param{const wxColour\& }{colInit}}
1340 Shows the colour selection dialog and returns the colour selected by user or
1341 invalid colour (use \helpref{wxColour::Ok}{wxcolourok} to test whether a colour
1342 is valid) if the dialog was cancelled.
1344 \wxheading{Parameters}
1346 \docparam{parent}{The parent window for the colour selection dialog}
1348 \docparam{colInit}{If given, this will be the colour initially selected in the dialog.}
1350 \wxheading{Include files}
1354 \membersection{::wxGetFontFromUser}\label{wxgetfontfromuser}
1356 \func{wxFont}{wxGetFontFromUser}{\param{wxWindow *}{parent}, \param{const wxFont\& }{fontInit}}
1358 Shows the font selection dialog and returns the font selected by user or
1359 invalid font (use \helpref{wxFont::Ok}{wxfontok} to test whether a font
1360 is valid) if the dialog was cancelled.
1362 \wxheading{Parameters}
1364 \docparam{parent}{The parent window for the font selection dialog}
1366 \docparam{fontInit}{If given, this will be the font initially selected in the dialog.}
1368 \wxheading{Include files}
1373 \membersection{::wxGetMultipleChoices}\label{wxgetmultiplechoices}
1375 \func{size\_t}{wxGetMultipleChoices}{\\
1376 \param{wxArrayInt\& }{selections},\\
1377 \param{const wxString\& }{message},\\
1378 \param{const wxString\& }{caption},\\
1379 \param{const wxArrayString\& }{aChoices},\\
1380 \param{wxWindow *}{parent = NULL},\\
1381 \param{int}{ x = -1}, \param{int}{ y = -1},\\
1382 \param{bool}{ centre = TRUE},\\
1383 \param{int }{width=150}, \param{int }{height=200}}
1385 \func{size\_t}{wxGetMultipleChoices}{\\
1386 \param{wxArrayInt\& }{selections},\\
1387 \param{const wxString\& }{message},\\
1388 \param{const wxString\& }{caption},\\
1389 \param{int}{ n}, \param{const wxString\& }{choices[]},\\
1390 \param{wxWindow *}{parent = NULL},\\
1391 \param{int}{ x = -1}, \param{int}{ y = -1},\\
1392 \param{bool}{ centre = TRUE},\\
1393 \param{int }{width=150}, \param{int }{height=200}}
1395 Pops up a dialog box containing a message, OK/Cancel buttons and a
1396 multiple-selection listbox. The user may choose an arbitrary (including 0)
1397 number of items in the listbox whose indices will be returned in
1398 {\it selection} array. The initial contents of this array will be used to
1399 select the items when the dialog is shown.
1401 You may pass the list of strings to choose from either using {\it choices}
1402 which is an array of {\it n} strings for the listbox or by using a single
1403 {\it aChoices} parameter of type \helpref{wxArrayString}{wxarraystring}.
1405 If {\it centre} is TRUE, the message text (which may include new line
1406 characters) is centred; if FALSE, the message is left-justified.
1408 \wxheading{Include files}
1412 \perlnote{In wxPerl there is just an array reference in place of {\tt n}
1413 and {\tt choices}, and no {\tt selections} parameter; the function
1414 returns an array containing the user selections.}
1416 \membersection{::wxGetNumberFromUser}\label{wxgetnumberfromuser}
1418 \func{long}{wxGetNumberFromUser}{
1419 \param{const wxString\& }{message},
1420 \param{const wxString\& }{prompt},
1421 \param{const wxString\& }{caption},
1422 \param{long }{value},
1423 \param{long }{min = 0},
1424 \param{long }{max = 100},
1425 \param{wxWindow *}{parent = NULL},
1426 \param{const wxPoint\& }{pos = wxDefaultPosition}}
1428 Shows a dialog asking the user for numeric input. The dialogs title is set to
1429 {\it caption}, it contains a (possibly) multiline {\it message} above the
1430 single line {\it prompt} and the zone for entering the number.
1432 The number entered must be in the range {\it min}..{\it max} (both of which
1433 should be positive) and {\it value} is the initial value of it. If the user
1434 enters an invalid value or cancels the dialog, the function will return -1.
1436 Dialog is centered on its {\it parent} unless an explicit position is given in
1439 \wxheading{Include files}
1443 \membersection{::wxGetPasswordFromUser}\label{wxgetpasswordfromuser}
1445 \func{wxString}{wxGetTextFromUser}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Input text"},\\
1446 \param{const wxString\& }{default\_value = ``"}, \param{wxWindow *}{parent = NULL}}
1448 Similar to \helpref{wxGetTextFromUser}{wxgettextfromuser} but the text entered
1449 in the dialog is not shown on screen but replaced with stars. This is intended
1450 to be used for entering passwords as the function name implies.
1452 \wxheading{Include files}
1456 \membersection{::wxGetTextFromUser}\label{wxgettextfromuser}
1458 \func{wxString}{wxGetTextFromUser}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Input text"},\\
1459 \param{const wxString\& }{default\_value = ``"}, \param{wxWindow *}{parent = NULL},\\
1460 \param{int}{ x = -1}, \param{int}{ y = -1}, \param{bool}{ centre = TRUE}}
1462 Pop up a dialog box with title set to {\it caption}, {\it message}, and a
1463 \rtfsp{\it default\_value}. The user may type in text and press OK to return this text,
1464 or press Cancel to return the empty string.
1466 If {\it centre} is TRUE, the message text (which may include new line characters)
1467 is centred; if FALSE, the message is left-justified.
1469 \wxheading{Include files}
1473 \membersection{::wxGetMultipleChoice}\label{wxgetmultiplechoice}
1475 \func{int}{wxGetMultipleChoice}{\param{const wxString\& }{message}, \param{const wxString\& }{caption}, \param{int}{ n}, \param{const wxString\& }{choices[]},\\
1476 \param{int }{nsel}, \param{int *}{selection},
1477 \param{wxWindow *}{parent = NULL}, \param{int}{ x = -1}, \param{int}{ y = -1},\\
1478 \param{bool}{ centre = TRUE}, \param{int }{width=150}, \param{int }{height=200}}
1480 Pops up a dialog box containing a message, OK/Cancel buttons and a multiple-selection
1481 listbox. The user may choose one or more item(s) and press OK or Cancel.
1483 The number of initially selected choices, and array of the selected indices,
1484 are passed in; this array will contain the user selections on exit, with
1485 the function returning the number of selections. {\it selection} must be
1486 as big as the number of choices, in case all are selected.
1488 If Cancel is pressed, -1 is returned.
1490 {\it choices} is an array of {\it n} strings for the listbox.
1492 If {\it centre} is TRUE, the message text (which may include new line characters)
1493 is centred; if FALSE, the message is left-justified.
1495 \wxheading{Include files}
1499 \membersection{::wxGetSingleChoice}\label{wxgetsinglechoice}
1501 \func{wxString}{wxGetSingleChoice}{\param{const wxString\& }{message},\\
1502 \param{const wxString\& }{caption},\\
1503 \param{const wxArrayString\& }{aChoices},\\
1504 \param{wxWindow *}{parent = NULL},\\
1505 \param{int}{ x = -1}, \param{int}{ y = -1},\\
1506 \param{bool}{ centre = TRUE},\\
1507 \param{int }{width=150}, \param{int }{height=200}}
1509 \func{wxString}{wxGetSingleChoice}{\param{const wxString\& }{message},\\
1510 \param{const wxString\& }{caption},\\
1511 \param{int}{ n}, \param{const wxString\& }{choices[]},\\
1512 \param{wxWindow *}{parent = NULL},\\
1513 \param{int}{ x = -1}, \param{int}{ y = -1},\\
1514 \param{bool}{ centre = TRUE},\\
1515 \param{int }{width=150}, \param{int }{height=200}}
1517 Pops up a dialog box containing a message, OK/Cancel buttons and a
1518 single-selection listbox. The user may choose an item and press OK to return a
1519 string or Cancel to return the empty string. Use
1520 \helpref{wxGetSingleChoiceIndex}{wxgetsinglechoiceindex} if empty string is a
1521 valid choice and if you want to be able to detect pressing Cancel reliably.
1523 You may pass the list of strings to choose from either using {\it choices}
1524 which is an array of {\it n} strings for the listbox or by using a single
1525 {\it aChoices} parameter of type \helpref{wxArrayString}{wxarraystring}.
1527 If {\it centre} is TRUE, the message text (which may include new line
1528 characters) is centred; if FALSE, the message is left-justified.
1530 \wxheading{Include files}
1534 \perlnote{In wxPerl there is just an array reference in place of {\tt n}
1537 \membersection{::wxGetSingleChoiceIndex}\label{wxgetsinglechoiceindex}
1539 \func{int}{wxGetSingleChoiceIndex}{\param{const wxString\& }{message},\\
1540 \param{const wxString\& }{caption},\\
1541 \param{const wxArrayString\& }{aChoices},\\
1542 \param{wxWindow *}{parent = NULL}, \param{int}{ x = -1}, \param{int}{ y = -1},\\
1543 \param{bool}{ centre = TRUE}, \param{int }{width=150}, \param{int }{height=200}}
1545 \func{int}{wxGetSingleChoiceIndex}{\param{const wxString\& }{message},\\
1546 \param{const wxString\& }{caption},\\
1547 \param{int}{ n}, \param{const wxString\& }{choices[]},\\
1548 \param{wxWindow *}{parent = NULL}, \param{int}{ x = -1}, \param{int}{ y = -1},\\
1549 \param{bool}{ centre = TRUE}, \param{int }{width=150}, \param{int }{height=200}}
1551 As {\bf wxGetSingleChoice} but returns the index representing the selected
1552 string. If the user pressed cancel, -1 is returned.
1554 \wxheading{Include files}
1558 \perlnote{In wxPerl there is just an array reference in place of {\tt n}
1561 \membersection{::wxGetSingleChoiceData}\label{wxgetsinglechoicedata}
1563 \func{wxString}{wxGetSingleChoiceData}{\param{const wxString\& }{message},\\
1564 \param{const wxString\& }{caption},\\
1565 \param{const wxArrayString\& }{aChoices},\\
1566 \param{const wxString\& }{client\_data[]},\\
1567 \param{wxWindow *}{parent = NULL},\\
1568 \param{int}{ x = -1}, \param{int}{ y = -1},\\
1569 \param{bool}{ centre = TRUE}, \param{int }{width=150}, \param{int }{height=200}}
1571 \func{wxString}{wxGetSingleChoiceData}{\param{const wxString\& }{message},\\
1572 \param{const wxString\& }{caption},\\
1573 \param{int}{ n}, \param{const wxString\& }{choices[]},\\
1574 \param{const wxString\& }{client\_data[]},\\
1575 \param{wxWindow *}{parent = NULL},\\
1576 \param{int}{ x = -1}, \param{int}{ y = -1},\\
1577 \param{bool}{ centre = TRUE}, \param{int }{width=150}, \param{int }{height=200}}
1579 As {\bf wxGetSingleChoice} but takes an array of client data pointers
1580 corresponding to the strings, and returns one of these pointers or NULL if
1581 Cancel was pressed. The {\it client\_data} array must have the same number of
1582 elements as {\it choices} or {\it aChoices}!
1584 \wxheading{Include files}
1588 \perlnote{In wxPerl there is just an array reference in place of {\tt n}
1589 and {\tt choices}, and the client data array must have the
1590 same length as the choices array.}
1592 \membersection{::wxIsBusy}\label{wxisbusy}
1594 \func{bool}{wxIsBusy}{\void}
1596 Returns TRUE if between two \helpref{wxBeginBusyCursor}{wxbeginbusycursor} and\rtfsp
1597 \helpref{wxEndBusyCursor}{wxendbusycursor} calls.
1599 See also \helpref{wxBusyCursor}{wxbusycursor}.
1601 \wxheading{Include files}
1605 \membersection{::wxMessageBox}\label{wxmessagebox}
1607 \func{int}{wxMessageBox}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Message"}, \param{int}{ style = wxOK \pipe wxCENTRE},\\
1608 \param{wxWindow *}{parent = NULL}, \param{int}{ x = -1}, \param{int}{ y = -1}}
1610 General purpose message dialog. {\it style} may be a bit list of the
1611 following identifiers:
1613 \begin{twocollist}\itemsep=0pt
1614 \twocolitem{wxYES\_NO}{Puts Yes and No buttons on the message box. May be combined with
1616 \twocolitem{wxCANCEL}{Puts a Cancel button on the message box. May be combined with
1618 \twocolitem{wxOK}{Puts an Ok button on the message box. May be combined with wxCANCEL.}
1619 \twocolitem{wxCENTRE}{Centres the text.}
1620 \twocolitem{wxICON\_EXCLAMATION}{Displays an exclamation mark symbol.}
1621 \twocolitem{wxICON\_HAND}{Displays an error symbol.}
1622 \twocolitem{wxICON\_ERROR}{Displays an error symbol - the same as wxICON\_HAND.}
1623 \twocolitem{wxICON\_QUESTION}{Displays a question mark symbol.}
1624 \twocolitem{wxICON\_INFORMATION}{Displays an information symbol.}
1627 The return value is one of: wxYES, wxNO, wxCANCEL, wxOK.
1633 int answer = wxMessageBox("Quit program?", "Confirm",
1634 wxYES_NO | wxCANCEL, main_frame);
1635 if (answer == wxYES)
1640 {\it message} may contain newline characters, in which case the
1641 message will be split into separate lines, to cater for large messages.
1643 Under Windows, the native MessageBox function is used unless wxCENTRE
1644 is specified in the style, in which case a generic function is used.
1645 This is because the native MessageBox function cannot centre text.
1646 The symbols are not shown when the generic function is used.
1648 \wxheading{Include files}
1652 \membersection{::wxShowTip}\label{wxshowtip}
1654 \func{bool}{wxShowTip}{\param{wxWindow *}{parent},
1655 \param{wxTipProvider *}{tipProvider},
1656 \param{bool }{showAtStartup = TRUE}}
1658 This function shows a "startup tip" to the user.
1660 \docparam{parent}{The parent window for the modal dialog}
1662 \docparam{tipProvider}{An object which is used to get the text of the tips.
1663 It may be created with the \helpref{wxCreateFileTipProvider}{wxcreatefiletipprovider} function.}
1665 \docparam{showAtStartup}{Should be TRUE if startup tips are shown, FALSE
1666 otherwise. This is used as the initial value for "Show tips at startup"
1667 checkbox which is shown in the tips dialog.}
1669 \wxheading{See also}
1671 \helpref{Tips overview}{tipsoverview}
1673 \wxheading{Include files}
1677 \section{GDI functions}\label{gdifunctions}
1679 The following are relevant to the GDI (Graphics Device Interface).
1681 \wxheading{Include files}
1685 \membersection{wxBITMAP}\label{wxbitmapmacro}
1687 \func{}{wxBITMAP}{bitmapName}
1689 This macro loads a bitmap from either application resources (on the platforms
1690 for which they exist, i.e. Windows and OS2) or from an XPM file. It allows to
1691 avoid using {\tt \#ifdef}s when creating bitmaps.
1693 \wxheading{See also}
1695 \helpref{Bitmaps and icons overview}{wxbitmapoverview},
1696 \helpref{wxICON}{wxiconmacro}
1698 \wxheading{Include files}
1702 \membersection{::wxClientDisplayRect}\label{wxclientdisplayrect}
1704 \func{void}{wxClientDisplayRect}{\param{int *}{x}, \param{int *}{y},
1705 \param{int *}{width}, \param{int *}{height}}
1707 \func{wxRect}{wxGetClientDisplayRect}{\void}
1709 Returns the dimensions of the work area on the display. On Windows
1710 this means the area not covered by the taskbar, etc. Other platforms
1711 are currently defaulting to the whole display until a way is found to
1712 provide this info for all window managers, etc.
1714 \membersection{::wxColourDisplay}\label{wxcolourdisplay}
1716 \func{bool}{wxColourDisplay}{\void}
1718 Returns TRUE if the display is colour, FALSE otherwise.
1720 \membersection{::wxDisplayDepth}\label{wxdisplaydepth}
1722 \func{int}{wxDisplayDepth}{\void}
1724 Returns the depth of the display (a value of 1 denotes a monochrome display).
1726 \membersection{::wxDisplaySize}\label{wxdisplaysize}
1728 \func{void}{wxDisplaySize}{\param{int *}{width}, \param{int *}{height}}
1730 \func{wxSize}{wxGetDisplaySize}{\void}
1732 Returns the display size in pixels.
1734 \membersection{::wxDisplaySizeMM}\label{wxdisplaysizemm}
1736 \func{void}{wxDisplaySizeMM}{\param{int *}{width}, \param{int *}{height}}
1738 \func{wxSize}{wxGetDisplaySizeMM}{\void}
1740 Returns the display size in millimeters.
1742 \membersection{::wxDROP\_ICON}\label{wxdropicon}
1744 \func{wxIconOrCursor}{wxDROP\_ICON}{\param{const char *}{name}}
1746 This macro creates either a cursor (MSW) or an icon (elsewhere) with the given
1747 name. Under MSW, the cursor is loaded from the resource file and the icon is
1748 loaded from XPM file under other platforms.
1750 This macro should be used with
1751 \helpref{wxDropSource constructor}{wxdropsourcewxdropsource}.
1753 \wxheading{Include files}
1757 \membersection{wxICON}\label{wxiconmacro}
1759 \func{}{wxICON}{iconName}
1761 This macro loads an icon from either application resources (on the platforms
1762 for which they exist, i.e. Windows and OS2) or from an XPM file. It allows to
1763 avoid using {\tt \#ifdef}s when creating icons.
1765 \wxheading{See also}
1767 \helpref{Bitmaps and icons overview}{wxbitmapoverview},
1768 \helpref{wxBITMAP}{wxbitmapmacro}
1770 \wxheading{Include files}
1774 \membersection{::wxMakeMetafilePlaceable}\label{wxmakemetafileplaceable}
1776 \func{bool}{wxMakeMetafilePlaceable}{\param{const wxString\& }{filename}, \param{int }{minX}, \param{int }{minY},
1777 \param{int }{maxX}, \param{int }{maxY}, \param{float }{scale=1.0}}
1779 Given a filename for an existing, valid metafile (as constructed using \helpref{wxMetafileDC}{wxmetafiledc})
1780 makes it into a placeable metafile by prepending a header containing the given
1781 bounding box. The bounding box may be obtained from a device context after drawing
1782 into it, using the functions wxDC::MinX, wxDC::MinY, wxDC::MaxX and wxDC::MaxY.
1784 In addition to adding the placeable metafile header, this function adds
1785 the equivalent of the following code to the start of the metafile data:
1788 SetMapMode(dc, MM_ANISOTROPIC);
1789 SetWindowOrg(dc, minX, minY);
1790 SetWindowExt(dc, maxX - minX, maxY - minY);
1793 This simulates the wxMM\_TEXT mapping mode, which wxWindows assumes.
1795 Placeable metafiles may be imported by many Windows applications, and can be
1796 used in RTF (Rich Text Format) files.
1798 {\it scale} allows the specification of scale for the metafile.
1800 This function is only available under Windows.
1802 \membersection{::wxSetCursor}\label{wxsetcursor}
1804 \func{void}{wxSetCursor}{\param{wxCursor *}{cursor}}
1806 Globally sets the cursor; only has an effect in Windows and GTK.
1807 See also \helpref{wxCursor}{wxcursor}, \helpref{wxWindow::SetCursor}{wxwindowsetcursor}.
1809 \section{Printer settings}\label{printersettings}
1811 These routines are obsolete and should no longer be used!
1813 The following functions are used to control PostScript printing. Under
1814 Windows, PostScript output can only be sent to a file.
1816 \wxheading{Include files}
1820 \membersection{::wxGetPrinterCommand}\label{wxgetprintercommand}
1822 \func{wxString}{wxGetPrinterCommand}{\void}
1824 Gets the printer command used to print a file. The default is {\tt lpr}.
1826 \membersection{::wxGetPrinterFile}\label{wxgetprinterfile}
1828 \func{wxString}{wxGetPrinterFile}{\void}
1830 Gets the PostScript output filename.
1832 \membersection{::wxGetPrinterMode}\label{wxgetprintermode}
1834 \func{int}{wxGetPrinterMode}{\void}
1836 Gets the printing mode controlling where output is sent (PS\_PREVIEW, PS\_FILE or PS\_PRINTER).
1837 The default is PS\_PREVIEW.
1839 \membersection{::wxGetPrinterOptions}\label{wxgetprinteroptions}
1841 \func{wxString}{wxGetPrinterOptions}{\void}
1843 Gets the additional options for the print command (e.g. specific printer). The default is nothing.
1845 \membersection{::wxGetPrinterOrientation}\label{wxgetprinterorientation}
1847 \func{int}{wxGetPrinterOrientation}{\void}
1849 Gets the orientation (PS\_PORTRAIT or PS\_LANDSCAPE). The default is PS\_PORTRAIT.
1851 \membersection{::wxGetPrinterPreviewCommand}\label{wxgetprinterpreviewcommand}
1853 \func{wxString}{wxGetPrinterPreviewCommand}{\void}
1855 Gets the command used to view a PostScript file. The default depends on the platform.
1857 \membersection{::wxGetPrinterScaling}\label{wxgetprinterscaling}
1859 \func{void}{wxGetPrinterScaling}{\param{float *}{x}, \param{float *}{y}}
1861 Gets the scaling factor for PostScript output. The default is 1.0, 1.0.
1863 \membersection{::wxGetPrinterTranslation}\label{wxgetprintertranslation}
1865 \func{void}{wxGetPrinterTranslation}{\param{float *}{x}, \param{float *}{y}}
1867 Gets the translation (from the top left corner) for PostScript output. The default is 0.0, 0.0.
1869 \membersection{::wxSetPrinterCommand}\label{wxsetprintercommand}
1871 \func{void}{wxSetPrinterCommand}{\param{const wxString\& }{command}}
1873 Sets the printer command used to print a file. The default is {\tt lpr}.
1875 \membersection{::wxSetPrinterFile}\label{wxsetprinterfile}
1877 \func{void}{wxSetPrinterFile}{\param{const wxString\& }{filename}}
1879 Sets the PostScript output filename.
1881 \membersection{::wxSetPrinterMode}\label{wxsetprintermode}
1883 \func{void}{wxSetPrinterMode}{\param{int }{mode}}
1885 Sets the printing mode controlling where output is sent (PS\_PREVIEW, PS\_FILE or PS\_PRINTER).
1886 The default is PS\_PREVIEW.
1888 \membersection{::wxSetPrinterOptions}\label{wxsetprinteroptions}
1890 \func{void}{wxSetPrinterOptions}{\param{const wxString\& }{options}}
1892 Sets the additional options for the print command (e.g. specific printer). The default is nothing.
1894 \membersection{::wxSetPrinterOrientation}\label{wxsetprinterorientation}
1896 \func{void}{wxSetPrinterOrientation}{\param{int}{ orientation}}
1898 Sets the orientation (PS\_PORTRAIT or PS\_LANDSCAPE). The default is PS\_PORTRAIT.
1900 \membersection{::wxSetPrinterPreviewCommand}\label{wxsetprinterpreviewcommand}
1902 \func{void}{wxSetPrinterPreviewCommand}{\param{const wxString\& }{command}}
1904 Sets the command used to view a PostScript file. The default depends on the platform.
1906 \membersection{::wxSetPrinterScaling}\label{wxsetprinterscaling}
1908 \func{void}{wxSetPrinterScaling}{\param{float }{x}, \param{float }{y}}
1910 Sets the scaling factor for PostScript output. The default is 1.0, 1.0.
1912 \membersection{::wxSetPrinterTranslation}\label{wxsetprintertranslation}
1914 \func{void}{wxSetPrinterTranslation}{\param{float }{x}, \param{float }{y}}
1916 Sets the translation (from the top left corner) for PostScript output. The default is 0.0, 0.0.
1918 \section{Clipboard functions}\label{clipsboard}
1920 These clipboard functions are implemented for Windows only. The use of these functions
1921 is deprecated and the code is no longer maintained. Use the \helpref{wxClipboard}{wxclipboard}
1924 \wxheading{Include files}
1928 \membersection{::wxClipboardOpen}\label{wxclipboardopen}
1930 \func{bool}{wxClipboardOpen}{\void}
1932 Returns TRUE if this application has already opened the clipboard.
1934 \membersection{::wxCloseClipboard}\label{wxcloseclipboard}
1936 \func{bool}{wxCloseClipboard}{\void}
1938 Closes the clipboard to allow other applications to use it.
1940 \membersection{::wxEmptyClipboard}\label{wxemptyclipboard}
1942 \func{bool}{wxEmptyClipboard}{\void}
1944 Empties the clipboard.
1946 \membersection{::wxEnumClipboardFormats}\label{wxenumclipboardformats}
1948 \func{int}{wxEnumClipboardFormats}{\param{int}{dataFormat}}
1950 Enumerates the formats found in a list of available formats that belong
1951 to the clipboard. Each call to this function specifies a known
1952 available format; the function returns the format that appears next in
1955 {\it dataFormat} specifies a known format. If this parameter is zero,
1956 the function returns the first format in the list.
1958 The return value specifies the next known clipboard data format if the
1959 function is successful. It is zero if the {\it dataFormat} parameter specifies
1960 the last format in the list of available formats, or if the clipboard
1963 Before it enumerates the formats function, an application must open the clipboard by using the
1964 wxOpenClipboard function.
1966 \membersection{::wxGetClipboardData}\label{wxgetclipboarddata}
1968 \func{wxObject *}{wxGetClipboardData}{\param{int}{dataFormat}}
1970 Gets data from the clipboard.
1972 {\it dataFormat} may be one of:
1974 \begin{itemize}\itemsep=0pt
1975 \item wxCF\_TEXT or wxCF\_OEMTEXT: returns a pointer to new memory containing a null-terminated text string.
1976 \item wxCF\_BITMAP: returns a new wxBitmap.
1979 The clipboard must have previously been opened for this call to succeed.
1981 \membersection{::wxGetClipboardFormatName}\label{wxgetclipboardformatname}
1983 \func{bool}{wxGetClipboardFormatName}{\param{int}{dataFormat}, \param{const wxString\& }{formatName}, \param{int}{maxCount}}
1985 Gets the name of a registered clipboard format, and puts it into the buffer {\it formatName} which is of maximum
1986 length {\it maxCount}. {\it dataFormat} must not specify a predefined clipboard format.
1988 \membersection{::wxIsClipboardFormatAvailable}\label{wxisclipboardformatavailable}
1990 \func{bool}{wxIsClipboardFormatAvailable}{\param{int}{dataFormat}}
1992 Returns TRUE if the given data format is available on the clipboard.
1994 \membersection{::wxOpenClipboard}\label{wxopenclipboard}
1996 \func{bool}{wxOpenClipboard}{\void}
1998 Opens the clipboard for passing data to it or getting data from it.
2000 \membersection{::wxRegisterClipboardFormat}\label{wxregisterclipboardformat}
2002 \func{int}{wxRegisterClipboardFormat}{\param{const wxString\& }{formatName}}
2004 Registers the clipboard data format name and returns an identifier.
2006 \membersection{::wxSetClipboardData}\label{wxsetclipboarddata}
2008 \func{bool}{wxSetClipboardData}{\param{int}{dataFormat}, \param{wxObject *}{data}, \param{int}{width}, \param{int}{height}}
2010 Passes data to the clipboard.
2012 {\it dataFormat} may be one of:
2014 \begin{itemize}\itemsep=0pt
2015 \item wxCF\_TEXT or wxCF\_OEMTEXT: {\it data} is a null-terminated text string.
2016 \item wxCF\_BITMAP: {\it data} is a wxBitmap.
2017 \item wxCF\_DIB: {\it data} is a wxBitmap. The bitmap is converted to a DIB (device independent bitmap).
2018 \item wxCF\_METAFILE: {\it data} is a wxMetafile. {\it width} and {\it height} are used to give recommended dimensions.
2021 The clipboard must have previously been opened for this call to succeed.
2023 \section{Miscellaneous functions}\label{miscellany}
2025 \membersection{::wxNewId}\label{wxnewid}
2027 \func{long}{wxNewId}{\void}
2029 Generates an integer identifier unique to this run of the program.
2031 \wxheading{Include files}
2035 \membersection{::wxRegisterId}\label{wxregisterid}
2037 \func{void}{wxRegisterId}{\param{long}{ id}}
2039 Ensures that ids subsequently generated by {\bf NewId} do not clash with
2042 \wxheading{Include files}
2046 \membersection{::wxDDECleanUp}\label{wxddecleanup}
2048 \func{void}{wxDDECleanUp}{\void}
2050 Called when wxWindows exits, to clean up the DDE system. This no longer needs to be
2051 called by the application.
2053 See also \helpref{wxDDEInitialize}{wxddeinitialize}.
2055 \wxheading{Include files}
2059 \membersection{::wxDDEInitialize}\label{wxddeinitialize}
2061 \func{void}{wxDDEInitialize}{\void}
2063 Initializes the DDE system. May be called multiple times without harm.
2065 This no longer needs to be called by the application: it will be called
2066 by wxWindows if necessary.
2068 See also \helpref{wxDDEServer}{wxddeserver}, \helpref{wxDDEClient}{wxddeclient}, \helpref{wxDDEConnection}{wxddeconnection},
2069 \helpref{wxDDECleanUp}{wxddecleanup}.
2071 \wxheading{Include files}
2075 \membersection{::wxDisplaySize}\label{wxdisplaysize}
2077 \func{void}{wxDisplaySize}{\param{int *}{width}, \param{int *}{height}}
2079 Gets the physical size of the display in pixels.
2081 \wxheading{Include files}
2085 \membersection{::wxEnableTopLevelWindows}\label{wxenabletoplevelwindows}
2087 \func{void}{wxEnableTopLevelWindow}{\param{bool}{ enable = TRUE}}
2089 This function enables or disables all top level windows. It is used by
2090 \helpref{::wxSafeYield}{wxsafeyield}.
2092 \wxheading{Include files}
2096 \membersection{::wxFindMenuItemId}\label{wxfindmenuitemid}
2098 \func{int}{wxFindMenuItemId}{\param{wxFrame *}{frame}, \param{const wxString\& }{menuString}, \param{const wxString\& }{itemString}}
2100 Find a menu item identifier associated with the given frame's menu bar.
2102 \wxheading{Include files}
2106 \membersection{::wxFindWindowByLabel}\label{wxfindwindowbylabel}
2108 \func{wxWindow *}{wxFindWindowByLabel}{\param{const wxString\& }{label}, \param{wxWindow *}{parent=NULL}}
2110 Find a window by its label. Depending on the type of window, the label may be a window title
2111 or panel item label. If {\it parent} is NULL, the search will start from all top-level
2112 frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.
2113 The search is recursive in both cases.
2115 \wxheading{Include files}
2119 \membersection{::wxFindWindowByName}\label{wxfindwindowbyname}
2121 \func{wxWindow *}{wxFindWindowByName}{\param{const wxString\& }{name}, \param{wxWindow *}{parent=NULL}}
2123 Find a window by its name (as given in a window constructor or {\bf Create} function call).
2124 If {\it parent} is NULL, the search will start from all top-level
2125 frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.
2126 The search is recursive in both cases.
2128 If no such named window is found, {\bf wxFindWindowByLabel} is called.
2130 \wxheading{Include files}
2134 \membersection{::wxFindWindowAtPoint}\label{wxfindwindowatpoint}
2136 \func{wxWindow *}{wxFindWindowAtPoint}{\param{const wxPoint\& }{pt}}
2138 Find the deepest window at the given mouse position in screen coordinates,
2139 returning the window if found, or NULL if not.
2141 \membersection{::wxFindWindowAtPointer}\label{wxfindwindowatpointer}
2143 \func{wxWindow *}{wxFindWindowAtPointer}{\param{wxPoint\& }{pt}}
2145 Find the deepest window at the mouse pointer position, returning the window
2146 and current pointer position in screen coordinates.
2148 \membersection{::wxGetActiveWindow}\label{wxgetactivewindow}
2150 \func{wxWindow *}{wxGetActiveWindow}{\void}
2152 Gets the currently active window (Windows only).
2154 \wxheading{Include files}
2158 \membersection{::wxGetDisplayName}\label{wxgetdisplayname}
2160 \func{wxString}{wxGetDisplayName}{\void}
2162 Under X only, returns the current display name. See also \helpref{wxSetDisplayName}{wxsetdisplayname}.
2164 \wxheading{Include files}
2168 \membersection{::wxGetMousePosition}\label{wxgetmouseposition}
2170 \func{wxPoint}{wxGetMousePosition}{\void}
2172 Returns the mouse position in screen coordinates.
2174 \wxheading{Include files}
2178 \membersection{::wxGetResource}\label{wxgetresource}
2180 \func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
2181 \param{const wxString\& *}{value}, \param{const wxString\& }{file = NULL}}
2183 \func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
2184 \param{float *}{value}, \param{const wxString\& }{file = NULL}}
2186 \func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
2187 \param{long *}{value}, \param{const wxString\& }{file = NULL}}
2189 \func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
2190 \param{int *}{value}, \param{const wxString\& }{file = NULL}}
2192 Gets a resource value from the resource database (for example, WIN.INI, or
2193 .Xdefaults). If {\it file} is NULL, WIN.INI or .Xdefaults is used,
2194 otherwise the specified file is used.
2196 Under X, if an application class (wxApp::GetClassName) has been defined,
2197 it is appended to the string /usr/lib/X11/app-defaults/ to try to find
2198 an applications default file when merging all resource databases.
2200 The reason for passing the result in an argument is that it
2201 can be convenient to define a default value, which gets overridden
2202 if the value exists in the resource file. It saves a separate
2203 test for that resource's existence, and it also allows
2204 the overloading of the function for different types.
2206 See also \helpref{wxWriteResource}{wxwriteresource}, \helpref{wxConfigBase}{wxconfigbase}.
2208 \wxheading{Include files}
2212 \membersection{::wxLoadUserResource}\label{wxloaduserresource}
2214 \func{wxString}{wxLoadUserResource}{\param{const wxString\& }{resourceName}, \param{const wxString\& }{resourceType=``TEXT"}}
2216 Loads a user-defined Windows resource as a string. If the resource is found, the function creates
2217 a new character array and copies the data into it. A pointer to this data is returned. If unsuccessful, NULL is returned.
2219 The resource must be defined in the {\tt .rc} file using the following syntax:
2222 myResource TEXT file.ext
2225 where {\tt file.ext} is a file that the resource compiler can find.
2227 One use of this is to store {\tt .wxr} files instead of including the data in the C++ file; some compilers
2228 cannot cope with the long strings in a {\tt .wxr} file. The resource data can then be parsed
2229 using \helpref{wxResourceParseString}{wxresourceparsestring}.
2231 This function is available under Windows only.
2233 \wxheading{Include files}
2237 \membersection{::wxPostDelete}\label{wxpostdelete}
2239 \func{void}{wxPostDelete}{\param{wxObject *}{object}}
2241 Tells the system to delete the specified object when
2242 all other events have been processed. In some environments, it is
2243 necessary to use this instead of deleting a frame directly with the
2244 delete operator, because some GUIs will still send events to a deleted window.
2246 Now obsolete: use \helpref{wxWindow::Close}{wxwindowclose} instead.
2248 \wxheading{Include files}
2252 \membersection{::wxPostEvent}\label{wxpostevent}
2254 \func{void}{wxPostEvent}{\param{wxEvtHandler *}{dest}, \param{wxEvent\& }{event}}
2256 This function posts the event to the specified {\it dest} object. The
2257 difference between sending an event and posting it is that in the first case
2258 the event is processed before the function returns (in wxWindows, event sending
2259 is done with \helpref{ProcessEvent}{wxevthandlerprocessevent} function), but in
2260 the second, the function returns immediately and the event will be processed
2261 sometime later - usually during the next even loop iteration.
2263 Note that a copy of the {\it event} is made by the function, so the original
2264 copy can be deleted as soon as function returns. This function can also be used
2265 to send events between different threads safely. As this function makes a
2266 copy of the event, the event needs to have a fully implemented Clone() method,
2267 which may not be the case for all event in wxWindows.
2269 See also \helpref{AddPendingEvent}{wxevthandleraddpendingevent} (which this function
2272 \wxheading{Include files}
2276 \membersection{::wxSetDisplayName}\label{wxsetdisplayname}
2278 \func{void}{wxSetDisplayName}{\param{const wxString\& }{displayName}}
2280 Under X only, sets the current display name. This is the X host and display name such
2281 as ``colonsay:0.0", and the function indicates which display should be used for creating
2282 windows from this point on. Setting the display within an application allows multiple
2283 displays to be used.
2285 See also \helpref{wxGetDisplayName}{wxgetdisplayname}.
2287 \wxheading{Include files}
2291 \membersection{::wxStripMenuCodes}\label{wxstripmenucodes}
2293 \func{wxString}{wxStripMenuCodes}{\param{const wxString\& }{in}}
2295 \func{void}{wxStripMenuCodes}{\param{char *}{in}, \param{char *}{out}}
2297 This function is obsolete, please use
2298 \helpref{wxMenuItem::GetLabelFromText}{wxmenuitemgetlabelfromtext} instead.
2300 Strips any menu codes from {\it in} and places the result
2301 in {\it out} (or returns the new string, in the first form).
2303 Menu codes include \& (mark the next character with an underline
2304 as a keyboard shortkey in Windows and Motif) and $\backslash$t (tab in Windows).
2306 \wxheading{Include files}
2310 \membersection{::wxWriteResource}\label{wxwriteresource}
2312 \func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
2313 \param{const wxString\& }{value}, \param{const wxString\& }{file = NULL}}
2315 \func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
2316 \param{float }{value}, \param{const wxString\& }{file = NULL}}
2318 \func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
2319 \param{long }{value}, \param{const wxString\& }{file = NULL}}
2321 \func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
2322 \param{int }{value}, \param{const wxString\& }{file = NULL}}
2324 Writes a resource value into the resource database (for example, WIN.INI, or
2325 .Xdefaults). If {\it file} is NULL, WIN.INI or .Xdefaults is used,
2326 otherwise the specified file is used.
2328 Under X, the resource databases are cached until the internal function
2329 \rtfsp{\bf wxFlushResources} is called automatically on exit, when
2330 all updated resource databases are written to their files.
2332 Note that it is considered bad manners to write to the .Xdefaults
2333 file under Unix, although the WIN.INI file is fair game under Windows.
2335 See also \helpref{wxGetResource}{wxgetresource}, \helpref{wxConfigBase}{wxconfigbase}.
2337 \wxheading{Include files}
2341 \section{Byte order macros}\label{macros}
2343 The endian-ness issues (that is the difference between big-endian and
2344 little-endian architectures) are important for the portable programs working
2345 with the external binary data (for example, data files or data coming from
2346 network) which is usually in some fixed, platform-independent format. The
2347 macros are helpful for transforming the data to the correct format.
2349 \membersection{wxINTXX\_SWAP\_ALWAYS}\label{intswapalways}
2351 \func{wxInt32}{wxINT32\_SWAP\_ALWAYS}{\param{wxInt32 }{value}}
2353 \func{wxUint32}{wxUINT32\_SWAP\_ALWAYS}{\param{wxUint32 }{value}}
2355 \func{wxInt16}{wxINT16\_SWAP\_ALWAYS}{\param{wxInt16 }{value}}
2357 \func{wxUint16}{wxUINT16\_SWAP\_ALWAYS}{\param{wxUint16 }{value}}
2359 These macros will swap the bytes of the {\it value} variable from little
2360 endian to big endian or vice versa unconditionally, i.e. independently of the
2363 \membersection{wxINTXX\_SWAP\_ON\_BE}\label{intswaponbe}
2365 \func{wxInt32}{wxINT32\_SWAP\_ON\_BE}{\param{wxInt32 }{value}}
2367 \func{wxUint32}{wxUINT32\_SWAP\_ON\_BE}{\param{wxUint32 }{value}}
2369 \func{wxInt16}{wxINT16\_SWAP\_ON\_BE}{\param{wxInt16 }{value}}
2371 \func{wxUint16}{wxUINT16\_SWAP\_ON\_BE}{\param{wxUint16 }{value}}
2373 This macro will swap the bytes of the {\it value} variable from little
2374 endian to big endian or vice versa if the program is compiled on a
2375 big-endian architecture (such as Sun work stations). If the program has
2376 been compiled on a little-endian architecture, the value will be unchanged.
2378 Use these macros to read data from and write data to a file that stores
2379 data in little-endian (for example Intel i386) format.
2381 \membersection{wxINTXX\_SWAP\_ON\_LE}\label{intswaponle}
2383 \func{wxInt32}{wxINT32\_SWAP\_ON\_LE}{\param{wxInt32 }{value}}
2385 \func{wxUint32}{wxUINT32\_SWAP\_ON\_LE}{\param{wxUint32 }{value}}
2387 \func{wxInt16}{wxINT16\_SWAP\_ON\_LE}{\param{wxInt16 }{value}}
2389 \func{wxUint16}{wxUINT16\_SWAP\_ON\_LE}{\param{wxUint16 }{value}}
2391 This macro will swap the bytes of the {\it value} variable from little
2392 endian to big endian or vice versa if the program is compiled on a
2393 little-endian architecture (such as Intel PCs). If the program has
2394 been compiled on a big-endian architecture, the value will be unchanged.
2396 Use these macros to read data from and write data to a file that stores
2397 data in big-endian format.
2399 \section{RTTI functions}\label{macros}
2401 wxWindows uses its own RTTI ("run-time type identification") system which
2402 predates the current standard C++ RTTI and so is kept for backwards
2403 compatribility reasons but also because it allows some things which the
2404 standard RTTI doesn't directly support (such as creating a class from its
2407 The standard C++ RTTI can be used in the user code without any problems and in
2408 general you shouldn't need to use the functions and the macros in this section
2409 unless you are thinking of modifying or adding any wxWindows classes.
2411 \wxheading{See also}
2413 \helpref{RTTI overview}{runtimeclassoverview}
2415 \membersection{CLASSINFO}\label{classinfo}
2417 \func{wxClassInfo *}{CLASSINFO}{className}
2419 Returns a pointer to the wxClassInfo object associated with this class.
2421 \wxheading{Include files}
2425 \membersection{DECLARE\_ABSTRACT\_CLASS}\label{declareabstractclass}
2427 \func{}{DECLARE\_ABSTRACT\_CLASS}{className}
2429 Used inside a class declaration to declare that the class should be
2430 made known to the class hierarchy, but objects of this class cannot be created
2431 dynamically. The same as DECLARE\_CLASS.
2436 class wxCommand: public wxObject
2438 DECLARE_ABSTRACT_CLASS(wxCommand)
2447 \wxheading{Include files}
2451 \membersection{DECLARE\_APP}\label{declareapp}
2453 \func{}{DECLARE\_APP}{className}
2455 This is used in headers to create a forward declaration of the wxGetApp function implemented
2456 by IMPLEMENT\_APP. It creates the declaration {\tt className\& wxGetApp(void)}.
2464 \wxheading{Include files}
2468 \membersection{DECLARE\_CLASS}\label{declareclass}
2470 \func{}{DECLARE\_CLASS}{className}
2472 Used inside a class declaration to declare that the class should be
2473 made known to the class hierarchy, but objects of this class cannot be created
2474 dynamically. The same as DECLARE\_ABSTRACT\_CLASS.
2476 \wxheading{Include files}
2480 \membersection{DECLARE\_DYNAMIC\_CLASS}\label{declaredynamicclass}
2482 \func{}{DECLARE\_DYNAMIC\_CLASS}{className}
2484 Used inside a class declaration to declare that the objects of this class should be dynamically
2485 creatable from run-time type information.
2490 class wxFrame: public wxWindow
2492 DECLARE_DYNAMIC_CLASS(wxFrame)
2495 const wxString\& frameTitle;
2501 \wxheading{Include files}
2505 \membersection{IMPLEMENT\_ABSTRACT\_CLASS}\label{implementabstractclass}
2507 \func{}{IMPLEMENT\_ABSTRACT\_CLASS}{className, baseClassName}
2509 Used in a C++ implementation file to complete the declaration of
2510 a class that has run-time type information. The same as IMPLEMENT\_CLASS.
2515 IMPLEMENT_ABSTRACT_CLASS(wxCommand, wxObject)
2517 wxCommand::wxCommand(void)
2523 \wxheading{Include files}
2527 \membersection{IMPLEMENT\_ABSTRACT\_CLASS2}\label{implementabstractclass2}
2529 \func{}{IMPLEMENT\_ABSTRACT\_CLASS2}{className, baseClassName1, baseClassName2}
2531 Used in a C++ implementation file to complete the declaration of
2532 a class that has run-time type information and two base classes. The same as IMPLEMENT\_CLASS2.
2534 \wxheading{Include files}
2538 \membersection{IMPLEMENT\_APP}\label{implementapp}
2540 \func{}{IMPLEMENT\_APP}{className}
2542 This is used in the application class implementation file to make the application class known to
2543 wxWindows for dynamic construction. You use this instead of
2554 IMPLEMENT_APP(MyApp)
2557 See also \helpref{DECLARE\_APP}{declareapp}.
2559 \wxheading{Include files}
2563 \membersection{IMPLEMENT\_CLASS}\label{implementclass}
2565 \func{}{IMPLEMENT\_CLASS}{className, baseClassName}
2567 Used in a C++ implementation file to complete the declaration of
2568 a class that has run-time type information. The same as IMPLEMENT\_ABSTRACT\_CLASS.
2570 \wxheading{Include files}
2574 \membersection{IMPLEMENT\_CLASS2}\label{implementclass2}
2576 \func{}{IMPLEMENT\_CLASS2}{className, baseClassName1, baseClassName2}
2578 Used in a C++ implementation file to complete the declaration of a
2579 class that has run-time type information and two base classes. The
2580 same as IMPLEMENT\_ABSTRACT\_CLASS2.
2582 \wxheading{Include files}
2586 \membersection{IMPLEMENT\_DYNAMIC\_CLASS}\label{implementdynamicclass}
2588 \func{}{IMPLEMENT\_DYNAMIC\_CLASS}{className, baseClassName}
2590 Used in a C++ implementation file to complete the declaration of
2591 a class that has run-time type information, and whose instances
2592 can be created dynamically.
2597 IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
2599 wxFrame::wxFrame(void)
2605 \wxheading{Include files}
2609 \membersection{IMPLEMENT\_DYNAMIC\_CLASS2}\label{implementdynamicclass2}
2611 \func{}{IMPLEMENT\_DYNAMIC\_CLASS2}{className, baseClassName1, baseClassName2}
2613 Used in a C++ implementation file to complete the declaration of
2614 a class that has run-time type information, and whose instances
2615 can be created dynamically. Use this for classes derived from two
2618 \wxheading{Include files}
2622 \membersection{wxConstCast}\label{wxconstcast}
2624 \func{classname *}{wxConstCast}{ptr, classname}
2626 This macro expands into {\tt const\_cast<classname *>(ptr)} if the compiler
2627 supports {\it const\_cast} or into an old, C-style cast, otherwise.
2629 \wxheading{See also}
2631 \helpref{wxDynamicCast}{wxdynamiccast}\\
2632 \helpref{wxStaticCast}{wxstaticcast}
2634 \membersection{::wxCreateDynamicObject}\label{wxcreatedynamicobject}
2636 \func{wxObject *}{wxCreateDynamicObject}{\param{const wxString\& }{className}}
2638 Creates and returns an object of the given class, if the class has been
2639 registered with the dynamic class system using DECLARE... and IMPLEMENT... macros.
2641 \membersection{WXDEBUG\_NEW}\label{debugnew}
2643 \func{}{WXDEBUG\_NEW}{arg}
2645 This is defined in debug mode to be call the redefined new operator
2646 with filename and line number arguments. The definition is:
2649 #define WXDEBUG_NEW new(__FILE__,__LINE__)
2652 In non-debug mode, this is defined as the normal new operator.
2654 \wxheading{Include files}
2658 \membersection{wxDynamicCast}\label{wxdynamiccast}
2660 \func{classname *}{wxDynamicCast}{ptr, classname}
2662 This macro returns the pointer {\it ptr} cast to the type {\it classname *} if
2663 the pointer is of this type (the check is done during the run-time) or
2664 {\tt NULL} otherwise. Usage of this macro is preferred over obsoleted
2665 wxObject::IsKindOf() function.
2667 The {\it ptr} argument may be {\tt NULL}, in which case {\tt NULL} will be
2673 wxWindow *win = wxWindow::FindFocus();
2674 wxTextCtrl *text = wxDynamicCast(win, wxTextCtrl);
2677 // a text control has the focus...
2681 // no window has the focus or it is not a text control
2685 \wxheading{See also}
2687 \helpref{RTTI overview}{runtimeclassoverview}\\
2688 \helpref{wxDynamicCastThis}{wxdynamiccastthis}\\
2689 \helpref{wxConstCast}{wxconstcast}\\
2690 \helpref{wxStatiicCast}{wxstaticcast}
2692 \membersection{wxDynamicCastThis}\label{wxdynamiccastthis}
2694 \func{classname *}{wxDynamicCastThis}{classname}
2696 This macro is equivalent to {\tt wxDynamicCast(this, classname)} but the
2697 latter provokes spurious compilation warnings from some compilers (because it
2698 tests whether {\tt this} pointer is non {\tt NULL} which is always true), so
2699 this macro should be used to avoid them.
2701 \wxheading{See also}
2703 \helpref{wxDynamicCast}{wxdynamiccast}
2705 \membersection{wxStaticCast}\label{wxstaticcast}
2707 \func{classname *}{wxStaticCast}{ptr, classname}
2709 This macro checks that the cast is valid in debug mode (an assert failure will
2710 result if {\tt wxDynamicCast(ptr, classname) == NULL}) and then returns the
2711 result of executing an equivalent of {\tt static\_cast<classname *>(ptr)}.
2713 \helpref{wxDynamicCast}{wxdynamiccast}\\
2714 \helpref{wxConstCast}{wxconstcast}
2716 \section{Resource functions}\label{resourcefuncs}
2718 \overview{Resource functions}{resourceformats}
2720 This section details functions for manipulating wxWindows (.WXR) resource
2721 files and loading user interface elements from resources.
2723 \normalbox{Please note that this use of the word `resource' is different from that used when talking
2724 about initialisation file resource reading and writing, using such functions
2725 as wxWriteResource and wxGetResource. It is just an unfortunate clash of terminology.}
2727 \helponly{For an overview of the wxWindows resource mechanism, see \helpref{the wxWindows resource system}{resourceformats}.}
2729 See also \helpref{wxWindow::LoadFromResource}{wxwindowloadfromresource} for
2730 loading from resource data.
2732 \membersection{::wxResourceAddIdentifier}\label{wxresourceaddidentifier}
2734 \func{bool}{wxResourceAddIdentifier}{\param{const wxString\& }{name}, \param{int }{value}}
2736 Used for associating a name with an integer identifier (equivalent to dynamically\rtfsp
2737 \tt{#}defining a name to an integer). Unlikely to be used by an application except
2738 perhaps for implementing resource functionality for interpreted languages.
2740 \membersection{::wxResourceClear}\label{wxresourceclear}
2742 \func{void}{wxResourceClear}{\void}
2744 Clears the wxWindows resource table.
2746 \membersection{::wxResourceCreateBitmap}\label{wxresourcecreatebitmap}
2748 \func{wxBitmap *}{wxResourceCreateBitmap}{\param{const wxString\& }{resource}}
2750 Creates a new bitmap from a file, static data, or Windows resource, given a valid
2751 wxWindows bitmap resource identifier. For example, if the .WXR file contains
2755 static const wxString\& project_resource = "bitmap(name = 'project_resource',\
2756 bitmap = ['project', wxBITMAP_TYPE_BMP_RESOURCE, 'WINDOWS'],\
2757 bitmap = ['project.xpm', wxBITMAP_TYPE_XPM, 'X']).";
2760 then this function can be called as follows:
2763 wxBitmap *bitmap = wxResourceCreateBitmap("project_resource");
2766 \membersection{::wxResourceCreateIcon}\label{wxresourcecreateicon}
2768 \func{wxIcon *}{wxResourceCreateIcon}{\param{const wxString\& }{resource}}
2770 Creates a new icon from a file, static data, or Windows resource, given a valid
2771 wxWindows icon resource identifier. For example, if the .WXR file contains
2775 static const wxString\& project_resource = "icon(name = 'project_resource',\
2776 icon = ['project', wxBITMAP_TYPE_ICO_RESOURCE, 'WINDOWS'],\
2777 icon = ['project', wxBITMAP_TYPE_XBM_DATA, 'X']).";
2780 then this function can be called as follows:
2783 wxIcon *icon = wxResourceCreateIcon("project_resource");
2786 \membersection{::wxResourceCreateMenuBar}\label{wxresourcecreatemenubar}
2788 \func{wxMenuBar *}{wxResourceCreateMenuBar}{\param{const wxString\& }{resource}}
2790 Creates a new menu bar given a valid wxWindows menubar resource
2791 identifier. For example, if the .WXR file contains the following:
2794 static const wxString\& menuBar11 = "menu(name = 'menuBar11',\
2798 ['&Open File', 2, 'Open a file'],\
2799 ['&Save File', 3, 'Save a file'],\
2801 ['E&xit', 4, 'Exit program']\
2804 ['&About', 6, 'About this program']\
2809 then this function can be called as follows:
2812 wxMenuBar *menuBar = wxResourceCreateMenuBar("menuBar11");
2816 \membersection{::wxResourceGetIdentifier}\label{wxresourcegetidentifier}
2818 \func{int}{wxResourceGetIdentifier}{\param{const wxString\& }{name}}
2820 Used for retrieving the integer value associated with an identifier.
2821 A zero value indicates that the identifier was not found.
2823 See \helpref{wxResourceAddIdentifier}{wxresourceaddidentifier}.
2825 \membersection{::wxResourceParseData}\label{wxresourcedata}
2827 \func{bool}{wxResourceParseData}{\param{const wxString\& }{resource}, \param{wxResourceTable *}{table = NULL}}
2829 Parses a string containing one or more wxWindows resource objects. If
2830 the resource objects are global static data that are included into the
2831 C++ program, then this function must be called for each variable
2832 containing the resource data, to make it known to wxWindows.
2834 {\it resource} should contain data in the following form:
2837 dialog(name = 'dialog1',
2838 style = 'wxCAPTION | wxDEFAULT_DIALOG_STYLE',
2839 title = 'Test dialog box',
2840 x = 312, y = 234, width = 400, height = 300,
2842 control = [1000, wxStaticBox, 'Groupbox', '0', 'group6', 5, 4, 380, 262,
2843 [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]],
2844 control = [1001, wxTextCtrl, '', 'wxTE_MULTILINE', 'text3',
2845 156, 126, 200, 70, 'wxWindows is a multi-platform, GUI toolkit.',
2846 [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0],
2847 [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]]).
2850 This function will typically be used after including a {\tt .wxr} file into
2851 a C++ program as follows:
2854 #include "dialog1.wxr"
2857 Each of the contained resources will declare a new C++ variable, and each
2858 of these variables should be passed to wxResourceParseData.
2860 \membersection{::wxResourceParseFile}\label{wxresourceparsefile}
2862 \func{bool}{wxResourceParseFile}{\param{const wxString\& }{filename}, \param{wxResourceTable *}{table = NULL}}
2864 Parses a file containing one or more wxWindows resource objects
2865 in C++-compatible syntax. Use this function to dynamically load
2866 wxWindows resource data.
2868 \membersection{::wxResourceParseString}\label{wxresourceparsestring}
2870 \func{bool}{wxResourceParseString}{\param{char *}{s}, \param{wxResourceTable *}{table = NULL}}
2872 Parses a string containing one or more wxWindows resource objects. If
2873 the resource objects are global static data that are included into the
2874 C++ program, then this function must be called for each variable
2875 containing the resource data, to make it known to wxWindows.
2877 {\it resource} should contain data with the following form:
2880 dialog(name = 'dialog1',
2881 style = 'wxCAPTION | wxDEFAULT_DIALOG_STYLE',
2882 title = 'Test dialog box',
2883 x = 312, y = 234, width = 400, height = 300,
2885 control = [1000, wxStaticBox, 'Groupbox', '0', 'group6', 5, 4, 380, 262,
2886 [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]],
2887 control = [1001, wxTextCtrl, '', 'wxTE_MULTILINE', 'text3',
2888 156, 126, 200, 70, 'wxWindows is a multi-platform, GUI toolkit.',
2889 [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0],
2890 [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]]).
2893 This function will typically be used after calling \helpref{wxLoadUserResource}{wxloaduserresource} to
2894 load an entire {\tt .wxr file} into a string.
2896 \membersection{::wxResourceRegisterBitmapData}\label{registerbitmapdata}
2898 \func{bool}{wxResourceRegisterBitmapData}{\param{const wxString\& }{name}, \param{char *}{xbm\_data}, \param{int }{width},
2899 \param{int }{height}, \param{wxResourceTable *}{table = NULL}}
2901 \func{bool}{wxResourceRegisterBitmapData}{\param{const wxString\& }{name}, \param{char **}{xpm\_data}}
2903 Makes \tt{#}included XBM or XPM bitmap data known to the wxWindows resource system.
2904 This is required if other resources will use the bitmap data, since otherwise there
2905 is no connection between names used in resources, and the global bitmap data.
2907 \membersection{::wxResourceRegisterIconData}\label{wxresourceregistericondata}
2909 Another name for \helpref{wxResourceRegisterBitmapData}{registerbitmapdata}.
2911 \section{Log functions}\label{logfunctions}
2913 These functions provide a variety of logging functions: see \helpref{Log classes overview}{wxlogoverview} for
2914 further information. The functions use (implicitly) the currently active log
2915 target, so their descriptions here may not apply if the log target is not the
2916 standard one (installed by wxWindows in the beginning of the program).
2918 \wxheading{Include files}
2922 \membersection{::wxDebugMsg}\label{wxdebugmsg}
2924 \func{void}{wxDebugMsg}{\param{const wxString\& }{fmt}, \param{...}{}}
2926 {\bf This function is deprecated, use \helpref{wxLogDebug}{wxlogdebug} instead!}
2928 Display a debugging message; under Windows, this will appear on the
2929 debugger command window, and under Unix, it will be written to standard
2932 The syntax is identical to {\bf printf}: pass a format string and a
2933 variable list of arguments.
2935 {\bf Tip:} under Windows, if your application crashes before the
2936 message appears in the debugging window, put a wxYield call after
2937 each wxDebugMsg call. wxDebugMsg seems to be broken under WIN32s
2938 (at least for Watcom C++): preformat your messages and use OutputDebugString
2941 This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
2943 \wxheading{Include files}
2947 \membersection{::wxError}\label{wxerror}
2949 \func{void}{wxError}{\param{const wxString\& }{msg}, \param{const wxString\& }{title = "wxWindows Internal Error"}}
2951 This function is now obsolete, please use \helpref{wxLogError}{wxlogerror}
2954 Displays {\it msg} and continues. This writes to standard error under
2955 Unix, and pops up a message box under Windows. Used for internal
2956 wxWindows errors. See also \helpref{wxFatalError}{wxfatalerror}.
2958 \wxheading{Include files}
2962 \membersection{::wxFatalError}\label{wxfatalerror}
2964 \func{void}{wxFatalError}{\param{const wxString\& }{msg}, \param{const wxString\& }{title = "wxWindows Fatal Error"}}
2966 This function is now obsolete, please use
2967 \helpref{wxLogFatalError}{wxlogfatalerror} instead.
2969 Displays {\it msg} and exits. This writes to standard error under Unix,
2970 and pops up a message box under Windows. Used for fatal internal
2971 wxWindows errors. See also \helpref{wxError}{wxerror}.
2973 \wxheading{Include files}
2977 \membersection{::wxLogError}\label{wxlogerror}
2979 \func{void}{wxLogError}{\param{const char *}{formatString}, \param{...}{}}
2981 \func{void}{wxVLogError}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
2983 The functions to use for error messages, i.e. the messages that must be shown
2984 to the user. The default processing is to pop up a message box to inform the
2987 \membersection{::wxLogFatalError}\label{wxlogfatalerror}
2989 \func{void}{wxLogFatalError}{\param{const char *}{formatString}, \param{...}{}}
2991 \func{void}{wxVLogFatalError}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
2993 Like \helpref{wxLogError}{wxlogerror}, but also
2994 terminates the program with the exit code 3. Using {\it abort()} standard
2995 function also terminates the program with this exit code.
2997 \membersection{::wxLogWarning}\label{wxlogwarning}
2999 \func{void}{wxLogWarning}{\param{const char *}{formatString}, \param{...}{}}
3001 \func{void}{wxVLogWarning}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3003 For warnings - they are also normally shown to the user, but don't interrupt
3006 \membersection{::wxLogMessage}\label{wxlogmessage}
3008 \func{void}{wxLogMessage}{\param{const char *}{formatString}, \param{...}{}}
3010 \func{void}{wxVLogMessage}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3012 For all normal, informational messages. They also appear in a message box by
3013 default (but it can be changed). Notice that the standard behaviour is to not
3014 show informational messages if there are any errors later - the logic being
3015 that the later error messages make the informational messages preceding them
3018 \membersection{::wxLogVerbose}\label{wxlogverbose}
3020 \func{void}{wxLogVerbose}{\param{const char *}{formatString}, \param{...}{}}
3022 \func{void}{wxVLogVerbose}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3024 For verbose output. Normally, it is suppressed, but
3025 might be activated if the user wishes to know more details about the program
3026 progress (another, but possibly confusing name for the same function is {\bf wxLogInfo}).
3028 \membersection{::wxLogStatus}\label{wxlogstatus}
3030 \func{void}{wxLogStatus}{\param{wxFrame *}{frame}, \param{const char *}{formatString}, \param{...}{}}
3032 \func{void}{wxVLogStatus}{\param{wxFrame *}{frame}, \param{const char *}{formatString}, \param{va\_list }{argPtr}}
3034 \func{void}{wxLogStatus}{\param{const char *}{formatString}, \param{...}{}}
3036 \func{void}{wxVLogStatus}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3038 Messages logged by these functions will appear in the statusbar of the {\it
3039 frame} or of the top level application window by default (i.e. when using
3040 the second version of the functions).
3042 If the target frame doesn't have a statusbar, the message will be lost.
3044 \membersection{::wxLogSysError}\label{wxlogsyserror}
3046 \func{void}{wxLogSysError}{\param{const char *}{formatString}, \param{...}{}}
3048 \func{void}{wxVLogSysError}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3050 Mostly used by wxWindows itself, but might be handy for logging errors after
3051 system call (API function) failure. It logs the specified message text as well
3052 as the last system error code ({\it errno} or {\it ::GetLastError()} depending
3053 on the platform) and the corresponding error message. The second form
3054 of this function takes the error code explicitly as the first argument.
3056 \wxheading{See also}
3058 \helpref{wxSysErrorCode}{wxsyserrorcode},
3059 \helpref{wxSysErrorMsg}{wxsyserrormsg}
3061 \membersection{::wxLogDebug}\label{wxlogdebug}
3063 \func{void}{wxLogDebug}{\param{const char *}{formatString}, \param{...}{}}
3065 \func{void}{wxVLogDebug}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3067 The right functions for debug output. They only do something in debug
3068 mode (when the preprocessor symbol \_\_WXDEBUG\_\_ is defined) and expand to
3069 nothing in release mode (otherwise).
3071 \membersection{::wxLogTrace}\label{wxlogtrace}
3073 \func{void}{wxLogTrace}{\param{const char *}{formatString}, \param{...}{}}
3075 \func{void}{wxVLogTrace}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
3077 \func{void}{wxLogTrace}{\param{const char *}{mask}, \param{const char *}{formatString}, \param{...}{}}
3079 \func{void}{wxVLogTrace}{\param{const char *}{mask}, \param{const char *}{formatString}, \param{va\_list }{argPtr}}
3081 \func{void}{wxLogTrace}{\param{wxTraceMask}{ mask}, \param{const char *}{formatString}, \param{...}{}}
3083 \func{void}{wxVLogTrace}{\param{wxTraceMask}{ mask}, \param{const char *}{formatString}, \param{va\_list }{argPtr}}
3085 As {\bf wxLogDebug}, trace functions only do something in debug build and
3086 expand to nothing in the release one. The reason for making
3087 it a separate function from it is that usually there are a lot of trace
3088 messages, so it might make sense to separate them from other debug messages.
3090 The trace messages also usually can be separated into different categories and
3091 the second and third versions of this function only log the message if the
3092 {\it mask} which it has is currently enabled in \helpref{wxLog}{wxlog}. This
3093 allows to selectively trace only some operations and not others by changing
3094 the value of the trace mask (possible during the run-time).
3096 For the second function (taking a string mask), the message is logged only if
3097 the mask has been previously enabled by the call to
3098 \helpref{AddTraceMask}{wxlogaddtracemask}. The predefined string trace masks
3099 used by wxWindows are:
3101 \begin{itemize}\itemsep=0pt
3102 \item wxTRACE\_MemAlloc: trace memory allocation (new/delete)
3103 \item wxTRACE\_Messages: trace window messages/X callbacks
3104 \item wxTRACE\_ResAlloc: trace GDI resource allocation
3105 \item wxTRACE\_RefCount: trace various ref counting operations
3106 \item wxTRACE\_OleCalls: trace OLE method calls (Win32 only)
3109 The third version of the function only logs the message if all the bit
3110 corresponding to the {\it mask} are set in the wxLog trace mask which can be
3111 set by \helpref{SetTraceMask}{wxlogsettracemask}. This version is less
3112 flexible than the previous one because it doesn't allow defining the user
3113 trace masks easily - this is why it is deprecated in favour of using string
3116 \begin{itemize}\itemsep=0pt
3117 \item wxTraceMemAlloc: trace memory allocation (new/delete)
3118 \item wxTraceMessages: trace window messages/X callbacks
3119 \item wxTraceResAlloc: trace GDI resource allocation
3120 \item wxTraceRefCount: trace various ref counting operations
3121 \item wxTraceOleCalls: trace OLE method calls (Win32 only)
3124 \membersection{::wxSysErrorCode}\label{wxsyserrorcode}
3126 \func{unsigned long}{wxSysErrorCode}{\void}
3128 Returns the error code from the last system call. This function uses
3129 {\tt errno} on Unix platforms and {\tt GetLastError} under Win32.
3131 \wxheading{See also}
3133 \helpref{wxSysErrorMsg}{wxsyserrormsg},
3134 \helpref{wxLogSysError}{wxlogsyserror}
3136 \membersection{::wxSysErrorMsg}\label{wxsyserrormsg}
3138 \func{const wxChar *}{wxSysErrorMsg}{\param{unsigned long }{errCode = 0}}
3140 Returns the error message corresponding to the given system error code. If
3141 {\it errCode} is $0$ (default), the last error code (as returned by
3142 \helpref{wxSysErrorCode}{wxsyserrorcode}) is used.
3144 \wxheading{See also}
3146 \helpref{wxSysErrorCode}{wxsyserrorcode},
3147 \helpref{wxLogSysError}{wxlogsyserror}
3149 \membersection{WXTRACE}\label{trace}
3151 \wxheading{Include files}
3155 \func{}{WXTRACE}{formatString, ...}
3157 Calls wxTrace with printf-style variable argument syntax. Output
3158 is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
3160 This macro is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
3162 \wxheading{Include files}
3166 \membersection{WXTRACELEVEL}\label{tracelevel}
3168 \func{}{WXTRACELEVEL}{level, formatString, ...}
3170 Calls wxTraceLevel with printf-style variable argument syntax. Output
3171 is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
3172 The first argument should be the level at which this information is appropriate.
3173 It will only be output if the level returned by wxDebugContext::GetLevel is equal to or greater than
3176 This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
3178 \wxheading{Include files}
3182 \membersection{::wxTrace}\label{wxtrace}
3184 \func{void}{wxTrace}{\param{const wxString\& }{fmt}, \param{...}{}}
3186 Takes printf-style variable argument syntax. Output
3187 is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
3189 This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
3191 \wxheading{Include files}
3195 \membersection{::wxTraceLevel}\label{wxtracelevel}
3197 \func{void}{wxTraceLevel}{\param{int}{ level}, \param{const wxString\& }{fmt}, \param{...}{}}
3199 Takes printf-style variable argument syntax. Output
3200 is directed to the current output stream (see \helpref{wxDebugContext}{wxdebugcontextoverview}).
3201 The first argument should be the level at which this information is appropriate.
3202 It will only be output if the level returned by wxDebugContext::GetLevel is equal to or greater than
3205 This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}.
3207 \wxheading{Include files}
3211 \section{Time functions}\label{timefunctions}
3213 The functions in this section deal with getting the current time and
3214 starting/stopping the global timers. Please note that the timer functions are
3215 deprecated because they work with one global timer only and
3216 \helpref{wxTimer}{wxtimer} and/or \helpref{wxStopWatch}{wxstopwatch} classes
3217 should be used instead. For retrieving the current time, you may also use
3218 \helpref{wxDateTime::Now}{wxdatetimenow} or
3219 \helpref{wxDateTime::UNow}{wxdatetimeunow} methods.
3221 \membersection{::wxGetElapsedTime}\label{wxgetelapsedtime}
3223 \func{long}{wxGetElapsedTime}{\param{bool}{ resetTimer = TRUE}}
3225 Gets the time in milliseconds since the last \helpref{::wxStartTimer}{wxstarttimer}.
3227 If {\it resetTimer} is TRUE (the default), the timer is reset to zero
3230 See also \helpref{wxTimer}{wxtimer}.
3232 \wxheading{Include files}
3236 \membersection{::wxGetLocalTime}\label{wxgetlocaltime}
3238 \func{long}{wxGetLocalTime}{\void}
3240 Returns the number of seconds since local time 00:00:00 Jan 1st 1970.
3242 \wxheading{See also}
3244 \helpref{wxDateTime::Now}{wxdatetimenow}
3246 \wxheading{Include files}
3250 \membersection{::wxGetLocalTimeMillis}\label{wxgetlocaltimemillis}
3252 \func{wxLongLone}{wxGetLocalTimeMillis}{\void}
3254 Returns the number of milliseconds since local time 00:00:00 Jan 1st 1970.
3256 \wxheading{See also}
3258 \helpref{wxDateTime::Now}{wxdatetimenow},\\
3259 \helpref{wxLongLone}{wxlonglong}
3261 \wxheading{Include files}
3265 \membersection{::wxGetUTCTime}\label{wxgetutctime}
3267 \func{long}{wxGetUTCTime}{\void}
3269 Returns the number of seconds since GMT 00:00:00 Jan 1st 1970.
3271 \wxheading{See also}
3273 \helpref{wxDateTime::Now}{wxdatetimenow}
3275 \wxheading{Include files}
3279 \membersection{::wxNow}\label{wxnow}
3281 \func{wxString}{wxNow}{\void}
3283 Returns a string representing the current date and time.
3285 \wxheading{Include files}
3289 \membersection{::wxSleep}\label{wxsleep}
3291 \func{void}{wxSleep}{\param{int}{ secs}}
3293 Sleeps for the specified number of seconds.
3295 \wxheading{Include files}
3299 \membersection{::wxStartTimer}\label{wxstarttimer}
3301 \func{void}{wxStartTimer}{\void}
3303 Starts a stopwatch; use \helpref{::wxGetElapsedTime}{wxgetelapsedtime} to get the elapsed time.
3305 See also \helpref{wxTimer}{wxtimer}.
3307 \wxheading{Include files}
3311 \membersection{::wxUsleep}\label{wxusleep}
3313 \func{void}{wxUsleep}{\param{unsigned long}{ milliseconds}}
3315 Sleeps for the specified number of milliseconds. Notice that usage of this
3316 function is encouraged instead of calling usleep(3) directly because the
3317 standard usleep() function is not MT safe.
3319 \wxheading{Include files}
3323 \section{Debugging macros and functions}\label{debugmacros}
3325 Useful macros and functions for error checking and defensive programming.
3326 wxWindows defines three families of the assert-like macros:
3327 the wxASSERT and wxFAIL macros only do anything if \_\_WXDEBUG\_\_ is defined
3328 (in other words, in the debug build) but disappear completely in the release
3329 build. On the other hand, the wxCHECK macros stay event in release builds but a
3330 check failure doesn't generate any user-visible effects then. Finally, the
3331 compile time assertions don't happen during the run-time but result in the
3332 compilation error messages if the condition they check fail.
3334 \wxheading{Include files}
3338 \membersection{::wxOnAssert}\label{wxonassert}
3340 \func{void}{wxOnAssert}{\param{const char *}{fileName}, \param{int}{ lineNumber}, \param{const char *}{msg = NULL}}
3342 This function is called whenever one of debugging macros fails (i.e. condition
3343 is false in an assertion). It is only defined in the debug mode, in release
3344 builds the \helpref{wxCHECK}{wxcheck} failures don't result in anything.
3346 To override the default behaviour in the debug builds which is to show the user
3347 a dialog asking whether he wants to abort the program, continue or continue
3348 ignoring any subsequent assert failures, you may override
3349 \helpref{wxApp::OnAssert}{wxapponassert} which is called by this function if
3350 the global application object exists.
3352 \membersection{wxASSERT}\label{wxassert}
3354 \func{}{wxASSERT}{\param{}{condition}}
3356 Assert macro. An error message will be generated if the condition is FALSE in
3357 debug mode, but nothing will be done in the release build.
3359 Please note that the condition in wxASSERT() should have no side effects
3360 because it will not be executed in release mode at all.
3362 \wxheading{See also}
3364 \helpref{wxASSERT\_MSG}{wxassertmsg},\\
3365 \helpref{wxCOMPILE\_TIME\_ASSERT}{wxcompiletimeassert}
3367 \membersection{wxASSERT\_MIN\_BITSIZE}\label{wxassertminbitsize}
3369 \func{}{wxASSERT\_MIN\_BITSIZE}{\param{}{type}, \param{}{size}}
3371 This macro results in a
3372 \helpref{compile time assertion failure}{wxCOMPILE\_TIME\_ASSERT} if the size
3373 of the given type {\it type} is less than {\it size} bits.
3375 You may use it like this, for example:
3378 // we rely on the int being able to hold values up to 2^32
3379 wxASSERT_MIN_BITSIZE(int, 32);
3381 // can't work with the platforms using UTF-8 for wchar_t
3382 wxASSERT_MIN_BITSIZE(wchar_t, 16);
3385 \membersection{wxASSERT\_MSG}\label{wxassertmsg}
3387 \func{}{wxASSERT\_MSG}{\param{}{condition}, \param{}{msg}}
3389 Assert macro with message. An error message will be generated if the condition is FALSE.
3391 \wxheading{See also}
3393 \helpref{wxASSERT}{wxassert},\\
3394 \helpref{wxCOMPILE\_TIME\_ASSERT}{wxcompiletimeassert}
3396 \membersection{wxCOMPILE\_TIME\_ASSERT}\label{wxcompiletimeassert}
3398 \func{}{wxCOMPILE\_TIME\_ASSERT}{\param{}{condition}, \param{}{msg}}
3400 Using {\tt wxCOMPILE\_TIME\_ASSERT} results in a compilation error if the
3401 specified {\it condition| is false. The compiler error message should include
3402 the {\it msg} identifier - please note that it must be a valid C++ identifier
3403 and not a string unlike in the other cases.
3405 This macro is mostly useful for testing the expressions involing the
3406 {\tt sizeof} operator as they can't be tested by the preprocessor but it is
3407 sometimes desirable to test them at the compile time.
3409 \wxheading{See also}
3411 \helpref{wxASSERT\_MSG}{wxassertmsg},\\
3412 \helpref{wxASSERT\_MIN\_BITSIZE}{wxassertminbitsize}
3414 \membersection{wxFAIL}\label{wxfail}
3416 \func{}{wxFAIL}{\void}
3418 Will always generate an assert error if this code is reached (in debug mode).
3420 See also: \helpref{wxFAIL\_MSG}{wxfailmsg}
3422 \membersection{wxFAIL\_MSG}\label{wxfailmsg}
3424 \func{}{wxFAIL\_MSG}{\param{}{msg}}
3426 Will always generate an assert error with specified message if this code is reached (in debug mode).
3428 This macro is useful for marking unreachable" code areas, for example
3429 it may be used in the "default:" branch of a switch statement if all possible
3430 cases are processed above.
3432 \wxheading{See also}
3434 \helpref{wxFAIL}{wxfail}
3436 \membersection{wxCHECK}\label{wxcheck}
3438 \func{}{wxCHECK}{\param{}{condition}, \param{}{retValue}}
3440 Checks that the condition is true, returns with the given return value if not (FAILs in debug mode).
3441 This check is done even in release mode.
3443 \membersection{wxCHECK\_MSG}\label{wxcheckmsg}
3445 \func{}{wxCHECK\_MSG}{\param{}{condition}, \param{}{retValue}, \param{}{msg}}
3447 Checks that the condition is true, returns with the given return value if not (FAILs in debug mode).
3448 This check is done even in release mode.
3450 This macro may be only used in non void functions, see also
3451 \helpref{wxCHECK\_RET}{wxcheckret}.
3453 \membersection{wxCHECK\_RET}\label{wxcheckret}
3455 \func{}{wxCHECK\_RET}{\param{}{condition}, \param{}{msg}}
3457 Checks that the condition is true, and returns if not (FAILs with given error
3458 message in debug mode). This check is done even in release mode.
3460 This macro should be used in void functions instead of
3461 \helpref{wxCHECK\_MSG}{wxcheckmsg}.
3463 \membersection{wxCHECK2}\label{wxcheck2}
3465 \func{}{wxCHECK2}{\param{}{condition}, \param{}{operation}}
3467 Checks that the condition is true and \helpref{wxFAIL}{wxfail} and execute
3468 {\it operation} if it is not. This is a generalisation of
3469 \helpref{wxCHECK}{wxcheck} and may be used when something else than just
3470 returning from the function must be done when the {\it condition} is false.
3472 This check is done even in release mode.
3474 \membersection{wxCHECK2\_MSG}\label{wxcheck2msg}
3476 \func{}{wxCHECK2}{\param{}{condition}, \param{}{operation}, \param{}{msg}}
3478 This is the same as \helpref{wxCHECK2}{wxcheck2}, but
3479 \helpref{wxFAIL\_MSG}{wxfailmsg} with the specified {\it msg} is called
3480 instead of wxFAIL() if the {\it condition} is false.
3482 \membersection{::wxTrap}\label{wxtrap}
3484 \func{void}{wxTrap}{\void}
3486 In debug mode (when {\tt \_\_WXDEBUG\_\_} is defined) this function generates a
3487 debugger exception meaning that the control is passed to the debugger if one is
3488 attached to the process. Otherwise the program just terminates abnormally.
3490 In release mode this function does nothing.
3492 \wxheading{Include files}
3496 \section{Environment access functions}\label{environfunctions}
3498 The functions in this section allow to access (get) or change value of
3499 environment variables in a portable way. They are currently implemented under
3500 Win32 and POSIX-like systems (Unix).
3502 % TODO add some stuff about env var inheriting but not propagating upwards (VZ)
3504 \wxheading{Include files}
3508 \membersection{wxGetenv}\label{wxgetenvmacro}
3510 \func{wxChar *}{wxGetEnv}{\param{const wxString\&}{ var}}
3512 This is a macro defined as {\tt getenv()} or its wide char version in Unicode
3515 Note that under Win32 it may not return correct value for the variables set
3516 with \helpref{wxSetEnv}{wxsetenv}, use \helpref{wxGetEnv}{wxgetenv} function
3519 \membersection{wxGetEnv}\label{wxgetenv}
3521 \func{bool}{wxGetEnv}{\param{const wxString\&}{ var}, \param{wxString *}{value}}
3523 Returns the current value of the environment variable {\it var} in {\it value}.
3524 {\it value} may be {\tt NULL} if you just want to know if the variable exists
3525 and are not interested in its value.
3527 Returns {\tt TRUE} if the variable exists, {\tt FALSE} otherwise.
3529 \membersection{wxSetEnv}\label{wxsetenv}
3531 \func{bool}{wxSetEnv}{\param{const wxString\&}{ var}, \param{const wxChar *}{value}}
3533 Sets the value of the environment variable {\it var} (adding it if necessary)
3536 Returns {\tt TRUE} on success.
3538 \membersection{wxUnsetEnv}\label{wxunsetenv}
3540 \func{bool}{wxUnsetEnv}{\param{const wxString\&}{ var}}
3542 Removes the variable {\it var} from the environment.
3543 \helpref{wxGetEnv}{wxgetenv} will return {\tt NULL} after the call to this
3546 Returns {\tt TRUE} on success.