]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/motif/icon.cpp
Applied patch [ 1443707 ] kill "cast truncates constant value" warnings
[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// Create from XPM data
34wxIcon::wxIcon(char **data)
35{
36 (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
37}
38
39wxIcon::wxIcon(const char **data)
40{
41 (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
42}
43
44void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
45{
46 wxIcon *icon = (wxIcon*)(&bmp);
47 *this = *icon;
48}
49
50wxIcon::~wxIcon()
51{
52}
53
54bool 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}