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