]> git.saurik.com Git - wxWidgets.git/blame - src/motif/icon.cpp
DnD
[wxWidgets.git] / src / motif / icon.cpp
CommitLineData
4bb6408c
JS
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"
f97c9854
JS
17#include "wx/window.h"
18
19#include <Xm/Xm.h>
20#include <X11/cursorfont.h>
21
22#include "wx/motif/private.h"
4bb6408c
JS
23
24#if !USE_SHARED_LIBRARIES
25IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
26#endif
27
28/*
29 * Icons
30 */
31
f97c9854 32wxIcon::wxIcon()
4bb6408c 33{
4bb6408c
JS
34}
35
f97c9854
JS
36// Create from XBM data
37wxIcon::wxIcon(const char bits[], int width, int height)
4bb6408c 38{
f97c9854 39 (void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, 1);
4bb6408c
JS
40}
41
f97c9854 42// Create from XPM data
a4294b78 43wxIcon::wxIcon(char **data)
4bb6408c 44{
f97c9854 45 (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
4bb6408c
JS
46}
47
48wxIcon::wxIcon(const wxString& icon_file, long flags,
49 int desiredWidth, int desiredHeight)
50
51{
52 LoadFile(icon_file, flags, desiredWidth, desiredHeight);
53}
54
55wxIcon::~wxIcon()
56{
57}
58
59bool wxIcon::LoadFile(const wxString& filename, long type,
60 int desiredWidth, int desiredHeight)
61{
62 UnRef();
63
f97c9854 64 m_refData = new wxBitmapRefData;
4bb6408c
JS
65
66 wxBitmapHandler *handler = FindHandler(type);
67
68 if ( handler )
69 return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight);
70 else
71 return FALSE;
72}
73