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