Fixed helpview sample and app in binary compatible way by only exiting
on idle (would exit prematurely since help frame doesn't prevent app exit when still open) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44610 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -43,20 +43,34 @@ class MyApp : public wxApp
|
||||
virtual bool OnInit();
|
||||
virtual int OnExit();
|
||||
|
||||
private:
|
||||
wxHtmlHelpController *help;
|
||||
/// Respond to idle event
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
|
||||
private:
|
||||
bool m_exitIfNoMainWindow;
|
||||
wxHtmlHelpController * help;
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
BEGIN_EVENT_TABLE(MyApp, wxApp)
|
||||
EVT_IDLE(MyApp::OnIdle)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
m_exitIfNoMainWindow = false;
|
||||
#ifdef __WXMOTIF__
|
||||
delete wxLog::SetActiveTarget(new wxLogStderr); // So dialog boxes aren't used
|
||||
#endif
|
||||
|
||||
// Don't exit on frame deletion, since the help window is programmed
|
||||
// to cause the app to exit even if it is still open. We need to have the app
|
||||
// close by other means.
|
||||
SetExitOnFrameDelete(false);
|
||||
|
||||
wxInitAllImageHandlers();
|
||||
wxFileSystem::AddHandler(new wxZipFSHandler);
|
||||
|
||||
@@ -80,10 +94,17 @@ bool MyApp::OnInit()
|
||||
#endif
|
||||
|
||||
help -> DisplayContents();
|
||||
SetTopWindow(help->GetFrame());
|
||||
m_exitIfNoMainWindow = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MyApp::OnIdle(wxIdleEvent& event)
|
||||
{
|
||||
if (m_exitIfNoMainWindow && !GetTopWindow())
|
||||
ExitMainLoop();
|
||||
}
|
||||
|
||||
int MyApp::OnExit()
|
||||
{
|
||||
|
Reference in New Issue
Block a user