]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/icon.h
bitmap and image updates
[wxWidgets.git] / include / wx / os2 / icon.h
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: icon.h
3// Purpose: wxIcon class
fb9010ed 4// Author: David Webster
0e320a79 5// Modified by:
fb9010ed 6// Created: 10/09/99
0e320a79 7// RCS-ID: $Id$
fb9010ed
DW
8// Copyright: (c) David Webster
9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_ICON_H_
13#define _WX_ICON_H_
14
3b9e3455
DW
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
0e320a79 24
3b9e3455
DW
25#if wxICON_IS_BITMAP
26 #include "wx/bitmap.h"
0e320a79 27
3b9e3455
DW
28 #define wxIconRefDataBase wxBitmapRefData
29 #define wxIconBase wxBitmap
30#else
31 #include "wx/os2/gdiimage.h"
0e320a79 32
3b9e3455
DW
33 #define wxIconRefDataBase wxGDIImageRefData
34 #define wxIconBase wxGDIImage
35#endif
0e320a79 36
3b9e3455 37class WXDLLEXPORT wxIconRefData: public wxIconRefDataBase
0e320a79 38{
0e320a79 39public:
3b9e3455
DW
40 wxIconRefData() { };
41 virtual ~wxIconRefData() { Free(); m_hIcon = NULL; }
0e320a79 42
3b9e3455 43 virtual void Free();
0e320a79 44public:
3b9e3455 45 WXHICON m_hIcon;
0e320a79
DW
46};
47
3b9e3455
DW
48// ---------------------------------------------------------------------------
49// Icon
50// ---------------------------------------------------------------------------
51
52class WXDLLEXPORT wxIcon: public wxIconBase
0e320a79 53{
0e320a79 54public:
3b9e3455
DW
55 wxIcon();
56
57 // Copy constructors
58 inline wxIcon(const wxIcon& icon) { Ref(icon); }
59
60 wxIcon( const char bits[]
61 ,int nWidth
62 ,int nHeight
63 );
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
89protected:
90 virtual wxGDIImageRefData* CreateData() const
91 {
92 return new wxIconRefData;
93 }
0e320a79 94
3b9e3455
DW
95private:
96 DECLARE_DYNAMIC_CLASS(wxIcon)
0e320a79
DW
97};
98
0e320a79
DW
99#endif
100 // _WX_ICON_H_