]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/appcmn.cpp
Implement wxRendererMac::DrawItemSelectionRect and move the generic wxTreeCtrl to...
[wxWidgets.git] / src / common / appcmn.cpp
index fe6e9038106dd9520a8ed3f8f26a25fbde022316..ad67fbd657458c3b41d168e92e4321ebc61d1c38 100644 (file)
 #endif
 
 #ifndef WX_PRECOMP
 #endif
 
 #ifndef WX_PRECOMP
-    #include "wx/list.h"
     #include "wx/app.h"
     #include "wx/app.h"
+    #include "wx/window.h"
     #include "wx/bitmap.h"
     #include "wx/bitmap.h"
-    #include "wx/intl.h"
     #include "wx/log.h"
     #include "wx/msgdlg.h"
     #include "wx/log.h"
     #include "wx/msgdlg.h"
-    #include "wx/bitmap.h"
     #include "wx/confbase.h"
     #include "wx/confbase.h"
+    #include "wx/utils.h"
 #endif
 
 #include "wx/apptrait.h"
 #endif
 
 #include "wx/apptrait.h"
@@ -40,7 +39,7 @@
 #include "wx/evtloop.h"
 #include "wx/msgout.h"
 #include "wx/thread.h"
 #include "wx/evtloop.h"
 #include "wx/msgout.h"
 #include "wx/thread.h"
-#include "wx/utils.h"
+#include "wx/vidmode.h"
 #include "wx/ptr_scpd.h"
 
 #if defined(__WXMSW__)
 #include "wx/ptr_scpd.h"
 
 #if defined(__WXMSW__)
@@ -55,6 +54,7 @@
 #include "wx/build.h"
 WX_CHECK_BUILD_OPTIONS("wxCore")
 
 #include "wx/build.h"
 WX_CHECK_BUILD_OPTIONS("wxCore")
 
+WXDLLIMPEXP_DATA_CORE(wxList) wxPendingDelete;
 
 // ----------------------------------------------------------------------------
 // wxEventLoopPtr
 
 // ----------------------------------------------------------------------------
 // wxEventLoopPtr
@@ -74,7 +74,10 @@ wxDEFINE_TIED_SCOPED_PTR_TYPE(wxEventLoop)
 wxAppBase::wxAppBase()
 {
     m_topWindow = (wxWindow *)NULL;
 wxAppBase::wxAppBase()
 {
     m_topWindow = (wxWindow *)NULL;
+    
     m_useBestVisual = false;
     m_useBestVisual = false;
+    m_forceTrueColour = false;
+    
     m_isActive = true;
 
     m_mainLoop = NULL;
     m_isActive = true;
 
     m_mainLoop = NULL;
@@ -157,6 +160,41 @@ void wxAppBase::CleanUp()
 #endif // wxUSE_THREADS
 }
 
 #endif // wxUSE_THREADS
 }
 
+// ----------------------------------------------------------------------------
+// various accessors
+// ----------------------------------------------------------------------------
+
+wxWindow* wxAppBase::GetTopWindow() const
+{
+    wxWindow* window = m_topWindow;
+    if (window == NULL && wxTopLevelWindows.GetCount() > 0)
+        window = wxTopLevelWindows.GetFirst()->GetData();
+    return window;
+}
+
+wxVideoMode wxAppBase::GetDisplayMode() const
+{
+    return wxVideoMode();
+}
+
+wxLayoutDirection wxAppBase::GetLayoutDirection() const
+{
+#if wxUSE_INTL
+    const wxLocale *const locale = wxGetLocale();
+    if ( locale )
+    {
+        const wxLanguageInfo *const
+            info = wxLocale::GetLanguageInfo(locale->GetLanguage());
+
+        if ( info )
+            return info->LayoutDirection;
+    }
+#endif // wxUSE_INTL
+
+    // we don't know
+    return wxLayout_Default;
+}
+
 #if wxUSE_CMDLINE_PARSER
 
 // ----------------------------------------------------------------------------
 #if wxUSE_CMDLINE_PARSER
 
 // ----------------------------------------------------------------------------
@@ -366,11 +404,14 @@ void wxAppBase::DeletePendingObjects()
     {
         wxObject *obj = node->GetData();
 
     {
         wxObject *obj = node->GetData();
 
-        delete obj;
-
-        if (wxPendingDelete.Member(obj))
+        // remove it from the list first so that if we get back here somehow
+        // during the object deletion (e.g. wxYield called from its dtor) we
+        // wouldn't try to delete it the second time
+        if ( wxPendingDelete.Member(obj) )
             wxPendingDelete.Erase(node);
 
             wxPendingDelete.Erase(node);
 
+        delete obj;
+
         // Deleting one object may have deleted other pending
         // objects, so start from beginning of list again.
         node = wxPendingDelete.GetFirst();
         // Deleting one object may have deleted other pending
         // objects, so start from beginning of list again.
         node = wxPendingDelete.GetFirst();