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 WXDLLEXPORT wxIconRefData
: public wxIconRefDataBase
29 virtual ~wxIconRefData() { Free(); }
34 // ---------------------------------------------------------------------------
36 // ---------------------------------------------------------------------------
38 class WXDLLEXPORT wxIcon
: public wxIconBase
43 wxIcon( const char bits
[]
47 inline wxIcon(const char** ppData
) { CreateIconFromXpm(ppData
); }
48 inline wxIcon(char** ppData
) { CreateIconFromXpm((const char**)ppData
); }
49 wxIcon( const wxString
& rName
50 ,long lFlags
= wxBITMAP_TYPE_ICO_RESOURCE
51 ,int nDesiredWidth
= -1
52 ,int nDesiredHeight
= -1
54 wxIcon(const wxIconLocation
& loc
)
56 LoadFile(loc
.GetFileName(), wxBITMAP_TYPE_ICO
);
61 bool LoadFile( const wxString
& rName
62 ,long lFlags
= wxBITMAP_TYPE_ICO_RESOURCE
63 ,int nDesiredWidth
= -1
64 ,int nDesiredHeight
= -1
67 wxIconRefData
*GetIconData() const { return (wxIconRefData
*)m_refData
; }
69 inline void SetHICON(WXHICON hIcon
) { SetHandle((WXHANDLE
)hIcon
); }
70 inline WXHICON
GetHICON() const { return (WXHICON
)GetHandle(); }
71 inline bool IsXpm(void) const { return m_bIsXpm
; };
72 inline const wxBitmap
& GetXpmSrc(void) const { return m_vXpmSrc
; }
74 void CopyFromBitmap(const wxBitmap
& rBmp
);
76 virtual wxGDIImageRefData
* CreateData() const
78 return new wxIconRefData
;
80 void CreateIconFromXpm(const char **ppData
);
86 DECLARE_DYNAMIC_CLASS(wxIcon
)