]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/icon.h
fed25013ff1083f85f5e39092a4082ac405a8333
[wxWidgets.git] / include / wx / mac / icon.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: icon.h
3 // Purpose: wxIcon class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_ICON_H_
13 #define _WX_ICON_H_
14
15 #ifdef __GNUG__
16 #pragma interface "icon.h"
17 #endif
18
19 #include "wx/bitmap.h"
20
21 class WXDLLEXPORT wxIconRefData: public wxBitmapRefData
22 {
23 friend class WXDLLEXPORT wxBitmap;
24 friend class WXDLLEXPORT wxIcon;
25 public:
26 wxIconRefData();
27 ~wxIconRefData();
28
29 public:
30 WXHICON m_hIcon;
31 };
32
33 #define M_ICONDATA ((wxIconRefData *)m_refData)
34 #define M_ICONHANDLERDATA ((wxIconRefData *)bitmap->GetRefData())
35
36 // Icon
37 class WXDLLEXPORT wxIcon: public wxBitmap
38 {
39 DECLARE_DYNAMIC_CLASS(wxIcon)
40
41 public:
42 wxIcon();
43
44 // Copy constructors
45 inline wxIcon(const wxIcon& icon) { Ref(icon); }
46
47 wxIcon(const char bits[], int width, int height);
48 wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICON_RESOURCE,
49 int desiredWidth = -1, int desiredHeight = -1);
50 ~wxIcon();
51
52 bool LoadFile(const wxString& name, long flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
53 int desiredWidth /* = -1 */ , int desiredHeight = -1);
54 bool LoadFile(const wxString& name ,long flags = wxBITMAP_TYPE_ICON_RESOURCE )
55 { return LoadFile( name , flags , -1 , -1 ) ; }
56
57 inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
58 inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
59 inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; }
60
61 void SetHICON(WXHICON ico);
62 inline WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); }
63
64 virtual bool Ok() const { return (m_refData != NULL) ; }
65 };
66
67 /*
68 class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
69 {
70 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
71 public:
72 inline wxICONFileHandler()
73 {
74 m_name = "ICO icon file";
75 m_extension = "ico";
76 m_type = wxBITMAP_TYPE_ICO;
77 };
78
79 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
80 int desiredWidth = -1, int desiredHeight = -1);
81 };
82 */
83
84 class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler
85 {
86 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler)
87 public:
88 inline wxICONResourceHandler()
89 {
90 m_name = "ICON resource";
91 m_extension = "";
92 m_type = wxBITMAP_TYPE_ICON_RESOURCE;
93 };
94
95 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
96 int desiredWidth = -1, int desiredHeight = -1);
97
98 };
99
100 #endif
101 // _WX_ICON_H_