]> git.saurik.com Git - wxWidgets.git/blame - include/wx/iconbndl.h
Minor corrections to make dist after reports
[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"
f618020a
MB
16// for wxSize
17#include "wx/gdicmn.h"
52734360 18#include "wx/icon.h"
f618020a 19
d2cb636a
PC
20WX_DECLARE_EXPORTED_OBJARRAY(wxIcon, wxIconArray);
21
f618020a
MB
22// this class can't load bitmaps of type wxBITMAP_TYPE_ICO_RESOURCE,
23// if you need them, you have to load them manually and call
24// wxIconCollection::AddIcon
53a2db12 25class WXDLLIMPEXP_CORE wxIconBundle : public wxGDIObject
f618020a
MB
26{
27public:
28 // default constructor
52734360
VZ
29 wxIconBundle();
30
f618020a 31 // initializes the bundle with the icon(s) found in the file
e98e625c 32 wxIconBundle(const wxString& file, wxBitmapType type);
52734360 33
f618020a 34 // initializes the bundle with a single icon
52734360
VZ
35 wxIconBundle(const wxIcon& icon);
36
24af522c 37 // default copy ctor and assignment operator are OK
f618020a
MB
38
39 // adds all the icons contained in the file to the collection,
40 // if the collection already contains icons with the same
41 // width and height, they are replaced
e98e625c 42 void AddIcon(const wxString& file, wxBitmapType type);
52734360 43
f618020a
MB
44 // adds the icon to the collection, if the collection already
45 // contains an icon with the same width and height, it is
46 // replaced
52734360 47 void AddIcon(const wxIcon& icon);
f618020a
MB
48
49 // returns the icon with the given size; if no such icon exists,
50 // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists,
51 // returns the first icon in the bundle
52734360
VZ
52 wxIcon GetIcon(const wxSize& size) const;
53
9b5933bc 54 // equivalent to GetIcon(wxSize(size, size))
52734360 55 wxIcon GetIcon(wxCoord size = wxDefaultCoord) const
9b5933bc 56 { return GetIcon(wxSize(size, size)); }
52734360 57
9b5933bc
VZ
58 // returns the icon exactly of the specified size or wxNullIcon if no icon
59 // of exactly given size are available
60 wxIcon GetIconOfExactSize(const wxSize& size) const;
61 wxIcon GetIconOfExactSize(wxCoord size) const
62 { return GetIconOfExactSize(wxSize(size, size)); }
52734360
VZ
63
64 // enumerate all icons in the bundle: don't use these functions if ti can
65 // be avoided, using GetIcon() directly is better
66
67 // return the number of available icons
68 size_t GetIconCount() const;
69
70 // return the icon at index (must be < GetIconCount())
71 wxIcon GetIconByIndex(size_t n) const;
72
f7186899
VZ
73 // check if we have any icons at all
74 bool IsEmpty() const { return GetIconCount() == 0; }
75
831b64f3 76#if WXWIN_COMPATIBILITY_2_8
0ddec397
VZ
77 wxDEPRECATED( void AddIcon(const wxString& file, long type)
78 {
1473d17f 79 AddIcon(file, (wxBitmapType)type);
0ddec397
VZ
80 }
81 )
82
83 wxDEPRECATED( wxIconBundle(const wxString& file, long type)
84 {
85 AddIcon(file, (wxBitmapType)type);
86 }
87 )
88#endif // WXWIN_COMPATIBILITY_2_8
89
52734360 90protected:
8f884a0d
VZ
91 virtual wxGDIRefData *CreateGDIRefData() const;
92 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
52734360 93
f618020a
MB
94private:
95 // delete all icons
96 void DeleteIcons();
52734360
VZ
97
98 DECLARE_DYNAMIC_CLASS(wxIconBundle)
f618020a
MB
99};
100
52734360 101#endif // _WX_ICONBNDL_H_