]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/icon.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/icon.h
3 // Purpose: wxIcon class
4 // Author: David Elliott
7 // Copyright: (c) 2003 David Elliott
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_COCOA_ICON_H__
12 #define _WX_COCOA_ICON_H__
14 #include "wx/gdicmn.h"
15 #include "wx/gdiobj.h"
17 // ========================================================================
19 // ========================================================================
20 class WXDLLIMPEXP_CORE wxIcon
: public wxGDIObject
25 wxIcon(const char* const* data
) { CreateFromXpm(data
); }
26 wxIcon(const char bits
[], int width
, int height
);
27 wxIcon(const wxString
& name
, int flags
= wxICON_DEFAULT_TYPE
,
28 int desiredWidth
= -1, int desiredHeight
= -1);
29 wxIcon(const wxIconLocation
& loc
)
31 LoadFile(loc
.GetFileName(), wxBITMAP_TYPE_ICON
);
35 bool LoadFile(const wxString
& name
, wxBitmapType flags
= wxICON_DEFAULT_TYPE
,
36 int desiredWidth
=-1, int desiredHeight
=-1);
38 bool operator==(const wxIcon
& icon
) const
39 { return m_refData
== icon
.m_refData
; }
40 bool operator!=(const wxIcon
& icon
) const { return !(*this == icon
); }
42 // create from bitmap (which should have a mask unless it's monochrome):
43 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
44 // ctors, assignment operators...), but it's ok to have such function
45 void CopyFromBitmap(const wxBitmap
& bmp
);
48 int GetHeight() const;
50 wxSize
GetSize() const { return wxSize(GetWidth(), GetHeight()); }
52 WX_NSImage
GetNSImage() const;
53 bool CreateFromXpm(const char* const* bits
);
56 virtual wxGDIRefData
*CreateGDIRefData() const;
57 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
60 DECLARE_DYNAMIC_CLASS(wxIcon
)
63 #endif // _WX_COCOA_ICON_H__