]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/icon.h
Added wxStrnicmp and to wchar.h, not yet for Unicode mode.
[wxWidgets.git] / include / wx / os2 / icon.h
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: icon.h
3// Purpose: wxIcon class
fb9010ed 4// Author: David Webster
0e320a79 5// Modified by:
fb9010ed 6// Created: 10/09/99
0e320a79 7// RCS-ID: $Id$
fb9010ed
DW
8// Copyright: (c) David Webster
9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_ICON_H_
13#define _WX_ICON_H_
14
0e320a79
DW
15#include "wx/bitmap.h"
16
17class WXDLLEXPORT wxIconRefData: public wxBitmapRefData
18{
19 friend class WXDLLEXPORT wxBitmap;
20 friend class WXDLLEXPORT wxIcon;
21public:
22 wxIconRefData();
23 ~wxIconRefData();
24
25public:
fb9010ed 26 WXHICON m_hIcon;
0e320a79
DW
27};
28
29#define M_ICONDATA ((wxIconRefData *)m_refData)
30#define M_ICONHANDLERDATA ((wxIconRefData *)bitmap->GetRefData())
31
32// Icon
33class WXDLLEXPORT wxIcon: public wxBitmap
34{
35 DECLARE_DYNAMIC_CLASS(wxIcon)
36
37public:
38 wxIcon();
39
40 // Copy constructors
41 inline wxIcon(const wxIcon& icon) { Ref(icon); }
42
43 wxIcon(const char bits[], int width, int height);
44 wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
45 int desiredWidth = -1, int desiredHeight = -1);
0e320a79
DW
46 ~wxIcon();
47
48 bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
49 int desiredWidth = -1, int desiredHeight = -1);
50
51 inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
52 inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
53 inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; }
54
0e320a79
DW
55 void SetHICON(WXHICON ico);
56 inline WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); }
0e320a79 57
0e320a79
DW
58 virtual bool Ok() const { return (m_refData != NULL) ; }
59private:
54da4255
DW
60 // supress virtual function hiding warning
61 virtual bool LoadFile( const wxString& name
62 ,long type = wxBITMAP_TYPE_BMP_RESOURCE
63 )
64 { return(wxBitmap::LoadFile(name, type)); };
0e320a79
DW
65};
66
fb9010ed 67// Example handlers. TODO: write your own handlers for relevant types.
0e320a79
DW
68
69class WXDLLEXPORT wxICOFileHandler: public wxBitmapHandler
70{
71 DECLARE_DYNAMIC_CLASS(wxICOFileHandler)
72public:
73 inline wxICOFileHandler()
74 {
fb9010ed
DW
75 m_name = "ICO icon file";
76 m_extension = "ico";
77 m_type = wxBITMAP_TYPE_ICO;
0e320a79
DW
78 };
79
80 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
81 int desiredWidth = -1, int desiredHeight = -1);
82};
83
84class WXDLLEXPORT wxICOResourceHandler: public wxBitmapHandler
85{
86 DECLARE_DYNAMIC_CLASS(wxICOResourceHandler)
87public:
88 inline wxICOResourceHandler()
89 {
fb9010ed
DW
90 m_name = "ICO resource";
91 m_extension = "ico";
92 m_type = wxBITMAP_TYPE_ICO_RESOURCE;
0e320a79
DW
93 };
94
95 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
96 int desiredWidth = -1, int desiredHeight = -1);
97
98};
99
0e320a79
DW
100#endif
101 // _WX_ICON_H_
fb9010ed 102