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