]> git.saurik.com Git - wxWidgets.git/commitdiff
icon - bitmap conversions corrections (size is not always the 'standard' 32 pixels)
authorStefan Csomor <csomor@advancedconcepts.ch>
Tue, 15 Feb 2005 06:05:52 +0000 (06:05 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Tue, 15 Feb 2005 06:05:52 +0000 (06:05 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32059 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/icon.cpp

index 914b40b46bb7d8302a2a84305406d0578f856dff..796a5c8cdebcc435012f12117f8f5066234322f9 100644 (file)
@@ -24,6 +24,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
 #include "wx/image.h"
 #include "wx/mac/private.h"
 
+#define M_ICONDATA ((wxIconRefData *)m_refData)
+
 
 /*
  * Icons
@@ -69,12 +71,16 @@ WXHICON wxIcon::GetHICON() const
 
 int wxIcon::GetWidth() const
 {
-    return 32 ;
+   wxCHECK_MSG( Ok(), -1, wxT("invalid icon") );
+
+   return M_ICONDATA->GetWidth();
 }
 
 int wxIcon::GetHeight() const
 {
-    return 32 ;
+   wxCHECK_MSG( Ok(), -1, wxT("invalid icon") );
+
+   return M_ICONDATA->GetHeight();
 }
 
 bool wxIcon::Ok() const
@@ -171,11 +177,16 @@ void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
     UnRef() ;
     
     m_refData = new wxIconRefData( (WXHICON) wxMacCreateIconRef( bmp ) ) ;
+    M_ICONDATA->SetWidth( bmp.GetWidth() ) ;
+    M_ICONDATA->SetHeight( bmp.GetHeight() ) ;
 }
 
 wxIconRefData::wxIconRefData( WXHICON icon )
 {
     m_iconRef = MAC_WXHICON( icon ) ;
+    // Std sizes
+    SetWidth( 32 ) ;
+    SetHeight( 32 ) ;
 }
 
 void wxIconRefData::Init()