]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/minifram/minifram.cpp
added wxDataViewIndexListModel and sample
[wxWidgets.git] / samples / minifram / minifram.cpp
index e63bf430e0e3166ae0fc85b1897598e41df2c0fc..9cd56f413e2e02016d504c06dda01e1c30af1719 100644 (file)
@@ -57,13 +57,13 @@ wxButton      *button     = (wxButton*) NULL;
 // 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;
@@ -164,7 +164,6 @@ bool MyApp::InitToolbar(wxToolBar* toolBar)
 // 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()
@@ -175,11 +174,11 @@ MyMiniFrame::MyMiniFrame(wxFrame* parent, wxWindowID id, const wxString& title,
 {
 }
 
-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))
@@ -193,7 +192,7 @@ 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()
@@ -204,9 +203,9 @@ MyMainFrame::MyMainFrame(wxFrame* parent, wxWindowID id, const wxString& title,
 {
 }
 
-void MyMainFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
+void MyMainFrame::OnExit(wxCommandEvent&)
 {
-  Destroy();
+    Close();
 }
 
 void MyMainFrame::OnReparent(wxCommandEvent& WXUNUSED(event))
@@ -238,10 +237,10 @@ void MyMainFrame::OnSetSize_200_200(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 );
 }