virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL);
wxImage ConvertToImage() const;
+
+ // copies the contents and mask of the given (colour) icon to the bitmap
+ virtual bool CopyFromIcon(const wxIcon& icon);
bool Ok() const { return (M_BITMAPDATA && M_BITMAPDATA->m_ok); }
int GetWidth() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_width : 0); }
bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_XPM,
int desiredWidth = -1, int desiredHeight = -1);
+
+ // create from bitmap (which should have a mask unless it's monochrome):
+ // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
+ // ctors, assignment operators...), but it's ok to have such function
+ void CopyFromBitmap(const wxBitmap& bmp);
inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
inline bool operator == (const wxIcon& icon) const { return m_refData == icon.m_refData; }
return Create(bits, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
}
+bool wxBitmap::CopyFromIcon(const wxIcon& icon)
+{
+ *this = icon;
+ return TRUE;
+}
+
bool wxBitmap::Create(int w, int h, int d)
{
UnRef();
LoadFile(icon_file, flags, desiredWidth, desiredHeight);
}
+void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
+{
+ wxIcon *icon = (wxIcon*)(&bmp);
+ *this = *icon;
+}
+
wxIcon::~wxIcon()
{
}