]>
Commit | Line | Data |
---|---|---|
0e320a79 | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/os2/icon.h |
0e320a79 | 3 | // Purpose: wxIcon class |
fb9010ed | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
fb9010ed | 6 | // Created: 10/09/99 |
fb9010ed | 7 | // Copyright: (c) David Webster |
65571936 | 8 | // Licence: wxWindows licence |
0e320a79 DW |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef _WX_ICON_H_ | |
12 | #define _WX_ICON_H_ | |
13 | ||
3b9e3455 DW |
14 | // ---------------------------------------------------------------------------- |
15 | // headers | |
16 | // ---------------------------------------------------------------------------- | |
17 | ||
79c09341 | 18 | #include "wx/bitmap.h" |
81152407 | 19 | #include "wx/os2/gdiimage.h" |
0e320a79 | 20 | |
81152407 VZ |
21 | #define wxIconRefDataBase wxGDIImageRefData |
22 | #define wxIconBase wxGDIImage | |
0e320a79 | 23 | |
53a2db12 | 24 | class WXDLLIMPEXP_CORE wxIconRefData: public wxIconRefDataBase |
0e320a79 | 25 | { |
0e320a79 | 26 | public: |
6dd0883d | 27 | wxIconRefData() { } |
61243a51 | 28 | virtual ~wxIconRefData() { Free(); } |
0e320a79 | 29 | |
3b9e3455 | 30 | virtual void Free(); |
61243a51 | 31 | }; // end of |
0e320a79 | 32 | |
3b9e3455 DW |
33 | // --------------------------------------------------------------------------- |
34 | // Icon | |
35 | // --------------------------------------------------------------------------- | |
36 | ||
53a2db12 | 37 | class WXDLLIMPEXP_CORE wxIcon: public wxIconBase |
0e320a79 | 38 | { |
0e320a79 | 39 | public: |
3b9e3455 DW |
40 | wxIcon(); |
41 | ||
3b9e3455 DW |
42 | wxIcon( const char bits[] |
43 | ,int nWidth | |
44 | ,int nHeight | |
45 | ); | |
e45080c1 PC |
46 | wxIcon(const char* const* ppData) { CreateIconFromXpm(ppData); } |
47 | #ifdef wxNEEDS_CHARPP | |
5c33522f | 48 | wxIcon(char** ppData) { CreateIconFromXpm(const_cast<const char* const*>(ppData)); } |
e45080c1 | 49 | #endif |
3b9e3455 | 50 | wxIcon( const wxString& rName |
c48d0d37 | 51 | ,wxBitmapType lFlags = wxICON_DEFAULT_TYPE |
3b9e3455 DW |
52 | ,int nDesiredWidth = -1 |
53 | ,int nDesiredHeight = -1 | |
54 | ); | |
aaf7ab43 VZ |
55 | wxIcon(const wxIconLocation& loc) |
56 | { | |
57 | LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICO); | |
58 | } | |
59 | ||
d3c7fc99 | 60 | virtual ~wxIcon(); |
3b9e3455 DW |
61 | |
62 | bool LoadFile( const wxString& rName | |
c48d0d37 | 63 | ,wxBitmapType lFlags = wxICON_DEFAULT_TYPE |
3b9e3455 DW |
64 | ,int nDesiredWidth = -1 |
65 | ,int nDesiredHeight = -1 | |
66 | ); | |
67 | ||
3b9e3455 DW |
68 | wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; } |
69 | ||
70 | inline void SetHICON(WXHICON hIcon) { SetHandle((WXHANDLE)hIcon); } | |
71 | inline WXHICON GetHICON() const { return (WXHICON)GetHandle(); } | |
6dd0883d | 72 | inline bool IsXpm(void) const { return m_bIsXpm; } |
79c09341 | 73 | inline const wxBitmap& GetXpmSrc(void) const { return m_vXpmSrc; } |
3b9e3455 | 74 | |
8bb6da4a | 75 | void CopyFromBitmap(const wxBitmap& rBmp); |
3b9e3455 DW |
76 | protected: |
77 | virtual wxGDIImageRefData* CreateData() const | |
78 | { | |
79 | return new wxIconRefData; | |
80 | } | |
e45080c1 | 81 | void CreateIconFromXpm(const char* const* ppData); |
0e320a79 | 82 | |
3b9e3455 | 83 | private: |
79c09341 DW |
84 | bool m_bIsXpm; |
85 | wxBitmap m_vXpmSrc; | |
86 | ||
3b9e3455 | 87 | DECLARE_DYNAMIC_CLASS(wxIcon) |
0e320a79 DW |
88 | }; |
89 | ||
0e320a79 DW |
90 | #endif |
91 | // _WX_ICON_H_ |