]> git.saurik.com Git - wxWidgets.git/blob - src/os2/icon.cpp
[gtk] fixed bug that caused segfaults in wxYield when wxToolBar has non-button contr...
[wxWidgets.git] / src / os2 / icon.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: icon.cpp
3 // Purpose: wxIcon class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/09/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
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
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"
25 #endif
26
27 #include "wx/os2/private.h"
28 #include "assert.h"
29
30 #include "wx/icon.h"
31
32 #if !USE_SHARED_LIBRARIES
33 IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxIconBase)
34 #endif
35
36 // ============================================================================
37 // implementation
38 // ============================================================================
39
40 // ----------------------------------------------------------------------------
41 // wxIconRefData
42 // ----------------------------------------------------------------------------
43
44 void wxIconRefData::Free()
45 {
46 if ( m_hIcon )
47 ::DestroyIcon((HICON) m_hIcon);
48 }
49
50 // ----------------------------------------------------------------------------
51 // wxIcon
52 // ----------------------------------------------------------------------------
53
54 wxIcon::wxIcon()
55 {
56 }
57
58 wxIcon::wxIcon(
59 const char WXUNUSED(bits)[]
60 , int WXUNUSED(nWidth)
61 , int WXUNUSED(nHeight)
62 )
63 {
64 }
65
66 wxIcon::wxIcon(
67 const wxString& rIconFile
68 , long lFlags
69 , int nDesiredWidth
70 , int nDesiredHeight
71 )
72 {
73 LoadFile( rIconFile
74 ,lFlags
75 ,nDesiredWidth
76 ,nDesiredHeight
77 );
78 }
79
80 wxIcon::~wxIcon()
81 {
82 }
83
84 bool wxIcon::LoadFile(
85 const wxString& rFilename
86 , long lType
87 , int nDesiredWidth
88 , int nDesiredHeight
89 )
90 {
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 ));
103 else
104 return(FALSE);
105 }
106