X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/894d6c9abdac7b7b9ec02caa881db53607ccb99f..9d5507f7a2701395e1d5c121bd877bb9066ee6ea:/src/cocoa/icon.mm diff --git a/src/cocoa/icon.mm b/src/cocoa/icon.mm index d8c612aab1..91b059ba59 100644 --- a/src/cocoa/icon.mm +++ b/src/cocoa/icon.mm @@ -6,14 +6,16 @@ // Created: 2003/08/11 // RCS-ID: $Id$ // Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence +// Licence: wxWidgets licence ///////////////////////////////////////////////////////////////////////////// #include "wx/wxprec.h" + +#include "wx/icon.h" + #ifndef WX_PRECOMP - #include "wx/icon.h" + #include "wx/bitmap.h" #endif //WX_PRECOMP -#include "wx/bitmap.h" #include "wx/cocoa/autorelease.h" @@ -44,7 +46,7 @@ protected: wxIconRefData::wxIconRefData() { - m_ok = FALSE; + m_ok = false; m_width = 0; m_height = 0; m_depth = 0; @@ -106,17 +108,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) @@ -132,7 +126,7 @@ void wxIcon::CopyFromBitmap(const wxBitmap& bitmap) M_ICONDATA->m_quality = 0; } -bool wxIcon::Ok() const +bool wxIcon::IsOk() const { return m_refData && M_ICONDATA->m_ok; } @@ -157,4 +151,3 @@ WX_NSImage wxIcon::GetNSImage() const return nil; return M_ICONDATA->m_cocoaNSImage; } -