1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxIcon class
4 // Author: David Webster
7 // Copyright: (c) David Webster
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
18 #include "wx/bitmap.h"
19 #include "wx/os2/gdiimage.h"
21 #define wxIconRefDataBase wxGDIImageRefData
22 #define wxIconBase wxGDIImage
24 class WXDLLIMPEXP_CORE wxIconRefData
: public wxIconRefDataBase
28 virtual ~wxIconRefData() { Free(); }
33 // ---------------------------------------------------------------------------
35 // ---------------------------------------------------------------------------
37 class WXDLLIMPEXP_CORE wxIcon
: public wxIconBase
42 wxIcon( const char bits
[]
46 wxIcon(const char* const* ppData
) { CreateIconFromXpm(ppData
); }
48 wxIcon(char** ppData
) { CreateIconFromXpm(const_cast<const char* const*>(ppData
)); }
50 wxIcon( const wxString
& rName
51 ,wxBitmapType lFlags
= wxICON_DEFAULT_TYPE
52 ,int nDesiredWidth
= -1
53 ,int nDesiredHeight
= -1
55 wxIcon(const wxIconLocation
& loc
)
57 LoadFile(loc
.GetFileName(), wxBITMAP_TYPE_ICO
);
62 bool LoadFile( const wxString
& rName
63 ,wxBitmapType lFlags
= wxICON_DEFAULT_TYPE
64 ,int nDesiredWidth
= -1
65 ,int nDesiredHeight
= -1
68 wxIconRefData
*GetIconData() const { return (wxIconRefData
*)m_refData
; }
70 inline void SetHICON(WXHICON hIcon
) { SetHandle((WXHANDLE
)hIcon
); }
71 inline WXHICON
GetHICON() const { return (WXHICON
)GetHandle(); }
72 inline bool IsXpm(void) const { return m_bIsXpm
; }
73 inline const wxBitmap
& GetXpmSrc(void) const { return m_vXpmSrc
; }
75 void CopyFromBitmap(const wxBitmap
& rBmp
);
77 virtual wxGDIImageRefData
* CreateData() const
79 return new wxIconRefData
;
81 void CreateIconFromXpm(const char* const* ppData
);
87 DECLARE_DYNAMIC_CLASS(wxIcon
)