]>
Commit | Line | Data |
---|---|---|
0dbd6262 SC |
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: | |
0dbd6262 | 30 | WXHICON m_hIcon; |
0dbd6262 SC |
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 | ||
e7549107 SC |
47 | wxIcon( const char **bits, int width=-1, int height=-1 ); |
48 | wxIcon( char **bits, int width=-1, int height=-1 ); | |
0dbd6262 | 49 | wxIcon(const char bits[], int width, int height); |
519cb848 | 50 | wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICON_RESOURCE, |
0dbd6262 SC |
51 | int desiredWidth = -1, int desiredHeight = -1); |
52 | ~wxIcon(); | |
53 | ||
519cb848 SC |
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 ) ; } | |
0dbd6262 SC |
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 | ||
0dbd6262 SC |
63 | void SetHICON(WXHICON ico); |
64 | inline WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); } | |
0dbd6262 | 65 | |
0dbd6262 SC |
66 | virtual bool Ok() const { return (m_refData != NULL) ; } |
67 | }; | |
68 | ||
519cb848 SC |
69 | /* |
70 | class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler | |
0dbd6262 | 71 | { |
519cb848 | 72 | DECLARE_DYNAMIC_CLASS(wxICONFileHandler) |
0dbd6262 | 73 | public: |
519cb848 | 74 | inline wxICONFileHandler() |
0dbd6262 SC |
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 | }; | |
519cb848 | 84 | */ |
0dbd6262 | 85 | |
519cb848 | 86 | class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler |
0dbd6262 | 87 | { |
519cb848 | 88 | DECLARE_DYNAMIC_CLASS(wxICONResourceHandler) |
0dbd6262 | 89 | public: |
519cb848 | 90 | inline wxICONResourceHandler() |
0dbd6262 | 91 | { |
519cb848 SC |
92 | m_name = "ICON resource"; |
93 | m_extension = ""; | |
94 | m_type = wxBITMAP_TYPE_ICON_RESOURCE; | |
0dbd6262 SC |
95 | }; |
96 | ||
97 | virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, | |
98 | int desiredWidth = -1, int desiredHeight = -1); | |
99 | ||
100 | }; | |
101 | ||
0dbd6262 SC |
102 | #endif |
103 | // _WX_ICON_H_ |