]> git.saurik.com Git - wxWidgets.git/blob - src/motif/icon.cpp
[ 1936700 ] wxCAL_SHOW_WEEK_NUMBERS, slightly modified
[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 // 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
17 IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
18
19 // ============================================================================
20 // Icons
21 // ============================================================================
22
23 wxIcon::wxIcon()
24 {
25 }
26
27 // Create from XBM data
28 wxIcon::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
35 wxIcon::wxIcon(char **data)
36 {
37 (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
38 }
39 #endif
40
41 wxIcon::wxIcon(const char* const* data)
42 {
43 (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
44 }
45
46 void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
47 {
48 wxIcon *icon = (wxIcon*)(&bmp);
49 *this = *icon;
50 }
51
52 wxIcon::~wxIcon()
53 {
54 }
55
56 bool 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 }