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 WXDLLIMPEXP_CORE wxIcon
: public wxGDIObject
23 wxIcon(const char* const* data
);
24 wxIcon(const char bits
[], int width
, int height
);
25 wxIcon(const wxString
& name
, int flags
= wxBITMAP_TYPE_ICON_RESOURCE
,
26 int desiredWidth
= -1, int desiredHeight
= -1);
27 wxIcon(const wxIconLocation
& loc
)
29 LoadFile(loc
.GetFileName(), wxBITMAP_TYPE_ICON
);
32 wxIcon(WXHICON icon
, const wxSize
& size
);
36 bool LoadFile(const wxString
& name
, wxBitmapType flags
/* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
37 int desiredWidth
/* = -1 */ , int desiredHeight
= -1);
38 bool LoadFile(const wxString
& name
,wxBitmapType flags
= wxBITMAP_TYPE_ICON_RESOURCE
)
39 { return LoadFile( name
, flags
, -1 , -1 ) ; }
42 // create from bitmap (which should have a mask unless it's monochrome):
43 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
44 // ctors, assignment operators...), but it's ok to have such function
45 void CopyFromBitmap(const wxBitmap
& bmp
);
48 int GetHeight() const;
51 void SetHeight(int h
);
53 void SetOk(bool isOk
);
55 WXHICON
GetHICON() const ;
58 virtual wxGDIRefData
*CreateGDIRefData() const;
59 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
62 DECLARE_DYNAMIC_CLASS(wxIcon
)
66 class WXDLLIMPEXP_CORE wxICONFileHandler: public wxBitmapHandler
68 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
70 inline wxICONFileHandler()
72 m_name = "ICO icon file";
74 m_type = wxBITMAP_TYPE_ICO;
77 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
78 int desiredWidth = -1, int desiredHeight = -1);
82 class WXDLLIMPEXP_CORE wxICONResourceHandler
: public wxBitmapHandler
84 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler
)
86 inline wxICONResourceHandler()
88 SetName(wxT("ICON resource"));
89 SetExtension(wxEmptyString
);
90 SetType(wxBITMAP_TYPE_ICON_RESOURCE
);
93 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
94 int desiredWidth
= -1, int desiredHeight
= -1);