]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/icon.h
adapting comment to new 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 #include "wx/bitmap.h"
16
17 // Icon
18 class WXDLLEXPORT wxIcon: public wxGDIObject
19 {
20 public:
21 wxIcon();
22
23 // Copy constructors
24 wxIcon(const wxIcon& icon)
25 : wxGDIObject()
26 {
27 Ref(icon);
28 }
29
30 wxIcon(const char **data);
31 wxIcon(char **data);
32 wxIcon(const char bits[], int width , int height );
33 wxIcon(const wxString& name, int flags = wxBITMAP_TYPE_ICON_RESOURCE,
34 int desiredWidth = -1, int desiredHeight = -1);
35 wxIcon(const wxIconLocation& loc)
36 {
37 LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON);
38 }
39 ~wxIcon();
40
41 bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
42 int desiredWidth /* = -1 */ , int desiredHeight = -1);
43 bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE )
44 { return LoadFile( name , flags , -1 , -1 ) ; }
45
46 wxIcon& operator=(const wxIcon& icon)
47 { if (this != &icon) Ref(icon); return *this; }
48 bool operator==(const wxIcon& icon) const { return m_refData == icon.m_refData; }
49 bool operator!=(const wxIcon& icon) const { return !(*this == icon); }
50
51 // create from bitmap (which should have a mask unless it's monochrome):
52 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
53 // ctors, assignment operators...), but it's ok to have such function
54 void CopyFromBitmap(const wxBitmap& bmp);
55
56 bool Ok() const;
57 int GetWidth() const;
58 int GetHeight() const;
59 int GetDepth() const;
60 void SetWidth(int w);
61 void SetHeight(int h);
62 void SetDepth(int d);
63 void SetOk(bool isOk);
64
65 WXHICON GetHICON() const ;
66
67 DECLARE_DYNAMIC_CLASS(wxIcon)
68 };
69
70 /*
71 class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
72 {
73 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
74 public:
75 inline wxICONFileHandler()
76 {
77 m_name = "ICO icon file";
78 m_extension = "ico";
79 m_type = wxBITMAP_TYPE_ICO;
80 };
81
82 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
83 int desiredWidth = -1, int desiredHeight = -1);
84 };
85 */
86
87 class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler
88 {
89 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler)
90 public:
91 inline wxICONResourceHandler()
92 {
93 SetName(wxT("ICON resource"));
94 SetExtension(wxEmptyString);
95 SetType(wxBITMAP_TYPE_ICON_RESOURCE);
96 };
97
98 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
99 int desiredWidth = -1, int desiredHeight = -1);
100
101 };
102
103 #endif
104 // _WX_ICON_H_