]>
Commit | Line | Data |
---|---|---|
8cf73271 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 |
8cf73271 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_ICON_H_ | |
13 | #define _WX_ICON_H_ | |
14 | ||
8cf73271 SC |
15 | #include "wx/bitmap.h" |
16 | ||
17 | // Icon | |
20b69855 | 18 | class WXDLLEXPORT wxIcon: public wxGDIObject |
8cf73271 SC |
19 | { |
20 | public: | |
20b69855 | 21 | wxIcon(); |
8cf73271 | 22 | |
20b69855 SC |
23 | // Copy constructors |
24 | wxIcon(const wxIcon& icon) | |
f0794a4c VZ |
25 | : wxGDIObject() |
26 | { | |
27 | Ref(icon); | |
28 | } | |
8cf73271 | 29 | |
20b69855 SC |
30 | wxIcon(const char **data); |
31 | wxIcon(char **data); | |
32 | wxIcon(const char bits[], int width , int height ); | |
33 | wxIcon(const wxString& name, int flags = wxBITMAP_TYPE_ICON_RESOURCE, | |
8cf73271 | 34 | int desiredWidth = -1, int desiredHeight = -1); |
20b69855 SC |
35 | wxIcon(const wxIconLocation& loc) |
36 | { | |
8cf73271 | 37 | LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON); |
20b69855 SC |
38 | } |
39 | ~wxIcon(); | |
8cf73271 | 40 | |
20b69855 | 41 | bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ , |
8cf73271 | 42 | int desiredWidth /* = -1 */ , int desiredHeight = -1); |
20b69855 | 43 | bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE ) |
8cf73271 SC |
44 | { return LoadFile( name , flags , -1 , -1 ) ; } |
45 | ||
20b69855 | 46 | wxIcon& operator=(const wxIcon& icon) |
8cf73271 | 47 | { if (this != &icon) Ref(icon); return *this; } |
20b69855 SC |
48 | bool operator==(const wxIcon& icon) const { return m_refData == icon.m_refData; } |
49 | bool operator!=(const wxIcon& icon) const { return !(*this == icon); } | |
50 | ||
51 | // create from bitmap (which should have a mask unless it's monochrome): | |
52 | // there shouldn't be any implicit bitmap -> icon conversion (i.e. no | |
53 | // ctors, assignment operators...), but it's ok to have such function | |
54 | void CopyFromBitmap(const wxBitmap& bmp); | |
55 | ||
56 | bool Ok() const; | |
57 | int GetWidth() const; | |
58 | int GetHeight() const; | |
59 | int GetDepth() const; | |
60 | void SetWidth(int w); | |
61 | void SetHeight(int h); | |
62 | void SetDepth(int d); | |
63 | void SetOk(bool isOk); | |
f0794a4c | 64 | |
20b69855 SC |
65 | WXHICON GetHICON() const ; |
66 | ||
67 | DECLARE_DYNAMIC_CLASS(wxIcon) | |
8cf73271 SC |
68 | }; |
69 | ||
70 | /* | |
71 | class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler | |
72 | { | |
73 | DECLARE_DYNAMIC_CLASS(wxICONFileHandler) | |
74 | public: | |
75 | inline wxICONFileHandler() | |
76 | { | |
77 | m_name = "ICO icon file"; | |
78 | m_extension = "ico"; | |
79 | m_type = wxBITMAP_TYPE_ICO; | |
80 | }; | |
81 | ||
82 | virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, | |
83 | int desiredWidth = -1, int desiredHeight = -1); | |
84 | }; | |
85 | */ | |
86 | ||
87 | class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler | |
88 | { | |
89 | DECLARE_DYNAMIC_CLASS(wxICONResourceHandler) | |
90 | public: | |
91 | inline wxICONResourceHandler() | |
92 | { | |
19d360ad SC |
93 | SetName(wxT("ICON resource")); |
94 | SetExtension(wxEmptyString); | |
95 | SetType(wxBITMAP_TYPE_ICON_RESOURCE); | |
8cf73271 SC |
96 | }; |
97 | ||
98 | virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, | |
99 | int desiredWidth = -1, int desiredHeight = -1); | |
100 | ||
101 | }; | |
102 | ||
103 | #endif | |
104 | // _WX_ICON_H_ |