X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/923d28da0eed674dfd7f4a497568ac14a29f0189..2e334012b4babcf063fbe79540c4c154cd54ab2b:/src/cocoa/icon.mm diff --git a/src/cocoa/icon.mm b/src/cocoa/icon.mm index d385c6d9c7..44983b7272 100644 --- a/src/cocoa/icon.mm +++ b/src/cocoa/icon.mm @@ -14,10 +14,9 @@ #include "wx/icon.h" #ifndef WX_PRECOMP + #include "wx/bitmap.h" #endif //WX_PRECOMP -#include "wx/bitmap.h" - #include "wx/cocoa/autorelease.h" #import @@ -33,6 +32,8 @@ public: wxIconRefData( const wxIconRefData& data ); virtual ~wxIconRefData(); + virtual bool IsOk() const { return m_ok; } + protected: int m_width; int m_height; @@ -99,7 +100,17 @@ wxIcon::~wxIcon() { } -bool wxIcon::CreateFromXpm(const char **xpm) +wxGDIRefData *wxIcon::CreateGDIRefData() const +{ + return new wxIconRefData; +} + +wxGDIRefData *wxIcon::CloneGDIRefData(const wxGDIRefData *data) const +{ + return new wxIconRefData(*wx_static_cast(const wxIconRefData *, data)); +} + +bool wxIcon::CreateFromXpm(const char* const* xpm) { wxBitmap bitmap(xpm); CopyFromBitmap(bitmap); @@ -109,17 +120,9 @@ bool wxIcon::CreateFromXpm(const char **xpm) bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type, int desiredWidth, int desiredHeight) { - UnRef(); - - m_refData = new wxIconRefData; - M_ICONDATA->m_width = 5; - M_ICONDATA->m_height = 5; - M_ICONDATA->m_cocoaNSImage = [[NSImage alloc] initWithSize:NSMakeSize(5,5)]; - M_ICONDATA->m_ok = true; - M_ICONDATA->m_numColors = 0; - M_ICONDATA->m_quality = 0; - - return false; + wxBitmap bitmap(filename, type); + CopyFromBitmap(bitmap); + return bitmap.Ok(); } void wxIcon::CopyFromBitmap(const wxBitmap& bitmap) @@ -135,11 +138,6 @@ void wxIcon::CopyFromBitmap(const wxBitmap& bitmap) M_ICONDATA->m_quality = 0; } -bool wxIcon::Ok() const -{ - return m_refData && M_ICONDATA->m_ok; -} - int wxIcon::GetWidth() const { if(!m_refData)