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);
54 bool LoadFile(const wxString
& name
, long flags
= wxBITMAP_TYPE_ICO_RESOURCE
,
55 int desiredWidth
= -1, int desiredHeight
= -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 /* TODO: implementation
62 void SetHICON(WXHICON ico);
63 inline WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); }
67 virtual bool Ok() const { return (m_refData
!= NULL
) ; }
69 // supress virtual function hiding warning
70 virtual bool LoadFile( const wxString
& name
71 ,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);