Improve wxIMPLEMENT_APP() documentation
Explain that this macro defines the application entry point. Also document wxIMPLEMENT_WXWIN_MAIN which wasn't documented at all previously.
This commit is contained in:
@@ -53,12 +53,9 @@ bool DerivedApp::OnInit()
|
|||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
Note the use of wxIMPLEMENT_APP(appClass), which allows wxWidgets to dynamically
|
Note the use of wxIMPLEMENT_APP(), which defines the application entry
|
||||||
create an instance of the application object at the appropriate point in
|
point (either @c main() or @c WinMain() function, depending on the platform)
|
||||||
wxWidgets initialization. Previous versions of wxWidgets used to rely on the
|
and tells wxWidgets which application class should be used.
|
||||||
creation of a global application object, but this is no longer recommended,
|
|
||||||
because required global initialization may not have been performed at
|
|
||||||
application object construction time.
|
|
||||||
|
|
||||||
You can also use wxDECLARE_APP(appClass) in a header file to declare the wxGetApp
|
You can also use wxDECLARE_APP(appClass) in a header file to declare the wxGetApp
|
||||||
function which returns a reference to the application object. Otherwise you can
|
function which returns a reference to the application object. Otherwise you can
|
||||||
|
@@ -1132,8 +1132,17 @@ public:
|
|||||||
#define wxDECLARE_APP( className )
|
#define wxDECLARE_APP( className )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This is used in the application class implementation file to make the
|
This macro defines the application entry point and tells wxWidgets which
|
||||||
application class known to wxWidgets for dynamic construction.
|
application class should be used.
|
||||||
|
|
||||||
|
The two tasks performed by this macro can be done separately by using
|
||||||
|
wxIMPLEMENT_APP_NO_MAIN() and wxIMPLEMENT_WXWIN_MAIN() macros, but in a
|
||||||
|
typical GUI application it's simpler and more convenient to use this macro
|
||||||
|
to do both together.
|
||||||
|
|
||||||
|
The @a className passed to this macro must be a name of the class deriving
|
||||||
|
from wxApp.
|
||||||
|
|
||||||
Note that this macro requires a final semicolon.
|
Note that this macro requires a final semicolon.
|
||||||
|
|
||||||
@header{wx/app.h}
|
@header{wx/app.h}
|
||||||
@@ -1148,6 +1157,24 @@ public:
|
|||||||
*/
|
*/
|
||||||
#define wxIMPLEMENT_APP( className )
|
#define wxIMPLEMENT_APP( className )
|
||||||
|
|
||||||
|
/**
|
||||||
|
This macro defines the application entry point appropriate for the current
|
||||||
|
platform.
|
||||||
|
|
||||||
|
Note that usually wxIMPLEMENT_APP() is used instead of this macro.
|
||||||
|
|
||||||
|
For most platforms, it defines @c main() function, but for GUI Windows
|
||||||
|
applications, it defines @c WinMain() instead.
|
||||||
|
|
||||||
|
In either case, the macro expansion includes the call to
|
||||||
|
wxDISABLE_DEBUG_SUPPORT() which disables debugging code in release builds.
|
||||||
|
If you don't use this macro, but define the entry point yourself, you
|
||||||
|
probably want to call wxDISABLE_DEBUG_SUPPORT() explicitly.
|
||||||
|
|
||||||
|
@header{wx/app.h}
|
||||||
|
*/
|
||||||
|
#define wxIMPLEMENT_WXWIN_MAIN
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user