X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9d8aca4832f9052729d2fc51d25c23f6d7006cab..c6b65b76a196e1aa2313f89f6fc609d497c388a0:/docs/latex/wx/function.tex diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex index ad14fa41f1..ad28eda84b 100644 --- a/docs/latex/wx/function.tex +++ b/docs/latex/wx/function.tex @@ -96,6 +96,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}\\ @@ -107,6 +108,7 @@ the corresponding topic. \helpref{wxGetElapsedTime}{wxgetelapsedtime}\\ \helpref{wxGetEmailAddress}{wxgetemailaddress}\\ \helpref{wxGetEnv}{wxgetenv}\\ +\helpref{wxGetFileType}{wxgetfiletype}\\ \helpref{wxGetFontFromUser}{wxgetfontfromuser}\\ \helpref{wxGetFreeMemory}{wxgetfreememory}\\ \helpref{wxGetFullHostName}{wxgetfullhostname}\\ @@ -123,6 +125,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}\\ @@ -681,7 +684,7 @@ enum wxKillError 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 work you should have created the process by passing wxEXEC\_MAKE\_GROUP\_LEADER to wxExecute. \wxheading{See also} @@ -974,7 +977,7 @@ For example: \begin{verbatim} wxString f = wxFindFirstFile("/home/project/*.*"); - while ( !f.IsEmpty() ) + while ( !f.empty() ) { ... f = wxFindNextFile(); @@ -1013,6 +1016,30 @@ Mac OS and generic Unix provided the system has {\tt statfs()} function. This function first appeared in wxWidgets 2.3.2. +\membersection{::wxGetFileType}\label{wxgetfiletype} + +\func{wxFileTypeEnum}{wxGetFileType}{\param{int }{fd}} + +\func{wxFileTypeEnum}{wxGetFileType}{\param{FILE *}{fp}} + +Returns the type of an open file. Possible return values are: + +\begin{verbatim} +enum wxFileTypeEnum +{ + wxFILE_TYPE_UNKNOWN, + wxFILE_TYPE_DISK, // a file supporting seeking to arbitrary offsets + wxFILE_TYPE_TERMINAL, // a tty + wxFILE_TYPE_PIPE // a pipe +}; + +\end{verbatim} + +\wxheading{Include files} + + + + \membersection{::wxGetOSDirectory}\label{wxgetosdirectory} \func{wxString}{wxGetOSDirectory}{\void} @@ -1242,13 +1269,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{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} @@ -1271,21 +1314,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} @@ -1328,32 +1356,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} @@ -1415,6 +1417,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} @@ -1605,7 +1633,7 @@ 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 @@ -1648,7 +1676,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. @@ -2178,7 +2206,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. @@ -2595,7 +2623,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 @@ -2603,7 +2631,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} @@ -2822,6 +2850,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} @@ -2833,6 +2876,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} @@ -2879,6 +2936,28 @@ See also \helpref{wxWriteResource}{wxwriteresource}, \helpref{wxConfigBase}{wxco +\membersection{::wxGetStockLabel}\label{wxgetstocklabel} + +\func{wxString}{wxGetStockLabel}{\param{wxWindowID }{id}, \param{bool }{withCodes = true}, \param{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}} @@ -3011,7 +3090,7 @@ 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 +As with \texttt{va\_start}, each call to \texttt{wxVaCopy} must have a matching \texttt{va\_end}. @@ -3170,9 +3249,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: @@ -3457,7 +3536,7 @@ 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. @@ -3472,7 +3551,7 @@ arguments is the same as for the standard cast. \func{T}{wx\_reinterpret\_cast}{T, x} -Same as \texttt{reinterpret\_cast(x)} if the compiler supports reinterpret cast or +Same as \texttt{reinterpret\_cast(x)} if the compiler supports reinterpret cast or \texttt{(T)x} for old compilers. \wxheading{See also} @@ -3485,7 +3564,7 @@ Same as \texttt{reinterpret\_cast(x)} if the compiler supports reinterpret ca \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 @@ -3932,7 +4011,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} @@ -3993,8 +4072,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. @@ -4212,11 +4291,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.