]> git.saurik.com Git - wxWidgets.git/blobdiff - docs/latex/wx/function.tex
don't remove the old tags of different kinds when setting new style, this removes...
[wxWidgets.git] / docs / latex / wx / function.tex
index 20e484ecf91a9bdd0c5e6bf9c072a912b86f512e..8fd8b09c791f77a244b0a6f260d3aaca8b2684e8 100644 (file)
@@ -32,6 +32,7 @@ the corresponding topic.
 \helpref{IMPLEMENT\_CLASS}{implementclass}\\
 \helpref{IMPLEMENT\_DYNAMIC\_CLASS2}{implementdynamicclass2}\\
 \helpref{IMPLEMENT\_DYNAMIC\_CLASS}{implementdynamicclass}\\
+\helpref{wxAboutBox}{wxaboutbox}\\
 \helpref{wxASSERT}{wxassert}\\
 \helpref{wxASSERT\_MIN\_BITSIZE}{wxassertminbitsize}\\
 \helpref{wxASSERT\_MSG}{wxassertmsg}\\
@@ -83,6 +84,8 @@ the corresponding topic.
 \helpref{wxEndBusyCursor}{wxendbusycursor}\\
 \helpref{wxENTER\_CRIT\_SECT}{wxentercritsect}\\
 \helpref{wxEntry}{wxentry}\\
+\helpref{wxEntryStart}{wxentrystart}\\
+\helpref{wxEntryCleanup}{wxentrycleanup}\\
 \helpref{wxEnumClipboardFormats}{wxenumclipboardformats}\\
 \helpref{wxError}{wxerror}\\
 \helpref{wxExecute}{wxexecute}\\
@@ -103,6 +106,7 @@ the corresponding topic.
 \helpref{wxFindWindowByLabel}{wxfindwindowbylabel}\\
 \helpref{wxFindWindowByName}{wxfindwindowbyname}\\
 \helpref{wxFinite}{wxfinite}\\
+\helpref{wxGenericAboutBox}{wxgenericaboutbox}\\
 \helpref{wxGetActiveWindow}{wxgetactivewindow}\\
 \helpref{wxGetApp}{wxgetapp}\\
 \helpref{wxGetBatteryState}{wxgetbatterystate}\\
@@ -129,7 +133,6 @@ the corresponding topic.
 \helpref{wxGetMousePosition}{wxgetmouseposition}\\
 \helpref{wxGetMouseState}{wxgetmousestate}\\
 \helpref{wxGetMultipleChoices}{wxgetmultiplechoices}\\
-\helpref{wxGetMultipleChoice}{wxgetmultiplechoice}\\
 \helpref{wxGetNumberFromUser}{wxgetnumberfromuser}\\
 \helpref{wxGetOSDirectory}{wxgetosdirectory}\\
 \helpref{wxGetOsDescription}{wxgetosdescription}\\
@@ -176,6 +179,7 @@ the corresponding topic.
 \helpref{wxIsPlatformLittleEndian}{wxisplatformlittleendian}\\
 \helpref{wxIsPlatform64Bit}{wxisplatform64bit}\\
 \helpref{wxIsWild}{wxiswild}\\
+\helpref{wxJoin}{wxjoin}\\
 \helpref{wxKill}{wxkill}\\
 \helpref{wxLaunchDefaultBrowser}{wxlaunchdefaultbrowser}\\
 \helpref{wxLEAVE\_CRIT\_SECT}{wxleavecritsect}\\
@@ -235,6 +239,7 @@ the corresponding topic.
 \helpref{wxShutdown}{wxshutdown}\\
 \helpref{wxSleep}{wxsleep}\\
 \helpref{wxSnprintf}{wxsnprintf}\\
+\helpref{wxSplit}{wxsplit}\\
 \helpref{wxSplitPath}{wxsplitfunction}\\
 \helpref{wxStartTimer}{wxstarttimer}\\
 \helpref{wxStaticCast}{wxstaticcast}\\
@@ -245,6 +250,8 @@ the corresponding topic.
 \helpref{wxStringTokenize}{wxstringtokenize}\\
 \helpref{wxStripMenuCodes}{wxstripmenucodes}\\
 \helpref{wxStrlen}{wxstrlen}\\
+\helpref{wxSTRINGIZE}{wxstringize}\\
+\helpref{wxSTRINGIZE\_T}{wxstringizet}\\
 \helpref{wxSUPPRESS\_GCC\_PRIVATE\_DTOR\_WARNING}{wxsuppressgccprivatedtorwarning}\\
 \helpref{wxSysErrorCode}{wxsyserrorcode}\\
 \helpref{wxSysErrorMsg}{wxsyserrormsg}\\
