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 wxGDIObject
24 wxIcon(const wxIcon
& icon
)
30 wxIcon(const char **data
);
32 wxIcon(const char bits
[], int width
, int height
);
33 wxIcon(const wxString
& name
, int flags
= wxBITMAP_TYPE_ICON_RESOURCE
,
34 int desiredWidth
= -1, int desiredHeight
= -1);
35 wxIcon(const wxIconLocation
& loc
)
37 LoadFile(loc
.GetFileName(), wxBITMAP_TYPE_ICON
);
41 bool LoadFile(const wxString
& name
, wxBitmapType flags
/* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
42 int desiredWidth
/* = -1 */ , int desiredHeight
= -1);
43 bool LoadFile(const wxString
& name
,wxBitmapType flags
= wxBITMAP_TYPE_ICON_RESOURCE
)
44 { return LoadFile( name
, flags
, -1 , -1 ) ; }
46 wxIcon
& operator=(const wxIcon
& icon
)
47 { if (this != &icon
) Ref(icon
); return *this; }
48 bool operator==(const wxIcon
& icon
) const { return m_refData
== icon
.m_refData
; }
49 bool operator!=(const wxIcon
& icon
) const { return !(*this == icon
); }
51 // create from bitmap (which should have a mask unless it's monochrome):
52 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
53 // ctors, assignment operators...), but it's ok to have such function
54 void CopyFromBitmap(const wxBitmap
& bmp
);
58 int GetHeight() const;
61 void SetHeight(int h
);
63 void SetOk(bool isOk
);
65 WXHICON
GetHICON() const ;
67 DECLARE_DYNAMIC_CLASS(wxIcon
)
71 class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
73 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
75 inline wxICONFileHandler()
77 m_name = "ICO icon file";
79 m_type = wxBITMAP_TYPE_ICO;
82 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
83 int desiredWidth = -1, int desiredHeight = -1);
87 class WXDLLEXPORT wxICONResourceHandler
: public wxBitmapHandler
89 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler
)
91 inline wxICONResourceHandler()
93 SetName(wxT("ICON resource"));
94 SetExtension(wxEmptyString
);
95 SetType(wxBITMAP_TYPE_ICON_RESOURCE
);
98 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
99 int desiredWidth
= -1, int desiredHeight
= -1);