]> git.saurik.com Git - wxWidgets.git/blob - include/wx/iconbndl.h
fix aui crash related to SF bug 1531361
[wxWidgets.git] / include / wx / iconbndl.h
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
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_ICONBNDL_H_
13 #define _WX_ICONBNDL_H_
14
15 #include "wx/dynarray.h"
16 // for wxSize
17 #include "wx/gdicmn.h"
18
19 class WXDLLIMPEXP_CORE wxIcon;
20 class WXDLLIMPEXP_BASE wxString;
21
22 WX_DECLARE_EXPORTED_OBJARRAY( wxIcon, wxIconArray );
23
24 // this class can't load bitmaps of type wxBITMAP_TYPE_ICO_RESOURCE,
25 // if you need them, you have to load them manually and call
26 // wxIconCollection::AddIcon
27 class WXDLLEXPORT wxIconBundle
28 {
29 public:
30 // default constructor
31 wxIconBundle() : m_icons() {}
32 // initializes the bundle with the icon(s) found in the file
33 wxIconBundle( const wxString& file, long type ) : m_icons()
34 { AddIcon( file, type ); }
35 // initializes the bundle with a single icon
36 wxIconBundle( const wxIcon& icon ) : m_icons()
37 { AddIcon( icon ); }
38
39 const wxIconBundle& operator =( const wxIconBundle& ic );
40 wxIconBundle( const wxIconBundle& ic ) : m_icons()
41 { *this = ic; }
42
43 ~wxIconBundle() { DeleteIcons(); }
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
48 void AddIcon( const wxString& file, long type );
49 // adds the icon to the collection, if the collection already
50 // contains an icon with the same width and height, it is
51 // replaced
52 void AddIcon( const wxIcon& icon );
53
54 // returns the icon with the given size; if no such icon exists,
55 // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists,
56 // returns the first icon in the bundle
57 const wxIcon& GetIcon( const wxSize& size ) const;
58 // equivalent to GetIcon( wxSize( size, size ) )
59 const wxIcon& GetIcon( wxCoord size = wxDefaultCoord ) const
60 { return GetIcon( wxSize( size, size ) ); }
61 private:
62 // delete all icons
63 void DeleteIcons();
64 public:
65 wxIconArray m_icons;
66 };
67
68 #endif
69 // _WX_ICONBNDL_H_