]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/icon.h
Added function GetDefaultSize
[wxWidgets.git] / include / wx / os2 / icon.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: icon.h
3 // Purpose: wxIcon class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
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
49 wxIcon(const char bits[], int width, int height);
50 wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
51 int desiredWidth = -1, int desiredHeight = -1);
52 wxIcon( char **bits, int width=-1, int height=-1 );
53
54 ~wxIcon();
55
56 bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
57 int desiredWidth = -1, int desiredHeight = -1);
58
59 inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
60 inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
61 inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; }
62
63 /* TODO: implementation
64 void SetHICON(WXHICON ico);
65 inline WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); }
66 */
67
68 /* TODO */
69 virtual bool Ok() const { return (m_refData != NULL) ; }
70 private:
71 // supress VisAge hiding warning
72 bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_BMP_RESOURCE)
73 { return(wxBitmap::LoadFile(name, type)); }
74 };
75
76 /* Example handlers. TODO: write your own handlers for relevant types.
77
78 class WXDLLEXPORT wxICOFileHandler: public wxBitmapHandler
79 {
80 DECLARE_DYNAMIC_CLASS(wxICOFileHandler)
81 public:
82 inline wxICOFileHandler()
83 {
84 m_name = "ICO icon file";
85 m_extension = "ico";
86 m_type = wxBITMAP_TYPE_ICO;
87 };
88
89 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
90 int desiredWidth = -1, int desiredHeight = -1);
91 };
92
93 class WXDLLEXPORT wxICOResourceHandler: public wxBitmapHandler
94 {
95 DECLARE_DYNAMIC_CLASS(wxICOResourceHandler)
96 public:
97 inline wxICOResourceHandler()
98 {
99 m_name = "ICO resource";
100 m_extension = "ico";
101 m_type = wxBITMAP_TYPE_ICO_RESOURCE;
102 };
103
104 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
105 int desiredWidth = -1, int desiredHeight = -1);
106
107 };
108
109 */
110
111 #endif
112 // _WX_ICON_H_