]>
Commit | Line | Data |
---|---|---|
9b6dbb09 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: icon.h | |
3 | // Purpose: wxIcon class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
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(); | |
9b6dbb09 JS |
28 | }; |
29 | ||
30 | #define M_ICONDATA ((wxIconRefData *)m_refData) | |
31 | #define M_ICONHANDLERDATA ((wxIconRefData *)bitmap->GetRefData()) | |
32 | ||
33 | // Icon | |
34 | class WXDLLEXPORT wxIcon: public wxBitmap | |
35 | { | |
36 | DECLARE_DYNAMIC_CLASS(wxIcon) | |
37 | ||
38 | public: | |
39 | wxIcon(); | |
40 | ||
41 | // Copy constructors | |
42 | inline wxIcon(const wxIcon& icon) { Ref(icon); } | |
43 | inline wxIcon(const wxIcon* icon) { if (icon) Ref(*icon); } | |
44 | ||
45 | wxIcon(const char bits[], int width, int height); | |
46 | wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE, | |
47 | int desiredWidth = -1, int desiredHeight = -1); | |
48 | ~wxIcon(); | |
49 | ||
50 | bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE, | |
51 | int desiredWidth = -1, int desiredHeight = -1); | |
52 | ||
53 | inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; } | |
54 | inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; } | |
55 | inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; } | |
56 | ||
9b6dbb09 JS |
57 | /* TODO */ |
58 | virtual bool Ok() const { return (m_refData != NULL) ; } | |
59 | }; | |
60 | ||
61 | /* Example handlers. TODO: write your own handlers for relevant types. | |
62 | ||
63 | class WXDLLEXPORT wxICOFileHandler: public wxBitmapHandler | |
64 | { | |
65 | DECLARE_DYNAMIC_CLASS(wxICOFileHandler) | |
66 | public: | |
67 | inline wxICOFileHandler() | |
68 | { | |
69 | m_name = "ICO icon file"; | |
70 | m_extension = "ico"; | |
71 | m_type = wxBITMAP_TYPE_ICO; | |
72 | }; | |
73 | ||
74 | virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, | |
75 | int desiredWidth = -1, int desiredHeight = -1); | |
76 | }; | |
77 | ||
78 | class WXDLLEXPORT wxICOResourceHandler: public wxBitmapHandler | |
79 | { | |
80 | DECLARE_DYNAMIC_CLASS(wxICOResourceHandler) | |
81 | public: | |
82 | inline wxICOResourceHandler() | |
83 | { | |
84 | m_name = "ICO resource"; | |
85 | m_extension = "ico"; | |
86 | m_type = wxBITMAP_TYPE_ICO_RESOURCE; | |
87 | }; | |
88 | ||
89 | virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, | |
90 | int desiredWidth = -1, int desiredHeight = -1); | |
91 | ||
92 | }; | |
93 | ||
94 | */ | |
95 | ||
96 | #endif | |
97 | // _WX_ICON_H_ |