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