1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/generic/imaglist.h
3 // Purpose:
4 // Author:      Robert Roebling
5 // Created:     01/02/97
6 // Copyright:   (c) 1998 Robert Roebling and Julian Smart
7 // Licence:     wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9 
10 #ifndef _WX_IMAGLISTG_H_
11 #define _WX_IMAGLISTG_H_
12 
13 #include "wx/bitmap.h"
14 #include "wx/gdicmn.h"
15 #include "wx/vector.h"
16 
17 class WXDLLIMPEXP_FWD_CORE wxDC;
18 class WXDLLIMPEXP_FWD_CORE wxIcon;
19 class WXDLLIMPEXP_FWD_CORE wxColour;
20 
21 
22 class WXDLLIMPEXP_CORE wxGenericImageList: public wxObject
23 {
24 public:
wxGenericImageList()25     wxGenericImageList() { }
26     wxGenericImageList( int width, int height, bool mask = true, int initialCount = 1 );
27     virtual ~wxGenericImageList();
28     bool Create( int width, int height, bool mask = true, int initialCount = 1 );
29 
30     virtual int GetImageCount() const;
31     virtual bool GetSize( int index, int &width, int &height ) const;
GetSize()32     virtual wxSize GetSize() const { return m_size; }
33 
34     int Add( const wxBitmap& bitmap );
35     int Add( const wxBitmap& bitmap, const wxBitmap& mask );
36     int Add( const wxBitmap& bitmap, const wxColour& maskColour );
37     wxBitmap GetBitmap(int index) const;
38     wxIcon GetIcon(int index) const;
39     bool Replace( int index,
40                   const wxBitmap& bitmap,
41                   const wxBitmap& mask = wxNullBitmap );
42     bool Remove( int index );
43     bool RemoveAll();
44 
45     virtual bool Draw(int index, wxDC& dc, int x, int y,
46               int flags = wxIMAGELIST_DRAW_NORMAL,
47               bool solidBackground = false);
48 
49 #if WXWIN_COMPATIBILITY_3_0
50     wxDEPRECATED_MSG("Don't use this overload: it's not portable and does nothing")
Create()51     bool Create() { return true; }
52 
53     wxDEPRECATED_MSG("Use GetBitmap() instead")
GetBitmapPtr(int index)54     const wxBitmap *GetBitmapPtr(int index) const { return DoGetPtr(index); }
55 #endif // WXWIN_COMPATIBILITY_3_0
56 
57 private:
58     const wxBitmap *DoGetPtr(int index) const;
59 
60     wxVector<wxBitmap> m_images;
61     bool m_useMask;
62 
63     // Size of a single bitmap in the list.
64     wxSize m_size;
65     // Images in the list should have the same scale factor.
66     double m_scaleFactor;
67 
68     wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericImageList);
69 };
70 
71 #ifndef wxHAS_NATIVE_IMAGELIST
72 
73 /*
74  * wxImageList has to be a real class or we have problems with
75  * the run-time information.
76  */
77 
78 class WXDLLIMPEXP_CORE wxImageList: public wxGenericImageList
79 {
80     wxDECLARE_DYNAMIC_CLASS(wxImageList);
81 
82 public:
wxImageList()83     wxImageList() {}
84 
85     wxImageList( int width, int height, bool mask = true, int initialCount = 1 )
wxGenericImageList(width,height,mask,initialCount)86         : wxGenericImageList(width, height, mask, initialCount)
87     {
88     }
89 };
90 #endif // !wxHAS_NATIVE_IMAGELIST
91 
92 #endif  // _WX_IMAGLISTG_H_
93