]>
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 | 17 | |
59e034c0 | 18 | IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap); |
4bb6408c | 19 | |
59e034c0 MB |
20 | // ============================================================================ |
21 | // Icons | |
22 | // ============================================================================ | |
4bb6408c | 23 | |
f97c9854 | 24 | wxIcon::wxIcon() |
4bb6408c | 25 | { |
4bb6408c JS |
26 | } |
27 | ||
f97c9854 JS |
28 | // Create from XBM data |
29 | wxIcon::wxIcon(const char bits[], int width, int height) | |
4bb6408c | 30 | { |
f97c9854 | 31 | (void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, 1); |
4bb6408c JS |
32 | } |
33 | ||
f97c9854 | 34 | // Create from XPM data |
a4294b78 | 35 | wxIcon::wxIcon(char **data) |
4bb6408c | 36 | { |
f97c9854 | 37 | (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); |
4bb6408c JS |
38 | } |
39 | ||
42565245 GRG |
40 | wxIcon::wxIcon(const char **data) |
41 | { | |
42 | (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); | |
43 | } | |
44 | ||
1bc822df | 45 | wxIcon::wxIcon(const wxString& icon_file, wxBitmapType type, |
2d120f83 JS |
46 | int desiredWidth, int desiredHeight) |
47 | ||
4bb6408c | 48 | { |
1bc822df | 49 | LoadFile(icon_file, type, desiredWidth, desiredHeight); |
4bb6408c JS |
50 | } |
51 | ||
329e276a VS |
52 | void wxIcon::CopyFromBitmap(const wxBitmap& bmp) |
53 | { | |
54 | wxIcon *icon = (wxIcon*)(&bmp); | |
55 | *this = *icon; | |
56 | } | |
57 | ||
4bb6408c JS |
58 | wxIcon::~wxIcon() |
59 | { | |
60 | } | |
61 | ||
1bc822df | 62 | bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type, |
2d120f83 | 63 | int desiredWidth, int desiredHeight) |
4bb6408c | 64 | { |
2d120f83 | 65 | UnRef(); |
59e034c0 | 66 | |
2d120f83 JS |
67 | wxBitmapHandler *handler = FindHandler(type); |
68 | ||
69 | if ( handler ) | |
1bc822df MB |
70 | return handler->LoadFile(this, filename, type, |
71 | desiredWidth, desiredHeight); | |
2d120f83 JS |
72 | else |
73 | return FALSE; | |
4bb6408c | 74 | } |