@@ -306,10 +313,10 @@ and so normally is not useful.
 
 \membersection{wxCHECK\_GCC\_VERSION}\label{wxcheckgccversion}
 
-\func{bool}{wxCHECK\_GCC\_VERSION}{\param{}{major, minor, release}}
+\func{bool}{wxCHECK\_GCC\_VERSION}{\param{}{major, minor}}
 
 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
+compiler (g++) version major.minor or greater. Otherwise, and also if
 the compiler is not GNU C++ at all, returns $0$.
 
 
@@ -362,26 +369,27 @@ to control the behaviour of the main event loop of the GUI programs.
 
 \membersection{::wxEntry}\label{wxentry}
 
-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 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}}
+The following overload of wxEntry is available under all platforms:
+
+\func{int}{wxEntry}{\param{int\&}{ argc}, \param{wxChar **}{argv}}
 
-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.
+Under MS Windows, an additional overload suitable for calling from 
+\texttt{WinMain} is available:
 
-\func{void}{wxEntry}{\param{HANDLE}{ hInstance}, \param{HANDLE}{ hPrevInstance},
- \param{WORD}{ wDataSegment}, \param{WORD}{ wHeapSize}, \param{const wxString\& }{ commandLine}}
+\func{int}{wxEntry}{\param{HINSTANCE }{hInstance}, \param{HINSTANCE }{hPrevInstance = \NULL}, \param{char *}{pCmdLine = \NULL}, \param{int }{nCmdShow = \texttt{SW\_SHOWNORMAL}}}
 
-wxWidgets initialization under Windows (for applications constructed as a DLL).
+(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).
 
-\func{int}{wxEntry}{\param{int}{ argc}, \param{const wxString\& *}{argv}}
+\wxheading{See also}
 
-wxWidgets initialization under Unix.
+\helpref{wxEntryStart}{wxentrystart}
 
 \wxheading{Remarks}
 
@@ -405,6 +413,38 @@ int CTheApp::ExitInstance()
 
 
 
