1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxIcon class
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 #include "wx/bitmap.h"
20 #include "wx/os2/gdiimage.h"
22 #define wxIconRefDataBase wxGDIImageRefData
23 #define wxIconBase wxGDIImage
25 class WXDLLIMPEXP_CORE wxIconRefData
: public wxIconRefDataBase
29 virtual ~wxIconRefData() { Free(); }
34 // ---------------------------------------------------------------------------
36 // ---------------------------------------------------------------------------
38 class WXDLLIMPEXP_CORE wxIcon
: public wxIconBase
43 wxIcon( const char bits
[]
47 wxIcon(const char* const* ppData
) { CreateIconFromXpm(ppData
); }
49 wxIcon(char** ppData
) { CreateIconFromXpm(wx_const_cast(const char* const*, ppData
)); }
51 wxIcon( const wxString
& rName
52 ,wxBitmapType lFlags
= wxICON_DEFAULT_TYPE
53 ,int nDesiredWidth
= -1
54 ,int nDesiredHeight
= -1
56 wxIcon(const wxIconLocation
& loc
)
58 LoadFile(loc
.GetFileName(), wxBITMAP_TYPE_ICO
);
63 bool LoadFile( const wxString
& rName
64 ,wxBitmapType lFlags
= wxICON_DEFAULT_TYPE
65 ,int nDesiredWidth
= -1
66 ,int nDesiredHeight
= -1
69 wxIconRefData
*GetIconData() const { return (wxIconRefData
*)m_refData
; }
71 inline void SetHICON(WXHICON hIcon
) { SetHandle((WXHANDLE
)hIcon
); }
72 inline WXHICON
GetHICON() const { return (WXHICON
)GetHandle(); }
73 inline bool IsXpm(void) const { return m_bIsXpm
; };
74 inline const wxBitmap
& GetXpmSrc(void) const { return m_vXpmSrc
; }
76 void CopyFromBitmap(const wxBitmap
& rBmp
);
78 virtual wxGDIImageRefData
* CreateData() const
80 return new wxIconRefData
;
82 void CreateIconFromXpm(const char* const* ppData
);
88 DECLARE_DYNAMIC_CLASS(wxIcon
)