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