]>
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 | |
65571936 | 9 | // Licence: wxWindows licence |
4bb6408c JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
14f355c2 | 12 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
4bb6408c JS |
13 | #pragma implementation "icon.h" |
14 | #endif | |
15 | ||
1248b41f MB |
16 | // For compilers that support precompilation, includes "wx.h". |
17 | #include "wx/wxprec.h" | |
18 | ||
4bb6408c | 19 | #include "wx/icon.h" |
f97c9854 | 20 | |
59e034c0 | 21 | IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap); |
4bb6408c | 22 | |
59e034c0 MB |
23 | // ============================================================================ |
24 | // Icons | |
25 | // ============================================================================ | |
4bb6408c | 26 | |
f97c9854 | 27 | wxIcon::wxIcon() |
4bb6408c | 28 | { |
4bb6408c JS |
29 | } |
30 | ||
f97c9854 JS |
31 | // Create from XBM data |
32 | wxIcon::wxIcon(const char bits[], int width, int height) | |
4bb6408c | 33 | { |
f97c9854 | 34 | (void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, 1); |
4bb6408c JS |
35 | } |
36 | ||
f97c9854 | 37 | // Create from XPM data |
a4294b78 | 38 | wxIcon::wxIcon(char **data) |
4bb6408c | 39 | { |
f97c9854 | 40 | (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); |
4bb6408c JS |
41 | } |
42 | ||
42565245 GRG |
43 | wxIcon::wxIcon(const char **data) |
44 | { | |
45 | (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); | |
46 | } | |
47 | ||
329e276a VS |
48 | void wxIcon::CopyFromBitmap(const wxBitmap& bmp) |
49 | { | |
50 | wxIcon *icon = (wxIcon*)(&bmp); | |
51 | *this = *icon; | |
52 | } | |
53 | ||
4bb6408c JS |
54 | wxIcon::~wxIcon() |
55 | { | |
56 | } | |
57 | ||
1bc822df | 58 | bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type, |
2d120f83 | 59 | int desiredWidth, int desiredHeight) |
4bb6408c | 60 | { |
2d120f83 | 61 | UnRef(); |
59e034c0 | 62 | |
2d120f83 JS |
63 | wxBitmapHandler *handler = FindHandler(type); |
64 | ||
65 | if ( handler ) | |
1bc822df MB |
66 | return handler->LoadFile(this, filename, type, |
67 | desiredWidth, desiredHeight); | |
2d120f83 | 68 | else |
96be256b | 69 | return false; |
4bb6408c | 70 | } |