]> git.saurik.com Git - wxWidgets.git/commitdiff
made IsMainLoopRunning() static and implemented it for wxAppConsole too
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 4 Oct 2004 20:21:44 +0000 (20:21 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 4 Oct 2004 20:21:44 +0000 (20:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29655 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/app.tex
include/wx/app.h
src/common/http.cpp

index ea9a161210dab88c0d36e443106cefe094246eb0..49a09ab262e16ad28fd9a37818fbbf71556a3008 100644 (file)
@@ -209,7 +209,7 @@ to do it.
 
 \membersection{wxApp::IsMainLoopRunning}\label{wxappismainlooprunning}
 
-\constfunc{bool}{IsMainLoopRunning}{\void}
+\func{static bool}{IsMainLoopRunning}{\void}
 
 Returns \true if the main event loop is currently running, i.e. if the
 application is inside \helpref{OnRun}{wxapponrun}.
index 4eae440186f8fee3691237cba975e648c8ababd7..29f9f34c1886d2c76c5a6ab7877acd8ac14e51df 100644 (file)
@@ -251,6 +251,10 @@ public:
     // make sure that idle events are sent again
     virtual void WakeUpIdle() { }
 
+    // this is just a convenience: by providing its implementation here we
+    // avoid #ifdefs in the code using it
+    static bool IsMainLoopRunning() { return false; }
+
 
     // debugging support
     // -----------------
@@ -378,10 +382,11 @@ public:
 
         // return true if we're running main loop, i.e. if the events can
         // (already) be dispatched
-    bool IsMainLoopRunning() const
+    static bool IsMainLoopRunning()
     {
 #if wxUSE_EVTLOOP_IN_APP
-        return m_mainLoop != NULL;
+        wxAppBase *app = wx_static_cast(wxAppBase *, GetInstance());
+        return app && app->m_mainLoop != NULL;
 #else
         return false;
 #endif
index 259678ef7bfbb26344d619805919d6e6b8297825..bea35a2335963372292749c054322afe58671b51 100644 (file)
@@ -239,9 +239,8 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req)
   SaveState();
 
   // we may use non blocking sockets only if we can dispatch events from them
-  SetFlags( wxIsMainThread() && (wxTheApp && wxTheApp->IsMainLoopRunning())
-                ? wxSOCKET_NONE
-                : wxSOCKET_BLOCK );
+  SetFlags( wxIsMainThread() && wxApp::IsMainLoopRunning() ? wxSOCKET_NONE
+                                                           : wxSOCKET_BLOCK );
   Notify(false);
 
   wxString buf;