]>
Commit | Line | Data |
---|---|---|
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 WXDLLEXPORT wxIcon: public wxGDIObject | |
19 | { | |
20 | public: | |
21 | wxIcon(); | |
22 | ||
23 | wxIcon(const char **data); | |
24 | wxIcon(char **data); | |
25 | wxIcon(const char bits[], int width , int height ); | |
26 | wxIcon(const wxString& name, int flags = wxBITMAP_TYPE_ICON_RESOURCE, | |
27 | int desiredWidth = -1, int desiredHeight = -1); | |
28 | wxIcon(const wxIconLocation& loc) | |
29 | { | |
30 | LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON); | |
31 | } | |
32 | ||
33 | wxIcon(WXHICON icon, const wxSize& size); | |
34 | ||
35 | virtual ~wxIcon(); | |
36 | ||
37 | bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ , | |
38 | int desiredWidth /* = -1 */ , int desiredHeight = -1); | |
39 | bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE ) | |
40 | { return LoadFile( name , flags , -1 , -1 ) ; } | |
41 | ||
42 | ||
43 | // create from bitmap (which should have a mask unless it's monochrome): | |
44 | // there shouldn't be any implicit bitmap -> icon conversion (i.e. no | |
45 | // ctors, assignment operators...), but it's ok to have such function | |
46 | void CopyFromBitmap(const wxBitmap& bmp); | |
47 | ||
48 | bool Ok() const { return IsOk(); } | |
49 | bool IsOk() const; | |
50 | int GetWidth() const; | |
51 | int GetHeight() const; | |
52 | int GetDepth() const; | |
53 | void SetWidth(int w); | |
54 | void SetHeight(int h); | |
55 | void SetDepth(int d); | |
56 | void SetOk(bool isOk); | |
57 | ||
58 | WXHICON GetHICON() const ; | |
59 | ||
60 | DECLARE_DYNAMIC_CLASS(wxIcon) | |
61 | }; | |
62 | ||
63 | /* | |
64 | class WXDLLEXPORT 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 WXDLLEXPORT 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_ |