]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/carbon/icon.h
avoid GCC warning about type-punned pointer breaking strict aliasing rules
[wxWidgets.git] / include / wx / mac / carbon / icon.h
CommitLineData
8cf73271
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: icon.h
3// Purpose: wxIcon class
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
7// RCS-ID: $Id$
8// Copyright: (c) Stefan Csomor
65571936 9// Licence: wxWindows licence
8cf73271
SC
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_ICON_H_
13#define _WX_ICON_H_
14
8cf73271
SC
15#include "wx/bitmap.h"
16
17// Icon
8f884a0d 18class WXDLLEXPORT wxIcon : public wxGDIObject
8cf73271
SC
19{
20public:
20b69855 21 wxIcon();
8cf73271 22
20b69855
SC
23 wxIcon(const char **data);
24 wxIcon(char **data);
25 wxIcon(const char bits[], int width , int height );
26 wxIcon(const wxString& name, int flags = wxBITMAP_TYPE_ICON_RESOURCE,
8cf73271 27 int desiredWidth = -1, int desiredHeight = -1);
20b69855
SC
28 wxIcon(const wxIconLocation& loc)
29 {
8cf73271 30 LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON);
20b69855 31 }
52734360
VZ
32
33 wxIcon(WXHICON icon, const wxSize& size);
34
d3c7fc99 35 virtual ~wxIcon();
8cf73271 36
20b69855 37 bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
8cf73271 38 int desiredWidth /* = -1 */ , int desiredHeight = -1);
20b69855 39 bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE )
8cf73271
SC
40 { return LoadFile( name , flags , -1 , -1 ) ; }
41
20b69855
SC
42
43 // create from bitmap (which should have a mask unless it's monochrome):
44 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
45 // ctors, assignment operators...), but it's ok to have such function
46 void CopyFromBitmap(const wxBitmap& bmp);
47
20b69855
SC
48 int GetWidth() const;
49 int GetHeight() const;
50 int GetDepth() const;
51 void SetWidth(int w);
52 void SetHeight(int h);
53 void SetDepth(int d);
54 void SetOk(bool isOk);
f0794a4c 55
20b69855
SC
56 WXHICON GetHICON() const ;
57
8f884a0d
VZ
58protected:
59 virtual wxGDIRefData *CreateGDIRefData() const;
60 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
61
62private:
20b69855 63 DECLARE_DYNAMIC_CLASS(wxIcon)
8cf73271
SC
64};
65
66/*
67class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
68{
69 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
70public:
71 inline wxICONFileHandler()
72 {
73 m_name = "ICO icon file";
74 m_extension = "ico";
75 m_type = wxBITMAP_TYPE_ICO;
76 };
77
78 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
79 int desiredWidth = -1, int desiredHeight = -1);
80};
81*/
82
83class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler
84{
85 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler)
86public:
87 inline wxICONResourceHandler()
88 {
19d360ad
SC
89 SetName(wxT("ICON resource"));
90 SetExtension(wxEmptyString);
91 SetType(wxBITMAP_TYPE_ICON_RESOURCE);
8cf73271
SC
92 };
93
94 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
95 int desiredWidth = -1, int desiredHeight = -1);
96
97};
98
99#endif
100 // _WX_ICON_H_