]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/icon.h
Destroy the wxDialog::ShowWindowModalThenDo() functor a.s.a.p.
[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 // Copyright: (c) David Webster
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_ICON_H_
12 #define _WX_ICON_H_
13
14 // ----------------------------------------------------------------------------
15 // headers
16 // ----------------------------------------------------------------------------
17
18 #include "wx/bitmap.h"
19 #include "wx/os2/gdiimage.h"
20
21 #define wxIconRefDataBase wxGDIImageRefData
22 #define wxIconBase wxGDIImage
23
24 class WXDLLIMPEXP_CORE wxIconRefData: public wxIconRefDataBase
25 {
26 public:
27 wxIconRefData() { }
28 virtual ~wxIconRefData() { Free(); }
29
30 virtual void Free();
31 }; // end of
32
33 // ---------------------------------------------------------------------------
34 // Icon
35 // ---------------------------------------------------------------------------
36
37 class WXDLLIMPEXP_CORE wxIcon: public wxIconBase
38 {
39 public:
40 wxIcon();
41
42 wxIcon( const char bits[]
43 ,int nWidth
44 ,int nHeight
45 );
46 wxIcon(const char* const* ppData) { CreateIconFromXpm(ppData); }
47 #ifdef wxNEEDS_CHARPP
48 wxIcon(char** ppData) { CreateIconFromXpm(const_cast<const char* const*>(ppData)); }
49 #endif
50 wxIcon( const wxString& rName
51 ,wxBitmapType lFlags = wxICON_DEFAULT_TYPE
52 ,int nDesiredWidth = -1
53 ,int nDesiredHeight = -1
54 );
55 wxIcon(const wxIconLocation& loc)
56 {
57 LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICO);
58 }
59
60 virtual ~wxIcon();
61
62 bool LoadFile( const wxString& rName
63 ,wxBitmapType lFlags = wxICON_DEFAULT_TYPE
64 ,int nDesiredWidth = -1
65 ,int nDesiredHeight = -1
66 );
67
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(); }
72 inline bool IsXpm(void) const { return m_bIsXpm; }
73 inline const wxBitmap& GetXpmSrc(void) const { return m_vXpmSrc; }
74
75 void CopyFromBitmap(const wxBitmap& rBmp);
76 protected:
77 virtual wxGDIImageRefData* CreateData() const
78 {
79 return new wxIconRefData;
80 }
81 void CreateIconFromXpm(const char* const* ppData);
82
83 private:
84 bool m_bIsXpm;
85 wxBitmap m_vXpmSrc;
86
87 DECLARE_DYNAMIC_CLASS(wxIcon)
88 };
89
90 #endif
91 // _WX_ICON_H_