]> git.saurik.com Git - wxWidgets.git/blob - include/wx/iconbndl.h
use 2 extensions in a filter in FileSave() for testing
[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 #include "wx/gdiobj.h"
17 // for wxSize
18 #include "wx/gdicmn.h"
19 #include "wx/icon.h"
20
21 class WXDLLIMPEXP_CORE wxIcon;
22 class WXDLLIMPEXP_BASE wxString;
23
24 class WXDLLEXPORT wxIconBundle;
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 : public wxGDIObject
32 {
33 public:
34 // default constructor
35 wxIconBundle();
36
37 // initializes the bundle with the icon(s) found in the file
38 wxIconBundle(const wxString& file, long type);
39
40 // initializes the bundle with a single icon
41 wxIconBundle(const wxIcon& icon);
42
43 // initializes the bundle from another icon bundle
44 wxIconBundle(const wxIconBundle& icon);
45
46 wxIconBundle& operator=(const wxIconBundle& ic)
47 { if ( this != &ic) Ref(ic); return *this; }
48
49 virtual bool IsOk() const;
50
51
52 // adds all the icons contained in the file to the collection,
53 // if the collection already contains icons with the same
54 // width and height, they are replaced
55 void AddIcon(const wxString& file, long type);
56
57 // adds the icon to the collection, if the collection already
58 // contains an icon with the same width and height, it is
59 // replaced
60 void AddIcon(const wxIcon& icon);
61
62 // returns the icon with the given size; if no such icon exists,
63 // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists,
64 // returns the first icon in the bundle
65 wxIcon GetIcon(const wxSize& size) const;
66
67 // equivalent to GetIcon( wxSize( size, size ) )
68 wxIcon GetIcon(wxCoord size = wxDefaultCoord) const
69 { return GetIcon( wxSize( size, size ) ); }
70
71
72 // enumerate all icons in the bundle: don't use these functions if ti can
73 // be avoided, using GetIcon() directly is better
74
75 // return the number of available icons
76 size_t GetIconCount() const;
77
78 // return the icon at index (must be < GetIconCount())
79 wxIcon GetIconByIndex(size_t n) const;
80
81 protected:
82 virtual wxObjectRefData *CreateRefData() const;
83 virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
84
85 private:
86 // delete all icons
87 void DeleteIcons();
88
89 DECLARE_DYNAMIC_CLASS(wxIconBundle)
90 };
91
92 #endif // _WX_ICONBNDL_H_