]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/app.cpp
toplevel code transferred to wxTopLevelWindow
[wxWidgets.git] / src / gtk / app.cpp
index 38d4d1e75fdbd68a27c8c32b2d11363a342cabb1..f5afdd777c4d3df24cc61de7e534af908fd7c434 100644 (file)
 #include "wx/module.h"
 #include "wx/image.h"
 
+#ifdef __WXUNIVERSAL__
+    #include "wx/univ/theme.h"
+    #include "wx/univ/renderer.h"
+#endif
+
 #if wxUSE_THREADS
     #include "wx/thread.h"
 #endif
 
 #include <unistd.h>
+#include "wx/gtk/win_gtk.h"
 
-#include <glib.h>
-#include <gdk/gdk.h>
 #include <gtk/gtk.h>
-#include <gdk/gdkx.h>
 
-#include "wx/gtk/win_gtk.h"
 
 //-----------------------------------------------------------------------------
 // global data
@@ -81,10 +83,21 @@ void wxExit()
 // wxYield
 //-----------------------------------------------------------------------------
 
-static bool gs_inYield = FALSE;
-
-bool wxYield()
+bool wxApp::Yield(bool onlyIfNeeded)
 {
+    // MT-FIXME
+    static bool s_inYield = FALSE;
+
+    if ( s_inYield )
+    {
+        if ( !onlyIfNeeded )
+        {
+            wxFAIL_MSG( wxT("wxYield called recursively" ) );
+        }
+
+        return FALSE;
+    }
+
 #if wxUSE_THREADS
     if ( !wxThread::IsMain() )
     {
@@ -93,19 +106,14 @@ bool wxYield()
     }
 #endif // wxUSE_THREADS
 
-#ifdef __WXDEBUG__
-    if (gs_inYield)
-        wxFAIL_MSG( wxT("wxYield called recursively" ) );
-#endif
-
-    gs_inYield = TRUE;
+    s_inYield = TRUE;
 
     if (!g_isIdle)
     {
         // We need to remove idle callbacks or the loop will
         // never finish.
-        gtk_idle_remove( wxTheApp->m_idleTag );
-        wxTheApp->m_idleTag = 0;
+        gtk_idle_remove( m_idleTag );
+        m_idleTag = 0;
         g_isIdle = TRUE;
     }
 
@@ -119,29 +127,18 @@ bool wxYield()
     /* it's necessary to call ProcessIdle() to update the frames sizes which
        might have been changed (it also will update other things set from
        OnUpdateUI() which is a nice (and desired) side effect) */
-    while (wxTheApp->ProcessIdle()) { }
+    while ( ProcessIdle() )
+    {
+    }
 
     // let the logs be flashed again
     wxLog::Resume();
 
-    gs_inYield = FALSE;
+    s_inYield = FALSE;
 
     return TRUE;
 }
 
-//-----------------------------------------------------------------------------
-// wxYieldIfNeeded
-// Like wxYield, but fails silently if the yield is recursive.
-//-----------------------------------------------------------------------------
-
-bool wxYieldIfNeeded()
-{
-    if (gs_inYield)
-        return FALSE;
-
-    return wxYield();
-}
-
 //-----------------------------------------------------------------------------
 // wxWakeUpIdle
 //-----------------------------------------------------------------------------
@@ -682,8 +679,8 @@ GtkWidget* wxGetRootWindow()
 // wxEntry
 //-----------------------------------------------------------------------------
 
-
-int wxEntryStart( int argc, char *argv[] )
+// NB: argc and argv may be changed here, pass by reference!
+int wxEntryStart( int& argc, char *argv[] )
 {
 #if wxUSE_THREADS
     /* GTK 1.2 up to version 1.2.3 has broken threads */
@@ -862,13 +859,14 @@ int wxEntry( int argc, char *argv[] )
     return retValue;
 }
 
+#ifndef __WXUNIVERSAL__
+
 #include "wx/gtk/info.xpm"
 #include "wx/gtk/error.xpm"
 #include "wx/gtk/question.xpm"
 #include "wx/gtk/warning.xpm"
 
-wxIcon
-wxApp::GetStdIcon(int which) const
+wxIcon wxApp::GetStdIcon(int which) const
 {
     switch(which)
     {
@@ -889,6 +887,13 @@ wxApp::GetStdIcon(int which) const
             return wxIcon(error_xpm);
     }
 }
+#else
+wxIcon wxApp::GetStdIcon(int which) const
+{
+    return wxTheme::Get()->GetRenderer()->GetStdIcon(which);
+}
+#endif // !__WXUNIVERSAL__
+
 
 #ifdef __WXDEBUG__