]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/icon.h
setp.h changes
[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 8// Copyright: (c) David Webster
65571936 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
79c09341 25#include "wx/bitmap.h"
3b9e3455 26#if wxICON_IS_BITMAP
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 40 wxIconRefData() { };
61243a51 41 virtual ~wxIconRefData() { Free(); }
0e320a79 42
3b9e3455 43 virtual void Free();
61243a51 44}; // end of
0e320a79 45
3b9e3455
DW
46// ---------------------------------------------------------------------------
47// Icon
48// ---------------------------------------------------------------------------
49
50class WXDLLEXPORT wxIcon: public wxIconBase
0e320a79 51{
0e320a79 52public:
3b9e3455
DW
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 );
8bb6da4a
DW
62 inline wxIcon(const char** ppData) { CreateIconFromXpm(ppData); }
63 inline wxIcon(char** ppData) { CreateIconFromXpm((const char**)ppData); }
3b9e3455
DW
64 wxIcon( const wxString& rName
65 ,long lFlags = wxBITMAP_TYPE_ICO_RESOURCE
66 ,int nDesiredWidth = -1
67 ,int nDesiredHeight = -1
68 );
aaf7ab43
VZ
69 wxIcon(const wxIconLocation& loc)
70 {
71 LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICO);
72 }
73
3b9e3455
DW
74 ~wxIcon();
75
76 bool LoadFile( const wxString& rName
77 ,long lFlags = wxBITMAP_TYPE_ICO_RESOURCE
78 ,int nDesiredWidth = -1
79 ,int nDesiredHeight = -1
80 );
81
82 inline wxIcon& operator = (const wxIcon& rIcon)
9add53a4 83 { if (*this != rIcon) Ref(rIcon); return *this; }
0e70f525 84 inline bool operator == (const wxIcon& rIcon) const
3b9e3455 85 { return m_refData == rIcon.m_refData; }
0e70f525 86 inline bool operator != (const wxIcon& rIcon) const
3b9e3455
DW
87 { return m_refData != rIcon.m_refData; }
88
89 wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; }
90
91 inline void SetHICON(WXHICON hIcon) { SetHandle((WXHANDLE)hIcon); }
92 inline WXHICON GetHICON() const { return (WXHICON)GetHandle(); }
79c09341
DW
93 inline bool IsXpm(void) const { return m_bIsXpm; };
94 inline const wxBitmap& GetXpmSrc(void) const { return m_vXpmSrc; }
3b9e3455 95
8bb6da4a 96 void CopyFromBitmap(const wxBitmap& rBmp);
3b9e3455
DW
97protected:
98 virtual wxGDIImageRefData* CreateData() const
99 {
100 return new wxIconRefData;
101 }
8bb6da4a 102 void CreateIconFromXpm(const char **ppData);
0e320a79 103
3b9e3455 104private:
79c09341
DW
105 bool m_bIsXpm;
106 wxBitmap m_vXpmSrc;
107
3b9e3455 108 DECLARE_DYNAMIC_CLASS(wxIcon)
0e320a79
DW
109};
110
0e320a79
DW
111#endif
112 // _WX_ICON_H_