1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxIcon class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "icon.h"
19 // ----------------------------------------------------------------------------
21 // ----------------------------------------------------------------------------
23 // compatible (even if incorrect) behaviour by default: derive wxIcon from
25 #ifndef wxICON_IS_BITMAP
26 #define wxICON_IS_BITMAP 1
30 #include "wx/bitmap.h"
32 #define wxIconRefDataBase wxBitmapRefData
33 #define wxIconBase wxBitmap
35 #include "wx/msw/gdiimage.h"
37 #define wxIconRefDataBase wxGDIImageRefData
38 #define wxIconBase wxGDIImage
41 // ---------------------------------------------------------------------------
43 // ---------------------------------------------------------------------------
45 // notice that although wxIconRefData inherits from wxBitmapRefData, it is not
46 // a valid wxBitmapRefData
47 class WXDLLEXPORT wxIconRefData
: public wxIconRefDataBase
51 virtual ~wxIconRefData() { Free(); }
56 // ---------------------------------------------------------------------------
58 // ---------------------------------------------------------------------------
60 class WXDLLEXPORT wxIcon
: public wxIconBase
66 wxIcon(const wxIcon
& icon
) { Ref(icon
); }
68 wxIcon(const char bits
[], int width
, int height
);
69 wxIcon(const wxString
& name
,
70 long type
= wxBITMAP_TYPE_ICO_RESOURCE
,
71 int desiredWidth
= -1, int desiredHeight
= -1);
74 virtual bool LoadFile(const wxString
& name
,
75 long type
= wxBITMAP_TYPE_ICO_RESOURCE
,
76 int desiredWidth
= -1, int desiredHeight
= -1);
78 wxIcon
& operator = (const wxIcon
& icon
)
79 { if ( *this != icon
) Ref(icon
); return *this; }
80 bool operator == (const wxIcon
& icon
) const
81 { return m_refData
== icon
.m_refData
; }
82 bool operator != (const wxIcon
& icon
) const
83 { return m_refData
!= icon
.m_refData
; }
85 wxIconRefData
*GetIconData() const { return (wxIconRefData
*)m_refData
; }
87 void SetHICON(WXHICON icon
) { SetHandle((WXHANDLE
)icon
); }
88 WXHICON
GetHICON() const { return (WXHICON
)GetHandle(); }
91 virtual wxGDIImageRefData
*CreateData() const
93 return new wxIconRefData
;
97 DECLARE_DYNAMIC_CLASS(wxIcon
)