]>
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 JS |
29 | |
30 | #if !USE_SHARED_LIBRARIES | |
31 | IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap) | |
32 | #endif | |
33 | ||
34 | /* | |
2d120f83 JS |
35 | * Icons |
36 | */ | |
4bb6408c | 37 | |
f97c9854 | 38 | wxIcon::wxIcon() |
4bb6408c | 39 | { |
4bb6408c JS |
40 | } |
41 | ||
f97c9854 JS |
42 | // Create from XBM data |
43 | wxIcon::wxIcon(const char bits[], int width, int height) | |
4bb6408c | 44 | { |
f97c9854 | 45 | (void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, 1); |
4bb6408c JS |
46 | } |
47 | ||
f97c9854 | 48 | // Create from XPM data |
a4294b78 | 49 | wxIcon::wxIcon(char **data) |
4bb6408c | 50 | { |
f97c9854 | 51 | (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); |
4bb6408c JS |
52 | } |
53 | ||
54 | wxIcon::wxIcon(const wxString& icon_file, long flags, | |
2d120f83 JS |
55 | int desiredWidth, int desiredHeight) |
56 | ||
4bb6408c JS |
57 | { |
58 | LoadFile(icon_file, flags, desiredWidth, desiredHeight); | |
59 | } | |
60 | ||
61 | wxIcon::~wxIcon() | |
62 | { | |
63 | } | |
64 | ||
65 | bool wxIcon::LoadFile(const wxString& filename, long type, | |
2d120f83 | 66 | int desiredWidth, int desiredHeight) |
4bb6408c | 67 | { |
2d120f83 JS |
68 | UnRef(); |
69 | ||
70 | m_refData = new wxBitmapRefData; | |
71 | ||
72 | wxBitmapHandler *handler = FindHandler(type); | |
73 | ||
74 | if ( handler ) | |
75 | return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight); | |
76 | else | |
77 | return FALSE; | |
4bb6408c JS |
78 | } |
79 |