]> git.saurik.com Git - wxWidgets.git/blame - src/motif/icon.cpp
fixed memory leak in RestoreState
[wxWidgets.git] / src / motif / icon.cpp
CommitLineData
4bb6408c 1/////////////////////////////////////////////////////////////////////////////
355b4d3d 2// Name: src/motif/icon.cpp
4bb6408c
JS
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
355b4d3d 9// Licence: wxWindows licence
4bb6408c
JS
10/////////////////////////////////////////////////////////////////////////////
11
1248b41f
MB
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
4bb6408c 15#include "wx/icon.h"
f97c9854 16
e933b5bc 17IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
4bb6408c 18
59e034c0
MB
19// ============================================================================
20// Icons
21// ============================================================================
4bb6408c 22
f97c9854 23wxIcon::wxIcon()
4bb6408c 24{
4bb6408c
JS
25}
26
f97c9854
JS
27// Create from XBM data
28wxIcon::wxIcon(const char bits[], int width, int height)
4bb6408c 29{
f97c9854 30 (void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, 1);
4bb6408c
JS
31}
32
f97c9854 33// Create from XPM data
a4294b78 34wxIcon::wxIcon(char **data)
4bb6408c 35{
f97c9854 36 (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
4bb6408c
JS
37}
38
42565245
GRG
39wxIcon::wxIcon(const char **data)
40{
41 (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
42}
43
329e276a
VS
44void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
45{
46 wxIcon *icon = (wxIcon*)(&bmp);
47 *this = *icon;
48}
49
4bb6408c
JS
50wxIcon::~wxIcon()
51{
52}
53
1bc822df 54bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type,
2d120f83 55 int desiredWidth, int desiredHeight)
4bb6408c 56{
2d120f83 57 UnRef();
59e034c0 58
2d120f83 59 wxBitmapHandler *handler = FindHandler(type);
355b4d3d 60
2d120f83 61 if ( handler )
1bc822df
MB
62 return handler->LoadFile(this, filename, type,
63 desiredWidth, desiredHeight);
2d120f83 64 else
96be256b 65 return false;
4bb6408c 66}