]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/icon.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxIcon class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "icon.h"
18 IMPLEMENT_DYNAMIC_CLASS(wxIcon
, wxBitmap
)
25 wxIconRefData::wxIconRefData()
38 wxIconRefData::~wxIconRefData()
42 DisposeCIcon( m_hIcon
) ;
57 wxIcon::wxIcon(const char WXUNUSED(bits
)[], int WXUNUSED(width
), int WXUNUSED(height
))
61 wxIcon::wxIcon(const wxString
& icon_file
, long flags
,
62 int desiredWidth
, int desiredHeight
)
65 LoadFile(icon_file
, flags
, desiredWidth
, desiredHeight
);
72 bool wxIcon::LoadFile(const wxString
& filename
, long type
,
73 int desiredWidth
, int desiredHeight
)
77 m_refData
= new wxIconRefData
;
79 wxBitmapHandler
*handler
= FindHandler(type
);
82 return handler
->LoadFile(this, filename
, type
, desiredWidth
, desiredHeight
);
87 IMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler
, wxBitmapHandler
)
89 bool wxICONResourceHandler::LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
90 int desiredWidth
, int desiredHeight
)
95 strcpy( (char*) theName
, name
) ;
96 c2pstr( (char*) theName
) ;
98 Handle resHandle
= GetNamedResource( 'cicn' , theName
) ;
99 GetResInfo( resHandle
, &theId
, &theType
, theName
) ;
100 ReleaseResource( resHandle
) ;
102 CIconHandle theIcon
= (CIconHandle
) GetCIcon( theId
) ;
105 M_ICONHANDLERDATA
->m_hIcon
= theIcon
;
106 M_ICONHANDLERDATA
->m_width
= 32 ;
107 M_ICONHANDLERDATA
->m_height
= 32 ;
109 M_ICONHANDLERDATA
->m_depth
= 8 ;
110 M_ICONHANDLERDATA
->m_ok
= true ;
111 M_ICONHANDLERDATA
->m_numColors
= 256 ;