1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/generic/imaglist.h
3 // Purpose:
4 // Author:      Robert Roebling
5 // Created:     01/02/97
6 // Id:
7 // Copyright:   (c) 1998 Robert Roebling and Julian Smart
8 // Licence:     wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef __IMAGELISTH_G__
12 #define __IMAGELISTH_G__
13 
14 #include "wx/defs.h"
15 #include "wx/list.h"
16 #include "wx/icon.h"
17 
18 class WXDLLEXPORT wxDC;
19 class WXDLLEXPORT wxBitmap;
20 class WXDLLEXPORT wxColour;
21 
22 
23 class WXDLLEXPORT wxGenericImageList: public wxObject
24 {
25 public:
wxGenericImageList()26     wxGenericImageList() { m_width = m_height = 0; }
27     wxGenericImageList( int width, int height, bool mask = true, int initialCount = 1 );
28     virtual ~wxGenericImageList();
29     bool Create( int width, int height, bool mask = true, int initialCount = 1 );
30     bool Create();
31 
32     virtual int GetImageCount() const;
33     virtual bool GetSize( int index, int &width, int &height ) const;
34 
35     int Add( const wxBitmap& bitmap );
36     int Add( const wxBitmap& bitmap, const wxBitmap& mask );
37     int Add( const wxBitmap& bitmap, const wxColour& maskColour );
38     wxBitmap GetBitmap(int index) const;
39     wxIcon GetIcon(int index) const;
40     bool Replace( int index, const wxBitmap &bitmap );
41     bool Replace( int index, const wxBitmap &bitmap, const wxBitmap& mask );
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     // Internal use only
50     const wxBitmap *GetBitmapPtr(int index) const;
51 private:
52     wxList  m_images;
53 
54     int     m_width;
55     int     m_height;
56 
57     DECLARE_DYNAMIC_CLASS(wxGenericImageList)
58 };
59 
60 #ifndef wxHAS_NATIVE_IMAGELIST
61 
62 /*
63  * wxImageList has to be a real class or we have problems with
64  * the run-time information.
65  */
66 
67 class WXDLLEXPORT wxImageList: public wxGenericImageList
68 {
DECLARE_DYNAMIC_CLASS(wxImageList)69     DECLARE_DYNAMIC_CLASS(wxImageList)
70 
71 public:
72     wxImageList() {}
73 
74     wxImageList( int width, int height, bool mask = true, int initialCount = 1 )
wxGenericImageList(width,height,mask,initialCount)75         : wxGenericImageList(width, height, mask, initialCount)
76     {
77     }
78 };
79 #endif // !wxHAS_NATIVE_IMAGELIST
80 
81 #endif  // __IMAGELISTH_G__
82 
83