]>
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 | class WXDLLEXPORT wxIconRefData: public wxBitmapRefData | |
22 | { | |
23 | friend class WXDLLEXPORT wxBitmap; | |
24 | friend class WXDLLEXPORT wxIcon; | |
25 | public: | |
26 | wxIconRefData(); | |
27 | ~wxIconRefData(); | |
28 | ||
29 | public: | |
30 | WXHICON m_hIcon; | |
31 | }; | |
32 | ||
33 | #define M_ICONDATA ((wxIconRefData *)m_refData) | |
34 | #define M_ICONHANDLERDATA ((wxIconRefData *)bitmap->GetRefData()) | |
35 | ||
36 | // Icon | |
37 | class WXDLLEXPORT wxIcon: public wxBitmap | |
38 | { | |
39 | DECLARE_DYNAMIC_CLASS(wxIcon) | |
40 | ||
41 | public: | |
42 | wxIcon(); | |
43 | ||
44 | // Copy constructors | |
45 | inline wxIcon(const wxIcon& icon) { Ref(icon); } | |
46 | ||
47 | wxIcon( const char **bits, int width=-1, int height=-1 ); | |
48 | wxIcon( char **bits, int width=-1, int height=-1 ); | |
49 | wxIcon(const char bits[], int width, int height); | |
50 | wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICON_RESOURCE, | |
51 | int desiredWidth = -1, int desiredHeight = -1); | |
52 | ~wxIcon(); | |
53 | ||
54 | bool LoadFile(const wxString& name, long flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ , | |
55 | int desiredWidth /* = -1 */ , int desiredHeight = -1); | |
56 | bool LoadFile(const wxString& name ,long flags = wxBITMAP_TYPE_ICON_RESOURCE ) | |
57 | { return LoadFile( name , flags , -1 , -1 ) ; } | |
58 | ||
59 | inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; } | |
60 | inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; } | |
61 | inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; } | |
62 | ||
63 | void SetHICON(WXHICON ico); | |
64 | inline WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); } | |
65 | ||
66 | virtual bool Ok() const { return (m_refData != NULL) ; } | |
67 | }; | |
68 | ||
69 | /* | |
70 | class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler | |
71 | { | |
72 | DECLARE_DYNAMIC_CLASS(wxICONFileHandler) | |
73 | public: | |
74 | inline wxICONFileHandler() | |
75 | { | |
76 | m_name = "ICO icon file"; | |
77 | m_extension = "ico"; | |
78 | m_type = wxBITMAP_TYPE_ICO; | |
79 | }; | |
80 | ||
81 | virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, | |
82 | int desiredWidth = -1, int desiredHeight = -1); | |
83 | }; | |
84 | */ | |
85 | ||
86 | class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler | |
87 | { | |
88 | DECLARE_DYNAMIC_CLASS(wxICONResourceHandler) | |
89 | public: | |
90 | inline wxICONResourceHandler() | |
91 | { | |
92 | m_name = "ICON resource"; | |
93 | m_extension = ""; | |
94 | m_type = wxBITMAP_TYPE_ICON_RESOURCE; | |
95 | }; | |
96 | ||
97 | virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, | |
98 | int desiredWidth = -1, int desiredHeight = -1); | |
99 | ||
100 | }; | |
101 | ||
102 | #endif | |
103 | // _WX_ICON_H_ |