]> git.saurik.com Git - wxWidgets.git/blobdiff - docs/latex/wx/function.tex
More True/False fixes
[wxWidgets.git] / docs / latex / wx / function.tex
index d31df54da0f8b1c310037f06fbbcf67c5d4c144e..e00e9a84a5772c0ecdef5d205e692e747b07c8e7 100644 (file)
@@ -6,7 +6,7 @@ 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.
 
 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{CLASSINFO}{classinfo}\\
 \helpref{copystring}{copystring}\\
@@ -21,7 +21,6 @@ the corresponding topic.
 \helpref{IMPLEMENT\_CLASS}{implementclass}\\
 \helpref{IMPLEMENT\_DYNAMIC\_CLASS2}{implementdynamicclass2}\\
 \helpref{IMPLEMENT\_DYNAMIC\_CLASS}{implementdynamicclass}\\
 \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{wxCONCAT}{wxconcat}\\
 \helpref{WXDEBUG\_NEW}{debugnew}\\
 \helpref{WXTRACELEVEL}{tracelevel}\\
@@ -39,6 +38,7 @@ the corresponding topic.
 \helpref{wxCHECK\_MSG}{wxcheckmsg}\\
 \helpref{wxCHECK\_RET}{wxcheckret}\\
 \helpref{wxCHECK\_VERSION}{wxcheckversion}\\
 \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{wxCHECK\_W32API\_VERSION}{wxcheckw32apiversion}\\
 \helpref{wxClientDisplayRect}{wxclientdisplayrect}\\
 \helpref{wxClipboardOpen}{functionwxclipboardopen}\\
@@ -101,6 +101,8 @@ the corresponding topic.
 \helpref{wxGetCwd}{wxgetcwd}\\
 \helpref{wxGetDiskSpace}{wxgetdiskspace}\\
 \helpref{wxGetDisplayName}{wxgetdisplayname}\\
 \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{wxGetElapsedTime}{wxgetelapsedtime}\\
 \helpref{wxGetEmailAddress}{wxgetemailaddress}\\
 \helpref{wxGetEnv}{wxgetenv}\\
@@ -109,6 +111,7 @@ the corresponding topic.
 \helpref{wxGetFullHostName}{wxgetfullhostname}\\
 \helpref{wxGetHomeDir}{wxgethomedir}\\
 \helpref{wxGetHostName}{wxgethostname}\\
 \helpref{wxGetFullHostName}{wxgetfullhostname}\\
 \helpref{wxGetHomeDir}{wxgethomedir}\\
 \helpref{wxGetHostName}{wxgethostname}\\
+\helpref{wxGetKeyState}{wxgetkeystate}\\
 \helpref{wxGetLocalTimeMillis}{wxgetlocaltimemillis}\\
 \helpref{wxGetLocalTime}{wxgetlocaltime}\\
 \helpref{wxGetMousePosition}{wxgetmouseposition}\\
 \helpref{wxGetLocalTimeMillis}{wxgetlocaltimemillis}\\
 \helpref{wxGetLocalTime}{wxgetlocaltime}\\
 \helpref{wxGetMousePosition}{wxgetmouseposition}\\
@@ -174,6 +177,8 @@ the corresponding topic.
 \helpref{wxMakeMetafilePlaceable}{wxmakemetafileplaceable}\\
 \helpref{wxMatchWild}{wxmatchwild}\\
 \helpref{wxMessageBox}{wxmessagebox}\\
 \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{wxMkdir}{wxmkdir}\\
 \helpref{wxMutexGuiEnter}{wxmutexguienter}\\
 \helpref{wxMutexGuiLeave}{wxmutexguileave}\\
@@ -251,6 +256,8 @@ The following constants are defined in wxWidgets:
 \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 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 wxWidgets 2.1.15 are 2, 1 and
 \end{itemize}
 
 For example, the values or these constants for wxWidgets 2.1.15 are 2, 1 and
@@ -261,11 +268,23 @@ 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
 wxWidgets 2.2.
 
 three version numbers above: for 2.1.15, it is 2115 and it is 2200 for
 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>
 
 
 \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}}
 \membersection{wxCHECK\_VERSION}\label{wxcheckversion}
 
 \func{bool}{wxCHECK\_VERSION}{\param{}{major, minor, release}}
@@ -289,13 +308,12 @@ the following can be done:
 \end{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{wxCHECK\_W32API\_VERSION}\label{wxcheckw32apiversion}
@@ -931,6 +949,10 @@ that matches the path {\it spec}, or the empty string. Use \helpref{wxFindNextFi
 get the next matching file. Neither will report the current directory "." or the
 parent directory "..".
 
 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.
 {\it spec} may contain wildcards.
 
 {\it flags} may be wxDIR for restricting the query to directories, wxFILE for files or zero for either.
@@ -1395,7 +1417,7 @@ if successful, {\tt false} otherwise.
 
 
 
 
 
 
-\section{String functions}
+\section{String functions}\label{stringfunctions}
 
 
 \membersection{::copystring}\label{copystring}
 
 
 \membersection{::copystring}\label{copystring}
@@ -1408,22 +1430,6 @@ deleted with the {\it delete} operator.
 This function is deprecated, use \helpref{wxString}{wxstring} class instead.
 
 
 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}}
 \membersection{::wxGetTranslation}\label{wxgettranslation}
 
 \func{const char *}{wxGetTranslation}{\param{const char * }{str}}
@@ -1447,10 +1453,11 @@ It is also used as the key for the search in the catalog.
 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',
 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.
 
 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}}
 \membersection{::wxIsEmpty}\label{wxisempty}
 
 \func{bool}{wxIsEmpty}{\param{const char *}{ p}}
@@ -1623,11 +1630,6 @@ the string for the current locale during execution.
 
 Don't confuse this macro with \helpref{\_T()}{underscoret}!
 
 
 Don't confuse this macro with \helpref{\_T()}{underscoret}!
 
-\wxheading{See also}
-
-\helpref{ngettext}{ngettext}
-
-
 
 \membersection{\_T}\label{underscoret}
 
 
 \membersection{\_T}\label{underscoret}
 
@@ -2139,7 +2141,7 @@ checkbox which is shown in the tips dialog.}
 
 
 
 
 
 
-\section{Math functions}
+\section{Math functions}\label{mathfunctions}
 
 \wxheading{Include files}
 
 
 \wxheading{Include files}
 
@@ -2597,6 +2599,19 @@ code which might have to be compiled with an old compiler without support for
 this language feature but still take advantage of it when it is available.
 
 
 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}}
 \membersection{wxLL}\label{wxll}
 
 \func{wxLongLong\_t}{wxLL}{\param{}{number}}
@@ -3640,7 +3655,14 @@ used by wxWidgets are:
 \item wxTRACE\_OleCalls: trace OLE method calls (Win32 only)
 \end{itemize}
 
 \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
 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
@@ -3850,6 +3872,33 @@ Returns the number of seconds since GMT 00:00:00 Jan 1st 1970.
 <wx/timer.h>
 
 
 <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}
 \membersection{::wxNow}\label{wxnow}
 
 \func{wxString}{wxNow}{\void}
@@ -3889,13 +3938,10 @@ See also \helpref{wxTimer}{wxtimer}.
 
 \func{void}{wxUsleep}{\param{unsigned long}{ milliseconds}}
 
 
 \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.