]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/carbon/icon.h
Adding support for item font/style/color customization, unfortunately, it does not...
[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
20b69855 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 }
d3c7fc99 32 virtual ~wxIcon();
8cf73271 33
20b69855 34 bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
8cf73271 35 int desiredWidth /* = -1 */ , int desiredHeight = -1);
20b69855 36 bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE )
8cf73271
SC
37 { return LoadFile( name , flags , -1 , -1 ) ; }
38
20b69855
SC
39 bool operator==(const wxIcon& icon) const { return m_refData == icon.m_refData; }
40 bool operator!=(const wxIcon& icon) const { return !(*this == icon); }
41
42 // create from bitmap (which should have a mask unless it's monochrome):
43 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
44 // ctors, assignment operators...), but it's ok to have such function
45 void CopyFromBitmap(const wxBitmap& bmp);
46
b7cacb43
VZ
47 bool Ok() const { return IsOk(); }
48 bool IsOk() const;
20b69855
SC
49 int GetWidth() const;
50 int GetHeight() const;
51 int GetDepth() const;
52 void SetWidth(int w);
53 void SetHeight(int h);
54 void SetDepth(int d);
55 void SetOk(bool isOk);
f0794a4c 56
20b69855
SC
57 WXHICON GetHICON() const ;
58
59 DECLARE_DYNAMIC_CLASS(wxIcon)
8cf73271
SC
60};
61
62/*
63class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
64{
65 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
66public:
67 inline wxICONFileHandler()
68 {
69 m_name = "ICO icon file";
70 m_extension = "ico";
71 m_type = wxBITMAP_TYPE_ICO;
72 };
73
74 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
75 int desiredWidth = -1, int desiredHeight = -1);
76};
77*/
78
79class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler
80{
81 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler)
82public:
83 inline wxICONResourceHandler()
84 {
19d360ad
SC
85 SetName(wxT("ICON resource"));
86 SetExtension(wxEmptyString);
87 SetType(wxBITMAP_TYPE_ICON_RESOURCE);
8cf73271
SC
88 };
89
90 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
91 int desiredWidth = -1, int desiredHeight = -1);
92
93};
94
95#endif
96 // _WX_ICON_H_