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