X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/42d0df0030abbac4ca11a78b2f529133e3c9d986..4d76ea948a703e19008366bf79411dc9bd58b0c1:/docs/latex/wx/function.tex diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex index a6da0b19e4..e145da2886 100644 --- a/docs/latex/wx/function.tex +++ b/docs/latex/wx/function.tex @@ -1,3 +1,14 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: function.tex +%% Purpose: Functions and macros +%% Author: wxWidgets Team +%% Modified by: +%% Created: +%% RCS-ID: $Id$ +%% Copyright: (c) wxWidgets Team +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \chapter{Functions}\label{functions} \setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% \setfooter{\thepage}{}{}{}{}{\thepage} @@ -9,7 +20,6 @@ the corresponding topic. \section{Alphabetical functions and macros list}\label{functionsalphabetically} \helpref{CLASSINFO}{classinfo}\\ -\helpref{copystring}{copystring}\\ \helpref{DECLARE\_ABSTRACT\_CLASS}{declareabstractclass}\\ \helpref{DECLARE\_APP}{declareapp}\\ \helpref{DECLARE\_CLASS}{declareclass}\\ @@ -21,16 +31,17 @@ the corresponding topic. \helpref{IMPLEMENT\_CLASS}{implementclass}\\ \helpref{IMPLEMENT\_DYNAMIC\_CLASS2}{implementdynamicclass2}\\ \helpref{IMPLEMENT\_DYNAMIC\_CLASS}{implementdynamicclass}\\ -\helpref{wxCONCAT}{wxconcat}\\ -\helpref{WXDEBUG\_NEW}{debugnew}\\ -\helpref{WXTRACELEVEL}{tracelevel}\\ -\helpref{WXTRACE}{trace}\\ +\helpref{wxAboutBox}{wxaboutbox}\\ +\helpref{wxASSERT}{wxassert}\\ \helpref{wxASSERT\_MIN\_BITSIZE}{wxassertminbitsize}\\ \helpref{wxASSERT\_MSG}{wxassertmsg}\\ -\helpref{wxASSERT}{wxassert}\\ -\helpref{wxBITMAP}{wxbitmapmacro}\\ +\helpref{wxAtomicDec}{wxatomicdec}\\ +\helpref{wxAtomicInc}{wxatomicinc}\\ +\helpref{wxBase64Decode}{wxbase64decode}\\ +\helpref{wxBase64Encode}{wxbase64encode}\\ \helpref{wxBeginBusyCursor}{wxbeginbusycursor}\\ \helpref{wxBell}{wxbell}\\ +\helpref{wxBITMAP}{wxbitmapmacro}\\ \helpref{wxCHANGE\_UMASK}{wxchangeumask}\\ \helpref{wxCHECK}{wxcheck}\\ \helpref{wxCHECK2\_MSG}{wxcheck2msg}\\ @@ -38,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}\\ @@ -47,6 +59,7 @@ the corresponding topic. \helpref{wxColourDisplay}{wxcolourdisplay}\\ \helpref{wxCOMPILE\_TIME\_ASSERT}{wxcompiletimeassert}\\ \helpref{wxCOMPILE\_TIME\_ASSERT2}{wxcompiletimeassert2}\\ +\helpref{wxCONCAT}{wxconcat}\\ \helpref{wxConcatFiles}{wxconcatfiles}\\ \helpref{wxConstCast}{wxconstcast}\\ \helpref{wxCopyFile}{wxcopyfile}\\ @@ -60,6 +73,10 @@ the corresponding topic. \helpref{wxDDEInitialize}{wxddeinitialize}\\ \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}\\ \helpref{wxDisplaySize}{wxdisplaysize}\\ @@ -73,6 +90,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}\\ @@ -93,6 +112,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}\\ @@ -104,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}\\ @@ -117,8 +136,8 @@ the corresponding topic. \helpref{wxGetLocalTimeMillis}{wxgetlocaltimemillis}\\ \helpref{wxGetLocalTime}{wxgetlocaltime}\\ \helpref{wxGetMousePosition}{wxgetmouseposition}\\ +\helpref{wxGetMouseState}{wxgetmousestate}\\ \helpref{wxGetMultipleChoices}{wxgetmultiplechoices}\\ -\helpref{wxGetMultipleChoice}{wxgetmultiplechoice}\\ \helpref{wxGetNumberFromUser}{wxgetnumberfromuser}\\ \helpref{wxGetOSDirectory}{wxgetosdirectory}\\ \helpref{wxGetOsDescription}{wxgetosdescription}\\ @@ -134,7 +153,6 @@ the corresponding topic. \helpref{wxGetPrinterScaling}{wxgetprinterscaling}\\ \helpref{wxGetPrinterTranslation}{wxgetprintertranslation}\\ \helpref{wxGetProcessId}{wxgetprocessid}\\ -\helpref{wxGetResource}{wxgetresource}\\ \helpref{wxGetSingleChoiceData}{wxgetsinglechoicedata}\\ \helpref{wxGetSingleChoiceIndex}{wxgetsinglechoiceindex}\\ \helpref{wxGetSingleChoice}{wxgetsinglechoice}\\ @@ -162,7 +180,10 @@ the corresponding topic. \helpref{wxIsEmpty}{wxisempty}\\ \helpref{wxIsMainThread}{wxismainthread}\\ \helpref{wxIsNaN}{wxisnan}\\ +\helpref{wxIsPlatformLittleEndian}{wxisplatformlittleendian}\\ +\helpref{wxIsPlatform64Bit}{wxisplatform64bit}\\ \helpref{wxIsWild}{wxiswild}\\ +\helpref{wxJoin}{wxjoin}\\ \helpref{wxKill}{wxkill}\\ \helpref{wxLaunchDefaultBrowser}{wxlaunchdefaultbrowser}\\ \helpref{wxLEAVE\_CRIT\_SECT}{wxleavecritsect}\\ @@ -193,8 +214,8 @@ the corresponding topic. \helpref{wxON\_BLOCK\_EXIT\_OBJ}{wxonblockexitobj}\\ \helpref{wxOpenClipboard}{wxopenclipboard}\\ \helpref{wxParseCommonDialogsFilter}{wxparsecommondialogsfilter}\\ -\helpref{wxDirExists}{functionwxdirexists}\\ \helpref{wxPathOnly}{wxpathonly}\\ +\helpref{wxPLURAL}{wxplural}\\ \helpref{wxPostDelete}{wxpostdelete}\\ \helpref{wxPostEvent}{wxpostevent}\\ \helpref{wxRegisterClipboardFormat}{wxregisterclipboardformat}\\ @@ -222,20 +243,26 @@ the corresponding topic. \helpref{wxShutdown}{wxshutdown}\\ \helpref{wxSleep}{wxsleep}\\ \helpref{wxSnprintf}{wxsnprintf}\\ +\helpref{wxSplit}{wxsplit}\\ \helpref{wxSplitPath}{wxsplitfunction}\\ -\helpref{wxStartTimer}{wxstarttimer}\\ \helpref{wxStaticCast}{wxstaticcast}\\ \helpref{wxStrcmp}{wxstrcmp}\\ \helpref{wxStricmp}{wxstricmp}\\ \helpref{wxStringEq}{wxstringeq}\\ \helpref{wxStringMatch}{wxstringmatch}\\ +\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}\\ \helpref{wxT}{wxt}\\ -\helpref{wxTraceLevel}{wxtracelevel}\\ \helpref{wxTrace}{wxtrace}\\ +\helpref{WXTRACE}{trace}\\ +\helpref{wxTraceLevel}{wxtracelevel}\\ +\helpref{WXTRACELEVEL}{tracelevel}\\ \helpref{wxTransferFileToStream}{wxtransferfiletostream}\\ \helpref{wxTransferStreamToFile}{wxtransferstreamtofile}\\ \helpref{wxTrap}{wxtrap}\\ @@ -247,15 +274,14 @@ the corresponding topic. \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{wx\_truncate\_cast}{wxtruncatecast}\\ \helpref{\_}{underscore}\\ -\helpref{wxPLURAL}{wxplural}\\ \helpref{\_T}{underscoret} +\helpref{\_\_WXFUNCTION\_\_}{wxfunction} @@ -289,13 +315,22 @@ 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$. +\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}} @@ -329,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 @@ -345,26 +380,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: -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{int}{wxEntry}{\param{int\&}{ argc}, \param{wxChar **}{argv}} -\func{void}{wxEntry}{\param{HANDLE}{ hInstance}, \param{HANDLE}{ hPrevInstance}, - \param{WORD}{ wDataSegment}, \param{WORD}{ wHeapSize}, \param{const wxString\& }{ commandLine}} +Under MS Windows, an additional overload suitable for calling from +\texttt{WinMain} is available: -wxWidgets initialization under Windows (for applications constructed as a DLL). +\func{int}{wxEntry}{\param{HINSTANCE }{hInstance}, \param{HINSTANCE }{hPrevInstance = \NULL}, \param{char *}{pCmdLine = \NULL}, \param{int }{nCmdShow = \texttt{SW\_SHOWNORMAL}}} -\func{int}{wxEntry}{\param{int}{ argc}, \param{const wxString\& *}{argv}} +(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{See also} -wxWidgets initialization under Unix. +\helpref{wxEntryStart}{wxentrystart} \wxheading{Remarks} @@ -388,6 +424,47 @@ 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} + + + + +\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. + +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} + + + + \membersection{::wxGetApp}\label{wxgetapp} \func{wxAppDerivedClass\&}{wxGetApp}{\void} @@ -509,7 +586,7 @@ the corresponding functions \helpref{::wxPostEvent}{wxpostevent} and \wxheading{Include files} - + @@ -589,9 +666,16 @@ happening, i.e. with this flag the child process window will be shown normally. Under Unix the flag {\tt wxEXEC\_MAKE\_GROUP\_LEADER} may be used to ensure that the new process is a group leader (this will create a new session if needed). Calling \helpref{wxKill}{wxkill} passing wxKILL\_CHILDREN will -will kill this process as well as all of its children (except those which have +kill this process as well as all of its children (except those which have started their own session). +The {\tt wxEXEC\_NOEVENTS} flag prevents processing of any events from taking +place while the child process is running. It should be only used for very +short-lived processes as otherwise the application windows risk becoming +unresponsive from the users point of view. As this flag only makes sense with +{\tt wxEXEC\_SYNC}, {\tt wxEXEC\_BLOCK} equal to the sum of both of these flags +is provided as a convenience. + Finally, you may use the third overloaded version of this function to execute a process (always synchronously, the contents of \arg{flags} is or'd with \texttt{wxEXEC\_SYNC}) and capture its output in the array \arg{output}. The @@ -639,6 +723,23 @@ application. See \helpref{wxCloseEvent}{wxcloseevent} and \helpref{wxApp}{wxapp} +\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} + + + + \membersection{::wxKill}\label{wxkill} \func{int}{wxKill}{\param{long}{ pid}, \param{int}{ sig = wxSIGTERM}, \param{wxKillError }{*rc = NULL}, \param{int }{flags = 0}} @@ -736,7 +837,7 @@ See also \helpref{wxExecute}{wxexecute}, \helpref{Exec sample}{sampleexec}. This function shuts down or reboots the computer depending on the value of the {\it flags}. Please notice that doing this requires the corresponding access -rights (superuser under Unix, {\tt SE\_SHUTDOWN} privelege under Windows NT) +rights (superuser under Unix, {\tt SE\_SHUTDOWN} privilege under Windows NT) and that this function is only implemented under Unix and Win32. \wxheading{Parameters} @@ -940,7 +1041,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} @@ -958,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 @@ -1010,8 +1112,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. @@ -1059,7 +1161,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} @@ -1105,10 +1207,12 @@ true if successful. \func{bool}{wxCopyFile}{\param{const wxString\& }{file1}, \param{const wxString\& }{file2}, \param{bool }{overwrite = true}} Copies {\it file1} to {\it file2}, returning true if successful. If -{\it overwrite} parameter is true (default), the destination file is overwritten -if it exists, but if {\it overwrite} is false, the functions fails in this +{\it overwrite} parameter is \true (default), the destination file is overwritten +if it exists, but if {\it overwrite} is \false, the functions fails in this case. +This function supports resources forks under Mac OS. + \membersection{::wxGetCwd}\label{wxgetcwd} @@ -1121,7 +1225,7 @@ Returns a string containing the current (or working) directory. \func{wxString}{wxGetWorkingDirectory}{\param{char *}{buf=NULL}, \param{int }{sz=1000}} -{\bf NB:} This function is obsolete: use \helpref{wxGetCwd}{wxgetcwd} instead. +{\bf NB:} This function is deprecated: use \helpref{wxGetCwd}{wxgetcwd} instead. Copies the current working directory into the buffer if supplied, or copies the working directory into new storage (which you {\emph must} delete @@ -1174,7 +1278,7 @@ with wildcard characters. See \helpref{wxIsWild}{wxiswild}. 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. +supported (Unix) and doesn't have any effect on the other ones. \membersection{::wxParseCommonDialogsFilter}\label{wxparsecommondialogsfilter} @@ -1200,10 +1304,14 @@ Removes \arg{file}, returning true if successful. \membersection{::wxRenameFile}\label{wxrenamefile} -\func{bool}{wxRenameFile}{\param{const wxString\& }{file1}, \param{const wxString\& }{file2}} +\func{bool}{wxRenameFile}{\param{const wxString\& }{file1}, \param{const wxString\& }{file2}, \param{bool }{overwrite = true}} Renames \arg{file1} to \arg{file2}, returning true if successful. +If \arg{overwrite} parameter is true (default), the destination file is +overwritten if it exists, but if \arg{overwrite} is false, the functions fails +in this case. + \membersection{::wxRmdir}\label{wxrmdir} @@ -1213,6 +1321,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} @@ -1222,9 +1335,30 @@ 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} + + + + \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. @@ -1385,32 +1519,49 @@ user-readable form. For example, this function may return strings like \membersection{::wxGetOsVersion}\label{wxgetosversion} -\func{int}{wxGetOsVersion}{\param{int *}{major = NULL}, \param{int *}{minor = NULL}} +\func{wxOperatingSystemId}{wxGetOsVersion}{\param{int *}{major = NULL}, \param{int *}{minor = NULL}} -Gets operating system version information. +Gets the version and the operating system ID for currently running OS. +See \helpref{wxPlatformInfo}{wxplatforminfo} for more details about wxOperatingSystemId. + +\wxheading{See also} + +\helpref{::wxGetOsDescription}{wxgetosdescription}, +\helpref{wxPlatformInfo}{wxplatforminfo} + +\wxheading{Include files} + + -\begin{twocollist}\itemsep=0pt -\twocolitemruled{Platform}{Return types} -\twocolitem{Mac OS}{Return value is wxMAC when compiled with CodeWarrior under Mac OS 8.x/9.x and Mac OS X, wxMAC\_DARWIN when compiled with the Apple Developer Tools under Mac OS X. - -Both {\it major} and {\it minor} have to be looked at as hexadecimal numbers. So System 10.2.4 returns 0x10, resp 16 for {\it major} and 0x24, resp 36 for {\it minor}. } -\twocolitem{GTK}{Return value is wxGTK, For GTK 1.0, {\it major} is 1, {\it minor} is 0. } -\twocolitem{Motif}{Return value is wxMOTIF\_X, {\it major} is X version, {\it minor} is X revision.} -\twocolitem{OS/2}{Return value is wxOS2\_PM.} -\twocolitem{Windows 3.1}{Return value is wxWINDOWS, {\it major} is 3, {\it minor} is 1.} -\twocolitem{Windows NT/2000}{Return value is wxWINDOWS\_NT, version is returned in {\it major} and {\it minor}.} -\twocolitem{Windows 98}{Return value is wxWIN95, {\it major} is 4, {\it minor} is 1 or greater.} -\twocolitem{Windows 95}{Return value is wxWIN95, {\it major} is 4, {\it minor} is 0.} -\twocolitem{Win32s (Windows 3.1)}{Return value is wxWIN32S, {\it major} is 3, {\it minor} is 1.} -\twocolitem{Windows PocketPC}{Return value is wxWINDOWS\_POCKETPC, version is returned in {\it major} and {\it minor}.} -\twocolitem{Windows Smartphone}{Return value is wxWINDOWS\_SMARTPHONE, version is returned in {\it major} and {\it minor}.} -\twocolitem{Windows CE (non-specific)}{Return value is wxWINDOWS\_CE, version is returned in {\it major} and {\it minor}.} -\twocolitem{Watcom C++ 386 supervisor mode (Windows 3.1)}{Return value is wxWIN386, {\it major} is 3, {\it minor} is 1.} -\end{twocollist} + +\membersection{::wxIsPlatformLittleEndian}\label{wxisplatformlittleendian} + +\func{bool}{wxIsPlatformLittleEndian}{\void} + +Returns \true if the current platform is little endian (instead of big endian). +The check is performed at run-time. \wxheading{See also} -\helpref{::wxGetOsDescription}{wxgetosdescription} +\helpref{Byte order macros}{byteordermacros} + +\wxheading{Include files} + + + + +\membersection{::wxIsPlatform64Bit}\label{wxisplatform64bit} + +\func{bool}{wxIsPlatform64Bit}{\void} + +Returns \true if the operating system the program is running under is 64 bit. +The check is performed at run-time and may differ from the value available at +compile-time (at compile-time you can just check if {\tt sizeof(void*)==8}) +since the program could be running in emulation mode or in a mixed 32/64 bit system +(bi-architecture operating system). + +Very important: this function is not 100\% reliable on some systems given the fact +that there isn't always a standard way to do a reliable check on the OS architecture. \wxheading{Include files} @@ -1485,52 +1636,45 @@ if successful, \false otherwise. \section{String functions}\label{stringfunctions} - -\membersection{::copystring}\label{copystring} - -\func{char *}{copystring}{\param{const char *}{s}} - -Makes a copy of the string {\it s} using the C++ new operator, so it can be -deleted with the {\it delete} operator. - -This function is deprecated, use \helpref{wxString}{wxstring} class instead. - - \membersection{::wxGetTranslation}\label{wxgettranslation} -\func{const char *}{wxGetTranslation}{\param{const char * }{str}} +\func{const wxString\& }{wxGetTranslation}{\param{const wxString\& }{str}, + \param{const wxString\& }{domain = wxEmptyString}} -\func{const char *}{wxGetTranslation}{\param{const char * }{str}, \param{const char * }{strPlural}, \param{size\_t }{n}} +\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 message catalogs (see \helpref{internationalization 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 +should help to find the strings which were not yet translated. If +{\it domain} is specified then only that domain/catalog is searched +for a matching string. As this function is used very often, an alternative (and also common in Unix world) syntax is provided: the \helpref{\_()}{underscore} macro is defined to do the same thing as wxGetTranslation. The second form is used when retrieving translation of string that has different singular and plural form in English or different plural forms in some -other language. It takes two extra arguments: as above, \arg{str} +other language. It takes two extra arguments: as above, \arg{str} parameter must contain the singular form of the string to be converted and is 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', otherwise \arg{strPlural}. -See \urlref{GNU gettext manual}{http://www.gnu.org/manual/gettext/html\_chapter/gettext\_10.html\#SEC150} +See \urlref{GNU gettext manual}{http://www.gnu.org/manual/gettext/html\_chapter/gettext\_10.html\#SEC150} for additional information on plural forms handling. For a shorter alternative see the \helpref{wxPLURAL()}{wxplural} macro. Both versions call \helpref{wxLocale::GetString}{wxlocalegetstring}. Note that this function is not suitable for literal strings in Unicode -builds, since the literal strings must be enclosed into +builds, since the literal strings must be enclosed into \helpref{\_T()}{underscoret} or \helpref{wxT}{wxt} macro which makes them unrecognised by \texttt{xgettext}, and so they are not extracted to the message -catalog. Instead, use the \helpref{\_()}{underscore} and +catalog. Instead, use the \helpref{\_()}{underscore} and \helpref{wxPLURAL}{wxplural} macro for all literal strings. @@ -1564,6 +1708,19 @@ This function complements the standard C function {\it strcmp()} which performs case-sensitive comparison. +\membersection{::wxStringEq}\label{wxstringeq} + +\func{bool}{wxStringEq}{\param{const wxString\& }{s1}, \param{const wxString\& }{s2}} + +{\bf NB:} This function is obsolete, use \helpref{wxString}{wxstring} instead. + +A macro defined as: + +\begin{verbatim} +#define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) == 0)) +\end{verbatim} + + \membersection{::wxStringMatch}\label{wxstringmatch} \func{bool}{wxStringMatch}{\param{const wxString\& }{s1}, \param{const wxString\& }{s2},\\ @@ -1576,17 +1733,19 @@ ignoring case if {\it exact} is false. If {\it subString} is \false, no substring matching is done. -\membersection{::wxStringEq}\label{wxstringeq} +\membersection{::wxStringTokenize}\label{wxstringtokenize} -\func{bool}{wxStringEq}{\param{const wxString\& }{s1}, \param{const wxString\& }{s2}} +\func{wxArrayString}{wxStringTokenize}{\param{const wxString\& }{str},\\ + \param{const wxString\& }{delims = wxDEFAULT\_DELIMITERS},\\ + \param{wxStringTokenizerMode }{mode = wxTOKEN\_DEFAULT}} -{\bf NB:} This function is obsolete, use \helpref{wxString}{wxstring} instead. +This is a convenience function wrapping +\helpref{wxStringTokenizer}{wxstringtokenizer} which simply returns all tokens +found in the given \arg{str} in an array. -A macro defined as: - -\begin{verbatim} -#define wxStringEq(s1, s2) (s1 && s2 && (strcmp(s1, s2) == 0)) -\end{verbatim} +Please see +\helpref{wxStringTokenizer::wxStringTokenizer}{wxstringtokenizerwxstringtokenizer} +for the description of the other parameters. \membersection{::wxStrlen}\label{wxstrlen} @@ -1689,6 +1848,12 @@ wxGetTranslation wouldn't find them. The same as \helpref{wxSnprintf}{wxsnprintf} but takes a {\tt va\_list } argument instead of arbitrary number of parameters. +Note that if \texttt{wxUSE\_PRINTF\_POS\_PARAMS} is set to 1, then this function supports +positional arguments (see \helpref{wxString::Printf}{wxstringprintf} for more information). +However other functions of the same family (wxPrintf, wxSprintf, wxFprintf, wxVfprintf, +wxVfprintf, wxVprintf, wxVsprintf) currently do not to support positional parameters +even when \texttt{wxUSE\_PRINTF\_POS\_PARAMS} is 1. + \wxheading{See also} \helpref{wxSnprintf}{wxsnprintf}, \helpref{wxString::PrintfV}{wxstringprintfv} @@ -1697,7 +1862,7 @@ argument instead of arbitrary number of parameters. \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 @@ -1709,7 +1874,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}. @@ -1739,6 +1904,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 ")); + + 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} + + + + \membersection{::wxBeginBusyCursor}\label{wxbeginbusycursor} \func{void}{wxBeginBusyCursor}{\param{wxCursor *}{cursor = wxHOURGLASS\_CURSOR}} @@ -1827,8 +2025,10 @@ The path and filename are distinct elements of a full file pathname. 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, -wxSAVE, wxOVERWRITE\_PROMPT, wxFILE\_MUST\_EXIST, wxMULTIPLE or 0. +extension for the required filename. Flags may be a combination of wxFD\_OPEN, +wxFD\_SAVE, wxFD\_OVERWRITE\_PROMPT or wxFD\_FILE\_MUST\_EXIST. Note that wxFD\_MULTIPLE +can only be used with \helpref{wxFileDialog}{wxfiledialog} and not here as this +function only returns a single file name. Both the Unix and Windows versions implement a wildcard filter. Typing a filename containing wildcards (*, ?) in the filename text item, and @@ -1874,12 +2074,35 @@ See also \helpref{wxIsBusy}{wxisbusy}, \helpref{wxBusyCursor}{wxbusycursor}. +\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} + +\\ + + + \membersection{::wxGetColourFromUser}\label{wxgetcolourfromuser} -\func{wxColour}{wxGetColourFromUser}{\param{wxWindow *}{parent}, \param{const wxColour\& }{colInit}} +\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} @@ -1888,6 +2111,8 @@ is valid) if the dialog was cancelled. \docparam{colInit}{If given, this will be the colour initially selected in the dialog.} +\docparam{caption}{If given, this will be used for the dialog caption.} + \wxheading{Include files} @@ -1895,10 +2120,10 @@ is valid) if the dialog was cancelled. \membersection{::wxGetFontFromUser}\label{wxgetfontfromuser} -\func{wxFont}{wxGetFontFromUser}{\param{wxWindow *}{parent}, \param{const wxFont\& }{fontInit}} +\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} @@ -1907,6 +2132,8 @@ is valid) if the dialog was cancelled. \docparam{fontInit}{If given, this will be the font initially selected in the dialog.} +\docparam{caption}{If given, this will be used for the dialog caption.} + \wxheading{Include files} @@ -2018,33 +2245,6 @@ is centred; if false, the message is left-justified. -\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} - - - - \membersection{::wxGetSingleChoice}\label{wxgetsinglechoice} \func{wxString}{wxGetSingleChoice}{\param{const wxString\& }{message},\\ @@ -2166,7 +2366,7 @@ following identifiers: \begin{twocollist}\itemsep=0pt \twocolitem{wxYES\_NO}{Puts Yes and No buttons on the message box. May be combined with wxCANCEL.} -\twocolitem{wxCANCEL}{Puts a Cancel button on the message box. May be combined with +\twocolitem{wxCANCEL}{Puts a Cancel button on the message box. May only be combined with wxYES\_NO or wxOK.} \twocolitem{wxOK}{Puts an Ok button on the message box. May be combined with wxCANCEL.} \twocolitem{wxICON\_EXCLAMATION}{Displays an exclamation mark symbol.} @@ -2237,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. @@ -2641,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}} @@ -2674,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 @@ -2682,6 +3017,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}} @@ -2748,6 +3084,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} @@ -2758,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} @@ -2786,10 +3130,12 @@ 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} +This family of macros is similar to \helpref{wxON\_BLOCK\_EXIT}{wxonblockexit} but calls a method of the given object instead of a free function. \wxheading{Include files} @@ -2915,15 +3261,25 @@ 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{wxColourBase* }{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} -Gets the currently active window (Windows only). +Gets the currently active window (implemented for MSW and GTK only currently, +always returns \NULL in the other ports). \wxheading{Include files} - + \membersection{::wxGetBatteryState}\label{wxgetbatterystate} @@ -2934,7 +3290,7 @@ Returns battery state as one of \texttt{wxBATTERY\_NORMAL\_STATE}, \texttt{wxBATTERY\_LOW\_STATE}, \texttt{wxBATTERY\_CRITICAL\_STATE}, \texttt{wxBATTERY\_SHUTDOWN\_STATE} or \texttt{wxBATTERY\_UNKNOWN\_STATE}. \texttt{wxBATTERY\_UNKNOWN\_STATE} is also the default on platforms where -this feature is not implemented. +this feature is not implemented (currently everywhere but MS Windows). \wxheading{Include files} @@ -2959,7 +3315,7 @@ Under X only, returns the current display name. See also \helpref{wxSetDisplayNa Returns the type of power source as one of \texttt{wxPOWER\_SOCKET}, \texttt{wxPOWER\_BATTERY} or \texttt{wxPOWER\_UNKNOWN}. \texttt{wxPOWER\_UNKNOWN} is also the default on platforms where this -feature is not implemented. +feature is not implemented (currently everywhere but MS Windows). \wxheading{Include files} @@ -2977,39 +3333,54 @@ Returns the mouse position in screen coordinates. -\membersection{::wxGetResource}\label{wxgetresource} +\membersection{::wxGetMouseState}\label{wxgetmousestate} -\func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry}, - \param{const wxString\& *}{value}, \param{const wxString\& }{file = NULL}} +\func{wxMouseState}{wxGetMouseState}{\void} -\func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry}, - \param{float *}{value}, \param{const wxString\& }{file = NULL}} +Returns the current state of the mouse. Returns a wxMouseState +instance that contains the current position of the mouse pointer in +screen coordinants, as well as boolean values indicating the up/down +status of the mouse buttons and the modifier keys. -\func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry}, - \param{long *}{value}, \param{const wxString\& }{file = NULL}} +\wxheading{Include files} -\func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry}, - \param{int *}{value}, \param{const wxString\& }{file = NULL}} + -Gets a resource value from the resource database (for example, WIN.INI, or -.Xdefaults). If {\it file} is NULL, WIN.INI or .Xdefaults is used, -otherwise the specified file is used. +wxMouseState has the following interface: -Under X, if an application class (wxApp::GetClassName) has been defined, -it is appended to the string /usr/lib/X11/app-defaults/ to try to find -an applications default file when merging all resource databases. +\begin{verbatim} +class wxMouseState +{ +public: + wxMouseState(); -The reason for passing the result in an argument is that it -can be convenient to define a default value, which gets overridden -if the value exists in the resource file. It saves a separate -test for that resource's existence, and it also allows -the overloading of the function for different types. + wxCoord GetX(); + wxCoord GetY(); -See also \helpref{wxWriteResource}{wxwriteresource}, \helpref{wxConfigBase}{wxconfigbase}. + bool LeftDown(); + bool MiddleDown(); + bool RightDown(); -\wxheading{Include files} + bool ControlDown(); + bool ShiftDown(); + bool AltDown(); + bool MetaDown(); + bool CmdDown(); + + void SetX(wxCoord x); + void SetY(wxCoord y); + + void SetLeftDown(bool down); + void SetMiddleDown(bool down); + void SetRightDown(bool down); + + void SetControlDown(bool down); + void SetShiftDown(bool down); + void SetAltDown(bool down); + void SetMetaDown(bool down); +}; +\end{verbatim} - \membersection{::wxGetStockLabel}\label{wxgetstocklabel} @@ -3050,12 +3421,19 @@ frame or dialog containing it, or {\tt NULL}. \func{bool}{wxLaunchDefaultBrowser}{\param{const wxString\& }{url}, \param{int }{flags = $0$}} -Open the \arg{url} in user's default browser. If \arg{flags} parameter contains +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. +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} @@ -3132,24 +3510,89 @@ See also \helpref{wxGetDisplayName}{wxgetdisplayname}. \membersection{::wxStripMenuCodes}\label{wxstripmenucodes} -\func{wxString}{wxStripMenuCodes}{\param{const wxString\& }{in}} +\func{wxString}{wxStripMenuCodes}{\param{const wxString\& }{str}, \param{int }{flags = wxStrip\_All}} -\func{void}{wxStripMenuCodes}{\param{char *}{in}, \param{char *}{out}} +Strips any menu codes from \arg{str} and returns the result. -{\bf NB:} This function is obsolete, please use -\helpref{wxMenuItem::GetLabelFromText}{wxmenuitemgetlabelfromtext} instead. - -Strips any menu codes from {\it in} and places the result -in {\it out} (or returns the new string, in the first form). +By default, the functions strips both the mnemonics character (\texttt{'\&'}) +which is used to indicate a keyboard shortkey, and the accelerators, which are +used only in the menu items and are separated from the main text by the +\texttt{$\backslash$t} (TAB) character. By using \arg{flags} of +\texttt{wxStrip\_Mnemonics} or \texttt{wxStrip\_Accel} to strip only the former +or the latter part, respectively. -Menu codes include \& (mark the next character with an underline -as a keyboard shortkey in Windows and Motif) and $\backslash$t (tab in Windows). +Notice that in most cases +\helpref{wxMenuItem::GetLabelFromText}{wxmenuitemgetlabelfromtext} or +\helpref{wxControl::GetLabelText}{wxcontrolgetlabeltext} can be used instead. \wxheading{Include files} +\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}} + +GNU C++ compiler gives a warning for any class whose destructor is private +unless it has a friend. This warning may sometimes be useful but it doesn't +make sense for reference counted class which always delete themselves (hence +destructor should be private) but don't necessarily have any friends, so this +macro is provided to disable the warning in such case. The \arg{name} parameter +should be the name of the class but is only used to construct a unique friend +class name internally. Example of using the macro: + +\begin{verbatim} + class RefCounted + { + public: + RefCounted() { m_nRef = 1; } + void IncRef() { m_nRef++ ; } + void DecRef() { if ( !--m_nRef ) delete this; } + + private: + ~RefCounted() { } + + wxSUPPRESS_GCC_PRIVATE_DTOR(RefCounted) + }; +\end{verbatim} + +Notice that there should be no semicolon after this macro. + + +\membersection{wxToString}\label{wxtostring} + +\func{wxString}{wxToString}{\param{const wxColourBase\& }{col}} + +Converts its argument to string. +See also: \helpref{wxFromString}{wxfromstring}. + + \membersection{wxULL}\label{wxull} \func{wxLongLong\_t}{wxULL}{\param{}{number}} @@ -3185,36 +3628,14 @@ 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}, - \param{const wxString\& }{value}, \param{const wxString\& }{file = NULL}} -\func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry}, - \param{float }{value}, \param{const wxString\& }{file = NULL}} +\membersection{\_\_WXFUNCTION\_\_}\label{wxfunction} -\func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry}, - \param{long }{value}, \param{const wxString\& }{file = NULL}} +\func{}{\_\_WXFUNCTION\_\_}{\void} -\func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry}, - \param{int }{value}, \param{const wxString\& }{file = NULL}} - -Writes a resource value into the resource database (for example, WIN.INI, or -.Xdefaults). If {\it file} is NULL, WIN.INI or .Xdefaults is used, -otherwise the specified file is used. - -Under X, the resource databases are cached until the internal function -\rtfsp{\bf wxFlushResources} is called automatically on exit, when -all updated resource databases are written to their files. - -Note that it is considered bad manners to write to the .Xdefaults -file under Unix, although the WIN.INI file is fair game under Windows. - -See also \helpref{wxGetResource}{wxgetresource}, \helpref{wxConfigBase}{wxconfigbase}. - -\wxheading{Include files} - - +This macro expands to the name of the current function if the compiler supports +any of \texttt{\_\_FUNCTION\_\_}, \texttt{\_\_func\_\_} or equivalent variables +or macros or to \NULL if none of them is available. @@ -3376,7 +3797,7 @@ dynamically. The same as DECLARE\_ABSTRACT\_CLASS. Used inside a class declaration to make the class known to wxWidgets RTTI system and also declare that the objects of this class should be dynamically creatable from run-time type information. Notice that this implies that the -class should have a default constructor, if this is not the case consider using +class should have a default constructor, if this is not the case consider using \helpref{DECLARE\_CLASS}{declareclass}. Example: @@ -3603,7 +4024,7 @@ Example: This macro is equivalent to {\tt wxDynamicCast(this, classname)} but the latter provokes spurious compilation warnings from some compilers (because it -tests whether {\tt this} pointer is non {\tt NULL} which is always true), so +tests whether {\tt this} pointer is non-{\tt NULL} which is always true), so this macro should be used to avoid them. \wxheading{See also} @@ -4036,29 +4457,8 @@ this value. \section{Time functions}\label{timefunctions} -The functions in this section deal with getting the current time and -starting/stopping the global timers. Please note that the timer functions are -deprecated because they work with one global timer only and -\helpref{wxTimer}{wxtimer} and/or \helpref{wxStopWatch}{wxstopwatch} classes -should be used instead. For retrieving the current time, you may also use -\helpref{wxDateTime::Now}{wxdatetimenow} or -\helpref{wxDateTime::UNow}{wxdatetimeunow} methods. - - -\membersection{::wxGetElapsedTime}\label{wxgetelapsedtime} - -\func{long}{wxGetElapsedTime}{\param{bool}{ resetTimer = true}} - -Gets the time in milliseconds since the last \helpref{::wxStartTimer}{wxstarttimer}. - -If {\it resetTimer} is true (the default), the timer is reset to zero -by this call. - -See also \helpref{wxTimer}{wxtimer}. - -\wxheading{Include files} - - +The functions in this section deal with getting the current time and sleeping +for the specified time interval. \membersection{::wxGetLocalTime}\label{wxgetlocaltime} @@ -4073,7 +4473,7 @@ Returns the number of seconds since local time 00:00:00 Jan 1st 1970. \wxheading{Include files} - + \membersection{::wxGetLocalTimeMillis}\label{wxgetlocaltimemillis} @@ -4089,7 +4489,7 @@ Returns the number of milliseconds since local time 00:00:00 Jan 1st 1970. \wxheading{Include files} - + \membersection{::wxGetUTCTime}\label{wxgetutctime} @@ -4104,7 +4504,7 @@ Returns the number of seconds since GMT 00:00:00 Jan 1st 1970. \wxheading{Include files} - + \membersection{::wxMicroSleep}\label{wxmicrosleep} @@ -4156,19 +4556,6 @@ Sleeps for the specified number of seconds. -\membersection{::wxStartTimer}\label{wxstarttimer} - -\func{void}{wxStartTimer}{\void} - -Starts a stopwatch; use \helpref{::wxGetElapsedTime}{wxgetelapsedtime} to get the elapsed time. - -See also \helpref{wxTimer}{wxtimer}. - -\wxheading{Include files} - - - - \membersection{::wxUsleep}\label{wxusleep} \func{void}{wxUsleep}{\param{unsigned long}{ milliseconds}} @@ -4198,7 +4585,7 @@ compilation error messages if the condition they check fail. \membersection{::wxOnAssert}\label{wxonassert} -\func{void}{wxOnAssert}{\param{const char *}{fileName}, \param{int}{ lineNumber}, \param{const char *}{cond}, \param{const char *}{msg = NULL}} +\func{void}{wxOnAssert}{\param{const char *}{fileName}, \param{int}{ lineNumber}, \param{const char *}{func}, \param{const char *}{cond}, \param{const char *}{msg = NULL}} This function is called whenever one of debugging macros fails (i.e. condition is false in an assertion). It is only defined in the debug mode, in release @@ -4207,7 +4594,7 @@ builds the \helpref{wxCHECK}{wxcheck} failures don't result in anything. To override the default behaviour in the debug builds which is to show the user a dialog asking whether he wants to abort the program, continue or continue ignoring any subsequent assert failures, you may override -\helpref{wxApp::OnAssert}{wxapponassert} which is called by this function if +\helpref{wxApp::OnAssertFailure}{wxapponassertfailure} which is called by this function if the global application object exists. @@ -4337,7 +4724,7 @@ This check is done even in release mode. Checks that the condition is true, returns with the given return value if not (FAILs in debug mode). This check is done even in release mode. -This macro may be only used in non void functions, see also +This macro may be only used in non-void functions, see also \helpref{wxCHECK\_RET}{wxcheckret}. @@ -4439,13 +4826,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} @@ -4457,3 +4848,45 @@ 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. + +