fixed CopyFromBitmap() for shared wxIcon objects by adding CloneRefData() implementat...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 11 Sep 2004 20:26:44 +0000 (20:26 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 11 Sep 2004 20:26:44 +0000 (20:26 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29099 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

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

index ac8695bdb709a7873a28a2276993c8952096e1b4..3a4dab9ba190070784ed1ccfea186a7abadff135 100644 (file)
@@ -96,6 +96,8 @@ protected:
         return new wxIconRefData;
     }
 
+    virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
+
     // create from XPM data
     void CreateIconFromXpm(const char **data);
 
index 658c537e8867091d394176c2f622f7ed5fc62980..5cab68a51cfa9d354399a005bc43fdac924e5da9 100644 (file)
@@ -102,6 +102,25 @@ wxIcon::~wxIcon()
 {
 }
 
+wxObjectRefData *wxIcon::CloneRefData(const wxObjectRefData *dataOrig) const
+{
+    const wxIconRefData *
+        data = wx_static_cast(const wxIconRefData *, dataOrig);
+    if ( !data )
+        return NULL;
+
+    wxIcon *self = wx_const_cast(wxIcon *, this);
+    lf->UnRef();
+    lf->m_refData = new wxIconRefData(*data);
+
+    if ( data->m_hIcon )
+    {
+        ::CopyIcon(HICON(data->m_hIcon));
+    }
+
+    return m_refData;
+}
+
 void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
 {
 #ifndef __WXMICROWIN__