]> git.saurik.com Git - wxWidgets.git/blob - src/os2/icon.cpp
Changed order of #ifdefs to get native version on OS/2, even if
[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 IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxIconBase)
33
34 // ============================================================================
35 // implementation
36 // ============================================================================
37
38 // ----------------------------------------------------------------------------
39 // wxIconRefData
40 // ----------------------------------------------------------------------------
41
42 void wxIconRefData::Free()
43 {
44 if (m_hIcon)
45 ::WinFreeFileIcon((HPOINTER)m_hIcon);
46 }
47
48 // ----------------------------------------------------------------------------
49 // wxIcon
50 // ----------------------------------------------------------------------------
51
52 wxIcon::wxIcon()
53 {
54 }
55
56 wxIcon::wxIcon(
57 const char WXUNUSED(bits)[]
58 , int WXUNUSED(nWidth)
59 , int WXUNUSED(nHeight)
60 )
61 {
62 }
63
64 wxIcon::wxIcon(
65 const wxString& rIconFile
66 , long lFlags
67 , int nDesiredWidth
68 , int nDesiredHeight
69 )
70 {
71 LoadFile( rIconFile
72 ,lFlags
73 ,nDesiredWidth
74 ,nDesiredHeight
75 );
76 }
77
78 wxIcon::~wxIcon()
79 {
80 }
81
82 bool wxIcon::LoadFile(
83 const wxString& rFilename
84 , long lType
85 , int nDesiredWidth
86 , int nDesiredHeight
87 )
88 {
89 wxGDIImageHandler* pHandler = FindHandler(lType);
90 HPS hPs = NULLHANDLE;
91
92 UnRef();
93 m_refData = new wxIconRefData;
94
95 if (pHandler)
96 return(pHandler->Load( this
97 ,rFilename
98 ,hPs
99 ,lType
100 ,nDesiredWidth
101 ,nDesiredHeight
102 ));
103 else
104 return(FALSE);
105 }
106