// main frame
bool MyApp::OnInit()
{
+ if ( !wxApp::OnInit() )
+ return false;
+
// Create the main frame window
main_frame = new MyMainFrame((wxFrame *) NULL, wxID_ANY, _T("wxFrame sample"),
wxPoint(100, 100), wxSize(300, 200));
- // main_frame->SetMinSize( wxSize(100,100) );
- // main_frame->SetMaxSize( wxSize(400,400) );
- // same as
main_frame->SetSizeHints( 100,100, 400,400 );
wxMenu *file_menu = new wxMenu;
// MyMiniFrame
BEGIN_EVENT_TABLE(MyMiniFrame, wxMiniFrame)
- EVT_CLOSE ( MyMiniFrame::OnCloseWindow)
EVT_BUTTON (ID_REPARENT, MyMiniFrame::OnReparent)
EVT_MENU (wxID_PRINT, MyMiniFrame::OnReparent)
END_EVENT_TABLE()
{
}
-void MyMiniFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
+bool MyMiniFrame::Destroy()
{
// make it known that the miniframe is no more
mini_frame_exists = false;
- Destroy();
+ return wxMiniFrame::Destroy();
}
void MyMiniFrame::OnReparent(wxCommandEvent& WXUNUSED(event))
// MyMainFrame
BEGIN_EVENT_TABLE(MyMainFrame, wxFrame)
- EVT_CLOSE ( MyMainFrame::OnCloseWindow)
+ EVT_MENU (wxID_EXIT, MyMainFrame::OnExit)
EVT_BUTTON (ID_REPARENT, MyMainFrame::OnReparent)
EVT_MENU (wxID_PRINT, MyMainFrame::OnReparent)
END_EVENT_TABLE()
{
}
-void MyMainFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
+void MyMainFrame::OnExit(wxCommandEvent&)
{
- Destroy();
+ Close();
}
void MyMainFrame::OnReparent(wxCommandEvent& WXUNUSED(event))
void MyMainFrame::OnSetMaxSize_150_150(wxCommandEvent& WXUNUSED(event))
{
- SetMaxSize( wxSize(150,150) );
+ SetSizeHints( -1, -1, 150, 150 );
}
void MyMainFrame::OnSetMaxSize_300_300(wxCommandEvent& WXUNUSED(event))
{
- SetMaxSize( wxSize(300,300) );
+ SetSizeHints( -1, -1, 300, 300 );
}