]> git.saurik.com Git - wxWidgets.git/blame - src/os2/icon.cpp
[gtk] fixed bug that caused segfaults in wxYield when wxToolBar has non-button contr...
[wxWidgets.git] / src / os2 / icon.cpp
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: icon.cpp
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
fb9010ed
DW
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
15#ifdef __BORLANDC__
16#pragma hdrstop
17#endif
18
19#ifndef WX_PRECOMP
3b9e3455
DW
20 #include "wx/defs.h"
21 #include "wx/list.h"
22 #include "wx/utils.h"
23 #include "wx/app.h"
24 #include "wx/icon.h"
0e320a79
DW
25#endif
26
fb9010ed
DW
27#include "wx/os2/private.h"
28#include "assert.h"
29
0e320a79
DW
30#include "wx/icon.h"
31
32#if !USE_SHARED_LIBRARIES
3b9e3455 33 IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxIconBase)
0e320a79
DW
34#endif
35
3b9e3455
DW
36// ============================================================================
37// implementation
38// ============================================================================
0e320a79 39
3b9e3455
DW
40// ----------------------------------------------------------------------------
41// wxIconRefData
42// ----------------------------------------------------------------------------
0e320a79 43
3b9e3455 44void wxIconRefData::Free()
0e320a79 45{
3b9e3455
DW
46 if ( m_hIcon )
47 ::DestroyIcon((HICON) m_hIcon);
0e320a79
DW
48}
49
3b9e3455
DW
50// ----------------------------------------------------------------------------
51// wxIcon
52// ----------------------------------------------------------------------------
53
0e320a79
DW
54wxIcon::wxIcon()
55{
56}
57
3b9e3455
DW
58wxIcon::wxIcon(
59 const char WXUNUSED(bits)[]
60, int WXUNUSED(nWidth)
61, int WXUNUSED(nHeight)
62)
0e320a79
DW
63{
64}
65
3b9e3455
DW
66wxIcon::wxIcon(
67 const wxString& rIconFile
68, long lFlags
69, int nDesiredWidth
70, int nDesiredHeight
71)
0e320a79 72{
3b9e3455
DW
73 LoadFile( rIconFile
74 ,lFlags
75 ,nDesiredWidth
76 ,nDesiredHeight
77 );
0e320a79
DW
78}
79
80wxIcon::~wxIcon()
81{
82}
83
3b9e3455
DW
84bool wxIcon::LoadFile(
85 const wxString& rFilename
86, long lType
87, int nDesiredWidth
88, int nDesiredHeight
89)
fb9010ed 90{
3b9e3455
DW
91 wxGDIImageHandler* pHandler = FindHandler(type);
92
93 UnRef();
94 m_refData = new wxIconRefData;
95
96 if (pHandler)
97 return(pHandler->Load( this
98 ,rFilename
99 ,lType
100 ,nDesiredWidth
101 ,nDesiredHeight
102 ));
fb9010ed 103 else
3b9e3455 104 return(FALSE);
0e320a79
DW
105}
106