X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d37fd2fada5c7d1cbb78844a4a6540284256e72f..7bcb11d30764df47144189e164f53d8171ed4a63:/docs/latex/wx/function.tex

diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex
index 8829f12eb7..00cabcc85b 100644
--- a/docs/latex/wx/function.tex
+++ b/docs/latex/wx/function.tex
@@ -37,29 +37,28 @@ Returns TRUE if the file exists.
 
 \func{wxString}{wxFileNameFromPath}{\param{const wxString\& }{path}}
 
-Returns a temporary pointer to the filename for a full path.
-Copy this pointer for long-term use.
+\func{char*}{wxFileNameFromPath}{\param{char* }{path}}
+
+Returns the filename for a full path. The second form returns a pointer to
+temporary storage that should not be deallocated.
 
 \membersection{::wxFindFirstFile}\label{wxfindfirstfile}
 
-\func{wxString}{wxFindFirstFile}{\param{const wxString\& }{spec}, \param{int}{ flags = 0}}
+\func{wxString}{wxFindFirstFile}{\param{const char*}{spec}, \param{int}{ flags = 0}}
 
 This function does directory searching; returns the first file
-that matches the path {\it spec}, or NULL. Use \helpref{wxFindNextFile}{wxfindnextfile} to
+that matches the path {\it spec}, or the empty string. Use \helpref{wxFindNextFile}{wxfindnextfile} to
 get the next matching file.
 
 {\it spec} may contain wildcards.
 
 {\it flags} is reserved for future use.
 
-The returned filename is a pointer to static memory so should
-not be freed.
-
 For example:
 
 \begin{verbatim}
   wxString f = wxFindFirstFile("/home/project/*.*");
