]>
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 | ||
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
9b6dbb09 JS |
16 | #pragma interface "icon.h" |
17 | #endif | |
18 | ||
19 | #include "wx/bitmap.h" | |
20 | ||
9b6dbb09 | 21 | // Icon |
aaf7ab43 | 22 | class WXDLLEXPORT wxIcon : public wxBitmap |
9b6dbb09 | 23 | { |
9b6dbb09 | 24 | public: |
83df96d6 JS |
25 | wxIcon(); |
26 | ||
27 | // Copy constructors | |
28 | inline wxIcon(const wxIcon& icon) { Ref(icon); } | |
29 | ||
30 | // Initialize with XBM data | |
31 | wxIcon(const char bits[], int width, int height); | |
32 | ||
33 | // Initialize with XPM data | |
34 | wxIcon(const char **data); | |
35 | wxIcon(char **data); | |
36 | ||
1bc822df | 37 | wxIcon(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_XPM, |
aaf7ab43 VZ |
38 | int desiredWidth = -1, int desiredHeight = -1) |
39 | { | |
40 | LoadFile(name, type, desiredWidth, desiredHeight); | |
41 | } | |
42 | ||
43 | wxIcon(const wxIconLocation& loc) | |
44 | { | |
6f12c2c9 | 45 | LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ANY); |
aaf7ab43 VZ |
46 | } |
47 | ||
83df96d6 JS |
48 | ~wxIcon(); |
49 | ||
1bc822df | 50 | bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_XPM, |
aaf7ab43 | 51 | int desiredWidth = -1, int desiredHeight = -1); |
329e276a VS |
52 | |
53 | // create from bitmap (which should have a mask unless it's monochrome): | |
54 | // there shouldn't be any implicit bitmap -> icon conversion (i.e. no | |
55 | // ctors, assignment operators...), but it's ok to have such function | |
56 | void CopyFromBitmap(const wxBitmap& bmp); | |
83df96d6 | 57 | |
aaf7ab43 VZ |
58 | wxIcon& operator = (const wxIcon& icon) |
59 | { if (this != &icon) Ref(icon); return *this; } | |
60 | bool operator == (const wxIcon& icon) const | |
59e034c0 | 61 | { return m_refData == icon.m_refData; } |
aaf7ab43 VZ |
62 | bool operator != (const wxIcon& icon) const |
63 | { return !(*this == icon); } | |
64 | ||
65 | ||
66 | DECLARE_DYNAMIC_CLASS(wxIcon); | |
9b6dbb09 JS |
67 | }; |
68 | ||
59e034c0 | 69 | #endif // _WX_ICON_H_ |