]> git.saurik.com Git - wxWidgets.git/commitdiff
put frame creation code all inside MyFrame ctor
authorFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Mon, 16 Feb 2009 00:27:52 +0000 (00:27 +0000)
committerFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Mon, 16 Feb 2009 00:27:52 +0000 (00:27 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58928 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/animate/anitest.cpp

index 7ffc31712bb81aa4a08b38d513769acb1a89f868..aad21cb39f08cdd45afb55af2fc2675fd655a7c0 100644 (file)
@@ -98,9 +98,30 @@ bool MyApp::OnInit()
     MyFrame* frame = new MyFrame((wxFrame *)NULL, wxID_ANY, _T("Animation Demo"),
                                  wxDefaultPosition, wxSize(500, 400),
                                  wxDEFAULT_FRAME_STYLE);
+    frame->Show(true);
+
+    SetTopWindow(frame);
+
+    return true;
+}
 
-    // Give it an icon
-    frame->SetIcon(wxICON(sample));
+// ---------------------------------------------------------------------------
+// MyFrame
+// ---------------------------------------------------------------------------
+
+#include "wx/wfstream.h"
+
+// Define my frame constructor
+MyFrame::MyFrame(wxWindow *parent,
+                 const wxWindowID id,
+                 const wxString& title,
+                 const wxPoint& pos,
+                 const wxSize& size,
+                 const long style)
+       : wxFrame(parent, id, title, pos, size,
+                          style | wxNO_FULL_REPAINT_ON_RESIZE)
+{
+    SetIcon(wxICON(sample));
 
     // Make a menubar
     wxMenu *file_menu = new wxMenu;
@@ -132,36 +153,13 @@ bool MyApp::OnInit()
     menu_bar->Append(play_menu, _T("&Animation"));
     menu_bar->Append(help_menu, _T("&Help"));
 
-    // Associate the menu bar with the frame
-    frame->SetMenuBar(menu_bar);
+    // Associate the menu bar with this frame
+    SetMenuBar(menu_bar);
 
 #if wxUSE_STATUSBAR
-    frame->CreateStatusBar();
+    CreateStatusBar();
 #endif // wxUSE_STATUSBAR
 
-    frame->Show(true);
-
-    SetTopWindow(frame);
-
-    return true;
-}
-
-// ---------------------------------------------------------------------------
-// MyFrame
-// ---------------------------------------------------------------------------
-
-#include "wx/wfstream.h"
-
-// Define my frame constructor
-MyFrame::MyFrame(wxWindow *parent,
-                 const wxWindowID id,
-                 const wxString& title,
-                 const wxPoint& pos,
-                 const wxSize& size,
-                 const long style)
-       : wxFrame(parent, id, title, pos, size,
-                          style | wxNO_FULL_REPAINT_ON_RESIZE)
-{
     // use a wxBoxSizer otherwise wxFrame will automatically
     // resize the m_animationCtrl to fill its client area on
     // user resizes