1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxIcon class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "icon.h"
19 #include "wx/bitmap.h"
22 class WXDLLEXPORT wxIcon
: public wxGDIObject
28 wxIcon(const wxIcon
& icon
)
31 wxIcon(const char **data
);
33 wxIcon(const char bits
[], int width
, int height
);
34 wxIcon(const wxString
& name
, int flags
= wxBITMAP_TYPE_ICON_RESOURCE
,
35 int desiredWidth
= -1, int desiredHeight
= -1);
36 wxIcon(const wxIconLocation
& loc
)
38 LoadFile(loc
.GetFileName(), wxBITMAP_TYPE_ICON
);
42 bool LoadFile(const wxString
& name
, wxBitmapType flags
/* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
43 int desiredWidth
/* = -1 */ , int desiredHeight
= -1);
44 bool LoadFile(const wxString
& name
,wxBitmapType flags
= wxBITMAP_TYPE_ICON_RESOURCE
)
45 { return LoadFile( name
, flags
, -1 , -1 ) ; }
47 wxIcon
& operator=(const wxIcon
& icon
)
48 { if (this != &icon
) Ref(icon
); return *this; }
49 bool operator==(const wxIcon
& icon
) const { return m_refData
== icon
.m_refData
; }
50 bool operator!=(const wxIcon
& icon
) const { return !(*this == icon
); }
52 // create from bitmap (which should have a mask unless it's monochrome):
53 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
54 // ctors, assignment operators...), but it's ok to have such function
55 void CopyFromBitmap(const wxBitmap
& bmp
);
59 int GetHeight() const;
62 void SetHeight(int h
);
64 void SetOk(bool isOk
);
66 WXHICON
GetHICON() const ;
68 DECLARE_DYNAMIC_CLASS(wxIcon
)
72 class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
74 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
76 inline wxICONFileHandler()
78 m_name = "ICO icon file";
80 m_type = wxBITMAP_TYPE_ICO;
83 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
84 int desiredWidth = -1, int desiredHeight = -1);
88 class WXDLLEXPORT wxICONResourceHandler
: public wxBitmapHandler
90 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler
)
92 inline wxICONResourceHandler()
94 SetName(wxT("ICON resource"));
95 SetExtension(wxEmptyString
);
96 SetType(wxBITMAP_TYPE_ICON_RESOURCE
);
99 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
100 int desiredWidth
= -1, int desiredHeight
= -1);