\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}
-The functions and macros defined in wxWindows are described here: you can
+The functions and macros defined in wxWidgets are described here: you can
either look up a function using the alphabetical listing of them or find it in
the corresponding topic.
-
-
-\section{Alphabetical functions and macros list}
+\section{Alphabetical functions and macros list}\label{functionsalphabetically}
\helpref{CLASSINFO}{classinfo}\\
\helpref{copystring}{copystring}\\
\helpref{IMPLEMENT\_CLASS}{implementclass}\\
\helpref{IMPLEMENT\_DYNAMIC\_CLASS2}{implementdynamicclass2}\\
\helpref{IMPLEMENT\_DYNAMIC\_CLASS}{implementdynamicclass}\\
-\helpref{ngettext}{ngettext}\\
\helpref{wxCONCAT}{wxconcat}\\
\helpref{WXDEBUG\_NEW}{debugnew}\\
\helpref{WXTRACELEVEL}{tracelevel}\\
\helpref{wxBITMAP}{wxbitmapmacro}\\
\helpref{wxBeginBusyCursor}{wxbeginbusycursor}\\
\helpref{wxBell}{wxbell}\\
+\helpref{wxCHANGE\_UMASK}{wxchangeumask}\\
\helpref{wxCHECK}{wxcheck}\\
\helpref{wxCHECK2\_MSG}{wxcheck2msg}\\
\helpref{wxCHECK2}{wxcheck2}\\
\helpref{wxCHECK\_MSG}{wxcheckmsg}\\
\helpref{wxCHECK\_RET}{wxcheckret}\\
\helpref{wxCHECK\_VERSION}{wxcheckversion}\\
+\helpref{wxCHECK\_VERSION\_FULL}{wxcheckversionfull}\\
\helpref{wxCHECK\_W32API\_VERSION}{wxcheckw32apiversion}\\
\helpref{wxClientDisplayRect}{wxclientdisplayrect}\\
\helpref{wxClipboardOpen}{functionwxclipboardopen}\\
\helpref{wxGetCwd}{wxgetcwd}\\
\helpref{wxGetDiskSpace}{wxgetdiskspace}\\
\helpref{wxGetDisplayName}{wxgetdisplayname}\\
+\helpref{wxGetDisplaySize}{wxdisplaysize}\\
+\helpref{wxGetDisplaySizeMM}{wxdisplaysizemm}\\
\helpref{wxGetElapsedTime}{wxgetelapsedtime}\\
\helpref{wxGetEmailAddress}{wxgetemailaddress}\\
\helpref{wxGetEnv}{wxgetenv}\\
\helpref{wxGetFullHostName}{wxgetfullhostname}\\
\helpref{wxGetHomeDir}{wxgethomedir}\\
\helpref{wxGetHostName}{wxgethostname}\\
+\helpref{wxGetKeyState}{wxgetkeystate}\\
\helpref{wxGetLocalTimeMillis}{wxgetlocaltimemillis}\\
\helpref{wxGetLocalTime}{wxgetlocaltime}\\
\helpref{wxGetMousePosition}{wxgetmouseposition}\\
\helpref{wxMakeMetafilePlaceable}{wxmakemetafileplaceable}\\
\helpref{wxMatchWild}{wxmatchwild}\\
\helpref{wxMessageBox}{wxmessagebox}\\
+\helpref{wxMilliSleep}{wxmillisleep}\\
+\helpref{wxMicroSleep}{wxmicrosleep}\\
\helpref{wxMkdir}{wxmkdir}\\
\helpref{wxMutexGuiEnter}{wxmutexguienter}\\
\helpref{wxMutexGuiLeave}{wxmutexguileave}\\
\helpref{wxNow}{wxnow}\\
\helpref{wxOnAssert}{wxonassert}\\
\helpref{wxOpenClipboard}{wxopenclipboard}\\
+\helpref{wxParseCommonDialogsFilter}{wxparsecommondialogsfilter}\\
\helpref{wxPathOnly}{wxpathonly}\\
\helpref{wxPostDelete}{wxpostdelete}\\
\helpref{wxPostEvent}{wxpostevent}\\
\helpref{wxUnix2DosFilename}{wxunix2dosfilename}\\
\helpref{wxUnsetEnv}{wxunsetenv}\\
\helpref{wxUsleep}{wxusleep}\\
+\helpref{wxVaCopy}{wxvacopy}\\
\helpref{wxVsnprintf}{wxvsnprintf}\\
\helpref{wxWakeUpIdle}{wxwakeupidle}\\
\helpref{wxWriteResource}{wxwriteresource}\\
\helpref{wxYield}{wxyield}\\
+\helpref{wx\_const\_cast}{wxconstcastraw}\\
+\helpref{wx\_reinterpret\_cast}{wxreinterpretcastraw}\\
+\helpref{wx\_static\_cast}{wxstaticcastraw}\\
\helpref{\_}{underscore}\\
\helpref{\_T}{underscoret}
\section{Version macros}\label{versionfunctions}
-The following constants are defined in wxWindows:
+The following constants are defined in wxWidgets:
\begin{itemize}\itemsep=0pt
-\item {\tt wxMAJOR\_VERSION} is the major version of wxWindows
-\item {\tt wxMINOR\_VERSION} is the minor version of wxWindows
+\item {\tt wxMAJOR\_VERSION} is the major version of wxWidgets
+\item {\tt wxMINOR\_VERSION} is the minor version of wxWidgets
\item {\tt wxRELEASE\_NUMBER} is the release number
+\item {\tt wxSUBRELEASE\_NUMBER} is the subrelease number which is $0$ for all
+official releases
\end{itemize}
-For example, the values or these constants for wxWindows 2.1.15 are 2, 1 and
+For example, the values or these constants for wxWidgets 2.1.15 are 2, 1 and
15.
Additionally, {\tt wxVERSION\_STRING} is a user-readable string containing
-the full wxWindows version and {\tt wxVERSION\_NUMBER} is a combination of the
+the full wxWidgets version and {\tt wxVERSION\_NUMBER} is a combination of the
three version numbers above: for 2.1.15, it is 2115 and it is 2200 for
-wxWindows 2.2.
+wxWidgets 2.2.
+
+The subrelease number is only used for the sources in between official releases
+and so normally is not useful.
\wxheading{Include files}
<wx/version.h> or <wx/defs.h>
+\membersection{wxCHECK\_GCC\_VERSION}\label{wxcheckgccversion}
+
+\func{bool}{wxCHECK\_GCC\_VERSION}{\param{}{major, minor, release}}
+
+Returns $1$ if the compiler being used to compile the code is GNU C++
+compiler (g++) version major.minor.release or greater. Otherwise, and also if
+the compiler is not GNU C++ at all, returns $0$.
+
+
\membersection{wxCHECK\_VERSION}\label{wxcheckversion}
\func{bool}{wxCHECK\_VERSION}{\param{}{major, minor, release}}
-This is a macro which evaluates to true if the current wxWindows version is at
+This is a macro which evaluates to true if the current wxWidgets version is at
least major.minor.release.
-For example, to test if the program is compiled with wxWindows 2.2 or higher,
+For example, to test if the program is compiled with wxWidgets 2.2 or higher,
the following can be done:
\begin{verbatim}
\end{verbatim}
-\membersection{wxCHECK\_GCC\_VERSION}\label{wxcheckgccversion}
+\membersection{wxCHECK\_VERSION\_FULL}\label{wxcheckversionfull}
-\func{bool}{wxCHECK\_GCC\_VERSION}{\param{}{major, minor, release}}
+\func{bool}{wxCHECK\_VERSION\_FULL}{\param{}{major, minor, release, subrel}}
-Returns $1$ if the compiler being used to compile the code is GNU C++
-compiler (g++) version major.minor.release or greater. Otherwise, and also if
-the compiler is not GNU C++ at all, returns $0$.
+Same as \helpref{wxCHECK\_VERSION}{wxcheckversion} but also checks that
+\texttt{wxSUBRELEASE\_NUMBER} is at least \arg{subrel}.
\membersection{wxCHECK\_W32API\_VERSION}\label{wxcheckw32apiversion}
\membersection{::wxEntry}\label{wxentry}
-This initializes wxWindows in a platform-dependent way. Use this if you
-are not using the default wxWindows entry code (e.g. main or WinMain). For example,
-you can initialize wxWindows from an Microsoft Foundation Classes application using
+This initializes wxWidgets in a platform-dependent way. Use this if you
+are not using the default wxWidgets entry code (e.g. main or WinMain). For example,
+you can initialize wxWidgets from an Microsoft Foundation Classes application using
this function.
\func{void}{wxEntry}{\param{HANDLE}{ hInstance}, \param{HANDLE}{ hPrevInstance},
\param{const wxString\& }{commandLine}, \param{int}{ cmdShow}, \param{bool}{ enterLoop = true}}
-wxWindows initialization under Windows (non-DLL). If {\it enterLoop} is false, the
-function will return immediately after calling wxApp::OnInit. Otherwise, the wxWindows
+wxWidgets initialization under Windows (non-DLL). If {\it enterLoop} is false, the
+function will return immediately after calling wxApp::OnInit. Otherwise, the wxWidgets
message loop will be entered.
\func{void}{wxEntry}{\param{HANDLE}{ hInstance}, \param{HANDLE}{ hPrevInstance},
\param{WORD}{ wDataSegment}, \param{WORD}{ wHeapSize}, \param{const wxString\& }{ commandLine}}
-wxWindows initialization under Windows (for applications constructed as a DLL).
+wxWidgets initialization under Windows (for applications constructed as a DLL).
\func{int}{wxEntry}{\param{int}{ argc}, \param{const wxString\& *}{argv}}
-wxWindows initialization under Unix.
+wxWidgets initialization under Unix.
\wxheading{Remarks}
-To clean up wxWindows, call wxApp::OnExit followed by the static function
-wxApp::CleanUp. For example, if exiting from an MFC application that also uses wxWindows:
+To clean up wxWidgets, call wxApp::OnExit followed by the static function
+wxApp::CleanUp. For example, if exiting from an MFC application that also uses wxWidgets:
\begin{verbatim}
int CTheApp::ExitInstance()
\func{wxAppDerivedClass\&}{wxGetApp}{\void}
-This function doesn't exist in wxWindows but it is created by using
+This function doesn't exist in wxWidgets but it is created by using
the \helpref{IMPLEMENT\_APP}{implementapp} macro. Thus, before using it
anywhere but in the same module where this macro is used, you must make it
available using \helpref{DECLARE\_APP}{declareapp}.
This function is used in wxBase only and only if you don't create
\helpref{wxApp}{wxapp} object at all. In this case you must call it from your
-{\tt main()} function before calling any other wxWindows functions.
+{\tt main()} function before calling any other wxWidgets functions.
If the function returns {\tt false} the initialization could not be performed,
in this case the library cannot be used and
array, any additional ones are the command parameters and the array must be
terminated with a NULL pointer.}
-\docparam{flags}{Combination of bit masks {\tt wxEXEC\_ASYNC},
+\docparam{flags}{Combination of bit masks {\tt wxEXEC\_ASYNC},\rtfsp
{\tt wxEXEC\_SYNC} and {\tt wxEXEC\_NOHIDE}}
\docparam{callback}{An optional pointer to \helpref{wxProcess}{wxprocess}}
\end{verbatim}
{\tt wxSIGNONE}, {\tt wxSIGKILL} and {\tt wxSIGTERM} have the same meaning
-under both Unix and Windows but all the other signals are equivalent to
+under both Unix and Windows but all the other signals are equivalent to
{\tt wxSIGTERM} under Windows.
Returns 0 on success, -1 on failure. If {\it rc} parameter is not NULL, it will
\func{}{wxENTER\_CRIT\_SECT}{\param{wxCriticalSection\& }{cs}}
-This macro is equivalent to \helpref{cs.Enter()}{wxcriticalsectionenter} if
+This macro is equivalent to \helpref{cs.Enter()}{wxcriticalsectionenter} if
{\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$.
\func{}{wxLEAVE\_CRIT\_SECT}{\param{wxCriticalSection\& }{cs}}
-This macro is equivalent to \helpref{cs.Leave()}{wxcriticalsectionleave} if
+This macro is equivalent to \helpref{cs.Leave()}{wxcriticalsectionleave} if
{\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$.
\wxheading{Include files}
-<wx/utils.h>
+<wx/filefn.h>
\wxheading{See also}
get the next matching file. Neither will report the current directory "." or the
parent directory "..".
+\wxheading{Warning}
+
+As of wx 2.5.2, these functions are not thread-safe! (use static variables)
+
{\it spec} may contain wildcards.
{\it flags} may be wxDIR for restricting the query to directories, wxFILE for files or zero for either.
\wxheading{Portability}
-This function is implemented for Win16 (only for drives less than 2Gb), Win32,
+This function is implemented for Win32,
Mac OS and generic Unix provided the system has {\tt statfs()} function.
-This function first appeared in wxWindows 2.3.2.
+This function first appeared in wxWidgets 2.3.2.
\membersection{::wxGetOSDirectory}\label{wxgetosdirectory}
slashes with backslashes.
+\membersection{wxCHANGE\_UMASK}\label{wxchangeumask}
+
+\func{}{wxCHANGE\_UMASK}{\param{int }{mask}}
+
+Under Unix this macro changes the current process umask to the given value,
+unless it is equal to $-1$ in which case nothing is done, and restores it to
+the original value on scope exit. It works by declaring a variable which sets
+umask to \arg{mask} in its constructor and restores it in its destructor.
+
+Under other platforms this macro expands to nothing.
+
+
\membersection{::wxConcatFiles}\label{wxconcatfiles}
\func{bool}{wxConcatFiles}{\param{const wxString\& }{file1}, \param{const wxString\& }{file2},
\func{bool}{wxMatchWild}{\param{const wxString\& }{pattern}, \param{const wxString\& }{text}, \param{bool}{ dot\_special}}
-Returns true if the {\it pattern}\/ matches the {\it text}\/; if {\it
+Returns true if the \arg{pattern}\/ matches the {\it text}\/; if {\it
dot\_special}\/ is true, filenames beginning with a dot are not matched
with wildcard characters. See \helpref{wxIsWild}{wxiswild}.
\func{bool}{wxMkdir}{\param{const wxString\& }{dir}, \param{int }{perm = 0777}}
-Makes the directory {\it dir}, returning true if successful.
+Makes the directory \arg{dir}, returning true if successful.
{\it perm} is the access mask for the directory for the systems on which it is
supported (Unix) and doesn't have effect for the other ones.
+\membersection{::wxParseCommonDialogsFilter}\label{wxparsecommondialogsfilter}
+
+\func{int}{wxParseCommonDialogsFilter}{\param{const wxString\& }{wildCard}, \param{wxArrayString\& }{descriptions}, \param{wxArrayString\& }{filters}}
+
+Parses the \arg{wildCard}, returning the number of filters.
+Returns 0 if none or if there's a problem.
+The arrays will contain an equal number of items found before the error.
+On platforms where native dialogs handle only one filter per entry,
+entries in arrays are automatically adjusted.
+\arg{wildCard} is in the form:
+\begin{verbatim}
+ "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
+\end{verbatim}
+
\membersection{::wxRemoveFile}\label{wxremovefile}
\func{bool}{wxRemoveFile}{\param{const wxString\& }{file}}
-Removes {\it file}, returning true if successful.
+Removes \arg{file}, returning true if successful.
\membersection{::wxRenameFile}\label{wxrenamefile}
\func{bool}{wxRenameFile}{\param{const wxString\& }{file1}, \param{const wxString\& }{file2}}
-Renames {\it file1} to {\it file2}, returning true if successful.
+Renames \arg{file1} to \arg{file2}, returning true if successful.
\membersection{::wxRmdir}\label{wxrmdir}
Under Windows or NT, this function first looks in the environment
variable SYSTEM\_NAME; if this is not found, the entry {\bf HostName}\rtfsp
-in the {\bf wxWindows} section of the WIN.INI file is tried.
+in the {\bf wxWidgets} section of the WIN.INI file is tried.
The first variant of this function returns the hostname if successful or an
empty string otherwise. The second (deprecated) function returns true
Under Windows or NT, this function first looks in the environment
variables USER and LOGNAME; if neither of these is found, the entry {\bf UserId}\rtfsp
-in the {\bf wxWindows} section of the WIN.INI file is tried.
+in the {\bf wxWidgets} section of the WIN.INI file is tried.
The first variant of this function returns the login name if successful or an
empty string otherwise. The second (deprecated) function returns true
This function returns the full user name (something like "Mr. John Smith").
Under Windows or NT, this function looks for the entry {\bf UserName}\rtfsp
-in the {\bf wxWindows} section of the WIN.INI file. If PenWindows
+in the {\bf wxWidgets} section of the WIN.INI file. If PenWindows
is running, the entry {\bf Current} in the section {\bf User} of
the PENWIN.INI file is used.
-\section{String functions}
+\section{String functions}\label{stringfunctions}
\membersection{::copystring}\label{copystring}
This function is deprecated, use \helpref{wxString}{wxstring} class instead.
-\membersection{ngettext}\label{ngettext}
-
-\func{const wxChar *}{ngettext}{\param{const char *}{str}, \param{const char *}{strPlural}, \param{size\_t }{n}}
-
-This macro expands into a call to plural form version of
-\helpref{wxGetTranslation}{wxgettranslation}
-function, so it marks the message for the extraction by {\tt xgettext} just as
-\helpref{wxTRANSLATE}{wxtranslate} does, but also returns the translation of
-the string for the current locale during execution, either singular or plural
-form depending on the value of \arg{n}.
-
-\wxheading{See also}
-
-\helpref{\_}{underscore}
-
-
\membersection{::wxGetTranslation}\label{wxgettranslation}
\func{const char *}{wxGetTranslation}{\param{const char * }{str}}
The \arg{strPlural} parameter is the plural form (in English).
The parameter \arg{n} is used to determine the plural form. If no
message catalog is found \arg{str} is returned if `n == 1',
-otherwise \arg{strPlural}. The \helpref{ngettext}{ngettext} macro is defined
-to do the same thing.
+otherwise \arg{strPlural}.
See \urlref{GNU gettext manual}{http://www.gnu.org/manual/gettext/html\_chapter/gettext\_10.html\#SEC150} for additional information on plural forms handling.
+Both versions call \helpref{wxLocale::GetString}{wxlocalegetstring}.
+
\membersection{::wxIsEmpty}\label{wxisempty}
\func{bool}{wxIsEmpty}{\param{const char *}{ p}}
\func{const wxChar *}{wxTRANSLATE}{\param{const char *}{s}}
This macro doesn't do anything in the program code -- it simply expands to the
-value of its argument (expand in Unicode build where it is equivalent to
+value of its argument (except in Unicode build where it is equivalent to
\helpref{wxT}{wxt} which makes it unnecessary to use both wxTRANSLATE and wxT
with the same string which would be really unreadable).
However it does have a purpose and it is to mark the literal strings for the
extraction into the message catalog created by {\tt xgettext} program. Usually
this is achieved using \helpref{\_()}{underscore} but that macro not only marks
-the string for extraction but also expands into
+the string for extraction but also expands into a
\helpref{wxGetTranslation}{wxgettranslation} function call which means that it
-cannot be used in some situations, notably for the static arrays
+cannot be used in some situations, notably for static array
initialization.
Here is an example which should make it more clear: suppose that you have a
static array of strings containing the weekday names and which have to be
-translated (note that it is a bad example, really, as
+translated (note that it is a bad example, really, as
\helpref{wxDateTime}{wxdatetime} already can be used to get the localized week
day names already). If you write
+
\begin{verbatim}
static const wxChar * const weekdays[] = { _("Mon"), ..., _("Sun") };
...
// use weekdays[n] as usual
\end{verbatim}
+
the code wouldn't compile because the function calls are forbidden in the array
initializer. So instead you should do
+
\begin{verbatim}
static const wxChar * const weekdays[] = { wxTRANSLATE("Mon"), ..., wxTRANSLATE("Sun") };
...
// use wxGetTranslation(weekdays[n])
\end{verbatim}
+
here.
Note that although the code {\bf would} compile if you simply omit
no translations for the weekday names in the program message catalog and
wxGetTranslation wouldn't find them.
-
-
\membersection{::wxVsnprintf}\label{wxvsnprintf}
\func{int}{wxVsnprintf}{\param{wxChar *}{buf}, \param{size\_t }{len}, \param{const wxChar *}{format}, \param{va\_list }{argPtr}}
Don't confuse this macro with \helpref{\_T()}{underscoret}!
-\wxheading{See also}
-
-\helpref{ngettext}{ngettext}
-
-
\membersection{\_T}\label{underscoret}
\func{const wxChar *}{\_T}{\param{const wxChar }{ch}}
This macro is exactly the same as \helpref{wxT}{wxt} and is defined in
-wxWindows simply because it may be more intuitive for Windows programmers as
+wxWidgets simply because it may be more intuitive for Windows programmers as
the standard Win32 headers also define it (as well as yet another name for the
same macro which is {\tt \_TEXT()}).
\func{wxString}{wxFileSelector}{\param{const wxString\& }{message}, \param{const wxString\& }{default\_path = ""},\\
\param{const wxString\& }{default\_filename = ""}, \param{const wxString\& }{default\_extension = ""},\\
- \param{const wxString\& }{wildcard = ``*.*''}, \param{int }{flags = 0}, \param{wxWindow *}{parent = ""},\\
+ \param{const wxString\& }{wildcard = "*.*"}, \param{int }{flags = 0}, \param{wxWindow *}{parent = NULL},\\
\param{int}{ x = -1}, \param{int}{ y = -1}}
Pops up a file selector box. In Windows, this is the common file selector
no default filename will be supplied. The wildcard determines what files
are displayed in the file selector, and file extension supplies a type
extension for the required filename. Flags may be a combination of wxOPEN,
-wxSAVE, wxOVERWRITE\_PROMPT, wxHIDE\_READONLY, wxFILE\_MUST\_EXIST, wxMULTIPLE or 0.
+wxSAVE, wxOVERWRITE\_PROMPT, wxFILE\_MUST\_EXIST, wxMULTIPLE or 0.
Both the Unix and Windows versions implement a wildcard filter. Typing a
filename containing wildcards (*, ?) in the filename text item, and
\wxheading{Include files}
-<wx/textdlg.h>
+<wx/numdlg.h>
\membersection{::wxGetPasswordFromUser}\label{wxgetpasswordfromuser}
-\func{wxString}{wxGetTextFromUser}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Input text"},\\
- \param{const wxString\& }{default\_value = ``"}, \param{wxWindow *}{parent = NULL}}
+\func{wxString}{wxGetPasswordFromUser}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Input text"},\\
+ \param{const wxString\& }{default\_value = ``"}, \param{wxWindow *}{parent = NULL},\\
+ \param{int}{ x = wxDefaultCoord}, \param{int}{ y = wxDefaultCoord}, \param{bool}{ centre = true}}
Similar to \helpref{wxGetTextFromUser}{wxgettextfromuser} but the text entered
in the dialog is not shown on screen but replaced with stars. This is intended
\func{wxString}{wxGetTextFromUser}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Input text"},\\
\param{const wxString\& }{default\_value = ``"}, \param{wxWindow *}{parent = NULL},\\
- \param{int}{ x = -1}, \param{int}{ y = -1}, \param{bool}{ centre = true}}
+ \param{int}{ x = wxDefaultCoord}, \param{int}{ y = wxDefaultCoord}, \param{bool}{ centre = true}}
Pop up a dialog box with title set to {\it caption}, {\it message}, and a
\rtfsp{\it default\_value}. The user may type in text and press OK to return this text,
\param{bool }{showAtStartup = true}}
This function shows a "startup tip" to the user. The return value is the
-state of the ``Show tips at startup'' checkbox.
+state of the `Show tips at startup' checkbox.
\docparam{parent}{The parent window for the modal dialog}
-\section{Math functions}
+\section{Math functions}\label{mathfunctions}
\wxheading{Include files}
SetWindowExt(dc, maxX - minX, maxY - minY);
\end{verbatim}
-This simulates the wxMM\_TEXT mapping mode, which wxWindows assumes.
+This simulates the wxMM\_TEXT mapping mode, which wxWidgets assumes.
Placeable metafiles may be imported by many Windows applications, and can be
used in RTF (Rich Text Format) files.
\func{}{wxDYNLIB\_FUNCTION}{\param{}{type}, \param{}{name}, \param{}{dynlib}}
When loading a function from a DLL you always have to cast the returned
-\tt{void *} pointer to the correct type and, even more annoyingly, you have to
+{\tt void *} pointer to the correct type and, even more annoyingly, you have to
repeat this type twice if you want to declare and define a function pointer all
in one line
this language feature but still take advantage of it when it is available.
+\membersection{::wxGetKeyState}\label{wxgetkeystate}
+
+\func{bool}{wxGetKeyState}{\param{wxKeyCode }{key}}
+
+Returns \true if the key parameter is currently pressed on the keyboard, or
+with modifier keys, (caps lock, etc) if the key is active (the led light is
+on).
+
+\wxheading{Include files}
+
+<wx/utils.h>
+
+
\membersection{wxLL}\label{wxll}
\func{wxLongLong\_t}{wxLL}{\param{}{number}}
\func{void}{wxDDECleanUp}{\void}
-Called when wxWindows exits, to clean up the DDE system. This no longer needs to be
+Called when wxWidgets exits, to clean up the DDE system. This no longer needs to be
called by the application.
See also \helpref{wxDDEInitialize}{wxddeinitialize}.
Initializes the DDE system. May be called multiple times without harm.
This no longer needs to be called by the application: it will be called
-by wxWindows if necessary.
+by wxWidgets if necessary.
-See also \helpref{wxDDEServer}{wxddeserver}, \helpref{wxDDEClient}{wxddeclient}, \helpref{wxDDEConnection}{wxddeconnection},
+See also \helpref{wxDDEServer}{wxddeserver}, \helpref{wxDDEClient}{wxddeclient}, \helpref{wxDDEConnection}{wxddeconnection},\rtfsp
\helpref{wxDDECleanUp}{wxddecleanup}.
\wxheading{Include files}
\helpref{wxLL}{wxll}, \helpref{wxLongLong}{wxlonglong}
+\membersection{wxVaCopy}\label{wxvacopy}
+
+\func{void}{wxVaCopy}{\param{va\_list }{argptrDst}, \param{va\_list}{argptrSrc}}
+
+This macro is the same as the standard C99 \texttt{va\_copy} for the compilers
+which support it or its replacement for those that don't. It must be used to
+preserve the value of a \texttt{va\_list} object if you need to use it after
+passing it to another function because it can be modified by the latter.
+
+As with \texttt{va\_start}, each call to \texttt{wxVaCopy} must have a matching
+\texttt{va\_end}.
+
+
\membersection{::wxWriteResource}\label{wxwriteresource}
\func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
\section{RTTI functions}\label{rttimacros}
-wxWindows uses its own RTTI ("run-time type identification") system which
+wxWidgets uses its own RTTI ("run-time type identification") system which
predates the current standard C++ RTTI and so is kept for backwards
compatibility reasons but also because it allows some things which the
standard RTTI doesn't directly support (such as creating a class from its
The standard C++ RTTI can be used in the user code without any problems and in
general you shouldn't need to use the functions and the macros in this section
-unless you are thinking of modifying or adding any wxWindows classes.
+unless you are thinking of modifying or adding any wxWidgets classes.
\wxheading{See also}
\func{}{IMPLEMENT\_APP}{className}
This is used in the application class implementation file to make the application class known to
-wxWindows for dynamic construction. You use this instead of
+wxWidgets for dynamic construction. You use this instead of
Old form:
\wxheading{See also}
+\helpref{wx\_const\_cast}{wxconstcastraw}\\
\helpref{wxDynamicCast}{wxdynamiccast}\\
\helpref{wxStaticCast}{wxstaticcast}
result if {\tt wxDynamicCast(ptr, classname) == NULL}) and then returns the
result of executing an equivalent of {\tt static\_cast<classname *>(ptr)}.
+\wxheading{See also}
+
+\helpref{wx\_static\_cast}{wxstaticcastraw}\\
\helpref{wxDynamicCast}{wxdynamiccast}\\
\helpref{wxConstCast}{wxconstcast}
+\membersection{wx\_const\_cast}\label{wxconstcastraw}
+
+\func{T}{wx\_const\_cast}{T, x}
+
+Same as \texttt{const\_cast<T>(x)} if the compiler supports const cast or
+\texttt{(T)x} for old compilers. Unlike \helpref{wxConstCast}{wxconstcast},
+the cast it to the type \arg{T} and not to \texttt{T *} and also the order of
+arguments is the same as for the standard cast.
+
+\wxheading{See also}
+
+\helpref{wx\_reinterpret\_cast}{wxreinterpretcastraw},\\
+\helpref{wx\_static\_cast}{wxstaticcastraw}
+
+
+\membersection{wx\_reinterpret\_cast}\label{wxreinterpretcastraw}
+
+\func{T}{wx\_reinterpret\_cast}{T, x}
+
+Same as \texttt{reinterpret\_cast<T>(x)} if the compiler supports reinterpret cast or
+\texttt{(T)x} for old compilers.
+
+\wxheading{See also}
+
+\helpref{wx\_const\_cast}{wxconstcastraw},\\
+\helpref{wx\_static\_cast}{wxstaticcastraw}
+
+
+\membersection{wx\_static\_cast}\label{wxstaticcastraw}
+
+\func{T}{wx\_static\_cast}{T, x}
+
+Same as \texttt{static\_cast<T>(x)} if the compiler supports static cast or
+\texttt{(T)x} for old compilers. Unlike \helpref{wxStaticCast}{wxstaticcast},
+there are no checks being done and the meaning of the macro arguments is exactly
+the same as for the standard static cast, i.e. \arg{T} is the full type name and
+star is not appended to it.
+
+\wxheading{See also}
+
+\helpref{wx\_const\_cast}{wxconstcastraw},\\
+\helpref{wx\_reinterpret\_cast}{wxreinterpretcastraw}
+
+
\section{Log functions}\label{logfunctions}
These functions provide a variety of logging functions: see \helpref{Log classes overview}{wxlogoverview} for
further information. The functions use (implicitly) the currently active log
target, so their descriptions here may not apply if the log target is not the
-standard one (installed by wxWindows in the beginning of the program).
+standard one (installed by wxWidgets in the beginning of the program).
\wxheading{Include files}
\membersection{::wxError}\label{wxerror}
-\func{void}{wxError}{\param{const wxString\& }{msg}, \param{const wxString\& }{title = "wxWindows Internal Error"}}
+\func{void}{wxError}{\param{const wxString\& }{msg}, \param{const wxString\& }{title = "wxWidgets Internal Error"}}
{\bf NB:} This function is now obsolete, please use \helpref{wxLogError}{wxlogerror}
instead.
Displays {\it msg} and continues. This writes to standard error under
Unix, and pops up a message box under Windows. Used for internal
-wxWindows errors. See also \helpref{wxFatalError}{wxfatalerror}.
+wxWidgets errors. See also \helpref{wxFatalError}{wxfatalerror}.
\wxheading{Include files}
\membersection{::wxFatalError}\label{wxfatalerror}
-\func{void}{wxFatalError}{\param{const wxString\& }{msg}, \param{const wxString\& }{title = "wxWindows Fatal Error"}}
+\func{void}{wxFatalError}{\param{const wxString\& }{msg}, \param{const wxString\& }{title = "wxWidgets Fatal Error"}}
{\bf NB:} This function is now obsolete, please use
\helpref{wxLogFatalError}{wxlogfatalerror} instead.
Displays {\it msg} and exits. This writes to standard error under Unix,
and pops up a message box under Windows. Used for fatal internal
-wxWindows errors. See also \helpref{wxError}{wxerror}.
+wxWidgets errors. See also \helpref{wxError}{wxerror}.
\wxheading{Include files}
\func{void}{wxVLogSysError}{\param{const char *}{formatString}, \param{va\_list }{argPtr}}
-Mostly used by wxWindows itself, but might be handy for logging errors after
+Mostly used by wxWidgets itself, but might be handy for logging errors after
system call (API function) failure. It logs the specified message text as well
as the last system error code ({\it errno} or {\it ::GetLastError()} depending
on the platform) and the corresponding error message. The second form
For the second function (taking a string mask), the message is logged only if
the mask has been previously enabled by the call to
-\helpref{AddTraceMask}{wxlogaddtracemask}. The predefined string trace masks
-used by wxWindows are:
+\helpref{AddTraceMask}{wxlogaddtracemask} or by setting
+\helpref{{\tt WXTRACE} environment variable}{envvars}.
+The predefined string trace masks
+used by wxWidgets are:
\begin{itemize}\itemsep=0pt
\item wxTRACE\_MemAlloc: trace memory allocation (new/delete)
\item wxTRACE\_OleCalls: trace OLE method calls (Win32 only)
\end{itemize}
-The third version of the function only logs the message if all the bit
+{\bf Caveats:} since both the mask and the format string are strings,
+this might lead to function signature confusion in some cases:
+if you intend to call the format string only version of wxLogTrace,
+then add a \%s format string parameter and then supply a second string parameter for that \%s, the string mask version of wxLogTrace will erroneously get called instead, since you are supplying two string parameters to the function.
+In this case you'll unfortunately have to avoid having two leading
+string parameters, e.g. by adding a bogus integer (with its \%d format string).
+
+The third version of the function only logs the message if all the bits
corresponding to the {\it mask} are set in the wxLog trace mask which can be
set by \helpref{SetTraceMask}{wxlogsettracemask}. This version is less
flexible than the previous one because it doesn't allow defining the user
<wx/timer.h>
+\membersection{::wxMicroSleep}\label{wxmicrosleep}
+
+\func{void}{wxMicroSleep}{\param{unsigned long}{ microseconds}}
+
+Sleeps for the specified number of microseconds. The microsecond resolution may
+not, in fact, be available on all platforms (currently only Unix platforms with
+nanosleep(2) may provide it) in which case this is the same as
+\helpref{wxMilliSleep}{wxmillisleep}(\arg{microseconds}$/1000$).
+
+\wxheading{Include files}
+
+<wx/utils.h>
+
+
+\membersection{::wxMilliSleep}\label{wxmillisleep}
+
+\func{void}{wxMilliSleep}{\param{unsigned long}{ milliseconds}}
+
+Sleeps for the specified number of milliseconds. Notice that usage of this
+function is encouraged instead of calling usleep(3) directly because the
+standard usleep() function is not MT safe.
+
+\wxheading{Include files}
+
+<wx/utils.h>
+
+
\membersection{::wxNow}\label{wxnow}
\func{wxString}{wxNow}{\void}
\func{void}{wxUsleep}{\param{unsigned long}{ milliseconds}}
-Sleeps for the specified number of milliseconds. Notice that usage of this
-function is encouraged instead of calling usleep(3) directly because the
-standard usleep() function is not MT safe.
-
-\wxheading{Include files}
-
-<wx/utils.h>
+This function is deprecated because its name is misleading: notice that the
+argument is in milliseconds, not microseconds. Please use either
+\helpref{wxMilliSleep}{wxmillisleep} or \helpref{wxMicroSleep}{wxmicrosleep}
+depending on the resolution you need.
\section{Debugging macros and functions}\label{debugmacros}
Useful macros and functions for error checking and defensive programming.
-wxWindows defines three families of the assert-like macros:
+wxWidgets defines three families of the assert-like macros:
the wxASSERT and wxFAIL macros only do anything if \_\_WXDEBUG\_\_ is defined
(in other words, in the debug build) but disappear completely in the release
build. On the other hand, the wxCHECK macros stay event in release builds but a
\helpref{wxCOMPILE\_TIME\_ASSERT2}{wxcompiletimeassert2} macro.
Also note that Microsoft Visual C++ has a bug which results in compiler errors
-if you use this macro with ``Program Database For Edit And Continue''
-(\texttt{/ZI}) option, so you shouldn't use it (``Program Database''
+if you use this macro with `Program Database For Edit And Continue'
+(\texttt{/ZI}) option, so you shouldn't use it (`Program Database'
(\texttt{/Zi}) is ok though) for the code making use of this macro.
\wxheading{See also}