]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/icon.cpp
Initial revision
[wxWidgets.git] / src / msw / icon.cpp
index c0070fc7131022832a307ba28e8bd97cd7866df9..564a07d875f502a670da1c12eb236c2869011640 100644 (file)
@@ -17,7 +17,7 @@
 // headers
 // ----------------------------------------------------------------------------
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
     #pragma implementation "icon.h"
 #endif
 
@@ -85,10 +85,42 @@ wxIcon::wxIcon(const wxString& iconfile,
     LoadFile(iconfile, flags, desiredWidth, desiredHeight);
 }
 
+wxIcon::wxIcon(const wxIconLocation& loc)
+{
+    // wxICOFileHandler accepts names in the format "filename;index"
+    wxString fullname = loc.GetFileName();
+    if ( loc.GetIndex() )
+    {
+        fullname << _T(';') << loc.GetIndex();
+    }
+    //else: 0 is default
+
+    LoadFile(fullname, wxBITMAP_TYPE_ICO);
+}
+
 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);
+    self->UnRef();
+    self->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__
@@ -122,7 +154,7 @@ bool wxIcon::LoadFile(const wxString& filename,
     if ( !handler )
     {
         // say something?
-        return FALSE;
+        return false;
     }
 
     return handler->Load(this, filename, type, desiredWidth, desiredHeight);