]>
Commit | Line | Data |
---|---|---|
4bb6408c JS |
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" | |
f97c9854 JS |
17 | #include "wx/window.h" |
18 | ||
338dd992 JJ |
19 | #ifdef __VMS__ |
20 | #pragma message disable nosimpint | |
21 | #endif | |
f97c9854 JS |
22 | #include <Xm/Xm.h> |
23 | #include <X11/cursorfont.h> | |
338dd992 JJ |
24 | #ifdef __VMS__ |
25 | #pragma message enable nosimpint | |
26 | #endif | |
f97c9854 JS |
27 | |
28 | #include "wx/motif/private.h" | |
4bb6408c | 29 | |
4bb6408c | 30 | IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap) |
4bb6408c JS |
31 | |
32 | /* | |
2d120f83 JS |
33 | * Icons |
34 | */ | |
4bb6408c | 35 | |
f97c9854 | 36 | wxIcon::wxIcon() |
4bb6408c | 37 | { |
4bb6408c JS |
38 | } |
39 | ||
f97c9854 JS |
40 | // Create from XBM data |
41 | wxIcon::wxIcon(const char bits[], int width, int height) | |
4bb6408c | 42 | { |
f97c9854 | 43 | (void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, 1); |
4bb6408c JS |
44 | } |
45 | ||
f97c9854 | 46 | // Create from XPM data |
a4294b78 | 47 | wxIcon::wxIcon(char **data) |
4bb6408c | 48 | { |
f97c9854 | 49 | (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); |
4bb6408c JS |
50 | } |
51 | ||
42565245 GRG |
52 | wxIcon::wxIcon(const char **data) |
53 | { | |
54 | (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); | |
55 | } | |
56 | ||
1bc822df | 57 | wxIcon::wxIcon(const wxString& icon_file, wxBitmapType type, |
2d120f83 JS |
58 | int desiredWidth, int desiredHeight) |
59 | ||
4bb6408c | 60 | { |
1bc822df | 61 | LoadFile(icon_file, type, desiredWidth, desiredHeight); |
4bb6408c JS |
62 | } |
63 | ||
329e276a VS |
64 | void wxIcon::CopyFromBitmap(const wxBitmap& bmp) |
65 | { | |
66 | wxIcon *icon = (wxIcon*)(&bmp); | |
67 | *this = *icon; | |
68 | } | |
69 | ||
4bb6408c JS |
70 | wxIcon::~wxIcon() |
71 | { | |
72 | } | |
73 | ||
1bc822df | 74 | bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type, |
2d120f83 | 75 | int desiredWidth, int desiredHeight) |
4bb6408c | 76 | { |
2d120f83 JS |
77 | UnRef(); |
78 | ||
79 | m_refData = new wxBitmapRefData; | |
80 | ||
81 | wxBitmapHandler *handler = FindHandler(type); | |
82 | ||
83 | if ( handler ) | |
1bc822df MB |
84 | return handler->LoadFile(this, filename, type, |
85 | desiredWidth, desiredHeight); | |
2d120f83 JS |
86 | else |
87 | return FALSE; | |
4bb6408c JS |
88 | } |
89 |