]>
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 #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 wxString
& icon_file
, long flags
,
64 int desiredWidth
, int desiredHeight
)
67 LoadFile(icon_file
, flags
, desiredWidth
, desiredHeight
);
74 bool wxIcon::LoadFile(const wxString
& filename
, long type
,
75 int desiredWidth
, int desiredHeight
)
79 m_refData
= new wxIconRefData
;
81 wxBitmapHandler
*handler
= FindHandler(type
);
84 return handler
->LoadFile(this, filename
, type
, desiredWidth
, desiredHeight
);
89 IMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler
, wxBitmapHandler
)
91 bool wxICONResourceHandler::LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
92 int desiredWidth
, int desiredHeight
)
97 strcpy( (char*) theName
, name
) ;
98 c2pstr( (char*) theName
) ;
100 Handle resHandle
= GetNamedResource( 'cicn' , theName
) ;
101 GetResInfo( resHandle
, &theId
, &theType
, theName
) ;
102 ReleaseResource( resHandle
) ;
104 CIconHandle theIcon
= (CIconHandle
) GetCIcon( theId
) ;
107 M_ICONHANDLERDATA
->m_hIcon
= theIcon
;
108 M_ICONHANDLERDATA
->m_width
= 32 ;
109 M_ICONHANDLERDATA
->m_height
= 32 ;
111 M_ICONHANDLERDATA
->m_depth
= 8 ;
112 M_ICONHANDLERDATA
->m_ok
= true ;
113 M_ICONHANDLERDATA
->m_numColors
= 256 ;