]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/icon.h
wxFileName::Get/SetTimes() finally seem to work under Windows
[wxWidgets.git] / include / wx / motif / icon.h
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 #ifdef __GNUG__
16 #pragma interface "icon.h"
17 #endif
18
19 #include "wx/bitmap.h"
20
21 #define M_ICONDATA ((wxBitmapRefData *)m_refData)
22 #define M_ICONHANDLERDATA ((wxBitmapRefData *)bitmap->GetRefData())
23
24 // Icon
25 class WXDLLEXPORT wxIcon: public wxBitmap
26 {
27 DECLARE_DYNAMIC_CLASS(wxIcon)
28
29 public:
30 wxIcon();
31
32 // Copy constructors
33 inline wxIcon(const wxIcon& icon) { Ref(icon); }
34
35 // Initialize with XBM data
36 wxIcon(const char bits[], int width, int height);
37
38 // Initialize with XPM data
39 wxIcon(const char **data);
40 wxIcon(char **data);
41
42 wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_XPM,
43 int desiredWidth = -1, int desiredHeight = -1);
44 ~wxIcon();
45
46 bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_XPM,
47 int desiredWidth = -1, int desiredHeight = -1);
48
49 // create from bitmap (which should have a mask unless it's monochrome):
50 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
51 // ctors, assignment operators...), but it's ok to have such function
52 void CopyFromBitmap(const wxBitmap& bmp);
53
54 inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
55 inline bool operator == (const wxIcon& icon) const { return m_refData == icon.m_refData; }
56 inline bool operator != (const wxIcon& icon) const { return m_refData != icon.m_refData; }
57
58 virtual bool Ok() const { return ((m_refData != NULL) && (M_ICONDATA->m_ok)); }
59 };
60
61 #endif
62 // _WX_ICON_H_