1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxIcon class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "icon.h"
19 #include "wx/bitmap.h"
21 class WXDLLEXPORT wxIconRefData
: public wxBitmapRefData
23 friend class WXDLLEXPORT wxBitmap
;
24 friend class WXDLLEXPORT wxIcon
;
33 #define M_ICONDATA ((wxIconRefData *)m_refData)
34 #define M_ICONHANDLERDATA ((wxIconRefData *)bitmap->GetRefData())
37 class WXDLLEXPORT wxIcon
: public wxBitmap
39 DECLARE_DYNAMIC_CLASS(wxIcon
)
45 inline wxIcon(const wxIcon
& icon
) { Ref(icon
); }
47 wxIcon(const char bits
[], int width
, int height
);
48 wxIcon(const wxString
& name
, long flags
= wxBITMAP_TYPE_ICON_RESOURCE
,
49 int desiredWidth
= -1, int desiredHeight
= -1);
52 bool LoadFile(const wxString
& name
, long flags
/* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
53 int desiredWidth
/* = -1 */ , int desiredHeight
= -1);
54 bool LoadFile(const wxString
& name
,long flags
= wxBITMAP_TYPE_ICON_RESOURCE
)
55 { return LoadFile( name
, flags
, -1 , -1 ) ; }
57 inline wxIcon
& operator = (const wxIcon
& icon
) { if (*this == icon
) return (*this); Ref(icon
); return *this; }
58 inline bool operator == (const wxIcon
& icon
) { return m_refData
== icon
.m_refData
; }
59 inline bool operator != (const wxIcon
& icon
) { return m_refData
!= icon
.m_refData
; }
61 void SetHICON(WXHICON ico
);
62 inline WXHICON
GetHICON() const { return (M_ICONDATA
? M_ICONDATA
->m_hIcon
: 0); }
64 virtual bool Ok() const { return (m_refData
!= NULL
) ; }
68 class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
70 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
72 inline wxICONFileHandler()
74 m_name = "ICO icon file";
76 m_type = wxBITMAP_TYPE_ICO;
79 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
80 int desiredWidth = -1, int desiredHeight = -1);
84 class WXDLLEXPORT wxICONResourceHandler
: public wxBitmapHandler
86 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler
)
88 inline wxICONResourceHandler()
90 m_name
= "ICON resource";
92 m_type
= wxBITMAP_TYPE_ICON_RESOURCE
;
95 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
96 int desiredWidth
= -1, int desiredHeight
= -1);