// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "icon.h"
-#endif
-
#include "wx/wxprec.h"
#include "wx/icon.h"
-#if !USE_SHARED_LIBRARIES
IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
-#endif
#include "wx/image.h"
#include "wx/mac/private.h"
+#define M_ICONDATA ((wxIconRefData *)m_refData)
+
/*
* Icons
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();
+}
+
+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
}
else
{
+#if wxUSE_IMAGE
wxImage loadimage(filename, type);
if (loadimage.Ok())
{
CopyFromBitmap( bmp ) ;
return true;
}
+#endif
}
}
return true ;
{
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() ) ;
}
wxIconRefData::wxIconRefData( WXHICON icon )
{
m_iconRef = MAC_WXHICON( icon ) ;
+ // Std sizes
+ SetWidth( 32 ) ;
+ SetHeight( 32 ) ;
}
void wxIconRefData::Init()