git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1601
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxFrame *CreateFrame(void);
};
wxFrame *CreateFrame(void);
};
class MyCanvas: public wxScrolledWindow
{
public:
class MyCanvas: public wxScrolledWindow
{
public:
long xpos = -1;
long ypos = -1;
long xpos = -1;
long ypos = -1;
-// Initialise this in OnInit, not statically
-wxPen *red_pen;
-wxFont *small_font;
-
// ID for the menu quit command
#define HELLO_QUIT 1
#define HELLO_NEW 2
// ID for the menu quit command
#define HELLO_QUIT 1
#define HELLO_NEW 2
int CTheApp::ExitInstance()
{
int CTheApp::ExitInstance()
{
+ // OnExit isn't called by CleanUp so must be called explicitly.
+ wxTheApp->OnExit();
wxApp::CleanUp();
return CWinApp::ExitInstance();
wxApp::CleanUp();
return CWinApp::ExitInstance();
// Don't exit app when the top level frame is deleted
// SetExitOnFrameDelete(FALSE);
// Don't exit app when the top level frame is deleted
// SetExitOnFrameDelete(FALSE);
- // Create a red pen
- red_pen = new wxPen("RED", 3, wxSOLID);
-
- // Create a small font
- small_font = new wxFont(10, wxSWISS, wxNORMAL, wxNORMAL);
-
wxFrame* frame = CreateFrame();
return TRUE;
}
wxFrame* frame = CreateFrame();
return TRUE;
}
subframe->GetClientSize(&width, &height);
MyCanvas *canvas = new MyCanvas(subframe, wxPoint(0, 0), wxSize(width, height));
subframe->GetClientSize(&width, &height);
MyCanvas *canvas = new MyCanvas(subframe, wxPoint(0, 0), wxSize(width, height));
- wxCursor *cursor = new wxCursor(wxCURSOR_PENCIL);
- canvas->SetCursor(*cursor);
+ canvas->SetCursor(wxCursor(wxCURSOR_PENCIL));
subframe->canvas = canvas;
// Give it scrollbars
subframe->canvas = canvas;
// Give it scrollbars
- dc.SetFont(* small_font);
+ dc.SetFont(* wxSWISS_FONT);
dc.SetPen(* wxGREEN_PEN);
dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200);
dc.SetPen(* wxGREEN_PEN);
dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200);
void wxApp::CleanUp()
{
//// COMMON CLEANUP
void wxApp::CleanUp()
{
//// COMMON CLEANUP
+
+ // flush the logged messages if any
+ wxLog *pLog = wxLog::GetActiveTarget();
+ if ( pLog != NULL && pLog->HasPendingMessages() )
+ pLog->Flush();
+
+ // One last chance for pending objects to be cleaned up
+ wxTheApp->DeletePendingObjects();
+
wxModule::CleanUpModules();
#if wxUSE_WX_RESOURCES
wxModule::CleanUpModules();
#if wxUSE_WX_RESOURCES
{
retValue = wxTheApp->OnRun();
}
{
retValue = wxTheApp->OnRun();
}
+ else
+ // We want to initialize, but not run or exit immediately.
+ return 1;
}
//else: app initialization failed, so we skipped OnRun()
}
//else: app initialization failed, so we skipped OnRun()
- // flush the logged messages if any
- wxLog *pLog = wxLog::GetActiveTarget();
- if ( pLog != NULL && pLog->HasPendingMessages() )
- pLog->Flush();
-
-
wxApp::CleanUp();
return retValue;
wxApp::CleanUp();
return retValue;