]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/icon.h
put GetEscapeId() inside #if wxABI_VERSION > 20601
[wxWidgets.git] / include / wx / cocoa / icon.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/icon.h
3 // Purpose: wxIcon class
4 // Author: David Elliott
5 // Modified by:
6 // Created: 2003/08/11
7 // RCS-ID: $Id$
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_COCOA_ICON_H__
13 #define _WX_COCOA_ICON_H__
14
15 #include "wx/gdicmn.h"
16 #include "wx/gdiobj.h"
17
18 // ========================================================================
19 // wxIcon
20 // ========================================================================
21 class WXDLLEXPORT wxIcon: public wxGDIObject
22 {
23 DECLARE_DYNAMIC_CLASS(wxIcon)
24 public:
25 wxIcon();
26
27 // Copy constructors
28 wxIcon(const wxIcon& icon)
29 { Ref(icon); }
30
31 wxIcon(const char **data) { CreateFromXpm(data); }
32 wxIcon(char **data) { CreateFromXpm((const char**)data); }
33 wxIcon(const char bits[], int width , int height );
34 wxIcon(const wxString& name, int flags = wxBITMAP_TYPE_ICON_RESOURCE,
35 int desiredWidth = -1, int desiredHeight = -1);
36 wxIcon(const wxIconLocation& loc)
37 {
38 LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON);
39 }
40 ~wxIcon();
41
42 bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
43 int desiredWidth /* = -1 */ , int desiredHeight = -1);
44 bool LoadFile(const wxString& name, wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE )
45 { return LoadFile( name , flags , -1 , -1 ) ; }
46
47 wxIcon& operator=(const wxIcon& icon)
48 { if (this != &icon) Ref(icon); return *this; }
49 bool operator==(const wxIcon& icon) const
50 { return m_refData == icon.m_refData; }
51 bool operator!=(const wxIcon& icon) const { return !(*this == icon); }
52
53 // create from bitmap (which should have a mask unless it's monochrome):
54 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
55 // ctors, assignment operators...), but it's ok to have such function
56 void CopyFromBitmap(const wxBitmap& bmp);
57
58 bool Ok() const;
59 int GetWidth() const;
60 int GetHeight() const;
61
62 WX_NSImage GetNSImage() const;
63 bool CreateFromXpm(const char **bits);
64 };
65
66 #endif // _WX_COCOA_ICON_H__