August 28th Tuesday (八月 二十八日 火曜日)

来源:互联网 发布:网络销售 电话流程 编辑:程序博客网 时间:2024/05/01 21:45
wxAppDerivedClass& wxGetApp()

This function doesn't exist in wxWidgets but it is created by using the IMPLEMENT_APP macro. Thus, before using it anywhere but in
the same module where this macro is used, you must make it available using DECLARE_APP.

The advantage of using this function compared to directly using the global wxTheApp pointer is that the latter is of type wxApp *
and so wouldn't allow you to access the functions specific to your application class but not present in wxApp while wxGetApp() returns
the object of the right type.

DECLARE_APP(className)

This is used in headers to create a forward declaration of the wxGetApp function implemented by IMPLEMENT_APP. It creates the declaration
className& wxGetApp(void).

Example:

  DECLARE_APP(MyApp)

Include files
<wx/app.h>

IMPLEMENT_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 instead of

Example:

  IMPLEMENT_APP(MyApp)