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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "iconbndl.h"
19 #include "wx/dynarray.h"
21 #include "wx/gdicmn.h"
23 class WXDLLIMPEXP_CORE wxIcon
;
24 class WXDLLIMPEXP_BASE wxString
;
26 WX_DECLARE_EXPORTED_OBJARRAY( wxIcon
, wxIconArray
);
28 // this class can't load bitmaps of type wxBITMAP_TYPE_ICO_RESOURCE,
29 // if you need them, you have to load them manually and call
30 // wxIconCollection::AddIcon
31 class WXDLLEXPORT wxIconBundle
34 // default constructor
35 wxIconBundle() : m_icons() {}
36 // initializes the bundle with the icon(s) found in the file
37 wxIconBundle( const wxString
& file
, long type
) : m_icons()
38 { AddIcon( file
, type
); }
39 // initializes the bundle with a single icon
40 wxIconBundle( const wxIcon
& icon
) : m_icons()
43 const wxIconBundle
& operator =( const wxIconBundle
& ic
);
44 wxIconBundle( const wxIconBundle
& ic
) : m_icons()
47 ~wxIconBundle() { DeleteIcons(); }
49 // adds all the icons contained in the file to the collection,
50 // if the collection already contains icons with the same
51 // width and height, they are replaced
52 void AddIcon( const wxString
& file
, long type
);
53 // adds the icon to the collection, if the collection already
54 // contains an icon with the same width and height, it is
56 void AddIcon( const wxIcon
& icon
);
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
61 const wxIcon
& GetIcon( const wxSize
& size
) const;
62 // equivalent to GetIcon( wxSize( size, size ) )
63 const wxIcon
& GetIcon( wxCoord size
= -1 ) const
64 { return GetIcon( wxSize( size
, size
) ); }