]>
Commit | Line | Data |
---|---|---|
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 | #include "wx/window.h" | |
18 | ||
19 | #include <Xm/Xm.h> | |
20 | #include <X11/cursorfont.h> | |
21 | ||
22 | #include "wx/motif/private.h" | |
23 | ||
24 | #if !USE_SHARED_LIBRARIES | |
25 | IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap) | |
26 | #endif | |
27 | ||
28 | /* | |
29 | * Icons | |
30 | */ | |
31 | ||
32 | wxIcon::wxIcon() | |
33 | { | |
34 | } | |
35 | ||
36 | // Create from XBM data | |
37 | wxIcon::wxIcon(const char bits[], int width, int height) | |
38 | { | |
39 | (void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, 1); | |
40 | } | |
41 | ||
42 | // Create from XPM data | |
43 | wxIcon::wxIcon(char **data) | |
44 | { | |
45 | (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); | |
46 | } | |
47 | ||
48 | wxIcon::wxIcon(const wxString& icon_file, long flags, | |
49 | int desiredWidth, int desiredHeight) | |
50 | ||
51 | { | |
52 | LoadFile(icon_file, flags, desiredWidth, desiredHeight); | |
53 | } | |
54 | ||
55 | wxIcon::~wxIcon() | |
56 | { | |
57 | } | |
58 | ||
59 | bool wxIcon::LoadFile(const wxString& filename, long type, | |
60 | int desiredWidth, int desiredHeight) | |
61 | { | |
62 | UnRef(); | |
63 | ||
64 | m_refData = new wxBitmapRefData; | |
65 | ||
66 | wxBitmapHandler *handler = FindHandler(type); | |
67 | ||
68 | if ( handler ) | |
69 | return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight); | |
70 | else | |
71 | return FALSE; | |
72 | } | |
73 |