]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/event/event.cpp
fixing infinite recursion for rotated text, introduced in cleanup r57915
[wxWidgets.git] / samples / event / event.cpp
index 8994d0a138a045b7bbea2bc6c8bf4d6b409764f7..2b9c5850fbb3235f66edb5ed238698dc029391ec 100644 (file)
 // headers
 // ----------------------------------------------------------------------------
 
 // headers
 // ----------------------------------------------------------------------------
 
-#if defined(__GNUG__) && !defined(__APPLE__)
-    // DO NOT use event.cpp here, it breaks statics initialization in
-    // src/common/event.cpp and nothing works at all then!
-    #pragma implementation "eventsample.cpp"
-    #pragma interface "eventsample.cpp"
-#endif
-
 // For compilers that support precompilation, includes "wx/wx.h".
 #include "wx/wxprec.h"
 
 // For compilers that support precompilation, includes "wx/wx.h".
 #include "wx/wxprec.h"
 
@@ -104,7 +97,7 @@ public:
 
 protected:
     // number of pushed event handlers
 
 protected:
     // number of pushed event handlers
-    size_t m_nPush;
+    unsigned m_nPush;
 
 private:
     // any class wishing to process wxWidgets events must use this macro
 
 private:
     // any class wishing to process wxWidgets events must use this macro
@@ -127,7 +120,7 @@ public:
     }
 
 private:
     }
 
 private:
-    size_t m_level;
+    unsigned m_level;
 
     DECLARE_EVENT_TABLE()
 };
 
     DECLARE_EVENT_TABLE()
 };
@@ -207,6 +200,9 @@ IMPLEMENT_APP(MyApp)
 // 'Main program' equivalent: the program execution "starts" here
 bool MyApp::OnInit()
 {
 // 'Main program' equivalent: the program execution "starts" here
 bool MyApp::OnInit()
 {
+    if ( !wxApp::OnInit() )
+        return false;
+
     // create the main application window
     MyFrame *frame = new MyFrame(_T("Event wxWidgets Sample"),
                                  wxPoint(50, 50), wxSize(600, 340));
     // create the main application window
     MyFrame *frame = new MyFrame(_T("Event wxWidgets Sample"),
                                  wxPoint(50, 50), wxSize(600, 340));
@@ -295,7 +291,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
 void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
 {
     wxMessageBox( wxT("Event sample shows different ways of using events\n")
 void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
 {
     wxMessageBox( wxT("Event sample shows different ways of using events\n")
-                  wxT("© 2001 Vadim Zeitlin"),
+                  wxT("(c) 2001 Vadim Zeitlin"),
                   wxT("About Event Sample"), wxOK | wxICON_INFORMATION, this );
 }
 
                   wxT("About Event Sample"), wxOK | wxICON_INFORMATION, this );
 }
 
@@ -323,15 +319,19 @@ void MyFrame::OnConnect(wxCommandEvent& event)
                 (wxEventFunction)
                 (wxCommandEventFunction)&MyFrame::OnDynamic);
 
                 (wxEventFunction)
                 (wxCommandEventFunction)&MyFrame::OnDynamic);
 
+#if wxUSE_STATUSBAR
         SetStatusText(_T("You can now use \"Dynamic\" item in the menu"));
         SetStatusText(_T("Dynamic: on"), Status_Dynamic);
         SetStatusText(_T("You can now use \"Dynamic\" item in the menu"));
         SetStatusText(_T("Dynamic: on"), Status_Dynamic);
+#endif // wxUSE_STATUSBAR
     }
     else // connect
     {
         Disconnect(Event_Dynamic, wxID_ANY, wxEVT_COMMAND_MENU_SELECTED);
 
     }
     else // connect
     {
         Disconnect(Event_Dynamic, wxID_ANY, wxEVT_COMMAND_MENU_SELECTED);
 
+#if wxUSE_STATUSBAR
         SetStatusText(_T("You can no more use \"Dynamic\" item in the menu"));
         SetStatusText(_T("Dynamic: off"), Status_Dynamic);
         SetStatusText(_T("You can no more use \"Dynamic\" item in the menu"));
         SetStatusText(_T("Dynamic: off"), Status_Dynamic);
+#endif // wxUSE_STATUSBAR
     }
 }
 
     }
 }
 
@@ -343,7 +343,9 @@ void MyFrame::OnPushEventHandler(wxCommandEvent& WXUNUSED(event))
 {
     PushEventHandler(new MyEvtHandler(++m_nPush));
 
 {
     PushEventHandler(new MyEvtHandler(++m_nPush));
 
+#if wxUSE_STATUSBAR
     SetStatusText(wxString::Format(_T("Push count: %u"), m_nPush), Status_Push);
     SetStatusText(wxString::Format(_T("Push count: %u"), m_nPush), Status_Push);
+#endif // wxUSE_STATUSBAR
 }
 
 void MyFrame::OnPopEventHandler(wxCommandEvent& WXUNUSED(event))
 }
 
 void MyFrame::OnPopEventHandler(wxCommandEvent& WXUNUSED(event))
@@ -353,7 +355,9 @@ void MyFrame::OnPopEventHandler(wxCommandEvent& WXUNUSED(event))
     PopEventHandler(true /* delete handler */);
     m_nPush--;
 
     PopEventHandler(true /* delete handler */);
     m_nPush--;
 
+#if wxUSE_STATUSBAR
     SetStatusText(wxString::Format(_T("Push count: %u"), m_nPush), Status_Push);
     SetStatusText(wxString::Format(_T("Push count: %u"), m_nPush), Status_Push);
+#endif // wxUSE_STATUSBAR
 }
 
 void MyFrame::OnTest(wxCommandEvent& WXUNUSED(event))
 }
 
 void MyFrame::OnTest(wxCommandEvent& WXUNUSED(event))