]> git.saurik.com Git - wxWidgets.git/blame - src/motif/icon.cpp
ensure that the copies of the bitmap passed to wxMemoryDC ctor are not modified when...
[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
e45080c1 33#ifdef wxNEEDS_CHARPP
f97c9854 34// Create from XPM data
a4294b78 35wxIcon::wxIcon(char **data)
4bb6408c 36{
f97c9854 37 (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
4bb6408c 38}
e45080c1 39#endif
4bb6408c 40
e45080c1 41wxIcon::wxIcon(const char* const* data)
42565245
GRG
42{
43 (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
44}
45
329e276a
VS
46void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
47{
48 wxIcon *icon = (wxIcon*)(&bmp);
49 *this = *icon;
50}
51
4bb6408c
JS
52wxIcon::~wxIcon()
53{
54}
55
1bc822df 56bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type,
2d120f83 57 int desiredWidth, int desiredHeight)
4bb6408c 58{
2d120f83 59 UnRef();
59e034c0 60
2d120f83 61 wxBitmapHandler *handler = FindHandler(type);
355b4d3d 62
2d120f83 63 if ( handler )
1bc822df
MB
64 return handler->LoadFile(this, filename, type,
65 desiredWidth, desiredHeight);
2d120f83 66 else
96be256b 67 return false;
4bb6408c 68}