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