+\membersection{::wxEntryCleanup}\label{wxentrycleanup}
+
+\func{void}{wxEntryCleanup}{\void}
+
+Free resources allocated by a successful call to \helpref{wxEntryStart}{wxentrystart}.
+
+\wxheading{Include files}
+
+<wx/init.h>
+
+
+\membersection{::wxEntryStart}\label{wxentrystart}
+
+\func{bool}{wxEntryStart}{\param{int\&}{ argc}, \param{wxChar **}{argv}}
+
+This function can be used to perform the initialization of wxWidgets if you
+can't use the default initialization code for any reason.
+
+If the function returns \true, the initialization was successful and the global 
+\helpref{wxApp}{wxapp} object \texttt{wxTheApp} has been created. Moreover, 
+\helpref{wxEntryCleanup}{wxentrycleanup} must be called afterwards. If the
+function returns \false, a catastrophic initialization error occured and (at
+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.
+
+\wxheading{Include files}
+
+<wx/init.h>
+
+
 \membersection{::wxGetApp}\label{wxgetapp}
 
 \func{wxAppDerivedClass\&}{wxGetApp}{\void}
@@ -656,6 +696,23 @@ application. See \helpref{wxCloseEvent}{wxcloseevent} and \helpref{wxApp}{wxapp}
 <wx/app.h>
 
 
+\membersection{::wxJoin}\label{wxjoin}
+
+\func{wxString}{wxJoin}{\param{const wxArrayString\&}{ arr}, \param{const wxChar}{ sep}, \param{const wxChar}{ escape = '$\backslash$'}}
+
+Concatenate all lines of the given \helpref{wxArrayString}{wxarraystring} object using the separator \arg{sep} and returns
+the result as a \helpref{wxString}{wxstring}.
+
+If the \arg{escape} character is non-\NULL, then it's used as prefix for each occurrence of \arg{sep}
+in the strings contained in \arg{arr} before joining them which is necessary
+in order to be able to recover the original array contents from the string
+later using \helpref{wxSplit}{wxsplit}.
+
+\wxheading{Include files}
+
+<wx/arrstr.h>
+
+
 \membersection{::wxKill}\label{wxkill}
 
 \func{int}{wxKill}{\param{long}{ pid}, \param{int}{ sig = wxSIGTERM}, \param{wxKillError }{*rc = NULL}, \param{int }{flags = 0}}
@@ -957,7 +1014,8 @@ Returns true if the file exists and is a plain file.
 
 Returns time of last modification of given file.
 
-The return value is $0$ if an error occured (e.g. file not found).
+The function returns \texttt{(time\_t)}$-1$ if an error occurred (e.g. file not
+found).
 
 
 \membersection{::wxFileNameFromPath}\label{wxfilenamefrompath}
@@ -1027,8 +1085,8 @@ directory doesn't exist).
 
 \wxheading{Portability}
 
-This function is implemented for Win32,
-Mac OS and generic Unix provided the system has {\tt statfs()} function.
+The generic Unix implementation depends on the system having
+the \texttt{statfs()} or \texttt{statvfs()} function.
 
 This function first appeared in wxWidgets 2.3.2.
 
@@ -1076,7 +1134,7 @@ or drive name at the beginning.
 
 \func{bool}{wxDirExists}{\param{const wxString\& }{dirname}}
 
-Returns true if the path exists.
+Returns true if \arg{dirname} exists and is a directory.
 
 
 \membersection{::wxPathOnly}\label{wxpathonly}
@@ -1234,6 +1292,11 @@ Removes the directory {\it dir}, returning true if successful. Does not work und
 
 The {\it flags} parameter is reserved for future use.
 
+Please notice that there is also a wxRmDir() function which simply wraps the
+standard POSIX rmdir() function and so return an integer error code instead of
+a boolean value (but otherwise is currently identical to wxRmdir), don't
+confuse these two functions.
+
 
 \membersection{::wxSetWorkingDirectory}\label{wxsetworkingdirectory}
 
@@ -1243,6 +1306,27 @@ Sets the current working directory, returning true if the operation succeeded.
 Under MS Windows, the current drive is also changed if {\it dir} contains a drive specification.
 
 
+\membersection{::wxSplit}\label{wxsplit}
+
+\func{wxArrayString}{wxSplit}{\param{const wxString\&}{ str}, \param{const wxChar}{ sep}, \param{const wxChar}{ escape = '\\'}}
+
+Splits the given \helpref{wxString}{wxstring} object using the separator \arg{sep} and returns the
+result as a \helpref{wxArrayString}{wxarraystring}.
+
+If the \arg{escape} character is non-\NULL, then the occurrences of \arg{sep} immediately prefixed
+with \arg{escape} are not considered as separators.
+
+Note that empty tokens will be generated if there are two or more adjacent separators.
+
+\wxheading{See also}
+
+\helpref{wxJoin}{wxjoin}
+
+\wxheading{Include files}
+
+<wx/arrstr.h>
+
+
 \membersection{::wxSplitPath}\label{wxsplitfunction}
 
 \func{void}{wxSplitPath}{\param{const char *}{ fullname}, \param{wxString *}{ path}, \param{wxString *}{ name}, \param{wxString *}{ ext}}
@@ -1536,11 +1620,11 @@ This function is deprecated, use \helpref{wxString}{wxstring} class instead.
 
 \membersection{::wxGetTranslation}\label{wxgettranslation}
 
-\func{const wxChar *}{wxGetTranslation}{\param{const wxChar* }{str},
-  \param{const wxChar* }{domain = NULL}}
+\func{const wxString\& }{wxGetTranslation}{\param{const wxString\& }{str},
+  \param{const wxString\&  }{domain = wxEmptyString}}
 
-\func{const wxChar *}{wxGetTranslation}{\param{const wxChar* }{str}, \param{const wxChar* }{strPlural}, \param{size\_t }{n},
-  \param{const wxChar* }{domain = NULL}}
+\func{const wxString\& }{wxGetTranslation}{\param{const wxString\& }{str}, \param{const wxString\& }{strPlural}, \param{size\_t }{n},
+  \param{const wxString\&  }{domain = wxEmptyString}}
 
 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
@@ -1760,7 +1844,7 @@ even when \texttt{wxUSE\_PRINTF\_POS\_PARAMS} is 1.
 
 \membersection{\_}\label{underscore}
 
-\func{const wxChar *}{\_}{\param{const char *}{s}}
+\func{const wxString\&}{\_}{\param{const wxString\&}{s}}
 
 This macro expands into a call to \helpref{wxGetTranslation}{wxgettranslation}
 function, so it marks the message for the extraction by {\tt xgettext} just as
@@ -1772,7 +1856,7 @@ Don't confuse this macro with \helpref{\_T()}{underscoret}!
 
 \membersection{wxPLURAL}\label{wxplural}
 
-\func{const wxChar *}{wxPLURAL}{\param{const char *}{sing}, \param{const char *}{plur}, \param{size\_t}{n}}
+\func{const wxString\&}{wxPLURAL}{\param{const wxString\&}{sing}, \param{const wxString\&}{plur}, \param{size\_t}{n}}
 
 This macro is identical to \helpref{\_()}{underscore} but for the plural variant
 of \helpref{wxGetTranslation}{wxgettranslation}.
@@ -1802,6 +1886,39 @@ parameter, or (in MS Windows or Motif) the wrong window frame may be brought to
 the front when the dialog box is popped up.
 
 
+\membersection{::wxAboutBox}\label{wxaboutbox}
+
+\func{void}{wxAboutBox}{\param{const wxAboutDialogInfo\& }{info}}
+
+This function shows the standard about dialog containing the information
+specified in \arg{info}. If the current platform has a native about dialog
+which is capable of showing all the fields in \arg{info}, the native dialog is
+used, otherwise the function falls back to the generic wxWidgets version of the
+dialog, i.e. does the same thing as \helpref{wxGenericAboutBox()}{wxgenericaboutbox}.
+
+Here is an example of how this function may be used:
+\begin{verbatim}
+void MyFrame::ShowSimpleAboutDialog(wxCommandEvent& WXUNUSED(event))
+{
+    wxAboutDialogInfo info;
+    info.SetName(_("My Program"));
+    info.SetVersion(_("1.2.3 Beta"));
+    info.SetDescription(_("This program does something great."));
+    info.SetCopyright(_T("(C) 2007 Me <my@email.addre.ss>"));
+
+    wxAboutBox(info);
+}
+\end{verbatim}
+
+Please see the \helpref{dialogs sample}{sampledialogs} for more examples of
+using this function and \helpref{wxAboutDialogInfo}{wxaboutdialoginfo} for the
+description of the information which can be shown in the about dialog.
+
+\wxheading{Include files}
+
+<wx/aboutdlg.h>
+
+
 \membersection{::wxBeginBusyCursor}\label{wxbeginbusycursor}
 
 \func{void}{wxBeginBusyCursor}{\param{wxCursor *}{cursor = wxHOURGLASS\_CURSOR}}
@@ -1939,12 +2056,35 @@ See also \helpref{wxIsBusy}{wxisbusy}, \helpref{wxBusyCursor}{wxbusycursor}.
 <wx/utils.h>
 
 
+\membersection{::wxGenericAboutBox}\label{wxgenericaboutbox}
+
+\func{void}{wxGenericAboutBox}{\param{const wxAboutDialogInfo\& }{info}}
+
+This function does the same thing as \helpref{wxAboutBox}{wxaboutbox} except
+that it always uses the generic wxWidgets version of the dialog instead of the
+native one. This is mainly useful if you need to customize the dialog by e.g.
+adding custom controls to it (customizing the native dialog is not currently
+supported).
+
+See the \helpref{dialogs sample}{sampledialogs} for an example of about dialog
+customization.
+
+\wxheading{See also}
+
+\helpref{wxAboutDialogInfo}{wxaboutdialoginfo}
+
+\wxheading{Include files}
+
+<wx/aboutdlg.h>\\
+<wx/generic/aboutdlgg.h>
+
+
 \membersection{::wxGetColourFromUser}\label{wxgetcolourfromuser}
 
 \func{wxColour}{wxGetColourFromUser}{\param{wxWindow *}{parent}, \param{const wxColour\& }{colInit}, \param{const wxString\& }{caption = wxEmptyString}}
 
 Shows the colour selection dialog and returns the colour selected by user or
-invalid colour (use \helpref{wxColour::Ok}{wxcolourok} to test whether a colour
+invalid colour (use \helpref{wxColour:IsOk}{wxcolourisok} to test whether a colour
 is valid) if the dialog was cancelled.
 
 \wxheading{Parameters}
@@ -1965,7 +2105,7 @@ is valid) if the dialog was cancelled.
 \func{wxFont}{wxGetFontFromUser}{\param{wxWindow *}{parent}, \param{const wxFont\& }{fontInit}, \param{const wxString\& }{caption = wxEmptyString}}
 
 Shows the font selection dialog and returns the font selected by user or
-invalid font (use \helpref{wxFont::Ok}{wxfontok} to test whether a font
+invalid font (use \helpref{wxFont:IsOk}{wxfontisok} to test whether a font
 is valid) if the dialog was cancelled.
 
 \wxheading{Parameters}
@@ -2087,33 +2227,6 @@ is centred; if false, the message is left-justified.
 <wx/textdlg.h>
 
 
-\membersection{::wxGetMultipleChoice}\label{wxgetmultiplechoice}
-
-\func{int}{wxGetMultipleChoice}{\param{const wxString\& }{message}, \param{const wxString\& }{caption}, \param{int}{ n}, \param{const wxString\& }{choices[]},\\
- \param{int }{nsel}, \param{int *}{selection},
- \param{wxWindow *}{parent = NULL}, \param{int}{ x = -1}, \param{int}{ y = -1},\\
- \param{bool}{ centre = true}, \param{int }{width=150}, \param{int }{height=200}}
-
-Pops up a dialog box containing a message, OK/Cancel buttons and a multiple-selection
-listbox. The user may choose one or more item(s) and press OK or Cancel.
-
-The number of initially selected choices, and array of the selected indices,
-are passed in; this array will contain the user selections on exit, with
-the function returning the number of selections. {\it selection} must be
-as big as the number of choices, in case all are selected.
-
-If Cancel is pressed, -1 is returned.
-
-{\it choices} is an array of {\it n} strings for the listbox.
-
-If {\it centre} is true, the message text (which may include new line characters)
-is centred; if false, the message is left-justified.
-
-\wxheading{Include files}
-
-<wx/choicdlg.h>
-
-
 \membersection{::wxGetSingleChoice}\label{wxgetsinglechoice}
 
 \func{wxString}{wxGetSingleChoice}{\param{const wxString\& }{message},\\
@@ -2751,6 +2864,7 @@ 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.
 
 
+
 \membersection{::wxGetKeyState}\label{wxgetkeystate}
 
 \func{bool}{wxGetKeyState}{\param{wxKeyCode }{key}}
@@ -2817,6 +2931,12 @@ printed. Example of using it:
 
 \func{long}{wxNewId}{\void}
 
+This function is deprecated as the ids generated by it can conflict with the
+ids defined by the user code, use \texttt{wxID\_ANY} to assign ids which are
+guaranteed to not conflict with the user-defined ids for the controls and menu
+items you create instead of using this function.
+
+
 Generates an integer identifier unique to this run of the program.
 
 \wxheading{Include files}
@@ -2993,7 +3113,7 @@ always returns \NULL in the other ports).
 
 \wxheading{Include files}
 
-<wx/windows.h>
+<wx/window.h>
 
 
 \membersection{::wxGetBatteryState}\label{wxgetbatterystate}
@@ -3175,6 +3295,10 @@ Open the \arg{url} in user's default browser. If \arg{flags} parameter contains
 
 Returns \true if the application was successfully launched.
 
+Note that for some configurations of the running user, the application which
+is launched to open the given URL may be URL-dependent (e.g. a browser may be used for
+local URLs while another one may be used for remote URLs).
+
 \wxheading{Include files}
 
 <wx/utils.h>
@@ -3271,6 +3395,31 @@ Notice that in most cases
 <wx/utils.h>
 
 
+\membersection{wxSTRINGIZE}\label{wxstringize}
+
+\func{}{wxSTRINGIZE}{\param{}{x}}
+
+Returns the string representation of the given symbol which can be either a
+literal or a macro (hence the advantage of using this macro instead of the
+standard preprocessor \texttt{\#} operator which doesn't work with macros).
+
+Notice that this macro always produces a \texttt{char} string, use 
+\helpref{wxSTRINGIZE\_T}{wxstringizet} to build a wide string Unicode build.
+
+\wxheading{See also}
+
+\helpref{wxCONCAT}{wxconcat}
+
+
+\membersection{wxSTRINGIZE\_T}\label{wxstringizet}
+
+\func{}{wxSTRINGIZE\_T}{\param{}{x}}
+
+Returns the string representation of the given symbol as either an ASCII or
+Unicode string, depending on the current build. This is the Unicode-friendly
+equivalent of \helpref{wxSTRINGIZE}{wxstringize}.
+
+
 \membersection{wxSUPPRESS\_GCC\_PRIVATE\_DTOR\_WARNING}\label{wxsuppressgccprivatedtorwarning}
 
 \func{}{wxSUPPRESS\_GCC\_PRIVATE\_DTOR\_WARNING}{\param{}{name}}