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