]>
Commit | Line | Data |
---|---|---|
4bb6408c | 1 | ///////////////////////////////////////////////////////////////////////////// |
355b4d3d | 2 | // Name: src/motif/icon.cpp |
4bb6408c JS |
3 | // Purpose: wxIcon class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
4bb6408c | 7 | // Copyright: (c) Julian Smart |
355b4d3d | 8 | // Licence: wxWindows licence |
4bb6408c JS |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
1248b41f MB |
11 | // For compilers that support precompilation, includes "wx.h". |
12 | #include "wx/wxprec.h" | |
13 | ||
4bb6408c | 14 | #include "wx/icon.h" |
f97c9854 | 15 | |
e933b5bc | 16 | IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap) |
4bb6408c | 17 | |
59e034c0 MB |
18 | // ============================================================================ |
19 | // Icons | |
20 | // ============================================================================ | |
4bb6408c | 21 | |
f97c9854 | 22 | wxIcon::wxIcon() |
4bb6408c | 23 | { |
4bb6408c JS |
24 | } |
25 | ||
f97c9854 JS |
26 | // Create from XBM data |
27 | wxIcon::wxIcon(const char bits[], int width, int height) | |
4bb6408c | 28 | { |
f97c9854 | 29 | (void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, 1); |
4bb6408c JS |
30 | } |
31 | ||
e45080c1 | 32 | #ifdef wxNEEDS_CHARPP |
f97c9854 | 33 | // Create from XPM data |
a4294b78 | 34 | wxIcon::wxIcon(char **data) |
4bb6408c | 35 | { |
f97c9854 | 36 | (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); |
4bb6408c | 37 | } |
e45080c1 | 38 | #endif |
4bb6408c | 39 | |
e45080c1 | 40 | wxIcon::wxIcon(const char* const* data) |
42565245 GRG |
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 | 60 | wxBitmapHandler *handler = FindHandler(type); |
355b4d3d | 61 | |
2d120f83 | 62 | if ( handler ) |
1bc822df MB |
63 | return handler->LoadFile(this, filename, type, |
64 | desiredWidth, desiredHeight); | |
2d120f83 | 65 | else |
96be256b | 66 | return false; |
4bb6408c | 67 | } |