]> git.saurik.com Git - wxWidgets.git/blob - src/motif/icon.cpp
Fixed transparency problem when masked area was not black
[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 #ifdef __GNUG__
13 #pragma implementation "icon.h"
14 #endif
15
16 #include "wx/icon.h"
17 #include "wx/window.h"
18
19 #ifdef __VMS__
20 #pragma message disable nosimpint
21 #endif
22 #include <Xm/Xm.h>
23 #include <X11/cursorfont.h>
24 #ifdef __VMS__
25 #pragma message enable nosimpint
26 #endif
27
28 #include "wx/motif/private.h"
29
30 IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
31
32 /*
33 * Icons
34 */
35
36 wxIcon::wxIcon()
37 {
38 }
39
40 // Create from XBM data
41 wxIcon::wxIcon(const char bits[], int width, int height)
42 {
43 (void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, 1);
44 }
45
46 // Create from XPM data
47 wxIcon::wxIcon(char **data)
48 {
49 (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
50 }
51
52 wxIcon::wxIcon(const wxString& icon_file, long flags,
53 int desiredWidth, int desiredHeight)
54
55 {
56 LoadFile(icon_file, flags, desiredWidth, desiredHeight);
57 }
58
59 wxIcon::~wxIcon()
60 {
61 }
62
63 bool wxIcon::LoadFile(const wxString& filename, long type,
64 int desiredWidth, int desiredHeight)
65 {
66 UnRef();
67
68 m_refData = new wxBitmapRefData;
69
70 wxBitmapHandler *handler = FindHandler(type);
71
72 if ( handler )
73 return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight);
74 else
75 return FALSE;
76 }
77