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