]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/icon.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxIcon class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "icon.h"
18 #if !USE_SHARED_LIBRARIES
19 IMPLEMENT_DYNAMIC_CLASS(wxIcon
, wxBitmap
)
27 wxIconRefData::wxIconRefData()
40 wxIconRefData::~wxIconRefData()
44 DisposeCIcon( m_hIcon
) ;
59 wxIcon::wxIcon(const char WXUNUSED(bits
)[], int WXUNUSED(width
), int WXUNUSED(height
))
63 wxIcon::wxIcon( const char **bits
, int width
, int height
)
67 wxIcon::wxIcon( char **bits
, int width
, int height
)
71 wxIcon::wxIcon(const wxString
& icon_file
, long flags
,
72 int desiredWidth
, int desiredHeight
)
75 LoadFile(icon_file
, flags
, desiredWidth
, desiredHeight
);
82 bool wxIcon::LoadFile(const wxString
& filename
, long type
,
83 int desiredWidth
, int desiredHeight
)
87 m_refData
= new wxIconRefData
;
89 wxBitmapHandler
*handler
= FindHandler(type
);
92 return handler
->LoadFile(this, filename
, type
, desiredWidth
, desiredHeight
);
97 IMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler
, wxBitmapHandler
)
99 bool wxICONResourceHandler::LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
100 int desiredWidth
, int desiredHeight
)
107 c2pstrcpy( (StringPtr
) theName
, name
) ;
109 strcpy( (char *) theName
, name
) ;
110 c2pstr( (char *) theName
) ;
113 Handle resHandle
= GetNamedResource( 'cicn' , theName
) ;
114 if ( resHandle
!= 0L )
116 GetResInfo( resHandle
, &theId
, &theType
, theName
) ;
117 ReleaseResource( resHandle
) ;
119 CIconHandle theIcon
= (CIconHandle
) GetCIcon( theId
) ;
122 M_ICONHANDLERDATA
->m_hIcon
= theIcon
;
123 M_ICONHANDLERDATA
->m_width
= 32 ;
124 M_ICONHANDLERDATA
->m_height
= 32 ;
126 M_ICONHANDLERDATA
->m_depth
= 8 ;
127 M_ICONHANDLERDATA
->m_ok
= true ;
128 M_ICONHANDLERDATA
->m_numColors
= 256 ;