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