]> git.saurik.com Git - wxWidgets.git/blame - src/os2/icon.cpp
Added alpha blending in prep for FreeType text to canvas.
[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{
914589c2
DW
71 //
72 // A very poor hack, but we have to have separate icon files from windows
73 // So we have a modified name where replace the last three characters
74 // with os2. Also need the extension.
75 //
76 wxString sOs2Name = rIconFile.Mid(0, rIconFile.Length() - 3);
77
78 sOs2Name += "Os2.ico";
79 LoadFile( sOs2Name
3b9e3455
DW
80 ,lFlags
81 ,nDesiredWidth
82 ,nDesiredHeight
83 );
0e320a79
DW
84}
85
86wxIcon::~wxIcon()
87{
88}
89
3b9e3455
DW
90bool wxIcon::LoadFile(
91 const wxString& rFilename
92, long lType
93, int nDesiredWidth
94, int nDesiredHeight
95)
fb9010ed 96{
8ea3f821 97 HPS hPs = NULLHANDLE;
3b9e3455
DW
98
99 UnRef();
b41cdbf4
DW
100
101 wxGDIImageHandler* pHandler = FindHandler(lType);
3b9e3455
DW
102
103 if (pHandler)
104 return(pHandler->Load( this
105 ,rFilename
8ea3f821 106 ,hPs
3b9e3455
DW
107 ,lType
108 ,nDesiredWidth
109 ,nDesiredHeight
110 ));
fb9010ed 111 else
3b9e3455 112 return(FALSE);
0e320a79
DW
113}
114