-  while (f)
+  while ( !f.IsEmpty() )
   {
     ...
     f = wxFindNextFile();
@@ -89,8 +88,7 @@ or drive name at the beginning.
 
 \func{wxString}{wxPathOnly}{\param{const wxString\& }{path}}
 
-Returns a temporary pointer to the directory part of the filename. Copy this
-pointer for long-term use.
+Returns the directory part of the filename.
 
 \membersection{::wxUnix2DosFilename}
 
@@ -123,7 +121,9 @@ Returns a string containing the current (or working) directory.
 
 \func{bool}{wxGetHostName}{\param{const wxString\& }{buf}, \param{int }{sz}}
 
-Copies the current host machine's name into the supplied buffer.
+Copies the current host machine's name into the supplied buffer. Please note
+that the returned name is {\it not} fully qualified, i.e. it does not include
+the domain name.
 
 Under Windows or NT, this function first looks in the environment
 variable SYSTEM\_NAME; if this is not found, the entry {\bf HostName}\rtfsp
@@ -168,7 +168,7 @@ Returns TRUE if successful, FALSE otherwise.
 
 \membersection{::wxGetWorkingDirectory}
 
-\func{wxString}{wxGetWorkingDirectory}{\param{const wxString\& }{buf=NULL}, \param{int }{sz=1000}}
+\func{wxString}{wxGetWorkingDirectory}{\param{char*}{buf=NULL}, \param{int }{sz=1000}}
 
 This function is obsolete: use \helpref{wxGetCwd}{wxgetcwd} instead.
 
@@ -180,7 +180,7 @@ if the buffer is NULL.
 
 \membersection{::wxGetTempFileName}
 
-\func{wxString}{wxGetTempFileName}{\param{const wxString\& }{prefix}, \param{const wxString\& }{buf=NULL}}
+\func{char*}{wxGetTempFileName}{\param{const wxString\& }{prefix}, \param{char* }{buf=NULL}}
 
 Makes a temporary filename based on {\it prefix}, opens and closes the file,
 and places the name in {\it buf}. If {\it buf} is NULL, new store
@@ -260,6 +260,24 @@ three of them may be empty if the corresponding component is. The old contents o
 strings pointed to by these parameters will be overwritten in any case (if the pointers
 are not NULL).
 
+\membersection{::wxTransferFileToStream}\label{wxtransferfiletostream}
+
+\func{bool}{wxTransferFileToStream}{\param{const wxString\& }{filename}, \param{ostream\& }{stream}}
+
+Copies the given file to {\it stream}. Useful when converting an old application to
+use streams (within the document/view framework, for example).
+
+Use of this function requires the file wx\_doc.h to be included.
+
+\membersection{::wxTransferStreamToFile}\label{wxtransferstreamtofile}
+
+\func{bool}{wxTransferStreamToFile}{\param{istream\& }{stream} \param{const wxString\& }{filename}}
+
+Copies the given stream to the file {\it filename}. Useful when converting an old application to
+use streams (within the document/view framework, for example).
+
+Use of this function requires the file wx\_doc.h to be included.
+
 \section{String functions}
 
 \membersection{::copystring}
@@ -288,23 +306,42 @@ A macro defined as:
 #define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) == 0))
 \end{verbatim}
 
-\membersection{::wxTransferFileToStream}\label{wxtransferfiletostream}
+\membersection{::IsEmpty}\label{isempty}
 
-\func{bool}{wxTransferFileToStream}{\param{const wxString\& }{filename}, \param{ostream\& }{stream}}
+\func{bool}{IsEmpty}{\param{const char *}{ p}}
 
-Copies the given file to {\it stream}. Useful when converting an old application to
-use streams (within the document/view framework, for example).
+Returns TRUE if the string is empty, FALSE otherwise. It is safe to pass NULL
+pointer to this function and it will return TRUE for it.
 
-Use of this function requires the file wx\_doc.h to be included.
+\membersection{::Stricmp}\label{stricmp}
 
-\membersection{::wxTransferStreamToFile}\label{wxtransferstreamtofile}
+\func{int}{Stricmp}{\param{const char *}{p1}, \param{const char *}{p2}}
 
-\func{bool}{wxTransferStreamToFile}{\param{istream\& }{stream} \param{const wxString\& }{filename}}
+Returns a negative value, 0, or positive value if {\it p1} is less than, equal
+to or greater than {\it p2}. The comparison is case-insensitive.
 
-Copies the given stream to the file {\it filename}. Useful when converting an old application to
-use streams (within the document/view framework, for example).
+This function complements the standard C function {\it strcmp()} which performs
+case-sensitive comparison.
 
-Use of this function requires the file wx\_doc.h to be included.
+\membersection{::Strlen}\label{strlen}
+
+\func{size\_t}{Strlen}{\param{const char *}{ p}}
+
+This is a safe version of standard function {\it strlen()}: it does exactly the
+same thing (i.e. returns the length of the string) except that it returns 0 if
+{\it p} is the NULL pointer.
+
+\membersection{::wxGetTranslation}\label{wxgettranslation}
+
+\func{const char *}{wxGetTranslation}{\param{const char * }{str}}
+
+This function returns the translation of string {\it str} in the current 
+\helpref{locale}{wxlocale}. If the string is not found in any of the loaded
+message catalogs (see \helpref{i18n overview}{internationalization}), the
+original string is returned. In debug build, an error message is logged - this
+should help to find the strings which were not yet translated. As this function
+is used very often, an alternative syntax is provided: the \_() macro is
+defined as wxGetTranslation().
 
 \section{Dialog functions}\label{dialogfunctions}
 
@@ -316,15 +353,15 @@ the front when the dialog box is popped up.
 
 \membersection{::wxFileSelector}\label{wxfileselector}
 
-\func{wxString}{wxFileSelector}{\param{const wxString\& }{message}, \param{const wxString\& }{default\_path = NULL},\\
-  \param{const wxString\& }{default\_filename = NULL}, \param{const wxString\& }{default\_extension = NULL},\\
-  \param{const wxString\& }{wildcard = ``*.*''}, \param{int }{flags = 0}, \param{wxWindow *}{parent = NULL},\\
+\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{int}{ x = -1}, \param{int}{ y = -1}}
 
 Pops up a file selector box. In Windows, this is the common file selector
 dialog. In X, this is a file selector box with somewhat less functionality.
 The path and filename are distinct elements of a full file pathname.
-If path is NULL, the current directory will be used. If filename is NULL,
+If path is empty, the current directory will be used. If filename is empty,
 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,
@@ -345,20 +382,17 @@ types of file with a description for each, such as:
  "BMP files (*.bmp) | *.bmp | GIF files (*.gif) | *.gif"
 \end{verbatim}
 
-The application must check for a NULL return value (the user pressed
+The application must check for an empty return value (the user pressed
 Cancel). For example:
 
 \begin{verbatim}
-const wxString\& s = wxFileSelector("Choose a file to open");
+const wxString& s = wxFileSelector("Choose a file to open");
 if (s)
 {
   ...
 }
 \end{verbatim}
 
-Remember that the returned pointer is temporary and should be copied
-if other wxWindows calls will be made before the value is to be used.
-
 \wxheading{Include files}
 
 <wx/filedlg.h>
@@ -371,7 +405,7 @@ if other wxWindows calls will be made before the value is to be used.
 
 Pop up a dialog box with title set to {\it caption}, message {\it message}, and a
 \rtfsp{\it default\_value}.  The user may type in text and press OK to return this text,
-or press Cancel to return NULL.
+or press Cancel to return the empty string.
 
 If {\it centre} is TRUE, the message text (which may include new line characters)
 is centred; if FALSE, the message is left-justified.
@@ -414,7 +448,7 @@ is centred; if FALSE, the message is left-justified.
 
 Pops up a dialog box containing a message, OK/Cancel buttons and a single-selection
 listbox. The user may choose an item and press OK to return a string or
-Cancel to return NULL.
+Cancel to return the empty string.
 
 {\it choices} is an array of {\it n} strings for the listbox.
 
@@ -967,7 +1001,7 @@ arguments, terminated by NULL.
 If {\it sync} is FALSE (the default), flow of control immediately returns.
 If TRUE, the current application waits until the other program has terminated.
 
-In the case of synchronous execution, the return value is trhe exit code of
+In the case of synchronous execution, the return value is the exit code of
 the process (which terminates by the moment the function returns) and will be
 $-1$ if the process couldn't be started and typically 0 if the process
 terminated successfully.
@@ -1287,6 +1321,21 @@ Now obsolete: use \helpref{wxWindow::Close}{wxwindowclose} instead.
 
 <wx/utils.h>
 
+\membersection{::wxSafeYield}{wxsafeyield}
+
+\func{bool}{wxSafeYield}{\param{wxWindow*}{ win = NULL}}
+
+This function is similar to wxYield, except that it disables the user input to
+all program windows before calling wxYield and re-enables it again
+afterwards. If {\it win} is not NULL, this window will remain enabled, 
+allowing the implementation of some limited user interaction.
+
+Returns the result of the call to \helpref{::wxYield}{wxyield}.
+
+\wxheading{Include files}
+
+<wx/utils.h>
+
 \membersection{::wxSetDisplayName}\label{wxsetdisplayname}
 
 \func{void}{wxSetDisplayName}{\param{const wxString\& }{displayName}}
@@ -1402,6 +1451,18 @@ This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}
 
 <wx/memory.h>
 
+\membersection{::wxUsleep}\label{wxusleep}
+
+\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>
+
 \membersection{::wxWriteResource}\label{wxwriteresource}
 
 \func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry},
@@ -1433,7 +1494,7 @@ See also \helpref{wxGetResource}{wxgetresource}, \helpref{wxConfigBase}{wxconfig
 
 <wx/utils.h>
 
-\membersection{::wxYield}
+\membersection{::wxYield}\label{wxyield}
 
 \func{bool}{wxYield}{\void}
 
@@ -1445,7 +1506,8 @@ multitasking is cooperative) other processes will not respond.
 Caution should be exercised, however, since yielding may allow the
 user to perform actions which are not compatible with the current task.
 Disabling menu items or whole menus during processing can avoid unwanted
-reentrance of code.
+reentrance of code: see \helpref{::wxSafeYield}{wxsafeyield} for a better
+function.
 
 \wxheading{Include files}
 
