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
=-1, int height
=-1 );
48 wxIcon( char **bits
, int width
=-1, int height
=-1 );
49 wxIcon(const char bits
[], int width
, int height
);
50 wxIcon(const wxString
& name
, long flags
= wxBITMAP_TYPE_ICON_RESOURCE
,
51 int desiredWidth
= -1, int desiredHeight
= -1);
54 bool LoadFile(const wxString
& name
, long flags
/* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
55 int desiredWidth
/* = -1 */ , int desiredHeight
= -1);
56 bool LoadFile(const wxString
& name
,long flags
= wxBITMAP_TYPE_ICON_RESOURCE
)
57 { return LoadFile( name
, flags
, -1 , -1 ) ; }
59 inline wxIcon
& operator = (const wxIcon
& icon
) { if (*this == icon
) return (*this); Ref(icon
); return *this; }
60 inline bool operator == (const wxIcon
& icon
) { return m_refData
== icon
.m_refData
; }
61 inline bool operator != (const wxIcon
& icon
) { return m_refData
!= icon
.m_refData
; }
63 void SetHICON(WXHICON ico
);
64 inline WXHICON
GetHICON() const { return (M_ICONDATA
? M_ICONDATA
->m_hIcon
: 0); }
66 virtual bool Ok() const { return (m_refData
!= NULL
) ; }
70 class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
72 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
74 inline wxICONFileHandler()
76 m_name = "ICO icon file";
78 m_type = wxBITMAP_TYPE_ICO;
81 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
82 int desiredWidth = -1, int desiredHeight = -1);
86 class WXDLLEXPORT wxICONResourceHandler
: public wxBitmapHandler
88 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler
)
90 inline wxICONResourceHandler()
92 m_name
= "ICON resource";
94 m_type
= wxBITMAP_TYPE_ICON_RESOURCE
;
97 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
98 int desiredWidth
= -1, int desiredHeight
= -1);