]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/mimecmn.cpp
use "event-after" signal to send thumb release event
[wxWidgets.git] / src / common / mimecmn.cpp
index 3ac318ce0bf3a76c3d63f987e0f2292f2bde9a6c..680d57fc28843f735cde1ab9f715634d45022352 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        common/mimecmn.cpp
+// Name:        src/common/mimecmn.cpp
 // Purpose:     classes and functions to manage MIME types
 // Author:      Vadim Zeitlin
 // Modified by:
 // headers
 // ----------------------------------------------------------------------------
 
-#ifdef    __GNUG__
-    #pragma implementation "mimetypebase.h"
-#endif
-
 // for compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 
 #if wxUSE_MIMETYPE
 
+#include "wx/mimetype.h"
+
 #ifndef WX_PRECOMP
-  #include "wx/string.h"
+    #include "wx/dynarray.h"
+    #include "wx/string.h"
+    #include "wx/intl.h"
+    #include "wx/log.h"
 #endif //WX_PRECOMP
 
 #include "wx/module.h"
-#include "wx/log.h"
 #include "wx/file.h"
 #include "wx/iconloc.h"
-#include "wx/intl.h"
-#include "wx/dynarray.h"
 #include "wx/confbase.h"
 
-#include "wx/mimetype.h"
-
 // other standard headers
 #include <ctype.h>
 
@@ -85,7 +81,17 @@ wxFileTypeInfo::wxFileTypeInfo(const wxChar *mimeType,
 
     for ( ;; )
     {
+        // icc gives this warning in its own va_arg() macro, argh
+#ifdef __INTELC__
+    #pragma warning(push)
+    #pragma warning(disable: 1684)
+#endif
+
         const wxChar *ext = va_arg(argptr, const wxChar *);
+
+#ifdef __INTELC__
+    #pragma warning(pop)
+#endif
         if ( !ext )
         {
             // NULL terminates the list
@@ -114,7 +120,7 @@ wxFileTypeInfo::wxFileTypeInfo(const wxArrayString& sArray)
 }
 
 #include "wx/arrimpl.cpp"
-WX_DEFINE_OBJARRAY(wxArrayFileTypeInfo);
+WX_DEFINE_OBJARRAY(wxArrayFileTypeInfo)
 
 // ============================================================================
 // implementation of the wrapper classes
@@ -447,6 +453,33 @@ bool wxFileType::SetDefaultIcon(const wxString& cmd, int index)
 #endif
 }
 
+// ----------------------------------------------------------------------------
+// wxMimeTypesManagerFactory
+// ----------------------------------------------------------------------------
+
+wxMimeTypesManagerFactory *wxMimeTypesManagerFactory::m_factory = NULL;
+
+/* static */
+void wxMimeTypesManagerFactory::Set(wxMimeTypesManagerFactory *factory)
+{
+    delete m_factory;
+
+    m_factory = factory;
+}
+
+/* static */
+wxMimeTypesManagerFactory *wxMimeTypesManagerFactory::Get()
+{
+    if ( !m_factory )
+        m_factory = new wxMimeTypesManagerFactory;
+
+    return m_factory;
+}
+
+wxMimeTypesManagerImpl *wxMimeTypesManagerFactory::CreateMimeTypesManagerImpl()
+{
+    return new wxMimeTypesManagerImpl;
+}
 
 // ----------------------------------------------------------------------------
 // wxMimeTypesManager
@@ -455,7 +488,7 @@ bool wxFileType::SetDefaultIcon(const wxString& cmd, int index)
 void wxMimeTypesManager::EnsureImpl()
 {
     if ( !m_impl )
-        m_impl = new wxMimeTypesManagerImpl;
+        m_impl = wxMimeTypesManagerFactory::Get()->CreateMimeTypesManagerImpl();
 }
 
 bool wxMimeTypesManager::IsOfType(const wxString& mimeType,
@@ -639,10 +672,12 @@ class wxMimeTypeCmnModule: public wxModule
 {
 public:
     wxMimeTypeCmnModule() : wxModule() { }
+
     virtual bool OnInit() { return true; }
     virtual void OnExit()
     {
-        // this avoids false memory leak allerts:
+        wxMimeTypesManagerFactory::Set(NULL);
+
         if ( gs_mimeTypesManager.m_impl != NULL )
         {
             delete gs_mimeTypesManager.m_impl;