]>
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 | ||
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 | 25 | wxIcon(); |
1d54b9d2 | 26 | |
83df96d6 JS |
27 | // Copy constructors |
28 | inline wxIcon(const wxIcon& icon) { Ref(icon); } | |
1d54b9d2 | 29 | |
83df96d6 JS |
30 | // Initialize with XBM data |
31 | wxIcon(const char bits[], int width, int height); | |
1d54b9d2 | 32 | |
83df96d6 JS |
33 | // Initialize with XPM data |
34 | wxIcon(const char **data); | |
35 | wxIcon(char **data); | |
1d54b9d2 | 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 | 48 | ~wxIcon(); |
1d54b9d2 VZ |
49 | |
50 | bool LoadFile(const wxString& name, wxBitmapType type, | |
51 | int desiredWidth, int desiredHeight = -1); | |
52 | ||
53 | // unhide base class LoadFile() | |
54 | virtual bool LoadFile(const wxString& name, | |
55 | wxBitmapType type = wxBITMAP_TYPE_XPM) | |
56 | { | |
57 | return LoadFile(name, type, -1, -1); | |
58 | } | |
329e276a VS |
59 | |
60 | // create from bitmap (which should have a mask unless it's monochrome): | |
61 | // there shouldn't be any implicit bitmap -> icon conversion (i.e. no | |
62 | // ctors, assignment operators...), but it's ok to have such function | |
63 | void CopyFromBitmap(const wxBitmap& bmp); | |
1d54b9d2 | 64 | |
aaf7ab43 VZ |
65 | wxIcon& operator = (const wxIcon& icon) |
66 | { if (this != &icon) Ref(icon); return *this; } | |
67 | bool operator == (const wxIcon& icon) const | |
59e034c0 | 68 | { return m_refData == icon.m_refData; } |
aaf7ab43 VZ |
69 | bool operator != (const wxIcon& icon) const |
70 | { return !(*this == icon); } | |
71 | ||
72 | ||
777105f2 | 73 | DECLARE_DYNAMIC_CLASS(wxIcon) |
9b6dbb09 JS |
74 | }; |
75 | ||
59e034c0 | 76 | #endif // _WX_ICON_H_ |