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