]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/icon.h
Mac Core Graphics Implementation
[wxWidgets.git] / include / wx / mac / carbon / icon.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: icon.h
3 // Purpose: wxIcon class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_ICON_H_
13 #define _WX_ICON_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "icon.h"
17 #endif
18
19 #include "wx/bitmap.h"
20
21 // Icon
22 class WXDLLEXPORT wxIcon: public wxGDIObject
23 {
24 public:
25 wxIcon();
26
27 // Copy constructors
28 wxIcon(const wxIcon& icon)
29 { Ref(icon); }
30
31 wxIcon(const char **data);
32 wxIcon(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 { return m_refData == icon.m_refData; }
50 bool operator!=(const wxIcon& icon) const { return !(*this == icon); }
51
52 // create from bitmap (which should have a mask unless it's monochrome):
53 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
54 // ctors, assignment operators...), but it's ok to have such function
55 void CopyFromBitmap(const wxBitmap& bmp);
56
57 bool Ok() const;
58 int GetWidth() const;
59 int GetHeight() const;
60 int GetDepth() const;
61 void SetWidth(int w);
62 void SetHeight(int h);
63 void SetDepth(int d);
64 void SetOk(bool isOk);
65
66 WXHICON GetHICON() const ;
67
68 DECLARE_DYNAMIC_CLASS(wxIcon)
69 };
70
71 /*
72 class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
73 {
74 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
75 public:
76 inline wxICONFileHandler()
77 {
78 m_name = "ICO icon file";
79 m_extension = "ico";
80 m_type = wxBITMAP_TYPE_ICO;
81 };
82
83 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
84 int desiredWidth = -1, int desiredHeight = -1);
85 };
86 */
87
88 class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler
89 {
90 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler)
91 public:
92 inline wxICONResourceHandler()
93 {
94 SetName(wxT("ICON resource"));
95 SetExtension(wxEmptyString);
96 SetType(wxBITMAP_TYPE_ICON_RESOURCE);
97 };
98
99 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
100 int desiredWidth = -1, int desiredHeight = -1);
101
102 };
103
104 #endif
105 // _WX_ICON_H_