]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/icon.h
Harmonize wxDataViewCtrl::GetSelection() behaviour in all ports.
[wxWidgets.git] / include / wx / osx / icon.h
CommitLineData
6762286d 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/osx/icon.h
6762286d
SC
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
18class WXDLLIMPEXP_CORE wxIcon : public wxGDIObject
19{
20public:
21 wxIcon();
22
23 wxIcon(const char* const* data);
24 wxIcon(const char bits[], int width , int height );
25 wxIcon(const wxString& name, wxBitmapType flags = wxICON_DEFAULT_TYPE,
26 int desiredWidth = -1, int desiredHeight = -1);
27 wxIcon(const wxIconLocation& loc)
28 {
29 LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON);
30 }
31
32 wxIcon(WXHICON icon, const wxSize& size);
33
34 virtual ~wxIcon();
35
36 bool LoadFile(const wxString& name, wxBitmapType flags = wxICON_DEFAULT_TYPE,
37 int desiredWidth = -1, int desiredHeight = -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 int GetWidth() const;
46 int GetHeight() const;
47 int GetDepth() const;
48 void SetWidth(int w);
49 void SetHeight(int h);
50 void SetDepth(int d);
51 void SetOk(bool isOk);
52
9b307a69
VZ
53 wxSize GetSize() const { return wxSize(GetWidth(), GetHeight()); }
54
6762286d
SC
55 WXHICON GetHICON() const;
56
57protected:
58 virtual wxGDIRefData *CreateGDIRefData() const;
59 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
60
61private:
62 DECLARE_DYNAMIC_CLASS(wxIcon)
bd7bfb00
SC
63
64 bool LoadIconFromSystemResource(const wxString& resourceName, int desiredWidth, int desiredHeight);
65 bool LoadIconFromBundleResource(const wxString& resourceName, int desiredWidth, int desiredHeight);
66 bool LoadIconFromFile(const wxString& filename, int desiredWidth, int desiredHeight);
67 bool LoadIconAsBitmap(const wxString& filename, wxBitmapType flags = wxICON_DEFAULT_TYPE, int desiredWidth = -1, int desiredHeight = -1);
6762286d
SC
68};
69
70class WXDLLIMPEXP_CORE wxICONResourceHandler: public wxBitmapHandler
71{
72public:
73 wxICONResourceHandler()
74 {
75 SetName(wxT("ICON resource"));
76 SetExtension(wxEmptyString);
77 SetType(wxBITMAP_TYPE_ICON_RESOURCE);
78 }
79
80 virtual bool LoadFile(wxBitmap *bitmap,
81 const wxString& name,
82 wxBitmapType flags,
83 int desiredWidth = -1,
84 int desiredHeight = -1);
85
86 // unhide the base class virtual
87 virtual bool LoadFile(wxBitmap *bitmap,
88 const wxString& name,
89 wxBitmapType flags)
90 { return LoadFile(bitmap, name, flags, -1, -1); }
91
92private:
93 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler)
94};
95
5c6eb3a8 96#endif
6762286d 97 // _WX_ICON_H_