X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7266b6723573ce6317577226cb1e5d32826e24e8..29c99ad3597ad722ed540b1e600f3ae3afe0f872:/include/wx/x11/icon.h diff --git a/include/wx/x11/icon.h b/include/wx/x11/icon.h index b72e6c96f4..95ec79f429 100644 --- a/include/wx/x11/icon.h +++ b/include/wx/x11/icon.h @@ -12,48 +12,50 @@ #ifndef _WX_ICON_H_ #define _WX_ICON_H_ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "icon.h" #endif #include "wx/bitmap.h" -#define M_ICONDATA ((wxBitmapRefData *)m_refData) -#define M_ICONHANDLERDATA ((wxBitmapRefData *)bitmap->GetRefData()) +//----------------------------------------------------------------------------- +// wxIcon +//----------------------------------------------------------------------------- -// Icon -class WXDLLEXPORT wxIcon: public wxBitmap +class wxIcon: public wxBitmap { - DECLARE_DYNAMIC_CLASS(wxIcon) - public: wxIcon(); - - // Copy constructors - inline wxIcon(const wxIcon& icon) { Ref(icon); } - - // Initialize with XBM data - wxIcon(const char bits[], int width, int height); - - // Initialize with XPM data - wxIcon(const char **data); - wxIcon(char **data); - - wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_XPM, - int desiredWidth = -1, int desiredHeight = -1); - ~wxIcon(); - - bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_XPM, - int desiredWidth = -1, int desiredHeight = -1); - - 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; } - inline bool operator != (const wxIcon& icon) const { return m_refData != icon.m_refData; } - - virtual bool Ok() const { return ((m_refData != NULL) && (M_ICONDATA->m_ok)); } - - bool CopyFromBitmap(const wxBitmap& bitmap); + wxIcon( const wxIcon& icon); + wxIcon( const char **bits, int width=-1, int height=-1 ); + + // For compatibility with wxMSW where desired size is sometimes required to + // distinguish between multiple icons in a resource. + wxIcon( const wxString& filename, wxBitmapType type = wxBITMAP_TYPE_XPM, + int WXUNUSED(desiredWidth)=-1, int WXUNUSED(desiredHeight)=-1 ) : + wxBitmap(filename, type) + { + } + wxIcon( char **bits, int width=-1, int height=-1 ); + + wxIcon(const wxIconLocation& loc) + : wxBitmap(loc.GetFileName(), wxBITMAP_TYPE_XPM) + { + } + + wxIcon& operator=(const wxIcon& icon); + bool operator==(const wxIcon& icon) const { return m_refData == icon.m_refData; } + bool operator!=(const wxIcon& icon) const { return !(*this == icon); } + + // 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); + +private: + DECLARE_DYNAMIC_CLASS(wxIcon) }; + #endif // _WX_ICON_H_