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
) ; }
70 /* Example handlers. TODO: write your own handlers for relevant types.
72 class WXDLLEXPORT wxICOFileHandler: public wxBitmapHandler
74 DECLARE_DYNAMIC_CLASS(wxICOFileHandler)
76 inline wxICOFileHandler()
78 m_name = "ICO icon file";
80 m_type = wxBITMAP_TYPE_ICO;
83 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
84 int desiredWidth = -1, int desiredHeight = -1);
87 class WXDLLEXPORT wxICOResourceHandler: public wxBitmapHandler
89 DECLARE_DYNAMIC_CLASS(wxICOResourceHandler)
91 inline wxICOResourceHandler()
93 m_name = "ICO resource";
95 m_type = wxBITMAP_TYPE_ICO_RESOURCE;
98 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
99 int desiredWidth = -1, int desiredHeight = -1);