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
;
30 /* TODO: whatever your actual icon handle is
35 #define M_ICONDATA ((wxIconRefData *)m_refData)
36 #define M_ICONHANDLERDATA ((wxIconRefData *)bitmap->GetRefData())
39 class WXDLLEXPORT wxIcon
: public wxBitmap
41 DECLARE_DYNAMIC_CLASS(wxIcon
)
47 inline wxIcon(const wxIcon
& icon
) { Ref(icon
); }
49 wxIcon(const char bits
[], int width
, int height
);
50 wxIcon(const wxString
& name
, long flags
= wxBITMAP_TYPE_ICO_RESOURCE
,
51 int desiredWidth
= -1, int desiredHeight
= -1);
52 wxIcon( char **bits
, int width
=-1, int height
=-1 );
56 bool LoadFile(const wxString
& name
, long flags
= wxBITMAP_TYPE_ICO_RESOURCE
,
57 int desiredWidth
= -1, int desiredHeight
= -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 /* TODO: implementation
64 void SetHICON(WXHICON ico);
65 inline WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); }
69 virtual bool Ok() const { return (m_refData
!= NULL
) ; }
71 // supress VisAge hiding warning
72 bool LoadFile(const wxString
& name
, long type
= wxBITMAP_TYPE_BMP_RESOURCE
)
73 { return(wxBitmap::LoadFile(name
, type
)); }
76 /* Example handlers. TODO: write your own handlers for relevant types.
78 class WXDLLEXPORT wxICOFileHandler: public wxBitmapHandler
80 DECLARE_DYNAMIC_CLASS(wxICOFileHandler)
82 inline wxICOFileHandler()
84 m_name = "ICO icon file";
86 m_type = wxBITMAP_TYPE_ICO;
89 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
90 int desiredWidth = -1, int desiredHeight = -1);
93 class WXDLLEXPORT wxICOResourceHandler: public wxBitmapHandler
95 DECLARE_DYNAMIC_CLASS(wxICOResourceHandler)
97 inline wxICOResourceHandler()
99 m_name = "ICO resource";
101 m_type = wxBITMAP_TYPE_ICO_RESOURCE;
104 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
105 int desiredWidth = -1, int desiredHeight = -1);