]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/icon.h
converted to 16 colors
[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 /* TODO: whatever your actual icon handle is
31 WXHICON m_hIcon;
32 */
33 };
34
35 #define M_ICONDATA ((wxIconRefData *)m_refData)
36 #define M_ICONHANDLERDATA ((wxIconRefData *)bitmap->GetRefData())
37
38 // Icon
39 class WXDLLEXPORT wxIcon: public wxBitmap
40 {
41 DECLARE_DYNAMIC_CLASS(wxIcon)
42
43 public:
44 wxIcon();
45
46 // Copy constructors
47 inline wxIcon(const wxIcon& icon) { Ref(icon); }
48
49 wxIcon(const char bits[], int width, int height);
50 wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
51 int desiredWidth = -1, int desiredHeight = -1);
52 ~wxIcon();
53
54 bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
55 int desiredWidth = -1, int desiredHeight = -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 /* TODO: implementation
62 void SetHICON(WXHICON ico);
63 inline WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); }
64 */
65
66 /* TODO */
67 virtual bool Ok() const { return (m_refData != NULL) ; }
68 };
69
70 /* Example handlers. TODO: write your own handlers for relevant types.
71
72 class WXDLLEXPORT wxICOFileHandler: public wxBitmapHandler
73 {
74 DECLARE_DYNAMIC_CLASS(wxICOFileHandler)
75 public:
76 inline wxICOFileHandler()
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 class WXDLLEXPORT wxICOResourceHandler: public wxBitmapHandler
88 {
89 DECLARE_DYNAMIC_CLASS(wxICOResourceHandler)
90 public:
91 inline wxICOResourceHandler()
92 {
93 m_name = "ICO resource";
94 m_extension = "ico";
95 m_type = wxBITMAP_TYPE_ICO_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 */
104
105 #endif
106 // _WX_ICON_H_