]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed enhanced metafiles loading from files
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 16 Oct 2004 13:31:27 +0000 (13:31 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 16 Oct 2004 13:31:27 +0000 (13:31 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29915 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/enhmeta.h
src/msw/enhmeta.cpp

index b5469627d60b097b00300c9042814c43a4b6d631..7778969adc2fe5fbb2bd047603fe5c5618e5f71d 100644 (file)
@@ -61,7 +61,7 @@ public:
     void SetHENHMETAFILE(WXHANDLE hMF) { Free(); m_hMF = hMF; }
 
 protected:
-    void Init() { m_hMF = 0; }
+    void Init();
     void Free();
     void Assign(const wxEnhMetaFile& mf);
 
index 1767d356f291bd2610b3d28033d79fa5863b9850..cbb8acc6bf3f6959b0243dd982d4e9a858a9e6ce 100644 (file)
@@ -70,6 +70,21 @@ static inline const wxChar *GetMetaFileName(const wxString& fn)
 // wxEnhMetaFile
 // ----------------------------------------------------------------------------
 
+void wxEnhMetaFile::Init()
+{
+    if ( m_filename.empty() )
+    {
+        m_hMF = 0;
+    }
+    else // have valid file name, load metafile from it
+    {
+        m_hMF = GetEnhMetaFile(m_filename);
+        if ( !m_hMF )
+            wxLogSysError(_("Failed to load metafile from file \"%s\"."),
+                          m_filename.c_str());
+    }
+}
+
 void wxEnhMetaFile::Assign(const wxEnhMetaFile& mf)
 {
     if ( &mf == this )