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