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
23 wxIcon(const char **data
);
25 wxIcon(const char bits
[], int width
, int height
);
26 wxIcon(const wxString
& name
, int flags
= wxBITMAP_TYPE_ICON_RESOURCE
,
27 int desiredWidth
= -1, int desiredHeight
= -1);
28 wxIcon(const wxIconLocation
& loc
)
30 LoadFile(loc
.GetFileName(), wxBITMAP_TYPE_ICON
);
33 wxIcon(WXHICON icon
, const wxSize
& size
);
37 bool LoadFile(const wxString
& name
, wxBitmapType flags
/* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
38 int desiredWidth
/* = -1 */ , int desiredHeight
= -1);
39 bool LoadFile(const wxString
& name
,wxBitmapType flags
= wxBITMAP_TYPE_ICON_RESOURCE
)
40 { return LoadFile( name
, flags
, -1 , -1 ) ; }
43 // create from bitmap (which should have a mask unless it's monochrome):
44 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
45 // ctors, assignment operators...), but it's ok to have such function
46 void CopyFromBitmap(const wxBitmap
& bmp
);
48 bool Ok() const { return IsOk(); }
51 int GetHeight() const;
54 void SetHeight(int h
);
56 void SetOk(bool isOk
);
58 WXHICON
GetHICON() const ;
60 DECLARE_DYNAMIC_CLASS(wxIcon
)
64 class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
66 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
68 inline wxICONFileHandler()
70 m_name = "ICO icon file";
72 m_type = wxBITMAP_TYPE_ICO;
75 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
76 int desiredWidth = -1, int desiredHeight = -1);
80 class WXDLLEXPORT wxICONResourceHandler
: public wxBitmapHandler
82 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler
)
84 inline wxICONResourceHandler()
86 SetName(wxT("ICON resource"));
87 SetExtension(wxEmptyString
);
88 SetType(wxBITMAP_TYPE_ICON_RESOURCE
);
91 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
92 int desiredWidth
= -1, int desiredHeight
= -1);