]> git.saurik.com Git - wxWidgets.git/blob - src/motif/icon.cpp
Fix crash when using a proxy (m_protocol already gets cleaned up via CleanData())
[wxWidgets.git] / src / motif / icon.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: icon.cpp
3 // Purpose: wxIcon class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "icon.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18
19 #include "wx/icon.h"
20
21 IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap);
22
23 // ============================================================================
24 // Icons
25 // ============================================================================
26
27 wxIcon::wxIcon()
28 {
29 }
30
31 // Create from XBM data
32 wxIcon::wxIcon(const char bits[], int width, int height)
33 {
34 (void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, 1);
35 }
36
37 // Create from XPM data
38 wxIcon::wxIcon(char **data)
39 {
40 (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
41 }
42
43 wxIcon::wxIcon(const char **data)
44 {
45 (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
46 }
47
48 void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
49 {
50 wxIcon *icon = (wxIcon*)(&bmp);
51 *this = *icon;
52 }
53
54 wxIcon::~wxIcon()
55 {
56 }
57
58 bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type,
59 int desiredWidth, int desiredHeight)
60 {
61 UnRef();
62
63 wxBitmapHandler *handler = FindHandler(type);
64
65 if ( handler )
66 return handler->LoadFile(this, filename, type,
67 desiredWidth, desiredHeight);
68 else
69 return false;
70 }