]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/icon.h
Removed Motif files that only contained stubs
[wxWidgets.git] / include / wx / os2 / icon.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: 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 // compatible (even if incorrect) behaviour by default: derive wxIcon from
20 // wxBitmap
21 #ifndef wxICON_IS_BITMAP
22 #define wxICON_IS_BITMAP 1
23 #endif
24
25 #include "wx/bitmap.h"
26 #if wxICON_IS_BITMAP
27
28 #define wxIconRefDataBase wxBitmapRefData
29 #define wxIconBase wxBitmap
30 #else
31 #include "wx/os2/gdiimage.h"
32
33 #define wxIconRefDataBase wxGDIImageRefData
34 #define wxIconBase wxGDIImage
35 #endif
36
37 class WXDLLEXPORT wxIconRefData: public wxIconRefDataBase
38 {
39 public:
40 wxIconRefData() { };
41 virtual ~wxIconRefData() { Free(); }
42
43 virtual void Free();
44 }; // end of
45
46 // ---------------------------------------------------------------------------
47 // Icon
48 // ---------------------------------------------------------------------------
49
50 class WXDLLEXPORT wxIcon: public wxIconBase
51 {
52 public:
53 wxIcon();
54
55 // Copy constructors
56 inline wxIcon(const wxIcon& icon) { Ref(icon); }
57
58 wxIcon( const char bits[]
59 ,int nWidth
60 ,int nHeight
61 );
62 inline wxIcon(const char** ppData) { CreateIconFromXpm(ppData); }
63 inline wxIcon(char** ppData) { CreateIconFromXpm((const char**)ppData); }
64 wxIcon( const wxString& rName
65 ,long lFlags = wxBITMAP_TYPE_ICO_RESOURCE
66 ,int nDesiredWidth = -1
67 ,int nDesiredHeight = -1
68 );
69 ~wxIcon();
70
71 bool LoadFile( const wxString& rName
72 ,long lFlags = wxBITMAP_TYPE_ICO_RESOURCE
73 ,int nDesiredWidth = -1
74 ,int nDesiredHeight = -1
75 );
76
77 inline wxIcon& operator = (const wxIcon& rIcon)
78 { if (*this != rIcon) Ref(rIcon); return *this; }
79 inline bool operator == (const wxIcon& rIcon)
80 { return m_refData == rIcon.m_refData; }
81 inline bool operator != (const wxIcon& rIcon)
82 { return m_refData != rIcon.m_refData; }
83
84 wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; }
85
86 inline void SetHICON(WXHICON hIcon) { SetHandle((WXHANDLE)hIcon); }
87 inline WXHICON GetHICON() const { return (WXHICON)GetHandle(); }
88 inline bool IsXpm(void) const { return m_bIsXpm; };
89 inline const wxBitmap& GetXpmSrc(void) const { return m_vXpmSrc; }
90
91 void CopyFromBitmap(const wxBitmap& rBmp);
92 protected:
93 virtual wxGDIImageRefData* CreateData() const
94 {
95 return new wxIconRefData;
96 }
97 void CreateIconFromXpm(const char **ppData);
98
99 private:
100 bool m_bIsXpm;
101 wxBitmap m_vXpmSrc;
102
103 DECLARE_DYNAMIC_CLASS(wxIcon)
104 };
105
106 #endif
107 // _WX_ICON_H_