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
); }
48 inline wxIcon(const wxIcon
* icon
) { if (icon
) Ref(*icon
); }
50 wxIcon(const char bits
[], int width
, int height
);
51 wxIcon(const wxString
& name
, long flags
= wxBITMAP_TYPE_ICO_RESOURCE
,
52 int desiredWidth
= -1, int desiredHeight
= -1);
55 bool LoadFile(const wxString
& name
, long flags
= wxBITMAP_TYPE_ICO_RESOURCE
,
56 int desiredWidth
= -1, int desiredHeight
= -1);
58 inline wxIcon
& operator = (const wxIcon
& icon
) { if (*this == icon
) return (*this); Ref(icon
); return *this; }
59 inline bool operator == (const wxIcon
& icon
) { return m_refData
== icon
.m_refData
; }
60 inline bool operator != (const wxIcon
& icon
) { return m_refData
!= icon
.m_refData
; }
62 /* TODO: implementation
63 void SetHICON(WXHICON ico);
64 inline WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); }
68 virtual bool Ok() const { return (m_refData
!= NULL
) ; }
71 /* Example handlers. TODO: write your own handlers for relevant types.
73 class WXDLLEXPORT wxICOFileHandler: public wxBitmapHandler
75 DECLARE_DYNAMIC_CLASS(wxICOFileHandler)
77 inline wxICOFileHandler()
79 m_name = "ICO icon file";
81 m_type = wxBITMAP_TYPE_ICO;
84 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
85 int desiredWidth = -1, int desiredHeight = -1);
88 class WXDLLEXPORT wxICOResourceHandler: public wxBitmapHandler
90 DECLARE_DYNAMIC_CLASS(wxICOResourceHandler)
92 inline wxICOResourceHandler()
94 m_name = "ICO resource";
96 m_type = wxBITMAP_TYPE_ICO_RESOURCE;
99 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
100 int desiredWidth = -1, int desiredHeight = -1);