X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b4a81453b720b48c097664410fd025e30be5ad0e..85136e3bf5dadf921652519e71da5db351fb3194:/docs/latex/wx/function.tex?ds=inline diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex index bf4502d8a5..f8c78e68aa 100644 --- a/docs/latex/wx/function.tex +++ b/docs/latex/wx/function.tex @@ -9,7 +9,7 @@ %% License: wxWindows license %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\chapter{Functions}\label{functions} +\chapter{Functions and macros}\label{functions} \setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% \setfooter{\thepage}{}{}{}{}{\thepage} @@ -20,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}\\ @@ -32,9 +31,14 @@ the corresponding topic. \helpref{IMPLEMENT\_CLASS}{implementclass}\\ \helpref{IMPLEMENT\_DYNAMIC\_CLASS2}{implementdynamicclass2}\\ \helpref{IMPLEMENT\_DYNAMIC\_CLASS}{implementdynamicclass}\\ +\helpref{wxAboutBox}{wxaboutbox}\\ \helpref{wxASSERT}{wxassert}\\ \helpref{wxASSERT\_MIN\_BITSIZE}{wxassertminbitsize}\\ \helpref{wxASSERT\_MSG}{wxassertmsg}\\ +\helpref{wxAtomicDec}{wxatomicdec}\\ +\helpref{wxAtomicInc}{wxatomicinc}\\ +\helpref{wxBase64Decode}{wxbase64decode}\\ +\helpref{wxBase64Encode}{wxbase64encode}\\ \helpref{wxBeginBusyCursor}{wxbeginbusycursor}\\ \helpref{wxBell}{wxbell}\\ \helpref{wxBITMAP}{wxbitmapmacro}\\ @@ -45,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}\\ @@ -69,6 +74,9 @@ the corresponding topic. \helpref{wxDROP\_ICON}{wxdropicon}\\ \helpref{wxDebugMsg}{wxdebugmsg}\\ \helpref{WXDEBUG\_NEW}{debugnew}\\ +\helpref{wxDEPRECATED}{wxdeprecated}\\ +\helpref{wxDEPRECATED\_BUT\_USED\_INTERNALLY}{wxdeprecatedbutusedinternally}\\ +\helpref{wxDEPRECATED\_INLINE}{wxdeprecatedinline}\\ \helpref{wxDirExists}{functionwxdirexists}\\ \helpref{wxDirSelector}{wxdirselector}\\ \helpref{wxDisplayDepth}{wxdisplaydepth}\\ @@ -83,6 +91,8 @@ the corresponding topic. \helpref{wxEndBusyCursor}{wxendbusycursor}\\ \helpref{wxENTER\_CRIT\_SECT}{wxentercritsect}\\ \helpref{wxEntry}{wxentry}\\ +\helpref{wxEntryStart}{wxentrystart}\\ +\helpref{wxEntryCleanup}{wxentrycleanup}\\ \helpref{wxEnumClipboardFormats}{wxenumclipboardformats}\\ \helpref{wxError}{wxerror}\\ \helpref{wxExecute}{wxexecute}\\ @@ -103,6 +113,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}\\ @@ -114,7 +125,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}\\ @@ -129,7 +139,6 @@ the corresponding topic. \helpref{wxGetMousePosition}{wxgetmouseposition}\\ \helpref{wxGetMouseState}{wxgetmousestate}\\ \helpref{wxGetMultipleChoices}{wxgetmultiplechoices}\\ -\helpref{wxGetMultipleChoice}{wxgetmultiplechoice}\\ \helpref{wxGetNumberFromUser}{wxgetnumberfromuser}\\ \helpref{wxGetOSDirectory}{wxgetosdirectory}\\ \helpref{wxGetOsDescription}{wxgetosdescription}\\ @@ -145,7 +154,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}\\ @@ -161,6 +169,7 @@ the corresponding topic. \helpref{wxGetenv}{wxgetenvmacro}\\ \helpref{wxHandleFatalExceptions}{wxhandlefatalexceptions}\\ \helpref{wxICON}{wxiconmacro}\\ +\helpref{wxInfoMessageBox}{wxinfomessagebox}\\ \helpref{wxINTXX\_SWAP\_ALWAYS}{intswapalways}\\ \helpref{wxINTXX\_SWAP\_ON\_BE}{intswaponbe}\\ \helpref{wxINTXX\_SWAP\_ON\_LE}{intswaponle}\\ @@ -176,6 +185,7 @@ the corresponding topic. \helpref{wxIsPlatformLittleEndian}{wxisplatformlittleendian}\\ \helpref{wxIsPlatform64Bit}{wxisplatform64bit}\\ \helpref{wxIsWild}{wxiswild}\\ +\helpref{wxJoin}{wxjoin}\\ \helpref{wxKill}{wxkill}\\ \helpref{wxLaunchDefaultBrowser}{wxlaunchdefaultbrowser}\\ \helpref{wxLEAVE\_CRIT\_SECT}{wxleavecritsect}\\ @@ -235,8 +245,8 @@ 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}\\ @@ -246,6 +256,7 @@ the corresponding topic. \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}\\ @@ -265,7 +276,6 @@ 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}\\ @@ -307,13 +317,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}} @@ -347,7 +366,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 @@ -363,26 +382,27 @@ to control the behaviour of the main event loop of the GUI programs. \membersection{::wxEntry}\label{wxentry} -This initializes wxWidgets in a platform-dependent way. Use this if you -are not using the default wxWidgets entry code (e.g. main or WinMain). For example, -you can initialize wxWidgets from an Microsoft Foundation Classes application using +This initializes wxWidgets in a platform-dependent way. Use this if you are not +using the default wxWidgets entry code (e.g. main or WinMain). For example, you +can initialize wxWidgets from an Microsoft Foundation Classes application using this function. -\func{void}{wxEntry}{\param{HANDLE}{ hInstance}, \param{HANDLE}{ hPrevInstance}, - \param{const wxString\& }{commandLine}, \param{int}{ cmdShow}, \param{bool}{ enterLoop = true}} +The following overload of wxEntry is available under all platforms: + +\func{int}{wxEntry}{\param{int\&}{ argc}, \param{wxChar **}{argv}} -wxWidgets initialization under Windows (non-DLL). If {\it enterLoop} is false, the -function will return immediately after calling wxApp::OnInit. Otherwise, the wxWidgets -message loop will be entered. +Under MS Windows, an additional overload suitable for calling from +\texttt{WinMain} is available: -\func{void}{wxEntry}{\param{HANDLE}{ hInstance}, \param{HANDLE}{ hPrevInstance}, - \param{WORD}{ wDataSegment}, \param{WORD}{ wHeapSize}, \param{const wxString\& }{ commandLine}} +\func{int}{wxEntry}{\param{HINSTANCE }{hInstance}, \param{HINSTANCE }{hPrevInstance = \NULL}, \param{char *}{pCmdLine = \NULL}, \param{int }{nCmdShow = \texttt{SW\_SHOWNORMAL}}} -wxWidgets initialization under Windows (for applications constructed as a DLL). +(notice that under Windows CE platform, and only there, the type of +\arg{pCmdLine} is \texttt{wchar\_t *}, otherwise it is \texttt{char *}, even in +Unicode build). -\func{int}{wxEntry}{\param{int}{ argc}, \param{const wxString\& *}{argv}} +\wxheading{See also} -wxWidgets initialization under Unix. +\helpref{wxEntryStart}{wxentrystart} \wxheading{Remarks} @@ -406,6 +426,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} @@ -433,6 +494,11 @@ normal way which usually just means that the application will be terminated. Calling wxHandleFatalExceptions() with {\it doIt} equal to false will restore this default behaviour. +Notice that this function is only available if +\texttt{wxUSE\_ON\_FATAL\_EXCEPTION} is $1$ and under Windows platform this +requires a compiler with support for SEH (structured exception handling) which +currently means only Microsoft Visual C++ or a recent Borland C++ version. + \membersection{::wxInitAllImageHandlers}\label{wxinitallimagehandlers} @@ -610,6 +676,13 @@ 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). +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 @@ -657,6 +730,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}} @@ -958,7 +1048,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} @@ -976,7 +1067,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 @@ -1028,8 +1119,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. @@ -1077,7 +1168,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} @@ -1123,10 +1214,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} @@ -1235,6 +1328,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} @@ -1244,9 +1342,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. @@ -1458,11 +1577,14 @@ that there isn't always a standard way to do a reliable check on the OS architec \membersection{::wxGetUserHome}\label{wxgetuserhome} -\func{const wxChar *}{wxGetUserHome}{\param{const wxString\& }{user = ""}} +\func{wxString}{wxGetUserHome}{\param{const wxString\& }{user = ""}} + +Returns the home directory for the given user. If the \arg{user} is empty +(default value), this function behaves like +\helpref{wxGetHomeDir}{wxgethomedir} i.e. returns the current user home +directory. -Returns the home directory for the given user. If the username is empty -(default value), this function behaves like -\helpref{wxGetHomeDir}{wxgethomedir}. +If the home directory couldn't be determined, an empty string is returned. \wxheading{Include files} @@ -1524,24 +1646,13 @@ 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 wxChar *}{wxGetTranslation}{\param{const wxChar* }{str}, - \param{const wxChar* }{domain = NULL}} +\func{const wxString\& }{wxGetTranslation}{\param{const wxString\& }{str}, + \param{const wxString\& }{domain = wxEmptyString}} -\func{const wxChar *}{wxGetTranslation}{\param{const wxChar* }{str}, \param{const wxChar* }{strPlural}, \param{size\_t }{n}, - \param{const wxChar* }{domain = NULL}} +\func{const wxString\& }{wxGetTranslation}{\param{const wxString\& }{str}, \param{const wxString\& }{strPlural}, \param{size\_t }{n}, + \param{const wxString\& }{domain = wxEmptyString}} This function returns the translation of string {\it str} in the current \helpref{locale}{wxlocale}. If the string is not found in any of the loaded @@ -1700,11 +1811,9 @@ 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 -\helpref{wxT}{wxt} which makes it unnecessary to use both wxTRANSLATE and wxT -with the same string which would be really unreadable). +value of its argument. -However it does have a purpose and it is to mark the literal strings for the +However it does have a purpose which 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 @@ -1719,7 +1828,7 @@ translated (note that it is a bad example, really, as day names already). If you write \begin{verbatim} -static const wxChar * const weekdays[] = { _("Mon"), ..., _("Sun") }; +static const char * const weekdays[] = { _("Mon"), ..., _("Sun") }; ... // use weekdays[n] as usual \end{verbatim} @@ -1728,7 +1837,7 @@ the code wouldn't compile because the function calls are forbidden in the array initializer. So instead you should do \begin{verbatim} -static const wxChar * const weekdays[] = { wxTRANSLATE("Mon"), ..., wxTRANSLATE("Sun") }; +static const char * const weekdays[] = { wxTRANSLATE("Mon"), ..., wxTRANSLATE("Sun") }; ... // use wxGetTranslation(weekdays[n]) \end{verbatim} @@ -1740,6 +1849,7 @@ wxTRANSLATE() in the above, it wouldn't work as expected because there would be no translations for the weekday names in the program message catalog and wxGetTranslation wouldn't find them. + \membersection{::wxVsnprintf}\label{wxvsnprintf} \func{int}{wxVsnprintf}{\param{wxChar *}{buf}, \param{size\_t }{len}, \param{const wxChar *}{format}, \param{va\_list }{argPtr}} @@ -1761,7 +1871,7 @@ even when \texttt{wxUSE\_PRINTF\_POS\_PARAMS} is 1. \membersection{\_}\label{underscore} -\func{const wxChar *}{\_}{\param{const char *}{s}} +\func{const wxString\&}{\_}{\param{const wxString\&}{s}} This macro expands into a call to \helpref{wxGetTranslation}{wxgettranslation} function, so it marks the message for the extraction by {\tt xgettext} just as @@ -1773,7 +1883,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}. @@ -1803,6 +1913,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}} @@ -1825,6 +1968,8 @@ See also \helpref{wxIsBusy}{wxisbusy}, \helpref{wxBusyCursor}{wxbusycursor}. Ring the system bell. +Note that this function is categorized as a GUI one and so is not thread-safe. + \wxheading{Include files} @@ -1891,8 +2036,8 @@ 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 or wxFILE\_MUST\_EXIST. Note that wxMULTIPLE +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. @@ -1940,12 +2085,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}, \param{const wxString\& }{caption = wxEmptyString}} +\func{wxColour}{wxGetColourFromUser}{\param{wxWindow *}{parent}, \param{const wxColour\& }{colInit}, \param{const wxString\& }{caption = wxEmptyString}, \param{wxColourData *}{data = \NULL}} 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} @@ -1956,6 +2124,10 @@ is valid) if the dialog was cancelled. \docparam{caption}{If given, this will be used for the dialog caption.} +\docparam{data}{Optional object storing additional colour dialog settings, such +as custom colours. If none is provided the same settings as the last time are +used.} + \wxheading{Include files} @@ -1966,7 +2138,7 @@ is valid) if the dialog was cancelled. \func{wxFont}{wxGetFontFromUser}{\param{wxWindow *}{parent}, \param{const wxFont\& }{fontInit}, \param{const wxString\& }{caption = wxEmptyString}} Shows the font selection dialog and returns the font selected by user or -invalid font (use \helpref{wxFont::Ok}{wxfontok} to test whether a font +invalid font (use \helpref{wxFont:IsOk}{wxfontisok} to test whether a font is valid) if the dialog was cancelled. \wxheading{Parameters} @@ -2088,33 +2260,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},\\ @@ -2211,6 +2356,23 @@ and {\tt choices}, and the client data array must have the same length as the choices array.} +\membersection{::wxInfoMessageBox}\label{wxinfomessagebox} + +\func{void}{wxInfoMessageBox}{\param{wxWindow (}{parent = \NULL}} + +Shows a message box with the information about the wxWidgets build used, +including its version, most important build parameters and the version of the +underlying GUI toolkit. This is mainly used for diagnostic purposes and can be +invoked by Ctrl-Alt-middle clicking on any wxWindow which doesn't otherwise +handle this event. + +\newsince{2.9.0} + +\wxheading{Include files} + + + + \membersection{::wxIsBusy}\label{wxisbusy} \func{bool}{wxIsBusy}{\void} @@ -2307,7 +2469,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. @@ -2708,7 +2870,118 @@ Passes data to the clipboard. The clipboard must have previously been opened for this call to succeed. -\section{Miscellaneous functions}\label{miscellany} +\section{Miscellaneous functions and macros}\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}} + +\func{wxMemoryBuffer}{wxBase64Decode}{\\ +\param{const wxString\& }{src},\\ +\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. For the version using +wxString, the input string should contain only ASCII characters.} + +\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} @@ -2718,6 +2991,26 @@ The clipboard must have previously been opened for this call to succeed. This macro returns the concatenation of two tokens \arg{x} and \arg{y}. +\membersection{wxDECLARE\_APP}\label{wxdeclareapp} + +\func{}{wxDECLARE\_APP}{className} + +This is used in headers to create a forward declaration of the +\helpref{wxGetApp}{wxgetapp} function implemented by +\helpref{wxIMPLEMENT\_APP}{wximplementapp}. It creates the declaration +{\tt className\& wxGetApp(void)}. + +Example: + +\begin{verbatim} + wxDECLARE_APP(MyApp) +\end{verbatim} + +\wxheading{Include files} + + + + \membersection{wxDYNLIB\_FUNCTION}\label{wxdynlibfunction} \func{}{wxDYNLIB\_FUNCTION}{\param{}{type}, \param{}{name}, \param{}{dynlib}} @@ -2744,6 +3037,55 @@ 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{wxDEPRECATED\_INLINE}\label{wxdeprecatedinline} + +\func{}{wxDEPRECATED\_INLINE}{\param{}{func}, \param{}{body}} + +This macro is similar to \helpref{wxDEPRECATED}{wxdeprecated} but can be used +to not only declare the function \arg{func} as deprecated but to also provide +its (inline) implementation \arg{body}. + +It can be used as following: +\begin{verbatim} + class wxFoo + { + public: + // OldMethod() is deprecated, use NewMethod() instead + void NewMethod(); + wxDEPRECATED_INLINE( void OldMethod(), NewMethod() ); + }; +\end{verbatim} + \membersection{wxEXPLICIT}\label{wxexplicit} {\tt wxEXPLICIT} is a macro which expands to the C++ {\tt explicit} keyword if @@ -2752,6 +3094,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}} @@ -2818,6 +3161,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} @@ -2828,7 +3177,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} @@ -2856,7 +3207,9 @@ 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} @@ -2985,6 +3338,18 @@ 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{wxColour* }{col}} + +\func{bool}{wxFromString}{\param{const wxString\& }{str}, + \param{wxFont* }{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} @@ -2994,7 +3359,7 @@ always returns \NULL in the other ports). \wxheading{Include files} - + \membersection{::wxGetBatteryState}\label{wxgetbatterystate} @@ -3054,7 +3419,7 @@ Returns the mouse position in screen coordinates. 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 +screen coordinates, as well as boolean values indicating the up/down status of the mouse buttons and the modifier keys. \wxheading{Include files} @@ -3097,40 +3462,6 @@ public: \end{verbatim} -\membersection{::wxGetResource}\label{wxgetresource} - -\func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry}, - \param{const wxString\& *}{value}, \param{const wxString\& }{file = NULL}} - -\func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry}, - \param{float *}{value}, \param{const wxString\& }{file = NULL}} - -\func{bool}{wxGetResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry}, - \param{long *}{value}, \param{const wxString\& }{file = NULL}} - -\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. - -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. - -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. - -See also \helpref{wxWriteResource}{wxwriteresource}, \helpref{wxConfigBase}{wxconfigbase}. - -\wxheading{Include files} - - - \membersection{::wxGetStockLabel}\label{wxgetstocklabel} @@ -3143,8 +3474,8 @@ Returns label that should be used for given {\it id} element. \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} +useful for getting labels without accelerator char code like for toolbar tooltip or +on platforms without traditional keyboard like smartphones} \docparam{accelerator}{optional accelerator string automatically added to label; useful for building labels for \helpref{wxMenuItem}{wxmenuitem}} @@ -3172,10 +3503,17 @@ frame or dialog containing it, or {\tt NULL}. 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} @@ -3280,11 +3618,23 @@ 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}} @@ -3315,6 +3665,16 @@ class name internally. Example of using the macro: Notice that there should be no semicolon after this macro. +\membersection{wxToString}\label{wxtostring} + +\func{wxString}{wxToString}{\param{const wxColour\& }{col}} + +\func{wxString}{wxToString}{\param{const wxFont\& }{col}} + +Converts its argument to string. +See also: \helpref{wxFromString}{wxfromstring}. + + \membersection{wxULL}\label{wxull} \func{wxLongLong\_t}{wxULL}{\param{}{number}} @@ -3350,37 +3710,6 @@ 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}} - -\func{bool}{wxWriteResource}{\param{const wxString\& }{section}, \param{const wxString\& }{entry}, - \param{long }{value}, \param{const wxString\& }{file = NULL}} - -\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} - - - \membersection{\_\_WXFUNCTION\_\_}\label{wxfunction} @@ -3454,6 +3783,59 @@ Use these macros to read data from and write data to a file that stores data in big-endian format. +\membersection{wxFORCE\_LINK\_THIS\_MODULE}\label{wxforcelinkthismodule} + +\func{}{wxFORCE\_LINK\_THIS\_MODULE}{moduleName} + +This macro can be used in conjunction with the +\helpref{wxFORCE\_LINK\_MODULE}{wxforcelinkmodule} macro to force +the linker to include in its output a specific object file. + +In particular, you should use this macro in the source file which you want +to force for inclusion. The \tt{moduleName} needs to be a name not already +in use in other \tt{wxFORCE\_LINK\_THIS\_MODULE} macros, but is not required +to be e.g. the same name of the source file (even if it's a good choice). + +\wxheading{Include files} + + + + +\membersection{wxFORCE\_LINK\_MODULE}\label{wxforcelinkmodule} + +\func{}{wxFORCE\_LINK\_MODULE}{moduleName} + +This macro can be used in conjunction with the +\helpref{wxFORCE\_LINK\_THIS\_MODULE}{wxforcelinkthismodule} macro to force +the linker to include in its output a specific object file. + +In particular, you should use this macro in a source file which you know +for sure is linked in the output (e.g. the source file containing the "main()" +of your app). The \tt{moduleName} is the name of the module you want to forcefully link +(i.e. the name you used in the relative \helpref{wxFORCE\_LINK\_THIS\_MODULE}{wxforcelinkthismodule} macro. + +\wxheading{Include files} + + + + +\membersection{wxIMPLEMENT\_APP}\label{wximplementapp} + +\func{}{wxIMPLEMENT\_APP}{className} + +This is used in the application class implementation file to make the application class +known to wxWidgets for dynamic construction. You use this as: + +\begin{verbatim} + wxIMPLEMENT_APP(MyApp) +\end{verbatim} + +See also \helpref{wxDECLARE\_APP}{wxdeclareapp}. + +\wxheading{Include files} + + + \section{RTTI functions}\label{rttimacros} @@ -4210,29 +4592,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} @@ -4247,7 +4608,7 @@ Returns the number of seconds since local time 00:00:00 Jan 1st 1970. \wxheading{Include files} - + \membersection{::wxGetLocalTimeMillis}\label{wxgetlocaltimemillis} @@ -4263,7 +4624,7 @@ Returns the number of milliseconds since local time 00:00:00 Jan 1st 1970. \wxheading{Include files} - + \membersection{::wxGetUTCTime}\label{wxgetutctime} @@ -4278,7 +4639,7 @@ Returns the number of seconds since GMT 00:00:00 Jan 1st 1970. \wxheading{Include files} - + \membersection{::wxMicroSleep}\label{wxmicrosleep} @@ -4330,19 +4691,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}} @@ -4613,13 +4961,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} @@ -4630,3 +4982,46 @@ Removes the variable {\it var} from the environment. 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. + +