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
);
34 bool LoadFile(const wxString
& name
, wxBitmapType flags
/* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
35 int desiredWidth
/* = -1 */ , int desiredHeight
= -1);
36 bool LoadFile(const wxString
& name
,wxBitmapType flags
= wxBITMAP_TYPE_ICON_RESOURCE
)
37 { return LoadFile( name
, flags
, -1 , -1 ) ; }
40 // create from bitmap (which should have a mask unless it's monochrome):
41 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
42 // ctors, assignment operators...), but it's ok to have such function
43 void CopyFromBitmap(const wxBitmap
& bmp
);
45 bool Ok() const { return IsOk(); }
48 int GetHeight() const;
51 void SetHeight(int h
);
53 void SetOk(bool isOk
);
55 WXHICON
GetHICON() const ;
57 DECLARE_DYNAMIC_CLASS(wxIcon
)
61 class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
63 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
65 inline wxICONFileHandler()
67 m_name = "ICO icon file";
69 m_type = wxBITMAP_TYPE_ICO;
72 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
73 int desiredWidth = -1, int desiredHeight = -1);
77 class WXDLLEXPORT wxICONResourceHandler
: public wxBitmapHandler
79 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler
)
81 inline wxICONResourceHandler()
83 SetName(wxT("ICON resource"));
84 SetExtension(wxEmptyString
);
85 SetType(wxBITMAP_TYPE_ICON_RESOURCE
);
88 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
89 int desiredWidth
= -1, int desiredHeight
= -1);