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
44 inline wxIcon(const wxIcon
& icon
) { Ref(icon
); }
46 wxIcon( const char bits
[]
50 inline wxIcon(const char** ppData
) { CreateIconFromXpm(ppData
); }
51 inline wxIcon(char** ppData
) { CreateIconFromXpm((const char**)ppData
); }
52 wxIcon( const wxString
& rName
53 ,long lFlags
= wxBITMAP_TYPE_ICO_RESOURCE
54 ,int nDesiredWidth
= -1
55 ,int nDesiredHeight
= -1
57 wxIcon(const wxIconLocation
& loc
)
59 LoadFile(loc
.GetFileName(), wxBITMAP_TYPE_ICO
);
64 bool LoadFile( const wxString
& rName
65 ,long lFlags
= wxBITMAP_TYPE_ICO_RESOURCE
66 ,int nDesiredWidth
= -1
67 ,int nDesiredHeight
= -1
70 inline wxIcon
& operator = (const wxIcon
& rIcon
)
71 { if (*this != rIcon
) Ref(rIcon
); return *this; }
72 inline bool operator == (const wxIcon
& rIcon
) const
73 { return m_refData
== rIcon
.m_refData
; }
74 inline bool operator != (const wxIcon
& rIcon
) const
75 { return m_refData
!= rIcon
.m_refData
; }
77 wxIconRefData
*GetIconData() const { return (wxIconRefData
*)m_refData
; }
79 inline void SetHICON(WXHICON hIcon
) { SetHandle((WXHANDLE
)hIcon
); }
80 inline WXHICON
GetHICON() const { return (WXHICON
)GetHandle(); }
81 inline bool IsXpm(void) const { return m_bIsXpm
; };
82 inline const wxBitmap
& GetXpmSrc(void) const { return m_vXpmSrc
; }
84 void CopyFromBitmap(const wxBitmap
& rBmp
);
86 virtual wxGDIImageRefData
* CreateData() const
88 return new wxIconRefData
;
90 void CreateIconFromXpm(const char **ppData
);
96 DECLARE_DYNAMIC_CLASS(wxIcon
)