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