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