X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/26822b76fae3b6d8e90c305985ae13002b26b78a..ab9717339232a7a728dea666c59b73fd6ac78dd3:/docs/latex/wx/function.tex diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex index 1a99a1fb20..5d8a4e82b6 100644 --- a/docs/latex/wx/function.tex +++ b/docs/latex/wx/function.tex @@ -35,6 +35,10 @@ the corresponding topic. \helpref{wxASSERT}{wxassert}\\ \helpref{wxASSERT\_MIN\_BITSIZE}{wxassertminbitsize}\\ \helpref{wxASSERT\_MSG}{wxassertmsg}\\ +\helpref{wxAtomicDec}{wxatomicdec}\\ +\helpref{wxAtomicInc}{wxatomicinc}\\ +\helpref{wxBase64Decode}{wxbase64decode}\\ +\helpref{wxBase64Encode}{wxbase64encode}\\ \helpref{wxBeginBusyCursor}{wxbeginbusycursor}\\ \helpref{wxBell}{wxbell}\\ \helpref{wxBITMAP}{wxbitmapmacro}\\ @@ -45,6 +49,7 @@ the corresponding topic. \helpref{wxCHECK\_GCC\_VERSION}{wxcheckgccversion}\\ \helpref{wxCHECK\_MSG}{wxcheckmsg}\\ \helpref{wxCHECK\_RET}{wxcheckret}\\ +\helpref{wxCHECK\_SUNCC\_VERSION}{wxchecksunccversion}\\ \helpref{wxCHECK\_VERSION}{wxcheckversion}\\ \helpref{wxCHECK\_VERSION\_FULL}{wxcheckversionfull}\\ \helpref{wxCHECK\_W32API\_VERSION}{wxcheckw32apiversion}\\ @@ -69,6 +74,8 @@ the corresponding topic. \helpref{wxDROP\_ICON}{wxdropicon}\\ \helpref{wxDebugMsg}{wxdebugmsg}\\ \helpref{WXDEBUG\_NEW}{debugnew}\\ +\helpref{wxDEPRECATED}{wxdeprecated}\\ +\helpref{wxDEPRECATED\_BUT\_USED\_INTERNALLY}{wxdeprecatedbutusedinternally}\\ \helpref{wxDirExists}{functionwxdirexists}\\ \helpref{wxDirSelector}{wxdirselector}\\ \helpref{wxDisplayDepth}{wxdisplaydepth}\\ @@ -117,7 +124,6 @@ the corresponding topic. \helpref{wxGetDisplayName}{wxgetdisplayname}\\ \helpref{wxGetDisplaySize}{wxdisplaysize}\\ \helpref{wxGetDisplaySizeMM}{wxdisplaysizemm}\\ -\helpref{wxGetElapsedTime}{wxgetelapsedtime}\\ \helpref{wxGetEmailAddress}{wxgetemailaddress}\\ \helpref{wxGetEnv}{wxgetenv}\\ \helpref{wxGetFileKind}{wxgetfilekind}\\ @@ -239,7 +245,6 @@ the corresponding topic. \helpref{wxSnprintf}{wxsnprintf}\\ \helpref{wxSplit}{wxsplit}\\ \helpref{wxSplitPath}{wxsplitfunction}\\ -\helpref{wxStartTimer}{wxstarttimer}\\ \helpref{wxStaticCast}{wxstaticcast}\\ \helpref{wxStrcmp}{wxstrcmp}\\ \helpref{wxStricmp}{wxstricmp}\\ @@ -317,6 +322,15 @@ compiler (g++) version major.minor or greater. Otherwise, and also if the compiler is not GNU C++ at all, returns $0$. +\membersection{wxCHECK\_SUNCC\_VERSION}\label{wxchecksunccversion} + +\func{bool}{wxCHECK\_SUNCC\_VERSION}{\param{}{major, minor}} + +Returns $1$ if the compiler being used to compile the code is Sun CC Pro +compiler and its version is at least \texttt{major.minor}. Otherwise returns +$0$. + + \membersection{wxCHECK\_VERSION}\label{wxcheckversion} \func{bool}{wxCHECK\_VERSION}{\param{}{major, minor, release}} @@ -350,7 +364,7 @@ Same as \helpref{wxCHECK\_VERSION}{wxcheckversion} but also checks that \membersection{wxCHECK\_W32API\_VERSION}\label{wxcheckw32apiversion} -\func{bool}{wxCHECK\_GCC\_VERSION}{\param{}{major, minor, release}} +\func{bool}{wxCHECK\_W32API\_VERSION}{\param{}{major, minor, release}} Returns $1$ if the version of w32api headers used is major.minor.release or greater. Otherwise, and also if we are not compiling with mingw32/cygwin under @@ -437,6 +451,15 @@ least the GUI part of) the library can't be used at all. Notice that parameters \arg{argc} and \arg{argv} may be modified by this function. +An additional overload of wxEntryStart() is provided under MSW only: it is +meant to be called with the parameters passed to \texttt{WinMain()}. + +\func{bool}{wxEntryStart}{\param{HINSTANCE }{hInstance}, \param{HINSTANCE }{hPrevInstance = \NULL}, \param{char *}{pCmdLine = \NULL}, \param{int }{nCmdShow = \texttt{SW\_SHOWNORMAL}}} + +(notice that under Windows CE platform, and only there, the type of +\arg{pCmdLine} is \texttt{wchar\_t *}, otherwise it is \texttt{char *}, even in +Unicode build). + \wxheading{Include files} @@ -1037,7 +1060,7 @@ temporary storage that should not be deallocated. \membersection{::wxFindFirstFile}\label{wxfindfirstfile} -\func{wxString}{wxFindFirstFile}{\param{const char *}{spec}, \param{int}{ flags = 0}} +\func{wxString}{wxFindFirstFile}{\param{const wxString\& }{spec}, \param{int}{ flags = 0}} This function does directory searching; returns the first file that matches the path {\it spec}, or the empty string. Use \helpref{wxFindNextFile}{wxfindnextfile} to @@ -1335,7 +1358,7 @@ Note that empty tokens will be generated if there are two or more adjacent separ \membersection{::wxSplitPath}\label{wxsplitfunction} -\func{void}{wxSplitPath}{\param{const char *}{ fullname}, \param{wxString *}{ path}, \param{wxString *}{ name}, \param{wxString *}{ ext}} +\func{void}{wxSplitPath}{\param{const wxString\&}{ fullname}, \param{wxString *}{ path}, \param{wxString *}{ name}, \param{wxString *}{ ext}} {\bf NB:} This function is obsolete, please use \helpref{wxFileName::SplitPath}{wxfilenamesplitpath} instead. @@ -2414,7 +2437,7 @@ checkbox which is shown in the tips dialog.} \func{int}{wxFinite}{\param{double }{x}} -Returns a non-zero value if {\it x} is neither infinite or NaN (not a number), +Returns a non-zero value if {\it x} is neither infinite nor NaN (not a number), returns 0 otherwise. @@ -2818,6 +2841,111 @@ The clipboard must have previously been opened for this call to succeed. \section{Miscellaneous functions}\label{miscellany} +\membersection{wxBase64Decode}\label{wxbase64decode} + +\func{size\_t}{wxBase64Decode}{\param{void *}{dst}, \param{size\_t }{dstLen}, +\param{const char * }{src}, \param{size\_t }{srcLen = wxNO\_LEN}, +\param{wxBase64DecodeMode }{mode = wxBase64DecodeMode\_Strict}, +\param{size\_t }{*posErr = \NULL}} + +\func{wxMemoryBuffer}{wxBase64Decode}{\\ +\param{const char * }{src}, \param{size\_t }{srcLen = wxNO\_LEN},\\ +\param{wxBase64DecodeMode }{mode = wxBase64DecodeMode\_Strict},\\ +\param{size\_t }{*posErr = \NULL}} + +These function decode a Base64-encoded string. The first version is a raw +decoding function and decodes the data into the provided buffer \arg{dst} of +the given size \arg{dstLen}. An error is returned if the buffer is not large +enough -- that is not at least \helpref{wxBase64DecodedSize(srcLen)}{wxbase64decodedsize} +bytes. The second version allocates memory internally and returns it as +\helpref{wxMemoryBuffer}{wxmemorybuffer} and is recommended for normal use. + +The first version returns the number of bytes written to the buffer or the +necessary buffer size if \arg{dst} was \NULL or \texttt{wxCONV\_FAILED} on +error, e.g. if the output buffer is too small or invalid characters were +encountered in the input string. The second version returns a buffer with the +base64 decoded binary equivalent of the input string. In neither case is the +buffer NUL-terminated. + +\wxheading{Parameters} + +\docparam{dst}{Pointer to output buffer, may be \NULL to just compute the +necessary buffer size.} + +\docparam{dstLen}{The size of the output buffer, ignored if \arg{dst} is +\NULL.} + +\docparam{src}{The input string, must not be \NULL.} + +\docparam{srcLen}{The length of the input string or special value +\texttt{wxNO\_LEN} if the string is \NUL-terminated and the length should be +computed by this function itself.} + +\docparam{mode}{This parameter specifies the function behaviour when invalid +characters are encountered in input. By default, any such character stops the +decoding with error. If the mode is wxBase64DecodeMode\_SkipWS, then the white +space characters are silently skipped instead. And if it is +wxBase64DecodeMode\_Relaxed, then all invalid characters are skipped.} + +\docparam{posErr}{If this pointer is non-\NULL and an error occurs during +decoding, it is filled with the index of the invalid character.} + +\wxheading{Include files} + + + + +\membersection{wxBase64DecodedSize}\label{wxbase64decodedsize} + +\func{size\_t}{wxBase64DecodedSize}{\param{size\_t }{srcLen}} + +Returns the size of the buffer necessary to contain the data encoded in a +base64 string of length \arg{srcLen}. This can be useful for allocating a +buffer to be passed to \helpref{wxBase64Decode}{wxbase64decode}. + + +\membersection{wxBase64Encode}\label{wxbase64encode} + +\func{size\_t}{wxBase64Encode}{\param{char *}{dst}, \param{size\_t }{dstLen}, +\param{const void *}{src}, \param{size\_t }{srcLen}} + +\func{wxString}{wxBase64Encode}{\param{const void *}{src}, \param{size\_t }{srcLen}} + +\func{wxString}{wxBase64Encode}{\param{const wxMemoryBuffer\& }{buf}} + +These functions encode the given data using base64. The first of them is the +raw encoding function writing the output string into provided buffer while the +other ones return the output as wxString. There is no error return for these +functions except for the first one which returns \texttt{wxCONV\_FAILED} if the +output buffer is too small. To allocate the buffer of the correct size, use +\helpref{wxBase64EncodedSize}{wxbase64encodedsize} or call this function with +\arg{dst} set to \NULL -- it will then return the necessary buffer size. + +\wxheading{Parameters} + +\docparam{dst}{The output buffer, may be \NULL to retrieve the needed buffer +size.} + +\docparam{dstLen}{The output buffer size, ignored if \arg{dst} is \NULL.} + +\docparam{src}{The input buffer, must not be \NULL.} + +\docparam{srcLen}{The length of the input data.} + +\wxheading{Include files} + + + + +\membersection{wxBase64EncodedSize}\label{wxbase64encodedsize} + +\func{size\_t}{wxBase64EncodedSize}{\param{size\_t }{len}} + +Returns the length of the string with base64 representation of a buffer of +specified size \arg{len}. This can be useful for allocating the buffer passed +to \helpref{wxBase64Encode}{wxbase64encode}. + + \membersection{wxCONCAT}\label{wxconcat} \func{}{wxCONCAT}{\param{}{x}, \param{}{y}} @@ -2851,6 +2979,36 @@ it is quoted automatically by the macro)} +\membersection{wxDEPRECATED}\label{wxdeprecated} + +This macro can be used around a function declaration to generate warnings +indicating that this function is deprecated (i.e. obsolete and planned to be +removed in the future) when it is used. Only Visual C++ 7 and higher and g++ +compilers currently support this functionality. + +Example of use: +\begin{verbatim} + // old function, use wxString version instead + wxDEPRECATED( void wxGetSomething(char *buf, size_t len) ); + + // ... + wxString wxGetSomething(); +\end{verbatim} + + +\membersection{wxDEPRECATED\_BUT\_USED\_INTERNALLY}\label{wxdeprecatedbutusedinternally} + +This is a special version of \helpref{wxDEPRECATED}{wxdeprecated} macro which +only does something when the deprecated function is used from the code outside +wxWidgets itself but doesn't generate warnings when it is used from wxWidgets. +It is used with the virtual functions which are called by the library itself -- +even if such function is deprecated the library still has to call it to ensure +that the existing code overriding it continues to work, but the use of this +macro ensures that a deprecation warning will be generated if this function is +used from the user code or, in case of Visual C++, even when it is simply +overridden. + + \membersection{wxEXPLICIT}\label{wxexplicit} {\tt wxEXPLICIT} is a macro which expands to the C++ {\tt explicit} keyword if @@ -2942,7 +3100,9 @@ Generates an integer identifier unique to this run of the program. \membersection{wxON\_BLOCK\_EXIT}\label{wxonblockexit} \func{}{wxON\_BLOCK\_EXIT0}{\param{}{func}} + \func{}{wxON\_BLOCK\_EXIT1}{\param{}{func}, \param{}{p1}} + \func{}{wxON\_BLOCK\_EXIT2}{\param{}{func}, \param{}{p1}, \param{}{p2}} This family of macros allows to ensure that the global function \arg{func} @@ -2970,7 +3130,9 @@ details. \membersection{wxON\_BLOCK\_EXIT\_OBJ}\label{wxonblockexitobj} \func{}{wxON\_BLOCK\_EXIT\_OBJ0}{\param{}{obj}, \param{}{method}} + \func{}{wxON\_BLOCK\_EXIT\_OBJ1}{\param{}{obj}, \param{}{method}, \param{}{p1}} + \func{}{wxON\_BLOCK\_EXIT\_OBJ2}{\param{}{obj}, \param{}{method}, \param{}{p1}, \param{}{p2}} This family of macros is similar to \helpref{wxON\_BLOCK\_EXIT}{wxonblockexit} @@ -3099,6 +3261,18 @@ Find the deepest window at the mouse pointer position, returning the window and current pointer position in screen coordinates. +\membersection{wxFromString}\label{wxfromstring} + +\func{bool}{wxFromString}{\param{const wxString\& }{str}, + \param{wxColour* }{col}} + +\func{bool}{wxFromString}{\param{const wxString\& }{str}, + \param{wxFont* }{col}} + +Converts string to the type of the second argument. Returns \true on success. +See also: \helpref{wxToString}{wxtostring}. + + \membersection{::wxGetActiveWindow}\label{wxgetactivewindow} \func{wxWindow *}{wxGetActiveWindow}{\void} @@ -3252,7 +3426,10 @@ frame or dialog containing it, or {\tt NULL}. Open the \arg{url} in user's default browser. If \arg{flags} parameter contains \texttt{wxBROWSER\_NEW\_WINDOW} flag, a new window is opened for the URL -(currently this is only supported under Windows). +(currently this is only supported under Windows). The \arg{url} may also be a +local file path (with or without \texttt{file://} prefix), if it doesn't +correspond to an existing file and the URL has no scheme \texttt{http://} is +prepended to it by default. Returns \true if the application was successfully launched. @@ -3411,6 +3588,16 @@ class name internally. Example of using the macro: Notice that there should be no semicolon after this macro. +\membersection{wxToString}\label{wxtostring} + +\func{wxString}{wxToString}{\param{const wxColour\& }{col}} + +\func{wxString}{wxToString}{\param{const wxFont\& }{col}} + +Converts its argument to string. +See also: \helpref{wxFromString}{wxfromstring}. + + \membersection{wxULL}\label{wxull} \func{wxLongLong\_t}{wxULL}{\param{}{number}} @@ -4644,13 +4831,17 @@ Returns \true if the variable exists, \false otherwise. \membersection{wxSetEnv}\label{wxsetenv} -\func{bool}{wxSetEnv}{\param{const wxString\&}{ var}, \param{const wxChar *}{value}} +\func{bool}{wxSetEnv}{\param{const wxString\&}{ var}, \param{const wxString\& }{value}} Sets the value of the environment variable {\it var} (adding it if necessary) to {\it value}. Returns \true on success. +\wxheading{See also} + +\helpref{wxUnsetEnv}{wxunsetenv} + \membersection{wxUnsetEnv}\label{wxunsetenv} @@ -4661,3 +4852,46 @@ Removes the variable {\it var} from the environment. function. Returns \true on success. + +\wxheading{See also} + +\helpref{wxSetEnv}{wxsetenv} + + +\section{Atomic operations}\label{atomicoperations} + +When using multi-threaded applications, it is often required to access or +modify memory which is shared between threads. Atomic integer and pointer +operations are an efficient way to handle this issue (another, less efficient, +way is to use a \helpref{mutex}{wxmutex} or \helpref{critical +section}{wxcriticalsection}). A native implementation exists for Windows, +Linux, Solaris and Mac OS X, for other OS, a +\helpref{wxCriticalSection}{wxcriticalsection} is used to protect the data. + +One particular application is reference counting (used by so-called smart +pointers). + +You should define your variable with the type wxAtomicInt in order to apply +atomic operations to it. + +\wxheading{Include files} + + + +\membersection{::wxAtomicInc}\label{wxatomicinc} + +\func{void}{wxAtomicInc}{\param{wxAtomicInt\& }{value}} + +This function increments \arg{value} in an atomic manner. + + +\membersection{::wxAtomicDec}\label{wxatomicdec} + +\func{wxInt32}{wxAtomicDec}{\param{wxAtomicInt\& }{value}} + +This function decrements \arg{value} in an atomic manner. + +Returns 0 if \arg{value} is 0 after decrementation or any non-zero value (not +necessarily equal to the value of the variable) otherwise. + +