]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/icon.h
Added simple instructions and autogen.mk to rebuild configure script.
[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
79c09341 19#include "wx/bitmap.h"
81152407 20#include "wx/os2/gdiimage.h"
0e320a79 21
81152407
VZ
22#define wxIconRefDataBase wxGDIImageRefData
23#define wxIconBase wxGDIImage
0e320a79 24
3b9e3455 25class WXDLLEXPORT wxIconRefData: public wxIconRefDataBase
0e320a79 26{
0e320a79 27public:
3b9e3455 28 wxIconRefData() { };
61243a51 29 virtual ~wxIconRefData() { Free(); }
0e320a79 30
3b9e3455 31 virtual void Free();
61243a51 32}; // end of
0e320a79 33
3b9e3455
DW
34// ---------------------------------------------------------------------------
35// Icon
36// ---------------------------------------------------------------------------
37
38class WXDLLEXPORT wxIcon: public wxIconBase
0e320a79 39{
0e320a79 40public:
3b9e3455
DW
41 wxIcon();
42
43 // Copy constructors
44 inline wxIcon(const wxIcon& icon) { Ref(icon); }
45
46 wxIcon( const char bits[]
47 ,int nWidth
48 ,int nHeight
49 );
8bb6da4a
DW
50 inline wxIcon(const char** ppData) { CreateIconFromXpm(ppData); }
51 inline wxIcon(char** ppData) { CreateIconFromXpm((const char**)ppData); }
3b9e3455
DW
52 wxIcon( const wxString& rName
53 ,long lFlags = wxBITMAP_TYPE_ICO_RESOURCE
54 ,int nDesiredWidth = -1
55 ,int nDesiredHeight = -1
56 );
aaf7ab43
VZ
57 wxIcon(const wxIconLocation& loc)
58 {
59 LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICO);
60 }
61
3b9e3455
DW
62 ~wxIcon();
63
64 bool LoadFile( const wxString& rName
65 ,long lFlags = wxBITMAP_TYPE_ICO_RESOURCE
66 ,int nDesiredWidth = -1
67 ,int nDesiredHeight = -1
68 );
69
70 inline wxIcon& operator = (const wxIcon& rIcon)
9add53a4 71 { if (*this != rIcon) Ref(rIcon); return *this; }
0e70f525 72 inline bool operator == (const wxIcon& rIcon) const
3b9e3455 73 { return m_refData == rIcon.m_refData; }
0e70f525 74 inline bool operator != (const wxIcon& rIcon) const
3b9e3455
DW
75 { return m_refData != rIcon.m_refData; }
76
77 wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; }
78
79 inline void SetHICON(WXHICON hIcon) { SetHandle((WXHANDLE)hIcon); }
80 inline WXHICON GetHICON() const { return (WXHICON)GetHandle(); }
79c09341
DW
81 inline bool IsXpm(void) const { return m_bIsXpm; };
82 inline const wxBitmap& GetXpmSrc(void) const { return m_vXpmSrc; }
3b9e3455 83
8bb6da4a 84 void CopyFromBitmap(const wxBitmap& rBmp);
3b9e3455
DW
85protected:
86 virtual wxGDIImageRefData* CreateData() const
87 {
88 return new wxIconRefData;
89 }
8bb6da4a 90 void CreateIconFromXpm(const char **ppData);
0e320a79 91
3b9e3455 92private:
79c09341
DW
93 bool m_bIsXpm;
94 wxBitmap m_vXpmSrc;
95
3b9e3455 96 DECLARE_DYNAMIC_CLASS(wxIcon)
0e320a79
DW
97};
98
0e320a79
DW
99#endif
100 // _WX_ICON_H_