The rounded corners look really dumb at this size.
[wxWidgets.git] / src / motif / icon.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/motif/icon.cpp
3 // Purpose: wxIcon class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
13
14 #include "wx/icon.h"
15
16 IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
17
18 // ============================================================================
19 // Icons
20 // ============================================================================
21
22 wxIcon::wxIcon()
23 {
24 }
25
26 // Create from XBM data
27 wxIcon::wxIcon(const char bits[], int width, int height)
28 {
29 (void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, 1);
30 }
31
32 #ifdef wxNEEDS_CHARPP
33 // Create from XPM data
34 wxIcon::wxIcon(char **data)
35 {
36 (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
37 }
38 #endif
39
40 wxIcon::wxIcon(const char* const* 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 }