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
);
49 int GetHeight() const;
52 void SetHeight(int h
);
54 void SetOk(bool isOk
);
56 WXHICON
GetHICON() const ;
59 virtual wxGDIRefData
*CreateGDIRefData() const;
60 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
63 DECLARE_DYNAMIC_CLASS(wxIcon
)
67 class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
69 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
71 inline wxICONFileHandler()
73 m_name = "ICO icon file";
75 m_type = wxBITMAP_TYPE_ICO;
78 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
79 int desiredWidth = -1, int desiredHeight = -1);
83 class WXDLLEXPORT wxICONResourceHandler
: public wxBitmapHandler
85 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler
)
87 inline wxICONResourceHandler()
89 SetName(wxT("ICON resource"));
90 SetExtension(wxEmptyString
);
91 SetType(wxBITMAP_TYPE_ICON_RESOURCE
);
94 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
95 int desiredWidth
= -1, int desiredHeight
= -1);