]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/volume.cpp
Some improvements to accessibility behaviour
[wxWidgets.git] / src / msw / volume.cpp
index df62ac3e97cdde6467e41e67c52cbf0bd41b4234..628dc4e66ca94f85a8807e17991a5aef7f077201 100644 (file)
 
 #include "wx/volume.h"
 
-// Win32 headers
-#include <shlobj.h>
+#include <shellapi.h>
+
+#ifndef SHGetFileInfo
+#ifdef UNICODE
+#define SHGetFileInfo SHGetFileInfoW
+#else
+#define SHGetFileInfo SHGetFileInfoA
+#endif
+#endif
 
 #ifndef SHGFI_ATTRIBUTES
     #define SHGFI_ATTRIBUTES 2048
@@ -95,21 +102,38 @@ static WNetCloseEnumPtr s_pWNetCloseEnum;
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 static long s_cancelSearch = FALSE;
 
-struct FileInfo : public wxObject
+struct FileInfo
 {
     FileInfo(unsigned flag=0, wxFSVolumeKind type=wxFS_VOL_OTHER) :
         m_flags(flag), m_type(type) {}
+
+    FileInfo(const FileInfo& other) { *this = other; }
+    FileInfo& operator=(const FileInfo& other)
+    {
+        m_flags = other.m_flags;
+        m_type = other.m_type;
+        return *this;
+    }
+
     unsigned m_flags;
     wxFSVolumeKind m_type;
 };
 WX_DECLARE_STRING_HASH_MAP(FileInfo, FileInfoMap);
-static FileInfoMap s_fileInfo(25);
+// Cygwin bug (?) destructor for global s_fileInfo is called twice...
+static FileInfoMap& GetFileInfoMap()
+{
+    static FileInfoMap s_fileInfo(25);
+
+    return s_fileInfo;
+}
+#define s_fileInfo (GetFileInfoMap())
 
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 // Other initialization.
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 #if wxUSE_GUI
-WX_DEFINE_OBJARRAY(wxIconArray);
+// already in wx/iconbndl.h
+// WX_DEFINE_OBJARRAY(wxIconArray);
 #endif
 
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -405,7 +429,7 @@ wxArrayString wxFSVolume::GetVolumes(int flagsSet, int flagsUnset)
     {
 #ifdef UNICODE
         s_pWNetOpenEnum = (WNetOpenEnumPtr)s_mprLib.GetSymbol(_T("WNetOpenEnumW"));
-        s_pWNetEnumResource = (WNetEnumResourcePtr)s_mprLib.GetSymbol("WNetEnumResourceW");
+        s_pWNetEnumResource = (WNetEnumResourcePtr)s_mprLib.GetSymbol(_T("WNetEnumResourceW"));
 #else
         s_pWNetOpenEnum = (WNetOpenEnumPtr)s_mprLib.GetSymbol(_T("WNetOpenEnumA"));
         s_pWNetEnumResource = (WNetEnumResourcePtr)s_mprLib.GetSymbol(_T("WNetEnumResourceA"));