1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxIcon class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "icon.h"
19 #include "wx/bitmap.h"
22 class WXDLLEXPORT wxIcon
: public wxBitmap
24 DECLARE_DYNAMIC_CLASS(wxIcon
)
30 wxIcon(const wxIcon
& icon
)
34 wxIcon(const char **data
);
36 wxIcon(const char bits
[], int width
, int height
);
37 wxIcon(const wxString
& name
, int flags
= wxBITMAP_TYPE_ICON_RESOURCE
,
38 int desiredWidth
= -1, int desiredHeight
= -1);
41 bool LoadFile(const wxString
& name
, wxBitmapType flags
/* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
42 int desiredWidth
/* = -1 */ , int desiredHeight
= -1);
43 bool LoadFile(const wxString
& name
,wxBitmapType flags
= wxBITMAP_TYPE_ICON_RESOURCE
)
44 { return LoadFile( name
, flags
, -1 , -1 ) ; }
46 inline wxIcon
& operator = (const wxIcon
& icon
) { if (*this == icon
) return (*this); Ref(icon
); return *this; }
47 inline bool operator == (const wxIcon
& icon
) { return m_refData
== icon
.m_refData
; }
48 inline bool operator != (const wxIcon
& icon
) { return m_refData
!= icon
.m_refData
; }
50 // create from bitmap (which should have a mask unless it's monochrome):
51 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
52 // ctors, assignment operators...), but it's ok to have such function
53 void CopyFromBitmap(const wxBitmap
& bmp
);
57 class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
59 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
61 inline wxICONFileHandler()
63 m_name = "ICO icon file";
65 m_type = wxBITMAP_TYPE_ICO;
68 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
69 int desiredWidth = -1, int desiredHeight = -1);
73 class WXDLLEXPORT wxICONResourceHandler
: public wxBitmapHandler
75 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler
)
77 inline wxICONResourceHandler()
79 m_name
= wxT("ICON resource");
80 m_extension
= wxEmptyString
;
81 m_type
= wxBITMAP_TYPE_ICON_RESOURCE
;
84 virtual bool LoadFile(wxBitmap
*bitmap
, const wxString
& name
, long flags
,
85 int desiredWidth
= -1, int desiredHeight
= -1);