]>
Commit | Line | Data |
---|---|---|
0dbd6262 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: icon.h | |
3 | // Purpose: wxIcon class | |
a31a5f85 | 4 | // Author: Stefan Csomor |
0dbd6262 | 5 | // Modified by: |
a31a5f85 | 6 | // Created: 1998-01-01 |
0dbd6262 | 7 | // RCS-ID: $Id$ |
a31a5f85 | 8 | // Copyright: (c) Stefan Csomor |
e40298d5 | 9 | // Licence: wxWindows licence |
0dbd6262 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_ICON_H_ | |
13 | #define _WX_ICON_H_ | |
14 | ||
af49c4b8 | 15 | #if defined(__GNUG__) && !defined(__APPLE__) |
0dbd6262 SC |
16 | #pragma interface "icon.h" |
17 | #endif | |
18 | ||
19 | #include "wx/bitmap.h" | |
20 | ||
0dbd6262 SC |
21 | // Icon |
22 | class WXDLLEXPORT wxIcon: public wxBitmap | |
23 | { | |
0dbd6262 SC |
24 | public: |
25 | wxIcon(); | |
26 | ||
27 | // Copy constructors | |
7ee31b00 GD |
28 | wxIcon(const wxIcon& icon) |
29 | : wxBitmap() | |
30 | { Ref(icon); } | |
0dbd6262 | 31 | |
d062e17f GD |
32 | wxIcon(const char **data); |
33 | wxIcon(char **data); | |
b729ceb2 | 34 | wxIcon(const char bits[], int width , int height ); |
5273bf2f | 35 | wxIcon(const wxString& name, int flags = wxBITMAP_TYPE_ICON_RESOURCE, |
aaf7ab43 VZ |
36 | int desiredWidth = -1, int desiredHeight = -1); |
37 | wxIcon(const wxIconLocation& loc) | |
38 | { | |
39 | LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON); | |
40 | } | |
0dbd6262 SC |
41 | ~wxIcon(); |
42 | ||
5273bf2f | 43 | bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ , |
519cb848 | 44 | int desiredWidth /* = -1 */ , int desiredHeight = -1); |
5273bf2f | 45 | bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE ) |
aaf7ab43 VZ |
46 | { return LoadFile( name , flags , -1 , -1 ) ; } |
47 | ||
48 | wxIcon& operator=(const wxIcon& icon) | |
49 | { if (this != &icon) Ref(icon); return *this; } | |
50 | bool operator==(const wxIcon& icon) const { return m_refData == icon.m_refData; } | |
51 | bool operator!=(const wxIcon& icon) const { return !(*this == icon); } | |
0dbd6262 | 52 | |
d062e17f GD |
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); | |
aaf7ab43 VZ |
57 | |
58 | DECLARE_DYNAMIC_CLASS(wxIcon) | |
0dbd6262 SC |
59 | }; |
60 | ||
519cb848 SC |
61 | /* |
62 | class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler | |
0dbd6262 | 63 | { |
519cb848 | 64 | DECLARE_DYNAMIC_CLASS(wxICONFileHandler) |
0dbd6262 | 65 | public: |
519cb848 | 66 | inline wxICONFileHandler() |
0dbd6262 | 67 | { |
e40298d5 JS |
68 | m_name = "ICO icon file"; |
69 | m_extension = "ico"; | |
70 | m_type = wxBITMAP_TYPE_ICO; | |
0dbd6262 SC |
71 | }; |
72 | ||
73 | virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, | |
74 | int desiredWidth = -1, int desiredHeight = -1); | |
75 | }; | |
519cb848 | 76 | */ |
0dbd6262 | 77 | |
519cb848 | 78 | class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler |
0dbd6262 | 79 | { |
519cb848 | 80 | DECLARE_DYNAMIC_CLASS(wxICONResourceHandler) |
0dbd6262 | 81 | public: |
519cb848 | 82 | inline wxICONResourceHandler() |
0dbd6262 | 83 | { |
c4e41ce3 SC |
84 | m_name = wxT("ICON resource"); |
85 | m_extension = wxEmptyString; | |
e40298d5 | 86 | m_type = wxBITMAP_TYPE_ICON_RESOURCE; |
0dbd6262 SC |
87 | }; |
88 | ||
89 | virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, | |
90 | int desiredWidth = -1, int desiredHeight = -1); | |
91 | ||
92 | }; | |
93 | ||
0dbd6262 SC |
94 | #endif |
95 | // _WX_ICON_H_ |