]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
6d167489 | 2 | // Name: wx/msw/icon.h |
2bda0e17 KB |
3 | // Purpose: wxIcon class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
bbcdf8bc | 7 | // Copyright: (c) Julian Smart |
65571936 | 8 | // Licence: wxWindows licence |
2bda0e17 KB |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
bbcdf8bc JS |
11 | #ifndef _WX_ICON_H_ |
12 | #define _WX_ICON_H_ | |
2bda0e17 | 13 | |
6d167489 VZ |
14 | // ---------------------------------------------------------------------------- |
15 | // headers | |
16 | // ---------------------------------------------------------------------------- | |
17 | ||
c781807d | 18 | #include "wx/msw/gdiimage.h" |
2bda0e17 | 19 | |
c793fa87 VZ |
20 | // --------------------------------------------------------------------------- |
21 | // icon data | |
22 | // --------------------------------------------------------------------------- | |
c793fa87 | 23 | |
6d167489 VZ |
24 | // notice that although wxIconRefData inherits from wxBitmapRefData, it is not |
25 | // a valid wxBitmapRefData | |
53a2db12 | 26 | class WXDLLIMPEXP_CORE wxIconRefData : public wxGDIImageRefData |
6d167489 | 27 | { |
2bda0e17 | 28 | public: |
6d167489 VZ |
29 | wxIconRefData() { } |
30 | virtual ~wxIconRefData() { Free(); } | |
2bda0e17 | 31 | |
6d167489 | 32 | virtual void Free(); |
2bda0e17 KB |
33 | }; |
34 | ||
c793fa87 | 35 | // --------------------------------------------------------------------------- |
2bda0e17 | 36 | // Icon |
c793fa87 | 37 | // --------------------------------------------------------------------------- |
2bda0e17 | 38 | |
53a2db12 | 39 | class WXDLLIMPEXP_CORE wxIcon : public wxGDIImage |
6d167489 | 40 | { |
2bda0e17 | 41 | public: |
4b7f2165 VZ |
42 | // ctors |
43 | // default | |
44 | wxIcon() { } | |
2bda0e17 | 45 | |
4b7f2165 | 46 | // from raw data |
c793fa87 | 47 | wxIcon(const char bits[], int width, int height); |
aaf7ab43 | 48 | |
4b7f2165 | 49 | // from XPM data |
e45080c1 PC |
50 | wxIcon(const char* const* data) { CreateIconFromXpm(data); } |
51 | #ifdef wxNEEDS_CHARPP | |
5c33522f | 52 | wxIcon(char **data) { CreateIconFromXpm(const_cast<const char* const*>(data)); } |
e45080c1 | 53 | #endif |
4b7f2165 | 54 | // from resource/file |
6d167489 | 55 | wxIcon(const wxString& name, |
cbea3ec6 | 56 | wxBitmapType type = wxICON_DEFAULT_TYPE, |
c793fa87 | 57 | int desiredWidth = -1, int desiredHeight = -1); |
4b7f2165 | 58 | |
aaf7ab43 VZ |
59 | wxIcon(const wxIconLocation& loc); |
60 | ||
6d167489 | 61 | virtual ~wxIcon(); |
2bda0e17 | 62 | |
6d167489 | 63 | virtual bool LoadFile(const wxString& name, |
cbea3ec6 | 64 | wxBitmapType type = wxICON_DEFAULT_TYPE, |
6d167489 | 65 | int desiredWidth = -1, int desiredHeight = -1); |
2bda0e17 | 66 | |
973abcbb VZ |
67 | bool CreateFromHICON(WXHICON icon); |
68 | ||
4004f41e | 69 | // implementation only from now on |
6d167489 | 70 | wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; } |
2bda0e17 | 71 | |
6d167489 VZ |
72 | void SetHICON(WXHICON icon) { SetHandle((WXHANDLE)icon); } |
73 | WXHICON GetHICON() const { return (WXHICON)GetHandle(); } | |
2bda0e17 | 74 | |
4004f41e VZ |
75 | // create from bitmap (which should have a mask unless it's monochrome): |
76 | // there shouldn't be any implicit bitmap -> icon conversion (i.e. no | |
77 | // ctors, assignment operators...), but it's ok to have such function | |
78 | void CopyFromBitmap(const wxBitmap& bmp); | |
79 | ||
6d167489 VZ |
80 | protected: |
81 | virtual wxGDIImageRefData *CreateData() const | |
c793fa87 | 82 | { |
6d167489 VZ |
83 | return new wxIconRefData; |
84 | } | |
2bda0e17 | 85 | |
9d769508 VZ |
86 | virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; |
87 | ||
4b7f2165 | 88 | // create from XPM data |
e45080c1 | 89 | void CreateIconFromXpm(const char* const* data); |
4b7f2165 | 90 | |
6d167489 VZ |
91 | private: |
92 | DECLARE_DYNAMIC_CLASS(wxIcon) | |
2bda0e17 KB |
93 | }; |
94 | ||
95 | #endif | |
bbcdf8bc | 96 | // _WX_ICON_H_ |