]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/carbon/icon.h
tentative fix for BestSize problems (non-native toolbar)
[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
15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16#pragma interface "icon.h"
17#endif
18
19#include "wx/bitmap.h"
20
21// Icon
20b69855 22class WXDLLEXPORT wxIcon: public wxGDIObject
8cf73271
SC
23{
24public:
20b69855 25 wxIcon();
8cf73271 26
20b69855
SC
27 // Copy constructors
28 wxIcon(const wxIcon& icon)
f0794a4c
VZ
29 : wxGDIObject()
30 {
31 Ref(icon);
32 }
8cf73271 33
20b69855
SC
34 wxIcon(const char **data);
35 wxIcon(char **data);
36 wxIcon(const char bits[], int width , int height );
37 wxIcon(const wxString& name, int flags = wxBITMAP_TYPE_ICON_RESOURCE,
8cf73271 38 int desiredWidth = -1, int desiredHeight = -1);
20b69855
SC
39 wxIcon(const wxIconLocation& loc)
40 {
8cf73271 41 LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON);
20b69855
SC
42 }
43 ~wxIcon();
8cf73271 44
20b69855 45 bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
8cf73271 46 int desiredWidth /* = -1 */ , int desiredHeight = -1);
20b69855 47 bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE )
8cf73271
SC
48 { return LoadFile( name , flags , -1 , -1 ) ; }
49
20b69855 50 wxIcon& operator=(const wxIcon& icon)
8cf73271 51 { if (this != &icon) Ref(icon); return *this; }
20b69855
SC
52 bool operator==(const wxIcon& icon) const { return m_refData == icon.m_refData; }
53 bool operator!=(const wxIcon& icon) const { return !(*this == icon); }
54
55 // create from bitmap (which should have a mask unless it's monochrome):
56 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
57 // ctors, assignment operators...), but it's ok to have such function
58 void CopyFromBitmap(const wxBitmap& bmp);
59
60 bool Ok() const;
61 int GetWidth() const;
62 int GetHeight() const;
63 int GetDepth() const;
64 void SetWidth(int w);
65 void SetHeight(int h);
66 void SetDepth(int d);
67 void SetOk(bool isOk);
f0794a4c 68
20b69855
SC
69 WXHICON GetHICON() const ;
70
71 DECLARE_DYNAMIC_CLASS(wxIcon)
8cf73271
SC
72};
73
74/*
75class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
76{
77 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
78public:
79 inline wxICONFileHandler()
80 {
81 m_name = "ICO icon file";
82 m_extension = "ico";
83 m_type = wxBITMAP_TYPE_ICO;
84 };
85
86 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
87 int desiredWidth = -1, int desiredHeight = -1);
88};
89*/
90
91class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler
92{
93 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler)
94public:
95 inline wxICONResourceHandler()
96 {
19d360ad
SC
97 SetName(wxT("ICON resource"));
98 SetExtension(wxEmptyString);
99 SetType(wxBITMAP_TYPE_ICON_RESOURCE);
8cf73271
SC
100 };
101
102 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
103 int desiredWidth = -1, int desiredHeight = -1);
104
105};
106
107#endif
108 // _WX_ICON_H_