]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
f6bcfd97 | 2 | // Name: wx/generic/imaglist.h |
c801d85f KB |
3 | // Purpose: |
4 | // Author: Robert Roebling | |
5 | // Created: 01/02/97 | |
6 | // Id: | |
371a5b4e | 7 | // Copyright: (c) 1998 Robert Roebling and Julian Smart |
65571936 | 8 | // Licence: wxWindows licence |
c801d85f KB |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef __IMAGELISTH_G__ | |
12 | #define __IMAGELISTH_G__ | |
13 | ||
c801d85f | 14 | #include "wx/defs.h" |
00dd3b18 | 15 | #include "wx/list.h" |
f45fac95 | 16 | #include "wx/icon.h" |
00dd3b18 MB |
17 | |
18 | class WXDLLEXPORT wxDC; | |
19 | class WXDLLEXPORT wxBitmap; | |
20 | class WXDLLEXPORT wxColour; | |
c801d85f KB |
21 | |
22 | /* | |
23 | * wxImageList is used for wxListCtrl, wxTreeCtrl. These controls refer to | |
24 | * images for their items by an index into an image list. | |
25 | * A wxImageList is capable of creating images with optional masks from | |
26 | * a variety of sources - a single bitmap plus a colour to indicate the mask, | |
27 | * two bitmaps, or an icon. | |
28 | * | |
29 | * Image lists can also create and draw images used for drag and drop functionality. | |
30 | * This is not yet implemented in wxImageList. We need to discuss a generic API | |
31 | * for doing drag and drop and see whether it ties in with the Win95 view of it. | |
32 | * See below for candidate functions and an explanation of how they might be | |
33 | * used. | |
34 | */ | |
35 | ||
3cd94a0d JS |
36 | #if !defined(wxIMAGELIST_DRAW_NORMAL) |
37 | ||
c801d85f KB |
38 | // Flags for Draw |
39 | #define wxIMAGELIST_DRAW_NORMAL 0x0001 | |
40 | #define wxIMAGELIST_DRAW_TRANSPARENT 0x0002 | |
41 | #define wxIMAGELIST_DRAW_SELECTED 0x0004 | |
42 | #define wxIMAGELIST_DRAW_FOCUSED 0x0008 | |
43 | ||
e2414cbe RR |
44 | // Flag values for Set/GetImageList |
45 | enum { | |
46 | wxIMAGE_LIST_NORMAL, // Normal icons | |
47 | wxIMAGE_LIST_SMALL, // Small icons | |
48 | wxIMAGE_LIST_STATE // State icons: unimplemented (see WIN32 documentation) | |
49 | }; | |
50 | ||
3cd94a0d JS |
51 | #endif |
52 | ||
53 | class WXDLLEXPORT wxGenericImageList: public wxObject | |
c801d85f | 54 | { |
f6bcfd97 | 55 | public: |
77bf4cef | 56 | wxGenericImageList() { m_width = m_height = 0; } |
ca65c044 | 57 | wxGenericImageList( int width, int height, bool mask = true, int initialCount = 1 ); |
3cd94a0d | 58 | ~wxGenericImageList(); |
ca65c044 | 59 | bool Create( int width, int height, bool mask = true, int initialCount = 1 ); |
0423b685 | 60 | bool Create(); |
f6bcfd97 | 61 | |
3cd94a0d JS |
62 | virtual int GetImageCount() const; |
63 | virtual bool GetSize( int index, int &width, int &height ) const; | |
f6bcfd97 | 64 | |
4d449473 VS |
65 | int Add( const wxBitmap& bitmap ); |
66 | int Add( const wxBitmap& bitmap, const wxBitmap& mask ); | |
67 | int Add( const wxBitmap& bitmap, const wxColour& maskColour ); | |
49bf4e3e JS |
68 | wxBitmap GetBitmap(int index) const; |
69 | wxIcon GetIcon(int index) const; | |
0423b685 | 70 | bool Replace( int index, const wxBitmap &bitmap ); |
f644bc11 | 71 | bool Replace( int index, const wxBitmap &bitmap, const wxBitmap& mask ); |
0423b685 VZ |
72 | bool Remove( int index ); |
73 | bool RemoveAll(); | |
debe6624 | 74 | |
3cd94a0d | 75 | virtual bool Draw(int index, wxDC& dc, int x, int y, |
f6bcfd97 | 76 | int flags = wxIMAGELIST_DRAW_NORMAL, |
ca65c044 | 77 | bool solidBackground = false); |
c801d85f | 78 | |
49bf4e3e JS |
79 | // Internal use only |
80 | const wxBitmap *GetBitmapPtr(int index) const; | |
f6bcfd97 | 81 | private: |
c801d85f | 82 | wxList m_images; |
f6bcfd97 | 83 | |
219f895a RR |
84 | int m_width; |
85 | int m_height; | |
f6bcfd97 | 86 | |
3cd94a0d | 87 | DECLARE_DYNAMIC_CLASS(wxGenericImageList) |
c801d85f KB |
88 | }; |
89 | ||
3a5bcc4d | 90 | #if !defined(__WXMSW__) || defined(__WXUNIVERSAL__) |
b31989e2 JS |
91 | /* |
92 | * wxImageList has to be a real class or we have problems with | |
93 | * the run-time information. | |
94 | */ | |
95 | ||
96 | class WXDLLEXPORT wxImageList: public wxGenericImageList | |
97 | { | |
98 | DECLARE_DYNAMIC_CLASS(wxImageList) | |
99 | ||
100 | public: | |
101 | wxImageList() {} | |
102 | ||
ca65c044 | 103 | wxImageList( int width, int height, bool mask = true, int initialCount = 1 ) |
b31989e2 JS |
104 | : wxGenericImageList(width, height, mask, initialCount) |
105 | { | |
106 | } | |
107 | }; | |
3a5bcc4d | 108 | #endif // !__WXMSW__ || __WXUNIVERSAL__ |
b31989e2 | 109 | |
c801d85f KB |
110 | #endif // __IMAGELISTH_G__ |
111 |