]> git.saurik.com Git - wxWidgets.git/blob - src/motif/icon.cpp
wxCocoa: Added preliminary Blit support
[wxWidgets.git] / src / motif / icon.cpp
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
18 IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap);
19
20 // ============================================================================
21 // Icons
22 // ============================================================================
23
24 wxIcon::wxIcon()
25 {
26 }
27
28 // Create from XBM data
29 wxIcon::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
35 wxIcon::wxIcon(char **data)
36 {
37 (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
38 }
39
40 wxIcon::wxIcon(const char **data)
41 {
42 (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
43 }
44
45 void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
46 {
47 wxIcon *icon = (wxIcon*)(&bmp);
48 *this = *icon;
49 }
50
51 wxIcon::~wxIcon()
52 {
53 }
54
55 bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type,
56 int desiredWidth, int desiredHeight)
57 {
58 UnRef();
59
60 wxBitmapHandler *handler = FindHandler(type);
61
62 if ( handler )
63 return handler->LoadFile(this, filename, type,
64 desiredWidth, desiredHeight);
65 else
66 return FALSE;
67 }