]> git.saurik.com Git - wxWidgets.git/blob - include/wx/iconbndl.h
More details about the internal module name changes
[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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "iconbndl.h"
17 #endif
18
19 #include "wx/dynarray.h"
20 // for wxSize
21 #include "wx/gdicmn.h"
22
23 class WXDLLEXPORT wxIcon;
24 class WXDLLEXPORT wxString;
25
26 WX_DECLARE_EXPORTED_OBJARRAY( wxIcon, wxIconArray );
27
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
32 {
33 public:
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()
41 { AddIcon( icon ); }
42
43 const wxIconBundle& operator =( const wxIconBundle& ic );
44 wxIconBundle( const wxIconBundle& ic ) : m_icons()
45 { *this = ic; }
46
47 ~wxIconBundle() { DeleteIcons(); }
48
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
55 // replaced
56 void AddIcon( const wxIcon& icon );
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
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 ) ); }
65 private:
66 // delete all icons
67 void DeleteIcons();
68 public:
69 wxIconArray m_icons;
70 };
71
72 #endif
73 // _WX_ICONBNDL_H_