X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ae3c17b4013e80b99976c750c19fca47729517f6..285f511671d4bc10168cfb43a087012e05036738:/interface/wx/init.h diff --git a/interface/wx/init.h b/interface/wx/init.h index 499dbe1eed..a673a0b7e0 100644 --- a/interface/wx/init.h +++ b/interface/wx/init.h @@ -3,10 +3,45 @@ // Purpose: interface of global functions // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -/** @ingroup group_funcmacro_appinitterm */ + +/** + @class wxInitializer + + Create an object of this class on the stack to initialize/cleanup the library + automatically. + + @library{wxbase} + @category{appmanagement} + + @see wxGLContext +*/ +class wxInitializer +{ +public: + /** + Initializes the library. + Calls wxInitialize(). + */ + wxInitializer(int argc = 0, wxChar **argv = NULL); + + /** + Has the initialization been successful? (explicit test) + */ + bool IsOk() const; + + /** + This dtor only does clean up if we initialized the library properly. + Calls wxUninitialize(). + */ + ~wxInitializer(); +}; + + + +/** @addtogroup group_funcmacro_appinitterm */ //@{ /** @@ -16,7 +51,7 @@ If the function returns true, the initialization was successful and the global wxApp object ::wxTheApp has been created. Moreover, wxEntryCleanup() must be called afterwards. If the function returns false, a catastrophic - initialization error occured and (at least the GUI part of) the library + initialization error occurred and (at least the GUI part of) the library can't be used at all. Notice that parameters @c argc and @c argv may be modified by this @@ -35,6 +70,8 @@ bool wxEntryStart(int& argc, wxChar** argv); @note Under Windows CE platform, and only there, the type of @a pCmdLine is @c wchar_t *, otherwise it is @c char *, even in Unicode build. + @onlyfor{wxmsw} + @header{wx/init.h} */ bool wxEntryStart(HINSTANCE hInstance, @@ -49,5 +86,27 @@ bool wxEntryStart(HINSTANCE hInstance, */ void wxEntryCleanup(); +/** + Initialize the library (may be called as many times as needed, but each + call to wxInitialize() must be matched by wxUninitialize()). + + With this function you may avoid wxDECLARE_APP() and wxIMPLEMENT_APP() macros + and use wxInitialize() and wxUninitialize() dynamically in the + program startup and termination. + + @header{wx/init.h} +*/ +bool wxInitialize(int argc = 0, wxChar **argv = NULL); + +/** + Clean up; the library can't be used any more after the last call to + wxUninitialize(). + + See wxInitialize() for more info. + + @header{wx/init.h} +*/ +void wxUninitialize(); + //@}