]> git.saurik.com Git - wxWidgets.git/blame - include/wx/iconbndl.h
Avoid setting attributes in GTK wxDataViewRenderer if not supported.
[wxWidgets.git] / include / wx / iconbndl.h
CommitLineData
f618020a
MB
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/iconbndl.h
3// Purpose: wxIconBundle
4// Author: Mattia barbon
5// Modified by:
6// Created: 23.03.02
7// RCS-ID: $Id$
8// Copyright: (c) Mattia Barbon
65571936 9// Licence: wxWindows licence
f618020a
MB
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_ICONBNDL_H_
13#define _WX_ICONBNDL_H_
14
52734360 15#include "wx/gdiobj.h"
b85b06e1 16#include "wx/gdicmn.h" // for wxSize
52734360 17#include "wx/icon.h"
f618020a 18
7105649b
VZ
19#include "wx/dynarray.h"
20
cee875e3
VS
21class WXDLLIMPEXP_FWD_BASE wxInputStream;
22
d2cb636a
PC
23WX_DECLARE_EXPORTED_OBJARRAY(wxIcon, wxIconArray);
24
f618020a
MB
25// this class can't load bitmaps of type wxBITMAP_TYPE_ICO_RESOURCE,
26// if you need them, you have to load them manually and call
27// wxIconCollection::AddIcon
53a2db12 28class WXDLLIMPEXP_CORE wxIconBundle : public wxGDIObject
f618020a
MB
29{
30public:
31 // default constructor
52734360
VZ
32 wxIconBundle();
33
f618020a 34 // initializes the bundle with the icon(s) found in the file
cee875e3 35#if wxUSE_STREAMS
b85b06e1 36 wxIconBundle(const wxString& file, wxBitmapType type = wxBITMAP_TYPE_ANY);
cee875e3 37 wxIconBundle(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY);
b85b06e1 38#endif // wxUSE_STREAMS
52734360 39
f618020a 40 // initializes the bundle with a single icon
52734360
VZ
41 wxIconBundle(const wxIcon& icon);
42
24af522c 43 // default copy ctor and assignment operator are OK
f618020a
MB
44
45 // adds all the icons contained in the file to the collection,
46 // if the collection already contains icons with the same
47 // width and height, they are replaced
cee875e3 48#if wxUSE_STREAMS
b85b06e1 49 void AddIcon(const wxString& file, wxBitmapType type = wxBITMAP_TYPE_ANY);
cee875e3 50 void AddIcon(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY);
b85b06e1 51#endif // wxUSE_STREAMS
52734360 52
f618020a
MB
53 // adds the icon to the collection, if the collection already
54 // contains an icon with the same width and height, it is
55 // replaced
52734360 56 void AddIcon(const wxIcon& icon);
f618020a
MB
57
58 // returns the icon with the given size; if no such icon exists,
59 // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists,
60 // returns the first icon in the bundle
52734360
VZ
61 wxIcon GetIcon(const wxSize& size) const;
62
9b5933bc 63 // equivalent to GetIcon(wxSize(size, size))
52734360 64 wxIcon GetIcon(wxCoord size = wxDefaultCoord) const
9b5933bc 65 { return GetIcon(wxSize(size, size)); }
52734360 66
9b5933bc
VZ
67 // returns the icon exactly of the specified size or wxNullIcon if no icon
68 // of exactly given size are available
69 wxIcon GetIconOfExactSize(const wxSize& size) const;
70 wxIcon GetIconOfExactSize(wxCoord size) const
71 { return GetIconOfExactSize(wxSize(size, size)); }
52734360
VZ
72
73 // enumerate all icons in the bundle: don't use these functions if ti can
74 // be avoided, using GetIcon() directly is better
75
76 // return the number of available icons
77 size_t GetIconCount() const;
78
79 // return the icon at index (must be < GetIconCount())
80 wxIcon GetIconByIndex(size_t n) const;
81
f7186899
VZ
82 // check if we have any icons at all
83 bool IsEmpty() const { return GetIconCount() == 0; }
84
831b64f3 85#if WXWIN_COMPATIBILITY_2_8
0ddec397
VZ
86 wxDEPRECATED( void AddIcon(const wxString& file, long type)
87 {
1473d17f 88 AddIcon(file, (wxBitmapType)type);
0ddec397
VZ
89 }
90 )
70bf3295
SC
91
92 wxDEPRECATED_CONSTRUCTOR( wxIconBundle (const wxString& file, long type)
0ddec397
VZ
93 {
94 AddIcon(file, (wxBitmapType)type);
95 }
96 )
97#endif // WXWIN_COMPATIBILITY_2_8
98
52734360 99protected:
8f884a0d
VZ
100 virtual wxGDIRefData *CreateGDIRefData() const;
101 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
52734360 102
f618020a
MB
103private:
104 // delete all icons
105 void DeleteIcons();
52734360
VZ
106
107 DECLARE_DYNAMIC_CLASS(wxIconBundle)
f618020a
MB
108};
109
52734360 110#endif // _WX_ICONBNDL_H_