]> git.saurik.com Git - wxWidgets.git/blame - src/msw/icon.cpp
Various things related to wxFileDialog and attributes.
[wxWidgets.git] / src / msw / icon.cpp
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
0d0512bd 2// Name: msw/icon.cpp
2bda0e17
KB
3// Purpose: wxIcon class
4// Author: Julian Smart
0d0512bd 5// Modified by: 20.11.99 (VZ): don't derive from wxBitmap any more
2bda0e17
KB
6// Created: 04/01/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
8ed57d93 9// Licence: wxWindows license
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
0d0512bd
VZ
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
2bda0e17 20#ifdef __GNUG__
0d0512bd 21 #pragma implementation "icon.h"
2bda0e17
KB
22#endif
23
24// For compilers that support precompilation, includes "wx.h".
25#include "wx/wxprec.h"
26
27#ifdef __BORLANDC__
0d0512bd 28 #pragma hdrstop
2bda0e17
KB
29#endif
30
31#ifndef WX_PRECOMP
0d0512bd
VZ
32 #include "wx/defs.h"
33 #include "wx/list.h"
34 #include "wx/utils.h"
35 #include "wx/app.h"
36 #include "wx/icon.h"
2bda0e17
KB
37#endif
38
39#include "wx/msw/private.h"
2bda0e17 40
47d67540 41#if wxUSE_RESOURCE_LOADING_IN_MSW
0d0512bd
VZ
42 #include "wx/msw/curico.h"
43 #include "wx/msw/curicop.h"
2bda0e17
KB
44#endif
45
0d0512bd
VZ
46// ----------------------------------------------------------------------------
47// wxWin macros
48// ----------------------------------------------------------------------------
49
2bda0e17 50#if !USE_SHARED_LIBRARIES
0d0512bd 51 IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxIconBase)
2bda0e17
KB
52#endif
53
0d0512bd
VZ
54// ============================================================================
55// implementation
56// ============================================================================
2bda0e17 57
0d0512bd
VZ
58// ----------------------------------------------------------------------------
59// wxIconRefData
60// ----------------------------------------------------------------------------
2bda0e17 61
0d0512bd 62void wxIconRefData::Free()
2bda0e17 63{
0d0512bd 64 if ( m_hIcon )
032af30f 65 {
0d0512bd 66 ::DestroyIcon((HICON) m_hIcon);
032af30f
VZ
67
68 m_hIcon = 0;
69 }
2bda0e17
KB
70}
71
0d0512bd
VZ
72// ----------------------------------------------------------------------------
73// wxIcon
74// ----------------------------------------------------------------------------
2bda0e17 75
0d0512bd 76wxIcon::wxIcon()
2bda0e17
KB
77{
78}
79
0d0512bd
VZ
80wxIcon::wxIcon(const char WXUNUSED(bits)[],
81 int WXUNUSED(width),
82 int WXUNUSED(height))
2bda0e17
KB
83{
84}
85
0d0512bd
VZ
86wxIcon::wxIcon(const wxString& iconfile,
87 long flags,
88 int desiredWidth,
89 int desiredHeight)
2bda0e17
KB
90
91{
0d0512bd 92 LoadFile(iconfile, flags, desiredWidth, desiredHeight);
2bda0e17
KB
93}
94
0d0512bd 95wxIcon::~wxIcon()
2bda0e17
KB
96{
97}
98
0d0512bd
VZ
99bool wxIcon::LoadFile(const wxString& filename,
100 long type,
101 int desiredWidth, int desiredHeight)
2bda0e17 102{
0d0512bd 103 UnRef();
2bda0e17 104
0d0512bd 105 wxGDIImageHandler *handler = FindHandler(type);
2bda0e17 106
0d0512bd 107 if ( !handler )
2bda0e17 108 {
0d0512bd
VZ
109 // say something?
110 return FALSE;
2bda0e17
KB
111 }
112
0d0512bd 113 return handler->Load(this, filename, type, desiredWidth, desiredHeight);
2bda0e17
KB
114}
115