]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/motif/icon.h
Committing in .
[wxWidgets.git] / include / wx / motif / icon.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: icon.h
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#ifndef _WX_ICON_H_
13#define _WX_ICON_H_
14
15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16#pragma interface "icon.h"
17#endif
18
19#include "wx/bitmap.h"
20
21// Icon
22class WXDLLEXPORT wxIcon : public wxBitmap
23{
24public:
25 wxIcon();
26
27 // Copy constructors
28 inline wxIcon(const wxIcon& icon) { Ref(icon); }
29
30 // Initialize with XBM data
31 wxIcon(const char bits[], int width, int height);
32
33 // Initialize with XPM data
34 wxIcon(const char **data);
35 wxIcon(char **data);
36
37 wxIcon(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_XPM,
38 int desiredWidth = -1, int desiredHeight = -1)
39 {
40 LoadFile(name, type, desiredWidth, desiredHeight);
41 }
42
43 wxIcon(const wxIconLocation& loc)
44 {
45 LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ANY);
46 }
47
48 ~wxIcon();
49
50 bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_XPM,
51 int desiredWidth = -1, int desiredHeight = -1);
52
53 // create from bitmap (which should have a mask unless it's monochrome):
54 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
55 // ctors, assignment operators...), but it's ok to have such function
56 void CopyFromBitmap(const wxBitmap& bmp);
57
58 wxIcon& operator = (const wxIcon& icon)
59 { if (this != &icon) Ref(icon); return *this; }
60 bool operator == (const wxIcon& icon) const
61 { return m_refData == icon.m_refData; }
62 bool operator != (const wxIcon& icon) const
63 { return !(*this == icon); }
64
65
66 DECLARE_DYNAMIC_CLASS(wxIcon);
67};
68
69#endif // _WX_ICON_H_