]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/icon.h
remove unused wxAppTraits-related files
[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 WXDLLIMPEXP_CORE wxIcon : public wxGDIObject
22 {
23 public:
24 wxIcon();
25
26 wxIcon(const char* const* data) { CreateFromXpm(data); }
27 wxIcon(const char bits[], int width , int height );
28 wxIcon(const wxString& name, int flags = wxBITMAP_TYPE_ICON_RESOURCE,
29 int desiredWidth = -1, int desiredHeight = -1);
30 wxIcon(const wxIconLocation& loc)
31 {
32 LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON);
33 }
34 virtual ~wxIcon();
35
36 bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
37 int desiredWidth /* = -1 */ , int desiredHeight = -1);
38 bool LoadFile(const wxString& name, wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE )
39 { return LoadFile( name , flags , -1 , -1 ) ; }
40
41 bool operator==(const wxIcon& icon) const
42 { return m_refData == icon.m_refData; }
43 bool operator!=(const wxIcon& icon) const { return !(*this == icon); }
44
45 // create from bitmap (which should have a mask unless it's monochrome):
46 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
47 // ctors, assignment operators...), but it's ok to have such function
48 void CopyFromBitmap(const wxBitmap& bmp);
49
50 int GetWidth() const;
51 int GetHeight() const;
52
53 WX_NSImage GetNSImage() const;
54 bool CreateFromXpm(const char* const* bits);
55
56 protected:
57 virtual wxGDIRefData *CreateGDIRefData() const;
58 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
59
60 private:
61 DECLARE_DYNAMIC_CLASS(wxIcon)
62 };
63
64 #endif // _WX_COCOA_ICON_H__