]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/animate/anitest.cpp
fixing reset clip
[wxWidgets.git] / samples / animate / anitest.cpp
index f026946c0fd084cc81d5ed7af65730ba4ae19d7c..cc45359a33f67ca4adc0439a6a181bd021bce7c1 100644 (file)
 #endif
 
 #ifndef __WXMSW__
-    #include "mondrian.xpm"
+    #include "sample.xpm"
 #endif
 
+#include "wx/aboutdlg.h"
 #include "anitest.h"
 
+#if !wxUSE_ANIMATIONCTRL
+    #error Cannot compile this sample if wxAnimationCtrl is not enabled
+#endif
+
+
 IMPLEMENT_APP(MyApp)
 
 // ---------------------------------------------------------------------------
@@ -46,11 +52,11 @@ IMPLEMENT_APP(MyApp)
 
 enum
 {
-    wxID_PLAY
+    ID_PLAY = 1
 };
 
 BEGIN_EVENT_TABLE(MyFrame, wxFrame)
-    EVT_MENU(wxID_PLAY, MyFrame::OnPlay)
+    EVT_MENU(ID_PLAY, MyFrame::OnPlay)
     EVT_MENU(wxID_STOP, MyFrame::OnStop)
     EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
     EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
@@ -75,8 +81,8 @@ bool MyApp::OnInit()
 {
     // Create the main frame window
 
-    MyFrame* frame = new MyFrame((wxFrame *)NULL, -1, _T("Animation Demo"),
-                        wxPoint(-1, -1), wxSize(500, 400),
+    MyFrame* frame = new MyFrame((wxFrame *)NULL, wxID_ANY, _T("Animation Demo"),
+                        wxDefaultPosition, wxSize(500, 400),
                         wxDEFAULT_FRAME_STYLE);
 
     // Give it an icon
@@ -91,7 +97,7 @@ bool MyApp::OnInit()
     file_menu->Append(wxID_EXIT);
 
     wxMenu *play_menu = new wxMenu;
-    play_menu->Append(wxID_PLAY, _T("Play\tCtrl+P"), _T("Play the animation"));
+    play_menu->Append(ID_PLAY, _T("Play\tCtrl+P"), _T("Play the animation"));
     play_menu->Append(wxID_STOP, _T("Stop\tCtrl+P"), _T("Stop the animation"));
 
     wxMenu *help_menu = new wxMenu;
@@ -133,18 +139,10 @@ MyFrame::MyFrame(wxWindow *parent,
        : wxFrame(parent, id, title, pos, size,
                           style | wxNO_FULL_REPAINT_ON_RESIZE)
 {
-    //m_canvas = new MyCanvas(this, wxPoint(0, 0), wxDefaultSize);
-
-    //wxSizer *sz = new wxBoxSizer(wxVERTICAL);
-
     m_animationCtrl = new wxAnimationCtrl(this, wxID_ANY, wxNullAnimation,
                                           wxPoint(0,0),wxSize(100,100));
     if (m_animationCtrl->LoadFile(wxT("throbber.gif")))
         m_animationCtrl->Play();
-
-    //sz->Add(m_animationCtrl, 1, wxGROW);
-
-    //SetSizer(sz);
 }
 
 MyFrame::~MyFrame()
@@ -169,16 +167,16 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
 
 void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
 {
-    /*
-
-    FIXME: on wxGTK at least using File->About command it shows
-    the message dialog but does not focus it
+    wxAboutDialogInfo info;
+    info.SetName(_("wxAnimationCtrl and wxAnimation sample"));
+    info.SetDescription(_("This sample program demonstrates the usage of wxAnimationCtrl"));
+    info.SetCopyright(_T("(C) 2006 Julian Smart"));
 
-    */
+    info.AddDeveloper(_T("Julian Smart"));
+    info.AddDeveloper(_T("Guillermo Rodriguez Garcia"));
+    info.AddDeveloper(_T("Francesco Montorsi"));
 
-    (void)wxMessageBox(_T("wxWidgets 2 Animation Demo\n")
-                       _T("Author: Julian Smart (c) 2001\n"),
-                       _T("About Animation Demo"));
+    wxAboutBox(info);
 }
 
 #if wxUSE_FILEDLG
@@ -233,30 +231,6 @@ void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
 void MyFrame::OnUpdateUI(wxUpdateUIEvent& WXUNUSED(event) )
 {
     GetMenuBar()->FindItem(wxID_STOP)->Enable(m_animationCtrl->IsPlaying());
-    GetMenuBar()->FindItem(wxID_PLAY)->Enable(!m_animationCtrl->IsPlaying());
+    GetMenuBar()->FindItem(ID_PLAY)->Enable(!m_animationCtrl->IsPlaying());
 }
 
-// ---------------------------------------------------------------------------
-// MyCanvas
-// ---------------------------------------------------------------------------
-
-BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
-    //EVT_PAINT(MyCanvas::OnPaint)
-END_EVENT_TABLE()
-
-// Define a constructor for my canvas
-MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size)
-        : wxScrolledWindow(parent, -1, pos, size,
-                           wxSUNKEN_BORDER |
-                           wxNO_FULL_REPAINT_ON_RESIZE |
-                           wxVSCROLL | wxHSCROLL)
-{
-    SetBackgroundColour(wxColour(_T("YELLOW")));
-}
-
-void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
-{
-    //wxPaintDC dc(this);
-
-    //dc.DrawRotatedText(wxT("Background"),
-}