]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/animate/anitest.cpp
Use wxRefCounter instead of wxObjecrDataRef
[wxWidgets.git] / samples / animate / anitest.cpp
index 73bc0173061e1a3b0123604286b7acb88e19827a..f775d03f671d4354185594861d7b19e5c0530811 100644 (file)
@@ -35,6 +35,8 @@
 #include "wx/aboutdlg.h"
 #include "wx/artprov.h"
 #include "wx/colordlg.h"
+#include "wx/wfstream.h"
+
 #include "anitest.h"
 
 #if !wxUSE_ANIMATIONCTRL
@@ -90,14 +92,36 @@ END_EVENT_TABLE()
 // Initialise this in OnInit, not statically
 bool MyApp::OnInit()
 {
+    if ( !wxApp::OnInit() )
+        return false;
+
     // Create the main frame window
 
     MyFrame* frame = new MyFrame((wxFrame *)NULL, wxID_ANY, _T("Animation Demo"),
                                  wxDefaultPosition, wxSize(500, 400),
                                  wxDEFAULT_FRAME_STYLE);
+    frame->Show(true);
+
+    SetTopWindow(frame);
 
-    // Give it an icon
-    frame->SetIcon(wxICON(sample));
+    return true;
+}
+
+// ---------------------------------------------------------------------------
+// MyFrame
+// ---------------------------------------------------------------------------
+
+// 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;
@@ -129,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