1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxIcon class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "icon.h"
19 #include "wx/bitmap.h"
22 class WXDLLEXPORT wxIcon
: public wxBitmap
24 DECLARE_DYNAMIC_CLASS(wxIcon
)
30 inline wxIcon(const wxIcon
& icon
) { Ref(icon
); }
32 wxIcon(const char **data
);
34 wxIcon(const char bits
[], int width
=-1, int height
=-1);
35 wxIcon(const wxString
& name
, long flags
= wxBITMAP_TYPE_ICON_RESOURCE
,
36 int desiredWidth
= -1, int desiredHeight
= -1);
39 bool LoadFile(const wxString
& name
, long flags
/* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
40 int desiredWidth
/* = -1 */ , int desiredHeight
= -1);
41 bool LoadFile(const wxString
& name
,long flags
= wxBITMAP_TYPE_ICON_RESOURCE
)
42 { return LoadFile( name
, flags
, -1 , -1 ) ; }
44 inline wxIcon
& operator = (const wxIcon
& icon
) { if (*this == icon
) return (*this); Ref(icon
); return *this; }
45 inline bool operator == (const wxIcon
& icon
) { return m_refData
== icon
.m_refData
; }
46 inline bool operator != (const wxIcon
& icon
) { return m_refData
!= icon
.m_refData
; }
48 // create from bitmap (which should have a mask unless it's monochrome):
49 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
50 // ctors, assignment operators...), but it's ok to have such function
51 void CopyFromBitmap(const wxBitmap
& bmp
);
55 class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
57 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
59 inline wxICONFileHandler()
61 m_name = "ICO icon file";
63 m_type = wxBITMAP_TYPE_ICO;
66 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
67 int desiredWidth = -1, int desiredHeight = -1);
71 class WXDLLEXPORT wxICONResourceHandler
: public wxBitmapHandler
73 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler
)
75 inline wxICONResourceHandler()
77 m_name
= "ICON resource";
79 m_type
= wxBITMAP_TYPE_ICON_RESOURCE
;
82 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
83 int desiredWidth
= -1, int desiredHeight
= -1);