]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/icon.h
Added Motif files.
[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 class WXDLLEXPORT wxIconRefData: public wxBitmapRefData
22 {
23 friend class WXDLLEXPORT wxBitmap;
24 friend class WXDLLEXPORT wxIcon;
25 public:
26 wxIconRefData();
27 ~wxIconRefData();
28
29 public:
30 /* TODO: whatever your actual icon handle is
31 WXHICON m_hIcon;
32 */
33 };
34
35 #define M_ICONDATA ((wxIconRefData *)m_refData)
36 #define M_ICONHANDLERDATA ((wxIconRefData *)bitmap->GetRefData())
37
38 // Icon
39 class WXDLLEXPORT wxIcon: public wxBitmap
40 {
41 DECLARE_DYNAMIC_CLASS(wxIcon)
42
43 public:
44 wxIcon();
45
46 // Copy constructors
47 inline wxIcon(const wxIcon& icon) { Ref(icon); }
48 inline wxIcon(const wxIcon* icon) { if (icon) Ref(*icon); }
49
50 wxIcon(const char bits[], int width, int height);
51 wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
52 int desiredWidth = -1, int desiredHeight = -1);
53 ~wxIcon();
54
55 bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
56 int desiredWidth = -1, int desiredHeight = -1);
57
58 inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
59 inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
60 inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; }
61
62 /* TODO: implementation
63 void SetHICON(WXHICON ico);
64 inline WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); }
65 */
66
67 /* TODO */
68 virtual bool Ok() const { return (m_refData != NULL) ; }
69 };
70
71 /* Example handlers. TODO: write your own handlers for relevant types.
72
73 class WXDLLEXPORT wxICOFileHandler: public wxBitmapHandler
74 {
75 DECLARE_DYNAMIC_CLASS(wxICOFileHandler)
76 public:
77 inline wxICOFileHandler()
78 {
79 m_name = "ICO icon file";
80 m_extension = "ico";
81 m_type = wxBITMAP_TYPE_ICO;
82 };
83
84 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
85 int desiredWidth = -1, int desiredHeight = -1);
86 };
87
88 class WXDLLEXPORT wxICOResourceHandler: public wxBitmapHandler
89 {
90 DECLARE_DYNAMIC_CLASS(wxICOResourceHandler)
91 public:
92 inline wxICOResourceHandler()
93 {
94 m_name = "ICO resource";
95 m_extension = "ico";
96 m_type = wxBITMAP_TYPE_ICO_RESOURCE;
97 };
98
99 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
100 int desiredWidth = -1, int desiredHeight = -1);
101
102 };
103
104 */
105
106 #endif
107 // _WX_ICON_H_