X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ea68b7060519bc63646e39fc76a963ecd04e667e..3b9b80c0e25ac0ef0d162b2a8e2d8206105a485b:/src/mac/carbon/icon.cpp?ds=sidebyside diff --git a/src/mac/carbon/icon.cpp b/src/mac/carbon/icon.cpp index 796a5c8cde..956d8f72c3 100644 --- a/src/mac/carbon/icon.cpp +++ b/src/mac/carbon/icon.cpp @@ -17,9 +17,7 @@ #include "wx/icon.h" -#if !USE_SHARED_LIBRARIES IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap) -#endif #include "wx/image.h" #include "wx/mac/private.h" @@ -83,6 +81,22 @@ int wxIcon::GetHeight() const return M_ICONDATA->GetHeight(); } +int wxIcon::GetDepth() const{ + return 32; +} + +void wxIcon::SetDepth(int depth){ + +} + +void wxIcon::SetWidth(int width){ + +} + +void wxIcon::SetHeight(int height){ + +} + bool wxIcon::Ok() const { return m_refData != NULL ; @@ -154,6 +168,7 @@ bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type, } else { +#if wxUSE_IMAGE wxImage loadimage(filename, type); if (loadimage.Ok()) { @@ -167,6 +182,7 @@ bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type, CopyFromBitmap( bmp ) ; return true; } +#endif } } return true ; @@ -176,7 +192,10 @@ void wxIcon::CopyFromBitmap(const wxBitmap& bmp) { UnRef() ; - m_refData = new wxIconRefData( (WXHICON) wxMacCreateIconRef( bmp ) ) ; + // as the bitmap owns that ref, we have to acquire it as well + IconRef iconRef = bmp.GetBitmapData()->GetIconRef() ; + AcquireIconRef( iconRef ) ; + m_refData = new wxIconRefData( (WXHICON) iconRef ) ; M_ICONDATA->SetWidth( bmp.GetWidth() ) ; M_ICONDATA->SetHeight( bmp.GetHeight() ) ; }