X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f70c044346a655e3115879ab2554bfd665139670..fccb65a23c050b35fb29f7b8119a97ca7eb38fb7:/docs/latex/wx/function.tex?ds=inline diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex index 68441377ac..4bb920a505 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} @@ -6,7 +17,7 @@ The functions and macros defined in wxWidgets are described here: you can either look up a function using the alphabetical listing of them or find it in the corresponding topic. -\section{Alphabetical functions and macros list} +\section{Alphabetical functions and macros list}\label{functionsalphabetically} \helpref{CLASSINFO}{classinfo}\\ \helpref{copystring}{copystring}\\ @@ -31,6 +42,7 @@ the corresponding topic. \helpref{wxBITMAP}{wxbitmapmacro}\\ \helpref{wxBeginBusyCursor}{wxbeginbusycursor}\\ \helpref{wxBell}{wxbell}\\ +\helpref{wxCHANGE\_UMASK}{wxchangeumask}\\ \helpref{wxCHECK}{wxcheck}\\ \helpref{wxCHECK2\_MSG}{wxcheck2msg}\\ \helpref{wxCHECK2}{wxcheck2}\\ @@ -59,7 +71,6 @@ the corresponding topic. \helpref{wxDDEInitialize}{wxddeinitialize}\\ \helpref{wxDROP\_ICON}{wxdropicon}\\ \helpref{wxDebugMsg}{wxdebugmsg}\\ -\helpref{wxDirExists}{functionwxdirexists}\\ \helpref{wxDirSelector}{wxdirselector}\\ \helpref{wxDisplayDepth}{wxdisplaydepth}\\ \helpref{wxDisplaySize}{wxdisplaysize}\\ @@ -95,6 +106,7 @@ the corresponding topic. \helpref{wxFinite}{wxfinite}\\ \helpref{wxGetActiveWindow}{wxgetactivewindow}\\ \helpref{wxGetApp}{wxgetapp}\\ +\helpref{wxGetBatteryState}{wxgetbatterystate}\\ \helpref{wxGetClipboardData}{wxgetclipboarddata}\\ \helpref{wxGetClipboardFormatName}{wxgetclipboardformatname}\\ \helpref{wxGetColourFromUser}{wxgetcolourfromuser}\\ @@ -102,10 +114,11 @@ the corresponding topic. \helpref{wxGetDiskSpace}{wxgetdiskspace}\\ \helpref{wxGetDisplayName}{wxgetdisplayname}\\ \helpref{wxGetDisplaySize}{wxdisplaysize}\\ -\helpref{wxGetDisplaySizeMM}{wxdisplaysizemm}\\ +\helpref{wxGetDisplaySizeMM}{wxdisplaysizemm}\\ \helpref{wxGetElapsedTime}{wxgetelapsedtime}\\ \helpref{wxGetEmailAddress}{wxgetemailaddress}\\ \helpref{wxGetEnv}{wxgetenv}\\ +\helpref{wxGetFileKind}{wxgetfilekind}\\ \helpref{wxGetFontFromUser}{wxgetfontfromuser}\\ \helpref{wxGetFreeMemory}{wxgetfreememory}\\ \helpref{wxGetFullHostName}{wxgetfullhostname}\\ @@ -115,6 +128,7 @@ the corresponding topic. \helpref{wxGetLocalTimeMillis}{wxgetlocaltimemillis}\\ \helpref{wxGetLocalTime}{wxgetlocaltime}\\ \helpref{wxGetMousePosition}{wxgetmouseposition}\\ +\helpref{wxGetMouseState}{wxgetmousestate}\\ \helpref{wxGetMultipleChoices}{wxgetmultiplechoices}\\ \helpref{wxGetMultipleChoice}{wxgetmultiplechoice}\\ \helpref{wxGetNumberFromUser}{wxgetnumberfromuser}\\ @@ -122,6 +136,7 @@ the corresponding topic. \helpref{wxGetOsDescription}{wxgetosdescription}\\ \helpref{wxGetOsVersion}{wxgetosversion}\\ \helpref{wxGetPasswordFromUser}{wxgetpasswordfromuser}\\ +\helpref{wxGetPowerType}{wxgetpowertype}\\ \helpref{wxGetPrinterCommand}{wxgetprintercommand}\\ \helpref{wxGetPrinterFile}{wxgetprinterfile}\\ \helpref{wxGetPrinterMode}{wxgetprintermode}\\ @@ -161,6 +176,7 @@ the corresponding topic. \helpref{wxIsNaN}{wxisnan}\\ \helpref{wxIsWild}{wxiswild}\\ \helpref{wxKill}{wxkill}\\ +\helpref{wxLaunchDefaultBrowser}{wxlaunchdefaultbrowser}\\ \helpref{wxLEAVE\_CRIT\_SECT}{wxleavecritsect}\\ \helpref{wxLoadUserResource}{wxloaduserresource}\\ \helpref{wxLogDebug}{wxlogdebug}\\ @@ -185,8 +201,11 @@ the corresponding topic. \helpref{wxNewId}{wxnewid}\\ \helpref{wxNow}{wxnow}\\ \helpref{wxOnAssert}{wxonassert}\\ +\helpref{wxON\_BLOCK\_EXIT}{wxonblockexit}\\ +\helpref{wxON\_BLOCK\_EXIT\_OBJ}{wxonblockexitobj}\\ \helpref{wxOpenClipboard}{wxopenclipboard}\\ \helpref{wxParseCommonDialogsFilter}{wxparsecommondialogsfilter}\\ +\helpref{wxDirExists}{functionwxdirexists}\\ \helpref{wxPathOnly}{wxpathonly}\\ \helpref{wxPostDelete}{wxpostdelete}\\ \helpref{wxPostEvent}{wxpostevent}\\ @@ -222,8 +241,10 @@ the corresponding topic. \helpref{wxStricmp}{wxstricmp}\\ \helpref{wxStringEq}{wxstringeq}\\ \helpref{wxStringMatch}{wxstringmatch}\\ +\helpref{wxStringTokenize}{wxstringtokenize}\\ \helpref{wxStripMenuCodes}{wxstripmenucodes}\\ \helpref{wxStrlen}{wxstrlen}\\ +\helpref{wxSUPPRESS\_GCC\_PRIVATE\_DTOR\_WARNING}{wxsuppressgccprivatedtorwarning}\\ \helpref{wxSysErrorCode}{wxsyserrorcode}\\ \helpref{wxSysErrorMsg}{wxsyserrormsg}\\ \helpref{wxT}{wxt}\\ @@ -237,13 +258,17 @@ the corresponding topic. \helpref{wxUnix2DosFilename}{wxunix2dosfilename}\\ \helpref{wxUnsetEnv}{wxunsetenv}\\ \helpref{wxUsleep}{wxusleep}\\ +\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} @@ -312,7 +337,7 @@ the following can be done: \func{bool}{wxCHECK\_VERSION\_FULL}{\param{}{major, minor, release, subrel}} -Same as \helpref{wxCHECK\_VERSION}{wxcheckversion} but also checks that +Same as \helpref{wxCHECK\_VERSION}{wxcheckversion} but also checks that \texttt{wxSUBRELEASE\_NUMBER} is at least \arg{subrel}. @@ -429,7 +454,7 @@ This function is used in wxBase only and only if you don't create \helpref{wxApp}{wxapp} object at all. In this case you must call it from your {\tt main()} function before calling any other wxWidgets functions. -If the function returns {\tt false} the initialization could not be performed, +If the function returns \false the initialization could not be performed, in this case the library cannot be used and \helpref{wxUninitialize}{wxuninitialize} shouldn't be called neither. @@ -518,16 +543,16 @@ processes. \perlnote{In wxPerl this function is called \texttt{Wx::ExecuteArgs}} -\func{long}{wxExecute}{\param{const wxString\& }{command}, \param{wxArrayString\& }{output}} +\func{long}{wxExecute}{\param{const wxString\& }{command}, \param{wxArrayString\& }{output}, \param{int }{flags = 0}} \perlnote{In wxPerl this function is called \texttt{Wx::ExecuteStdout} and it only takes the {\tt command} argument, and returns a 2-element list {\tt ( status, output )}, where {\tt output} is an array reference.} -\func{long}{wxExecute}{\param{const wxString\& }{command}, \param{wxArrayString\& }{output}, \param{wxArrayString\& }{errors}} +\func{long}{wxExecute}{\param{const wxString\& }{command}, \param{wxArrayString\& }{output}, \param{wxArrayString\& }{errors}, \param{int }{flags = 0}} -\perlnote{In wxPerl this function is called \texttt{Wx::ExecuteStdoutStderr} +\perlnote{In wxPerl this function is called \texttt{Wx::ExecuteStdoutStderr} and it only takes the {\tt command} argument, and returns a 3-element list {\tt ( status, output, errors )}, where {\tt output} and {\tt errors} are array references.} @@ -550,9 +575,12 @@ 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. Also, while waiting for the process to -terminate, wxExecute will call \helpref{wxYield}{wxyield}. The caller -should ensure that this can cause no recursion, in the simplest case by -calling \helpref{wxEnableTopLevelWindows(false)}{wxenabletoplevelwindows}. +terminate, wxExecute will call \helpref{wxYield}{wxyield}. Because of this, by +default this function disables all application windows to avoid unexpected +reentrancies which could result from the users interaction with the program +while the child process is running. If you are sure that it is safe to not +disable the program windows, you may pass \texttt{wxEXEC\_NODISABLE} flag to +prevent this automatic disabling from happening. For asynchronous execution, however, the return value is the process id and zero value indicates that the command could not be executed. As an added @@ -574,14 +602,15 @@ 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} with the argument of -pid where pid -is the process ID of the new process will kill this process as well as all of -its children (except those which have started their own session). +needed). Calling \helpref{wxKill}{wxkill} passing wxKILL\_CHILDREN will +kill this process as well as all of its children (except those which have +started their own session). Finally, you may use the third overloaded version of this function to execute -a process (always synchronously) and capture its output in the array -{\it output}. The fourth version adds the possibility to additionally capture -the messages from standard error output in the {\it errors} array. +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 +fourth version adds the possibility to additionally capture the messages from +standard error output in the \arg{errors} array. {\bf NB:} Currently wxExecute() can only be used from the main thread, calling this function from another thread will result in an assert failure in debug @@ -626,7 +655,7 @@ application. See \helpref{wxCloseEvent}{wxcloseevent} and \helpref{wxApp}{wxapp} \membersection{::wxKill}\label{wxkill} -\func{int}{wxKill}{\param{long}{ pid}, \param{int}{ sig = wxSIGTERM}, \param{wxKillError }{*rc = NULL}} +\func{int}{wxKill}{\param{long}{ pid}, \param{int}{ sig = wxSIGTERM}, \param{wxKillError }{*rc = NULL}, \param{int }{flags = 0}} Equivalent to the Unix kill function: send the given signal {\it sig} to the process with PID {\it pid}. The valid signal values are @@ -654,7 +683,7 @@ enum wxSignal \end{verbatim} {\tt wxSIGNONE}, {\tt wxSIGKILL} and {\tt wxSIGTERM} have the same meaning -under both Unix and Windows but all the other signals are equivalent to +under both Unix and Windows but all the other signals are equivalent to {\tt wxSIGTERM} under Windows. Returns 0 on success, -1 on failure. If {\it rc} parameter is not NULL, it will @@ -671,6 +700,12 @@ enum wxKillError }; \end{verbatim} +The {\it flags} parameter can be wxKILL\_NOCHILDREN (the default), +or wxKILL\_CHILDREN, in which case the child processes of this +process will be killed too. Note that under Unix, for wxKILL\_CHILDREN +to work you should have created the process by passing wxEXEC\_MAKE\_GROUP\_LEADER +to wxExecute. + \wxheading{See also} \helpref{wxProcess::Kill}{wxprocesskill},\rtfsp @@ -724,7 +759,7 @@ and that this function is only implemented under Unix and Win32. \wxheading{Returns} -{\tt true} on success, {\tt false} if an error occured. +\true on success, \false if an error occurred. \wxheading{Include files} @@ -758,7 +793,7 @@ to create and use the critical section only when needed. \func{}{wxCRIT\_SECT\_DECLARE}{\param{}{cs}} -This macro declares a (static) critical section object named {\it cs} if +This macro declares a (static) critical section object named {\it cs} if {\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$. @@ -767,9 +802,9 @@ This macro declares a (static) critical section object named {\it cs} if \func{}{wxCRIT\_SECT\_DECLARE}{\param{}{cs}} -This macro declares a critical section object named {\it cs} if +This macro declares a critical section object named {\it cs} if {\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$. As it doesn't -include the {\tt static} keyword (unlike +include the {\tt static} keyword (unlike \helpref{wxCRIT\_SECT\_DECLARE}{wxcritsectdeclare}), it can be used to declare a class or struct member which explains its name. @@ -779,8 +814,8 @@ a class or struct member which explains its name. \func{}{wxCRIT\_SECT\_LOCKER}{\param{}{name}, \param{}{cs}} -This macro creates a \helpref{critical section lock}{wxcriticalsectionlocker} -object named {\it name} and associated with the critical section {\it cs} if +This macro creates a \helpref{critical section lock}{wxcriticalsectionlocker} +object named {\it name} and associated with the critical section {\it cs} if {\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$. @@ -789,7 +824,7 @@ object named {\it name} and associated with the critical section {\it cs} if \func{}{wxCRITICAL\_SECTION}{\param{}{name}} -This macro combines \helpref{wxCRIT\_SECT\_DECLARE}{wxcritsectdeclare} and +This macro combines \helpref{wxCRIT\_SECT\_DECLARE}{wxcritsectdeclare} and \helpref{wxCRIT\_SECT\_LOCKER}{wxcritsectlocker}: it creates a static critical section object and also the lock object associated with it. Because of this, it can be only used inside a function, not at global scope. For example: @@ -807,7 +842,7 @@ int IncCount() (note that we suppose that the function is called the first time from the main thread so that the critical section object is initialized correctly by the time -other threads start calling it, if this is not the case this approach can +other threads start calling it, if this is not the case this approach can {\bf not} be used and the critical section must be made a global instead). @@ -816,7 +851,7 @@ other threads start calling it, if this is not the case this approach can \func{}{wxENTER\_CRIT\_SECT}{\param{wxCriticalSection\& }{cs}} -This macro is equivalent to \helpref{cs.Enter()}{wxcriticalsectionenter} if +This macro is equivalent to \helpref{cs.Enter()}{wxcriticalsectionenter} if {\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$. @@ -825,7 +860,7 @@ This macro is equivalent to \helpref{cs.Enter()}{wxcriticalsectionenter} if \func{bool}{wxIsMainThread}{\void} -Returns {\tt true} if this thread is the main one. Always returns {\tt true} if +Returns \true if this thread is the main one. Always returns \true if {\tt wxUSE\_THREADS} is $0$. @@ -834,7 +869,7 @@ Returns {\tt true} if this thread is the main one. Always returns {\tt true} if \func{}{wxLEAVE\_CRIT\_SECT}{\param{wxCriticalSection\& }{cs}} -This macro is equivalent to \helpref{cs.Leave()}{wxcriticalsectionleave} if +This macro is equivalent to \helpref{cs.Leave()}{wxcriticalsectionleave} if {\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$. @@ -888,7 +923,7 @@ threads. \wxheading{Include files} - + \wxheading{See also} @@ -898,13 +933,6 @@ threads. \helpref{wxFileName}{wxfilename} -\membersection{::wxDirExists}\label{functionwxdirexists} - -\func{bool}{wxDirExists}{\param{const wxString\& }{dirname}} - -Returns true if the directory exists. - - \membersection{::wxDos2UnixFilename}\label{wxdos2unixfilename} \func{void}{wxDos2UnixFilename}{\param{wxChar *}{s}} @@ -926,6 +954,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). + \membersection{::wxFileNameFromPath}\label{wxfilenamefrompath} @@ -951,7 +981,7 @@ parent directory "..". \wxheading{Warning} -As of wx 2.5.2, these functions are not thread-safe! (use static variables) +As of wx 2.5.2, these functions are not thread-safe! (they use static variables). You probably want to use \helpref{wxDir::GetFirst}{wxdirgetfirst} or \helpref{wxDirTraverser}{wxdirtraverser} instead. {\it spec} may contain wildcards. @@ -961,7 +991,7 @@ For example: \begin{verbatim} wxString f = wxFindFirstFile("/home/project/*.*"); - while ( !f.IsEmpty() ) + while ( !f.empty() ) { ... f = wxFindNextFile(); @@ -989,7 +1019,7 @@ information is not needed. \wxheading{Returns} -{\tt true} on success, {\tt false} if an error occured (for example, the +\true on success, \false if an error occurred (for example, the directory doesn't exist). \wxheading{Portability} @@ -1000,6 +1030,30 @@ Mac OS and generic Unix provided the system has {\tt statfs()} function. This function first appeared in wxWidgets 2.3.2. +\membersection{::wxGetFileKind}\label{wxgetfilekind} + +\func{wxFileKind}{wxGetFileKind}{\param{int }{fd}} + +\func{wxFileKind}{wxGetFileKind}{\param{FILE *}{fp}} + +Returns the type of an open file. Possible return values are: + +\begin{verbatim} +enum wxFileKind +{ + wxFILE_KIND_UNKNOWN, + wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets + wxFILE_KIND_TERMINAL, // a tty + wxFILE_KIND_PIPE // a pipe +}; + +\end{verbatim} + +\wxheading{Include files} + + + + \membersection{::wxGetOSDirectory}\label{wxgetosdirectory} \func{wxString}{wxGetOSDirectory}{\void} @@ -1015,6 +1069,13 @@ Returns true if the argument is an absolute filename, i.e. with a slash or drive name at the beginning. +\membersection{::wxDirExists}\label{functionwxdirexists} + +\func{bool}{wxDirExists}{\param{const wxString\& }{dirname}} + +Returns true if the path exists. + + \membersection{::wxPathOnly}\label{wxpathonly} \func{wxString}{wxPathOnly}{\param{const wxString\& }{path}} @@ -1024,12 +1085,26 @@ Returns the directory part of the filename. \membersection{::wxUnix2DosFilename}\label{wxunix2dosfilename} -\func{void}{wxUnix2DosFilename}{\param{const wxString\& }{s}} +\func{void}{wxUnix2DosFilename}{\param{wxChar *}{s}} + +This function is deprecated, use \helpref{wxFileName}{wxfilename} instead. Converts a Unix to a DOS filename by replacing forward slashes with backslashes. +\membersection{wxCHANGE\_UMASK}\label{wxchangeumask} + +\func{}{wxCHANGE\_UMASK}{\param{int }{mask}} + +Under Unix this macro changes the current process umask to the given value, +unless it is equal to $-1$ in which case nothing is done, and restores it to +the original value on scope exit. It works by declaring a variable which sets +umask to \arg{mask} in its constructor and restores it in its destructor. + +Under other platforms this macro expands to nothing. + + \membersection{::wxConcatFiles}\label{wxconcatfiles} \func{bool}{wxConcatFiles}{\param{const wxString\& }{file1}, \param{const wxString\& }{file2}, @@ -1060,7 +1135,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 @@ -1217,13 +1292,29 @@ The functions in this section are used to retrieve information about the current computer and/or user characteristics. +\membersection{::wxGetEmailAddress}\label{wxgetemailaddress} + +\func{wxString}{wxGetEmailAddress}{\void} + +\func{bool}{wxGetEmailAddress}{\param{char * }{buf}, \param{int }{sz}} + +Copies the user's email address into the supplied buffer, by +concatenating the values returned by \helpref{wxGetFullHostName}{wxgetfullhostname}\rtfsp +and \helpref{wxGetUserId}{wxgetuserid}. + +Returns true if successful, false otherwise. + +\wxheading{Include files} + + + + \membersection{::wxGetFreeMemory}\label{wxgetfreememory} -\func{long}{wxGetFreeMemory}{\void} +\func{wxMemorySize}{wxGetFreeMemory}{\void} Returns the amount of free memory in bytes under environments which -support it, and -1 if not supported. Currently, it is supported only -under Windows, Linux and Solaris. +support it, and -1 if not supported or failed to perform measurement. \wxheading{Include files} @@ -1246,21 +1337,6 @@ error. -\membersection{::wxGetEmailAddress}\label{wxgetemailaddress} - -\func{bool}{wxGetEmailAddress}{\param{const wxString\& }{buf}, \param{int }{sz}} - -Copies the user's email address into the supplied buffer, by -concatenating the values returned by \helpref{wxGetFullHostName}{wxgetfullhostname}\rtfsp -and \helpref{wxGetUserId}{wxgetuserid}. - -Returns true if successful, false otherwise. - -\wxheading{Include files} - - - - \membersection{::wxGetHomeDir}\label{wxgethomedir} \func{wxString}{wxGetHomeDir}{\void} @@ -1269,7 +1345,8 @@ Return the (current) user's home directory. \wxheading{See also} -\helpref{wxGetUserHome}{wxgetuserhome} +\helpref{wxGetUserHome}{wxgetuserhome}\\ +\helpref{wxStandardPaths}{wxstandardpaths} \wxheading{Include files} @@ -1303,32 +1380,6 @@ if successful, false otherwise. -\membersection{::wxGetUserId}\label{wxgetuserid} - -\func{wxString}{wxGetUserId}{\void} - -\func{bool}{wxGetUserId}{\param{char * }{buf}, \param{int }{sz}} - -This function returns the "user id" also known as "login name" under Unix i.e. -something like "jsmith". It uniquely identifies the current user (on this system). - -Under Windows or NT, this function first looks in the environment -variables USER and LOGNAME; if neither of these is found, the entry {\bf UserId}\rtfsp -in the {\bf wxWidgets} section of the WIN.INI file is tried. - -The first variant of this function returns the login name if successful or an -empty string otherwise. The second (deprecated) function returns true -if successful, false otherwise. - -\wxheading{See also} - -\helpref{wxGetUserName}{wxgetusername} - -\wxheading{Include files} - - - - \membersection{::wxGetOsDescription}\label{wxgetosdescription} \func{wxString}{wxGetOsDescription}{\void} @@ -1354,17 +1405,20 @@ Gets operating system version information. \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. +\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 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} @@ -1390,6 +1444,32 @@ Returns the home directory for the given user. If the username is empty +\membersection{::wxGetUserId}\label{wxgetuserid} + +\func{wxString}{wxGetUserId}{\void} + +\func{bool}{wxGetUserId}{\param{char * }{buf}, \param{int }{sz}} + +This function returns the "user id" also known as "login name" under Unix i.e. +something like "jsmith". It uniquely identifies the current user (on this system). + +Under Windows or NT, this function first looks in the environment +variables USER and LOGNAME; if neither of these is found, the entry {\bf UserId}\rtfsp +in the {\bf wxWidgets} section of the WIN.INI file is tried. + +The first variant of this function returns the login name if successful or an +empty string otherwise. The second (deprecated) function returns true +if successful, false otherwise. + +\wxheading{See also} + +\helpref{wxGetUserName}{wxgetusername} + +\wxheading{Include files} + + + + \membersection{::wxGetUserName}\label{wxgetusername} \func{wxString}{wxGetUserName}{\void} @@ -1404,8 +1484,8 @@ is running, the entry {\bf Current} in the section {\bf User} of the PENWIN.INI file is used. The first variant of this function returns the user name if successful or an -empty string otherwise. The second (deprecated) function returns {\tt true} -if successful, {\tt false} otherwise. +empty string otherwise. The second (deprecated) function returns \true +if successful, \false otherwise. \wxheading{See also} @@ -1417,7 +1497,7 @@ if successful, {\tt false} otherwise. -\section{String functions} +\section{String functions}\label{stringfunctions} \membersection{::copystring}\label{copystring} @@ -1447,23 +1527,33 @@ 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: \arg{str} -parameter must contain the singular form of the string to be converted. -It is also used as the key for the search in the catalog. -The \arg{strPlural} parameter is the plural form (in English). -The parameter \arg{n} is used to determine the plural form. If no -message catalog is found \arg{str} is returned if `n == 1', +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} for additional information on plural forms handling. + +See \urlref{GNU gettext manual}{http://www.gnu.org/manual/gettext/html\_chapter/gettext\_10.html\#SEC150} +for additional information on plural forms handling. 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 +\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 +\helpref{wxPLURAL}{wxplural} macro for all literal strings. + + \membersection{::wxIsEmpty}\label{wxisempty} \func{bool}{wxIsEmpty}{\param{const char *}{ p}} -Returns {\tt true} if the pointer is either {\tt NULL} or points to an empty -string, {\tt false} otherwise. +Returns \true if the pointer is either {\tt NULL} or points to an empty +string, \false otherwise. \membersection{::wxStrcmp}\label{wxstrcmp} @@ -1488,6 +1578,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},\\ @@ -1495,22 +1598,24 @@ case-sensitive comparison. {\bf NB:} This function is obsolete, use \helpref{wxString::Find}{wxstringfind} instead. -Returns {\tt true} if the substring {\it s1} is found within {\it s2}, -ignoring case if {\it exact} is false. If {\it subString} is {\tt false}, +Returns \true if the substring {\it s1} is found within {\it s2}, +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} @@ -1547,7 +1652,7 @@ enough space. wxT() is a macro which can be used with character and string literals (in other words, {\tt 'x'} or {\tt "foo"}) to automatically convert them to Unicode in -Unicode build configuration. Please see the +Unicode build configuration. Please see the \helpref{Unicode overview}{unicode} for more information. This macro is simply returns the value passed to it without changes in ASCII @@ -1566,21 +1671,21 @@ build. In fact, its definition is: \func{const wxChar *}{wxTRANSLATE}{\param{const char *}{s}} This macro doesn't do anything in the program code -- it simply expands to the -value of its argument (except in Unicode build where it is equivalent to +value of its argument (except in Unicode build where it is equivalent to \helpref{wxT}{wxt} which makes it unnecessary to use both wxTRANSLATE and wxT with the same string which would be really unreadable). However it does have a purpose and it is to mark the literal strings for the extraction into the message catalog created by {\tt xgettext} program. Usually this is achieved using \helpref{\_()}{underscore} but that macro not only marks -the string for extraction but also expands into a +the string for extraction but also expands into a \helpref{wxGetTranslation}{wxgettranslation} function call which means that it cannot be used in some situations, notably for static array initialization. Here is an example which should make it more clear: suppose that you have a static array of strings containing the weekday names and which have to be -translated (note that it is a bad example, really, as +translated (note that it is a bad example, really, as \helpref{wxDateTime}{wxdatetime} already can be used to get the localized week day names already). If you write @@ -1623,7 +1728,7 @@ argument instead of arbitrary number of parameters. \func{const wxChar *}{\_}{\param{const char *}{s}} -This macro expands into a call to \helpref{wxGetTranslation}{wxgettranslation} +This macro expands into a call to \helpref{wxGetTranslation}{wxgettranslation} function, so it marks the message for the extraction by {\tt xgettext} just as \helpref{wxTRANSLATE}{wxtranslate} does, but also returns the translation of the string for the current locale during execution. @@ -1631,6 +1736,14 @@ the string for the current locale during execution. 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}} + +This macro is identical to \helpref{\_()}{underscore} but for the plural variant +of \helpref{wxGetTranslation}{wxgettranslation}. + + \membersection{\_T}\label{underscoret} \func{wxChar}{\_T}{\param{char }{ch}} @@ -1734,7 +1847,7 @@ if ( !dir.empty() ) \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{const wxString\& }{wildcard = "*.*"}, \param{int }{flags = 0}, \param{wxWindow *}{parent = NULL},\\ \param{int}{ x = -1}, \param{int}{ y = -1}} Pops up a file selector box. In Windows, this is the common file selector @@ -1744,7 +1857,9 @@ 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. +wxSAVE, wxOVERWRITE\_PROMPT or wxFILE\_MUST\_EXIST. Note that wxMULTIPLE +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 @@ -1792,7 +1907,7 @@ See also \helpref{wxIsBusy}{wxisbusy}, \helpref{wxBusyCursor}{wxbusycursor}. \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 @@ -1804,6 +1919,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} @@ -1811,7 +1928,7 @@ 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 @@ -1823,6 +1940,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} @@ -1903,8 +2022,9 @@ Dialog is centered on its {\it parent} unless an explicit position is given in \membersection{::wxGetPasswordFromUser}\label{wxgetpasswordfromuser} -\func{wxString}{wxGetTextFromUser}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Input text"},\\ - \param{const wxString\& }{default\_value = ``"}, \param{wxWindow *}{parent = NULL}} +\func{wxString}{wxGetPasswordFromUser}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Input text"},\\ + \param{const wxString\& }{default\_value = ``"}, \param{wxWindow *}{parent = NULL},\\ + \param{int}{ x = wxDefaultCoord}, \param{int}{ y = wxDefaultCoord}, \param{bool}{ centre = true}} Similar to \helpref{wxGetTextFromUser}{wxgettextfromuser} but the text entered in the dialog is not shown on screen but replaced with stars. This is intended @@ -1919,7 +2039,7 @@ to be used for entering passwords as the function name implies. \func{wxString}{wxGetTextFromUser}{\param{const wxString\& }{message}, \param{const wxString\& }{caption = ``Input text"},\\ \param{const wxString\& }{default\_value = ``"}, \param{wxWindow *}{parent = NULL},\\ - \param{int}{ x = -1}, \param{int}{ y = -1}, \param{bool}{ centre = true}} + \param{int}{ x = wxDefaultCoord}, \param{int}{ y = wxDefaultCoord}, \param{bool}{ centre = true}} Pop up a dialog box with title set to {\it caption}, {\it message}, and a \rtfsp{\it default\_value}. The user may type in text and press OK to return this text, @@ -2081,7 +2201,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.} @@ -2119,7 +2239,7 @@ message will be split into separate lines, to cater for large messages. \param{bool }{showAtStartup = true}} This function shows a "startup tip" to the user. The return value is the -state of the ``Show tips at startup'' checkbox. +state of the `Show tips at startup' checkbox. \docparam{parent}{The parent window for the modal dialog} @@ -2141,7 +2261,7 @@ checkbox which is shown in the tips dialog.} -\section{Math functions} +\section{Math functions}\label{mathfunctions} \wxheading{Include files} @@ -2152,7 +2272,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 or NaN (not a number), returns 0 otherwise. @@ -2471,7 +2591,7 @@ Empties the clipboard. \membersection{::wxEnumClipboardFormats}\label{wxenumclipboardformats} -\func{int}{wxEnumClipboardFormats}{\param{int}{dataFormat}} +\func{int}{wxEnumClipboardFormats}{\param{int}{ dataFormat}} Enumerates the formats found in a list of available formats that belong to the clipboard. Each call to this function specifies a known @@ -2492,7 +2612,7 @@ wxOpenClipboard function. \membersection{::wxGetClipboardData}\label{wxgetclipboarddata} -\func{wxObject *}{wxGetClipboardData}{\param{int}{dataFormat}} +\func{wxObject *}{wxGetClipboardData}{\param{int}{ dataFormat}} Gets data from the clipboard. @@ -2508,7 +2628,7 @@ The clipboard must have previously been opened for this call to succeed. \membersection{::wxGetClipboardFormatName}\label{wxgetclipboardformatname} -\func{bool}{wxGetClipboardFormatName}{\param{int}{dataFormat}, \param{const wxString\& }{formatName}, \param{int}{maxCount}} +\func{bool}{wxGetClipboardFormatName}{\param{int}{ dataFormat}, \param{const wxString\& }{formatName}, \param{int}{ maxCount}} Gets the name of a registered clipboard format, and puts it into the buffer {\it formatName} which is of maximum length {\it maxCount}. {\it dataFormat} must not specify a predefined clipboard format. @@ -2516,7 +2636,7 @@ length {\it maxCount}. {\it dataFormat} must not specify a predefined clipboard \membersection{::wxIsClipboardFormatAvailable}\label{wxisclipboardformatavailable} -\func{bool}{wxIsClipboardFormatAvailable}{\param{int}{dataFormat}} +\func{bool}{wxIsClipboardFormatAvailable}{\param{int}{ dataFormat}} Returns true if the given data format is available on the clipboard. @@ -2537,7 +2657,7 @@ Registers the clipboard data format name and returns an identifier. \membersection{::wxSetClipboardData}\label{wxsetclipboarddata} -\func{bool}{wxSetClipboardData}{\param{int}{dataFormat}, \param{wxObject *}{data}, \param{int}{width}, \param{int}{height}} +\func{bool}{wxSetClipboardData}{\param{int}{ dataFormat}, \param{wxObject*}{ data}, \param{int}{ width}, \param{int}{ height}} Passes data to the clipboard. @@ -2553,8 +2673,6 @@ Passes data to the clipboard. The clipboard must have previously been opened for this call to succeed. - - \section{Miscellaneous functions}\label{miscellany} @@ -2569,7 +2687,7 @@ This macro returns the concatenation of two tokens \arg{x} and \arg{y}. \func{}{wxDYNLIB\_FUNCTION}{\param{}{type}, \param{}{name}, \param{}{dynlib}} -When loading a function from a DLL you always have to cast the returned +When loading a function from a DLL you always have to cast the returned {\tt void *} pointer to the correct type and, even more annoyingly, you have to repeat this type twice if you want to declare and define a function pointer all in one line @@ -2577,7 +2695,7 @@ in one line This macro makes this slightly less painful by allowing you to specify the type only once, as the first parameter, and creating a variable of this type named after the function but with {\tt pfn} prefix and initialized with the -function \arg{name} from the \helpref{wxDynamicLibrary}{wxdynamiclibrary} +function \arg{name} from the \helpref{wxDynamicLibrary}{wxdynamiclibrary} \arg{dynlib}. \wxheading{Parameters} @@ -2603,9 +2721,14 @@ this language feature but still take advantage of it when it is available. \func{bool}{wxGetKeyState}{\param{wxKeyCode }{key}} -Returns \true if the key parameter is currently pressed on the keyboard, or -with modifier keys, (caps lock, etc) if the key is active (the led light is -on). +For normal keys, returns \true if the specified key is currently down. + +For togglable keys (Caps Lock, Num Lock and Scroll Lock), returns +\true if the key is toggled such that its LED indicator is lit. There is +currently no way to test whether togglable keys are up or down. + +Even though there are virtual key codes defined for mouse buttons, they +cannot be used with this function currently. \wxheading{Include files} @@ -2667,6 +2790,48 @@ 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} +with 0, 1, 2 or more parameters (up to some implementaton-defined limit) is +executed on scope exit, whether due to a normal function return or because an +exception has been thrown. A typical example of its usage: +\begin{verbatim} + void *buf = malloc(size); + wxON_BLOCK_EXIT1(free, buf); +\end{verbatim} + +Please see the original article by Andrei Alexandrescu and Petru Marginean +published in December 2000 issue of \emph{C/C++ Users Journal} for more +details. + +\wxheading{Include files} + + + +\wxheading{See also} + +\helpref{wxON\_BLOCK\_EXIT\_OBJ}{wxonblockexitobj} + + +\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} +but calls a method of the given object instead of a free function. + +\wxheading{Include files} + + + + \membersection{::wxRegisterId}\label{wxregisterid} \func{void}{wxRegisterId}{\param{long}{ id}} @@ -2712,7 +2877,7 @@ See also \helpref{wxDDEServer}{wxddeserver}, \helpref{wxDDEClient}{wxddeclient}, \membersection{::wxEnableTopLevelWindows}\label{wxenabletoplevelwindows} -\func{void}{wxEnableTopLevelWindow}{\param{bool}{ enable = true}} +\func{void}{wxEnableTopLevelWindows}{\param{bool}{ enable = true}} This function enables or disables all top level windows. It is used by \helpref{::wxSafeYield}{wxsafeyield}. @@ -2796,6 +2961,21 @@ Gets the currently active window (Windows only). +\membersection{::wxGetBatteryState}\label{wxgetbatterystate} + +\func{wxBatteryState}{wxGetBatteryState}{\void} + +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. + +\wxheading{Include files} + + + + \membersection{::wxGetDisplayName}\label{wxgetdisplayname} \func{wxString}{wxGetDisplayName}{\void} @@ -2807,6 +2987,20 @@ Under X only, returns the current display name. See also \helpref{wxSetDisplayNa +\membersection{::wxGetPowerType}\label{wxgetpowertype} + +\func{wxPowerType}{wxGetPowerType}{\void} + +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. + +\wxheading{Include files} + + + + \membersection{::wxGetMousePosition}\label{wxgetmouseposition} \func{wxPoint}{wxGetMousePosition}{\void} @@ -2818,6 +3012,55 @@ Returns the mouse position in screen coordinates. +\membersection{::wxGetMouseState}\label{wxgetmousestate} + +\func{wxMouseState}{wxGetMouseState}{\void} + +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. + +\wxheading{Include files} + + + +wxMouseState has the following interface: + +\begin{verbatim} +class wxMouseState +{ +public: + wxMouseState(); + + wxCoord GetX(); + wxCoord GetY(); + + bool LeftDown(); + bool MiddleDown(); + bool RightDown(); + + 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{::wxGetResource}\label{wxgetresource} \func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry}, @@ -2853,6 +3096,28 @@ See also \helpref{wxWriteResource}{wxwriteresource}, \helpref{wxConfigBase}{wxco +\membersection{::wxGetStockLabel}\label{wxgetstocklabel} + +\func{wxString}{wxGetStockLabel}{\param{wxWindowID }{id}, \param{bool }{withCodes = true}, \param{const wxString\& }{accelerator = wxEmptyString}} + +Returns label that should be used for given {\it id} element. + +\wxheading{Parameters} + +\docparam{id}{given id of the \helpref{wxMenuItem}{wxmenuitem}, \helpref{wxButton}{wxbutton}, \helpref{wxToolBar}{wxtoolbar} tool, etc.} + +\docparam{withCodes}{if false then strip accelerator code from the label; +usefull for getting labels without accelerator char code like for toolbar tooltip or +under platforms without traditional keyboard like smartphones} + +\docparam{accelerator}{optional accelerator string automatically added to label; useful +for building labels for \helpref{wxMenuItem}{wxmenuitem}} + +\wxheading{Include files} + + + + \membersection{::wxGetTopLevelParent}\label{wxgettoplevelparent} \func{wxWindow *}{wxGetTopLevelParent}{\param{wxWindow }{*win}} @@ -2865,6 +3130,21 @@ frame or dialog containing it, or {\tt NULL}. +\membersection{::wxLaunchDefaultBrowser}\label{wxlaunchdefaultbrowser} + +\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 +\texttt{wxBROWSER\_NEW\_WINDOW} flag, a new window is opened for the URL +(currently this is only supported under Windows). + +Returns \true if the application was successfully launched. + +\wxheading{Include files} + + + + \membersection{::wxLoadUserResource}\label{wxloaduserresource} \func{wxString}{wxLoadUserResource}{\param{const wxString\& }{resourceName}, \param{const wxString\& }{resourceType=``TEXT"}} @@ -2954,6 +3234,36 @@ as a keyboard shortkey in Windows and Motif) and $\backslash$t (tab in Windows). +\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{wxULL}\label{wxull} \func{wxLongLong\_t}{wxULL}{\param{}{number}} @@ -2976,6 +3286,19 @@ allows to define unsigned 64 bit compile time constants: \helpref{wxLL}{wxll}, \helpref{wxLongLong}{wxlonglong} +\membersection{wxVaCopy}\label{wxvacopy} + +\func{void}{wxVaCopy}{\param{va\_list }{argptrDst}, \param{va\_list}{ argptrSrc}} + +This macro is the same as the standard C99 \texttt{va\_copy} for the compilers +which support it or its replacement for those that don't. It must be used to +preserve the value of a \texttt{va\_list} object if you need to use it after +passing it to another function because it can be modified by the latter. + +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}, @@ -3131,9 +3454,9 @@ class wxCommand: public wxObject \func{}{DECLARE\_APP}{className} -This is used in headers to create a forward declaration of the -\helpref{wxGetApp}{wxgetapp} function implemented by -\helpref{IMPLEMENT\_APP}{implementapp}. It creates the declaration +This is used in headers to create a forward declaration of the +\helpref{wxGetApp}{wxgetapp} function implemented by +\helpref{IMPLEMENT\_APP}{implementapp}. It creates the declaration {\tt className\& wxGetApp(void)}. Example: @@ -3164,8 +3487,11 @@ dynamically. The same as DECLARE\_ABSTRACT\_CLASS. \func{}{DECLARE\_DYNAMIC\_CLASS}{className} -Used inside a class declaration to declare that the objects of this class should be dynamically -creatable from run-time type information. +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 +\helpref{DECLARE\_CLASS}{declareclass}. Example: @@ -3382,7 +3708,7 @@ Example: \helpref{RTTI overview}{runtimeclassoverview}\\ \helpref{wxDynamicCastThis}{wxdynamiccastthis}\\ \helpref{wxConstCast}{wxconstcast}\\ -\helpref{wxStatiicCast}{wxstaticcast} +\helpref{wxStaticCast}{wxstaticcast} \membersection{wxDynamicCastThis}\label{wxdynamiccastthis} @@ -3418,21 +3744,35 @@ result of executing an equivalent of {\tt static\_cast(ptr)}. \func{T}{wx\_const\_cast}{T, x} -Same as \texttt{const\_cast(x)} if the compiler supports const cast or +Same as \texttt{const\_cast(x)} if the compiler supports const cast or \texttt{(T)x} for old compilers. Unlike \helpref{wxConstCast}{wxconstcast}, the cast it to the type \arg{T} and not to \texttt{T *} and also the order of arguments is the same as for the standard cast. \wxheading{See also} -\helpref{wx\_static\_cast}{wxstaticcastraw}\\ +\helpref{wx\_reinterpret\_cast}{wxreinterpretcastraw},\\ +\helpref{wx\_static\_cast}{wxstaticcastraw} + + +\membersection{wx\_reinterpret\_cast}\label{wxreinterpretcastraw} + +\func{T}{wx\_reinterpret\_cast}{T, x} + +Same as \texttt{reinterpret\_cast(x)} if the compiler supports reinterpret cast or +\texttt{(T)x} for old compilers. + +\wxheading{See also} + +\helpref{wx\_const\_cast}{wxconstcastraw},\\ +\helpref{wx\_static\_cast}{wxstaticcastraw} \membersection{wx\_static\_cast}\label{wxstaticcastraw} \func{T}{wx\_static\_cast}{T, x} -Same as \texttt{static\_cast(x)} if the compiler supports static cast or +Same as \texttt{static\_cast(x)} if the compiler supports static cast or \texttt{(T)x} for old compilers. Unlike \helpref{wxStaticCast}{wxstaticcast}, there are no checks being done and the meaning of the macro arguments is exactly the same as for the standard static cast, i.e. \arg{T} is the full type name and @@ -3440,8 +3780,21 @@ star is not appended to it. \wxheading{See also} -\helpref{wx\_const\_cast}{wxconstcastraw}\\ +\helpref{wx\_const\_cast}{wxconstcastraw},\\ +\helpref{wx\_reinterpret\_cast}{wxreinterpretcastraw},\\ +\helpref{wx\_truncate\_cast}{wxtruncatecast} + +\membersection{wx\_truncate\_cast}\label{wxtruncatecast} + +\func{T}{wx\_truncate\_cast}{T, x} + +This case doesn't correspond to any standard cast but exists solely to make +casts which possibly result in a truncation of an integer value more readable. + +\wxheading{See also} + +\helpref{wx\_static\_cast}{wxstaticcastraw} \section{Log functions}\label{logfunctions} @@ -3552,11 +3905,7 @@ the program work. \func{void}{wxVLogMessage}{\param{const char *}{formatString}, \param{va\_list }{argPtr}} For all normal, informational messages. They also appear in a message box by -default (but it can be changed). Notice that the standard behaviour is to not -show informational messages if there are any errors later - the logic being -that the later error messages make the informational messages preceding them -meaningless. - +default (but it can be changed). \membersection{::wxLogVerbose}\label{wxlogverbose} @@ -3660,7 +4009,7 @@ this might lead to function signature confusion in some cases: if you intend to call the format string only version of wxLogTrace, then add a \%s format string parameter and then supply a second string parameter for that \%s, the string mask version of wxLogTrace will erroneously get called instead, since you are supplying two string parameters to the function. In this case you'll unfortunately have to avoid having two leading -string parameters, e.g. by adding a bogus integer (with its \%d format string). +string parameters, e.g. by adding a bogus integer (with its \%d format string). The third version of the function only logs the message if all the bits corresponding to the {\it mask} are set in the wxLog trace mask which can be @@ -3878,7 +4227,7 @@ Returns the number of seconds since GMT 00:00:00 Jan 1st 1970. Sleeps for the specified number of microseconds. The microsecond resolution may not, in fact, be available on all platforms (currently only Unix platforms with -nanosleep(2) may provide it) in which case this is the same as +nanosleep(2) may provide it) in which case this is the same as \helpref{wxMilliSleep}{wxmillisleep}(\arg{microseconds}$/1000$). \wxheading{Include files} @@ -3939,8 +4288,8 @@ See also \helpref{wxTimer}{wxtimer}. \func{void}{wxUsleep}{\param{unsigned long}{ milliseconds}} This function is deprecated because its name is misleading: notice that the -argument is in milliseconds, not microseconds. Please use either -\helpref{wxMilliSleep}{wxmillisleep} or \helpref{wxMicroSleep}{wxmicrosleep} +argument is in milliseconds, not microseconds. Please use either +\helpref{wxMilliSleep}{wxmillisleep} or \helpref{wxMicroSleep}{wxmicrosleep} depending on the resolution you need. @@ -4043,8 +4392,8 @@ either change the line in which either of them appears on or use the \helpref{wxCOMPILE\_TIME\_ASSERT2}{wxcompiletimeassert2} macro. Also note that Microsoft Visual C++ has a bug which results in compiler errors -if you use this macro with ``Program Database For Edit And Continue'' -(\texttt{/ZI}) option, so you shouldn't use it (``Program Database'' +if you use this macro with `Program Database For Edit And Continue' +(\texttt{/ZI}) option, so you shouldn't use it (`Program Database' (\texttt{/Zi}) is ok though) for the code making use of this macro. \wxheading{See also} @@ -4158,11 +4507,10 @@ In release mode this function does nothing. \func{bool}{wxIsDebuggerRunning}{\void} -Returns {\tt true} if the program is running under debugger, {\tt false} -otherwise. +Returns \true if the program is running under debugger, \false otherwise. -Please note that this function is currently only implemented for Mac builds -using CodeWarrior and always returns {\tt false} elsewhere. +Please note that this function is currently only implemented for Win32 and Mac +builds using CodeWarrior and always returns \false elsewhere. @@ -4200,7 +4548,7 @@ Returns the current value of the environment variable {\it var} in {\it value}. {\it value} may be {\tt NULL} if you just want to know if the variable exists and are not interested in its value. -Returns {\tt true} if the variable exists, {\tt false} otherwise. +Returns \true if the variable exists, \false otherwise. \membersection{wxSetEnv}\label{wxsetenv} @@ -4210,7 +4558,7 @@ Returns {\tt true} if the variable exists, {\tt false} otherwise. Sets the value of the environment variable {\it var} (adding it if necessary) to {\it value}. -Returns {\tt true} on success. +Returns \true on success. \membersection{wxUnsetEnv}\label{wxunsetenv} @@ -4221,5 +4569,4 @@ Removes the variable {\it var} from the environment. \helpref{wxGetEnv}{wxgetenv} will return {\tt NULL} after the call to this function. -Returns {\tt true} on success. - +Returns \true on success.