]>
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 | ||
f97c9854 JS |
21 | /* |
22 | // Same as for wxBitmap | |
9b6dbb09 JS |
23 | class WXDLLEXPORT wxIconRefData: public wxBitmapRefData |
24 | { | |
25 | friend class WXDLLEXPORT wxBitmap; | |
26 | friend class WXDLLEXPORT wxIcon; | |
27 | public: | |
28 | wxIconRefData(); | |
29 | ~wxIconRefData(); | |
9b6dbb09 | 30 | }; |
f97c9854 | 31 | */ |
9b6dbb09 | 32 | |
f97c9854 JS |
33 | #define M_ICONDATA ((wxBitmapRefData *)m_refData) |
34 | #define M_ICONHANDLERDATA ((wxBitmapRefData *)bitmap->GetRefData()) | |
9b6dbb09 JS |
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); } | |
9b6dbb09 | 46 | |
f97c9854 | 47 | // Initialize with XBM data |
9b6dbb09 | 48 | wxIcon(const char bits[], int width, int height); |
f97c9854 JS |
49 | |
50 | // Initialize with XPM data | |
42565245 | 51 | wxIcon(const char **data); |
a4294b78 | 52 | wxIcon(char **data); |
f97c9854 | 53 | |
cba2db0c | 54 | wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_XPM, |
9b6dbb09 JS |
55 | int desiredWidth = -1, int desiredHeight = -1); |
56 | ~wxIcon(); | |
57 | ||
cba2db0c | 58 | bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_XPM, |
9b6dbb09 | 59 | int desiredWidth = -1, int desiredHeight = -1); |
afce4c03 VZ |
60 | bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_XBM) |
61 | { return wxBitmap::LoadFile(name, type); } | |
9b6dbb09 JS |
62 | |
63 | inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; } | |
64 | inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; } | |
65 | inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; } | |
66 | ||
f97c9854 | 67 | virtual bool Ok() const { return ((m_refData != NULL) && (M_ICONDATA->m_ok)); } |
9b6dbb09 JS |
68 | }; |
69 | ||
9b6dbb09 JS |
70 | #endif |
71 | // _WX_ICON_H_ |