]> git.saurik.com Git - wxWidgets.git/blob - src/motif/icon.cpp
build fixes
[wxWidgets.git] / src / motif / icon.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/motif/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 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #include "wx/icon.h"
16
17 IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
18
19 // ============================================================================
20 // Icons
21 // ============================================================================
22
23 wxIcon::wxIcon()
24 {
25 }
26
27 // Create from XBM data
28 wxIcon::wxIcon(const char bits[], int width, int height)
29 {
30 (void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, 1);
31 }
32
33 // Create from XPM data
34 wxIcon::wxIcon(char **data)
35 {
36 (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
37 }
38
39 wxIcon::wxIcon(const char **data)
40 {
41 (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
42 }
43
44 void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
45 {
46 wxIcon *icon = (wxIcon*)(&bmp);
47 *this = *icon;
48 }
49
50 wxIcon::~wxIcon()
51 {
52 }
53
54 bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type,
55 int desiredWidth, int desiredHeight)
56 {
57 UnRef();
58
59 wxBitmapHandler *handler = FindHandler(type);
60
61 if ( handler )
62 return handler->LoadFile(this, filename, type,
63 desiredWidth, desiredHeight);
64 else
65 return false;
66 }