]>
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 | ||
329e276a VS |
45 | void wxIcon::CopyFromBitmap(const wxBitmap& bmp) |
46 | { | |
47 | wxIcon *icon = (wxIcon*)(&bmp); | |
48 | *this = *icon; | |
49 | } | |
50 | ||
4bb6408c JS |
51 | wxIcon::~wxIcon() |
52 | { | |
53 | } | |
54 | ||
1bc822df | 55 | bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type, |
2d120f83 | 56 | int desiredWidth, int desiredHeight) |
4bb6408c | 57 | { |
2d120f83 | 58 | UnRef(); |
59e034c0 | 59 | |
2d120f83 JS |
60 | wxBitmapHandler *handler = FindHandler(type); |
61 | ||
62 | if ( handler ) | |
1bc822df MB |
63 | return handler->LoadFile(this, filename, type, |
64 | desiredWidth, desiredHeight); | |
2d120f83 JS |
65 | else |
66 | return FALSE; | |
4bb6408c | 67 | } |