]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/icon.h
compilation fixes for wxMSW
[wxWidgets.git] / include / wx / msw / icon.h
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: icon.h
3// Purpose: wxIcon class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
bbcdf8bc 8// Copyright: (c) Julian Smart
c793fa87 9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_ICON_H_
13#define _WX_ICON_H_
2bda0e17
KB
14
15#ifdef __GNUG__
c793fa87 16 #pragma interface "icon.h"
2bda0e17
KB
17#endif
18
19#include "wx/bitmap.h"
20
c793fa87
VZ
21// ---------------------------------------------------------------------------
22// icon data
23// ---------------------------------------------------------------------------
2bda0e17
KB
24class WXDLLEXPORT wxIconRefData: public wxBitmapRefData
25{
26 friend class WXDLLEXPORT wxBitmap;
27 friend class WXDLLEXPORT wxIcon;
c793fa87 28
2bda0e17 29public:
c793fa87
VZ
30 wxIconRefData();
31 ~wxIconRefData();
2bda0e17
KB
32
33public:
c793fa87 34 WXHICON m_hIcon;
2bda0e17
KB
35};
36
37#define M_ICONDATA ((wxIconRefData *)m_refData)
38#define M_ICONHANDLERDATA ((wxIconRefData *)bitmap->GetRefData())
39
c793fa87 40// ---------------------------------------------------------------------------
2bda0e17 41// Icon
c793fa87
VZ
42// ---------------------------------------------------------------------------
43class WXDLLEXPORT wxIcon : public wxBitmap
2bda0e17 44{
c793fa87 45 DECLARE_DYNAMIC_CLASS(wxIcon)
2bda0e17
KB
46
47public:
c793fa87 48 wxIcon();
2bda0e17 49
c793fa87
VZ
50 // Copy constructors
51 wxIcon(const wxIcon& icon) { Ref(icon); }
2bda0e17 52
c793fa87
VZ
53 wxIcon(const char bits[], int width, int height);
54 wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
55 int desiredWidth = -1, int desiredHeight = -1);
56 ~wxIcon();
2bda0e17 57
c793fa87
VZ
58 bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
59 int desiredWidth = -1, int desiredHeight = -1);
2bda0e17 60
c793fa87
VZ
61 wxIcon& operator = (const wxIcon& icon)
62 { if (*this == icon) return (*this); Ref(icon); return *this; }
63 bool operator == (const wxIcon& icon) const
64 { return m_refData == icon.m_refData; }
65 bool operator != (const wxIcon& icon) const
66 { return m_refData != icon.m_refData; }
2bda0e17 67
c793fa87
VZ
68 void SetHICON(WXHICON ico);
69 WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); }
2bda0e17 70
c793fa87 71 bool Ok() const { return (m_refData != NULL && M_ICONDATA->m_hIcon != 0) ; }
2bda0e17 72
c793fa87 73 bool FreeResource(bool force = FALSE);
2bda0e17
KB
74};
75
76// TODO: Put these in separate, private header
77
78class WXDLLEXPORT wxICOFileHandler: public wxBitmapHandler
79{
c793fa87
VZ
80DECLARE_DYNAMIC_CLASS(wxICOFileHandler)
81
2bda0e17 82public:
c793fa87
VZ
83 wxICOFileHandler()
84 {
85 m_name = "ICO icon file";
86 m_extension = "ico";
87 m_type = wxBITMAP_TYPE_ICO;
88 };
89
90 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
91 int desiredWidth = -1, int desiredHeight = -1);
2bda0e17
KB
92};
93
94class WXDLLEXPORT wxICOResourceHandler: public wxBitmapHandler
95{
c793fa87
VZ
96DECLARE_DYNAMIC_CLASS(wxICOResourceHandler)
97
2bda0e17 98public:
c793fa87
VZ
99 wxICOResourceHandler()
100 {
101 m_name = "ICO resource";
102 m_extension = "ico";
103 m_type = wxBITMAP_TYPE_ICO_RESOURCE;
104 };
105
106 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
107 int desiredWidth = -1, int desiredHeight = -1);
2bda0e17
KB
108
109};
110
111#endif
bbcdf8bc 112 // _WX_ICON_H_