1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxIcon class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/bitmap.h"
18 class WXDLLEXPORT wxIcon
: public wxBitmap
24 wxIcon(const wxIcon
& icon
)
28 wxIcon(const char **data
);
30 wxIcon(const char bits
[], int width
, int height
);
31 wxIcon(const wxString
& name
, int flags
= wxBITMAP_TYPE_ICON_RESOURCE
,
32 int desiredWidth
= -1, int desiredHeight
= -1);
33 wxIcon(const wxIconLocation
& loc
)
35 LoadFile(loc
.GetFileName(), wxBITMAP_TYPE_ICON
);
39 bool LoadFile(const wxString
& name
, wxBitmapType flags
/* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
40 int desiredWidth
/* = -1 */ , int desiredHeight
= -1);
41 bool LoadFile(const wxString
& name
,wxBitmapType flags
= wxBITMAP_TYPE_ICON_RESOURCE
)
42 { return LoadFile( name
, flags
, -1 , -1 ) ; }
44 wxIcon
& operator=(const wxIcon
& icon
)
45 { if (this != &icon
) Ref(icon
); return *this; }
46 bool operator==(const wxIcon
& icon
) const { return m_refData
== icon
.m_refData
; }
47 bool operator!=(const wxIcon
& icon
) const { return !(*this == icon
); }
49 // create from bitmap (which should have a mask unless it's monochrome):
50 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
51 // ctors, assignment operators...), but it's ok to have such function
52 void CopyFromBitmap(const wxBitmap
& bmp
);
54 DECLARE_DYNAMIC_CLASS(wxIcon
)
58 class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
60 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
62 inline wxICONFileHandler()
64 m_name = "ICO icon file";
66 m_type = wxBITMAP_TYPE_ICO;
69 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
70 int desiredWidth = -1, int desiredHeight = -1);
74 class WXDLLEXPORT wxICONResourceHandler
: public wxBitmapHandler
76 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler
)
78 inline wxICONResourceHandler()
80 m_name
= wxT("ICON resource");
81 m_extension
= wxEmptyString
;
82 m_type
= wxBITMAP_TYPE_ICON_RESOURCE
;
85 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
86 int desiredWidth
= -1, int desiredHeight
= -1);