]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/icon.h
1. Moved m_usePrimary to wxClipboardBase as it's now also used by wxMSW/wxMac
[wxWidgets.git] / include / wx / mac / carbon / icon.h
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
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_ICON_H_
13 #define _WX_ICON_H_
14
15 #include "wx/bitmap.h"
16
17 // Icon
18 class WXDLLEXPORT wxIcon: public wxGDIObject
19 {
20 public:
21 wxIcon();
22
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,
27 int desiredWidth = -1, int desiredHeight = -1);
28 wxIcon(const wxIconLocation& loc)
29 {
30 LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON);
31 }
32 virtual ~wxIcon();
33
34 bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
35 int desiredWidth /* = -1 */ , int desiredHeight = -1);
36 bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE )
37 { return LoadFile( name , flags , -1 , -1 ) ; }
38
39
40 // create from bitmap (which should have a mask unless it's monochrome):
41 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
42 // ctors, assignment operators...), but it's ok to have such function
43 void CopyFromBitmap(const wxBitmap& bmp);
44
45 bool Ok() const { return IsOk(); }
46 bool IsOk() const;
47 int GetWidth() const;
48 int GetHeight() const;
49 int GetDepth() const;
50 void SetWidth(int w);
51 void SetHeight(int h);
52 void SetDepth(int d);
53 void SetOk(bool isOk);
54
55 WXHICON GetHICON() const ;
56
57 DECLARE_DYNAMIC_CLASS(wxIcon)
58 };
59
60 /*
61 class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
62 {
63 DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
64 public:
65 inline wxICONFileHandler()
66 {
67 m_name = "ICO icon file";
68 m_extension = "ico";
69 m_type = wxBITMAP_TYPE_ICO;
70 };
71
72 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
73 int desiredWidth = -1, int desiredHeight = -1);
74 };
75 */
76
77 class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler
78 {
79 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler)
80 public:
81 inline wxICONResourceHandler()
82 {
83 SetName(wxT("ICON resource"));
84 SetExtension(wxEmptyString);
85 SetType(wxBITMAP_TYPE_ICON_RESOURCE);
86 };
87
88 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
89 int desiredWidth = -1, int desiredHeight = -1);
90
91 };
92
93 #endif
94 // _WX_ICON_H_