1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/icon.h
3 // Purpose: wxIcon class
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_COCOA_ICON_H__
13 #define _WX_COCOA_ICON_H__
15 #include "wx/gdicmn.h"
16 #include "wx/gdiobj.h"
18 // ========================================================================
20 // ========================================================================
21 class WXDLLEXPORT wxIcon
: public wxGDIObject
26 wxIcon(const char **data
) { CreateFromXpm(data
); }
27 wxIcon(char **data
) { CreateFromXpm((const char**)data
); }
28 wxIcon(const char bits
[], int width
, int height
);
29 wxIcon(const wxString
& name
, int flags
= wxBITMAP_TYPE_ICON_RESOURCE
,
30 int desiredWidth
= -1, int desiredHeight
= -1);
31 wxIcon(const wxIconLocation
& loc
)
33 LoadFile(loc
.GetFileName(), wxBITMAP_TYPE_ICON
);
37 bool LoadFile(const wxString
& name
, wxBitmapType flags
/* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
38 int desiredWidth
/* = -1 */ , int desiredHeight
= -1);
39 bool LoadFile(const wxString
& name
, wxBitmapType flags
= wxBITMAP_TYPE_ICON_RESOURCE
)
40 { return LoadFile( name
, flags
, -1 , -1 ) ; }
42 bool operator==(const wxIcon
& icon
) const
43 { return m_refData
== icon
.m_refData
; }
44 bool operator!=(const wxIcon
& icon
) const { return !(*this == icon
); }
46 // create from bitmap (which should have a mask unless it's monochrome):
47 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
48 // ctors, assignment operators...), but it's ok to have such function
49 void CopyFromBitmap(const wxBitmap
& bmp
);
52 int GetHeight() const;
54 WX_NSImage
GetNSImage() const;
55 bool CreateFromXpm(const char **bits
);
58 virtual wxGDIRefData
*CreateGDIRefData() const;
59 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
62 DECLARE_DYNAMIC_CLASS(wxIcon
)
65 #endif // _WX_COCOA_ICON_H__