]>
Commit | Line | Data |
---|---|---|
52479aef SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: icon.h | |
3 | // Purpose: wxIcon class | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Stefan Csomor | |
65571936 | 9 | // Licence: wxWindows licence |
52479aef SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_ICON_H_ | |
13 | #define _WX_ICON_H_ | |
14 | ||
52479aef SC |
15 | #include "wx/bitmap.h" |
16 | ||
17 | // Icon | |
18 | class WXDLLEXPORT wxIcon: public wxBitmap | |
19 | { | |
20 | public: | |
21 | wxIcon(); | |
22 | ||
23 | // Copy constructors | |
24 | wxIcon(const wxIcon& icon) | |
25 | : wxBitmap() | |
26 | { Ref(icon); } | |
27 | ||
28 | wxIcon(const char **data); | |
29 | wxIcon(char **data); | |
30 | wxIcon(const char bits[], int width , int height ); | |
31 | wxIcon(const wxString& name, int flags = wxBITMAP_TYPE_ICON_RESOURCE, | |
32 | int desiredWidth = -1, int desiredHeight = -1); | |
33 | wxIcon(const wxIconLocation& loc) | |
34 | { | |
35 | LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON); | |
36 | } | |
37 | ~wxIcon(); | |
38 | ||
39 | bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ , | |
40 | int desiredWidth /* = -1 */ , int desiredHeight = -1); | |
41 | bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE ) | |
42 | { return LoadFile( name , flags , -1 , -1 ) ; } | |
43 | ||
44 | wxIcon& operator=(const wxIcon& icon) | |
45 | { if (this != &icon) Ref(icon); return *this; } | |
46 | bool operator==(const wxIcon& icon) const { return m_refData == icon.m_refData; } | |
47 | bool operator!=(const wxIcon& icon) const { return !(*this == icon); } | |
48 | ||
49 | // create from bitmap (which should have a mask unless it's monochrome): | |
50 | // there shouldn't be any implicit bitmap -> icon conversion (i.e. no | |
51 | // ctors, assignment operators...), but it's ok to have such function | |
52 | void CopyFromBitmap(const wxBitmap& bmp); | |
53 | ||
54 | DECLARE_DYNAMIC_CLASS(wxIcon) | |
55 | }; | |
56 | ||
57 | /* | |
58 | class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler | |
59 | { | |
60 | DECLARE_DYNAMIC_CLASS(wxICONFileHandler) | |
61 | public: | |
62 | inline wxICONFileHandler() | |
63 | { | |
64 | m_name = "ICO icon file"; | |
65 | m_extension = "ico"; | |
66 | m_type = wxBITMAP_TYPE_ICO; | |
67 | }; | |
68 | ||
69 | virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, | |
70 | int desiredWidth = -1, int desiredHeight = -1); | |
71 | }; | |
72 | */ | |
73 | ||
74 | class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler | |
75 | { | |
76 | DECLARE_DYNAMIC_CLASS(wxICONResourceHandler) | |
77 | public: | |
78 | inline wxICONResourceHandler() | |
79 | { | |
80 | m_name = wxT("ICON resource"); | |
81 | m_extension = wxEmptyString; | |
82 | m_type = wxBITMAP_TYPE_ICON_RESOURCE; | |
83 | }; | |
84 | ||
85 | virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, | |
86 | int desiredWidth = -1, int desiredHeight = -1); | |
87 | ||
88 | }; | |
89 | ||
90 | #endif | |
91 | // _WX_ICON_H_ |