1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxIconBundle
4 // Author: Mattia barbon
8 // Copyright: (c) Mattia Barbon
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_ICONBNDL_H_
13 #define _WX_ICONBNDL_H_
15 #include "wx/dynarray.h"
17 #include "wx/gdicmn.h"
19 class WXDLLIMPEXP_CORE wxIcon
;
20 class WXDLLIMPEXP_BASE wxString
;
22 WX_DECLARE_EXPORTED_OBJARRAY( wxIcon
, wxIconArray
);
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
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()
39 const wxIconBundle
& operator =( const wxIconBundle
& ic
);
40 wxIconBundle( const wxIconBundle
& ic
) : m_icons()
43 ~wxIconBundle() { DeleteIcons(); }
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
52 void AddIcon( const wxIcon
& icon
);
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
) ); }