]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/icon.h
remove test code for wxScopeGuard (there's already a better ScopeGuardTestCase)
[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
53a2db12 25class WXDLLIMPEXP_CORE 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
53a2db12 38class WXDLLIMPEXP_CORE wxIcon: public wxIconBase
0e320a79 39{
0e320a79 40public:
3b9e3455
DW
41 wxIcon();
42
3b9e3455
DW
43 wxIcon( const char bits[]
44 ,int nWidth
45 ,int nHeight
46 );
e45080c1
PC
47 wxIcon(const char* const* ppData) { CreateIconFromXpm(ppData); }
48#ifdef wxNEEDS_CHARPP
5c33522f 49 wxIcon(char** ppData) { CreateIconFromXpm(const_cast<const char* const*>(ppData)); }
e45080c1 50#endif
3b9e3455 51 wxIcon( const wxString& rName
c48d0d37 52 ,wxBitmapType lFlags = wxICON_DEFAULT_TYPE
3b9e3455
DW
53 ,int nDesiredWidth = -1
54 ,int nDesiredHeight = -1
55 );
aaf7ab43
VZ
56 wxIcon(const wxIconLocation& loc)
57 {
58 LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICO);
59 }
60
d3c7fc99 61 virtual ~wxIcon();
3b9e3455
DW
62
63 bool LoadFile( const wxString& rName
c48d0d37 64 ,wxBitmapType lFlags = wxICON_DEFAULT_TYPE
3b9e3455
DW
65 ,int nDesiredWidth = -1
66 ,int nDesiredHeight = -1
67 );
68
3b9e3455
DW
69 wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; }
70
71 inline void SetHICON(WXHICON hIcon) { SetHandle((WXHANDLE)hIcon); }
72 inline WXHICON GetHICON() const { return (WXHICON)GetHandle(); }
79c09341
DW
73 inline bool IsXpm(void) const { return m_bIsXpm; };
74 inline const wxBitmap& GetXpmSrc(void) const { return m_vXpmSrc; }
3b9e3455 75
8bb6da4a 76 void CopyFromBitmap(const wxBitmap& rBmp);
3b9e3455
DW
77protected:
78 virtual wxGDIImageRefData* CreateData() const
79 {
80 return new wxIconRefData;
81 }
e45080c1 82 void CreateIconFromXpm(const char* const* ppData);
0e320a79 83
3b9e3455 84private:
79c09341
DW
85 bool m_bIsXpm;
86 wxBitmap m_vXpmSrc;
87
3b9e3455 88 DECLARE_DYNAMIC_CLASS(wxIcon)
0e320a79
DW
89};
90
0e320a79
DW
91#endif
92 // _WX_ICON_H_