]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/evtloop.cpp
Don't create GtkScrolledWindow if neither wxHSCROLL
[wxWidgets.git] / src / gtk / evtloop.cpp
index d684ccb0eb167877e416b8f85a6350b41a30b8be..16fa2087f26c1fa182f33cb1b014d1c7ca1a90a5 100644 (file)
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        gtk/evtloop.cpp
+// Name:        src/gtk/evtloop.cpp
 // Purpose:     implements wxEventLoop for GTK+
 // Author:      Vadim Zeitlin
 // Modified by:
 #endif
 
 #include "wx/evtloop.h"
-#include "wx/app.h"
+#include "wx/ptr_scpd.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/app.h"
+#endif // WX_PRECOMP
 
 #include <gtk/gtk.h>
 
@@ -52,6 +56,8 @@ private:
 // wxEventLoop implementation
 // ============================================================================
 
+wxDEFINE_TIED_SCOPED_PTR_TYPE(wxEventLoopImpl)
+
 // ----------------------------------------------------------------------------
 // wxEventLoop running and exiting
 // ----------------------------------------------------------------------------
@@ -68,15 +74,13 @@ int wxEventLoop::Run()
 
     wxEventLoopActivator activate(this);
 
-    m_impl = new wxEventLoopImpl;
+    wxEventLoopImplTiedPtr impl(&m_impl, new wxEventLoopImpl);
 
     gtk_main();
 
-    int exitcode = m_impl->GetExitCode();
-    delete m_impl;
-    m_impl = NULL;
+    OnExit();
 
-    return exitcode;
+    return m_impl->GetExitCode();
 }
 
 void wxEventLoop::Exit(int rc)
@@ -98,7 +102,7 @@ bool wxEventLoop::Pending() const
     {
         // We need to remove idle callbacks or gtk_events_pending will
         // never return false.
-        wxTheApp->RemoveIdleTag();
+        wxTheApp->SuspendIdleCallback();
     }
 
     return gtk_events_pending();
@@ -106,10 +110,9 @@ bool wxEventLoop::Pending() const
 
 bool wxEventLoop::Dispatch()
 {
-    wxCHECK_MSG( IsRunning(), FALSE, _T("can't call Dispatch() if not running") );
+    wxCHECK_MSG( IsRunning(), false, _T("can't call Dispatch() if not running") );
 
     gtk_main_iteration();
 
-    return TRUE;
+    return true;
 }
-