]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/icon.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[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 // Copyright: (c) 2003 David Elliott
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_COCOA_ICON_H__
12 #define _WX_COCOA_ICON_H__
13
14 #include "wx/gdicmn.h"
15 #include "wx/gdiobj.h"
16
17 // ========================================================================
18 // wxIcon
19 // ========================================================================
20 class WXDLLIMPEXP_CORE wxIcon : public wxGDIObject
21 {
22 public:
23 wxIcon();
24
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)
30 {
31 LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON);
32 }
33 virtual ~wxIcon();
34
35 bool LoadFile(const wxString& name, wxBitmapType flags = wxICON_DEFAULT_TYPE,
36 int desiredWidth=-1, int desiredHeight=-1);
37
38 bool operator==(const wxIcon& icon) const
39 { return m_refData == icon.m_refData; }
40 bool operator!=(const wxIcon& icon) const { return !(*this == icon); }
41
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);
46
47 int GetWidth() const;
48 int GetHeight() const;
49
50 wxSize GetSize() const { return wxSize(GetWidth(), GetHeight()); }
51
52 WX_NSImage GetNSImage() const;
53 bool CreateFromXpm(const char* const* bits);
54
55 protected:
56 virtual wxGDIRefData *CreateGDIRefData() const;
57 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
58
59 private:
60 DECLARE_DYNAMIC_CLASS(wxIcon)
61 };
62
63 #endif // _WX_COCOA_ICON_H__