]>
Commit | Line | Data |
---|---|---|
8cf73271 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: imaglist.h | |
32c19f25 SC |
3 | // Purpose: |
4 | // Author: Robert Roebling, Stefan Csomor | |
5 | // Created: 01/02/97 | |
6 | // Id: | |
7 | // Copyright: (c) 1998 Robert Roebling and Julian Smart | |
65571936 | 8 | // Licence: wxWindows licence |
8cf73271 SC |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef _WX_IMAGLIST_H_ | |
12 | #define _WX_IMAGLIST_H_ | |
13 | ||
32c19f25 SC |
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; | |
8cf73271 SC |
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 | * | |
32c19f25 SC |
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. | |
8cf73271 SC |
34 | */ |
35 | ||
32c19f25 SC |
36 | #if !defined(wxIMAGELIST_DRAW_NORMAL) |
37 | ||
8cf73271 SC |
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 | ||
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 | ||
32c19f25 SC |
51 | #endif |
52 | ||
8cf73271 SC |
53 | class WXDLLEXPORT wxImageList: public wxObject |
54 | { | |
32c19f25 SC |
55 | public: |
56 | wxImageList() { m_width = m_height = 0; } | |
57 | wxImageList( int width, int height, bool mask = true, int initialCount = 1 ); | |
58 | ~wxImageList(); | |
59 | bool Create( int width, int height, bool mask = true, int initialCount = 1 ); | |
60 | bool Create(); | |
61 | ||
62 | virtual int GetImageCount() const; | |
63 | virtual bool GetSize( int index, int &width, int &height ) const; | |
64 | ||
65 | int Add( const wxIcon& bitmap ); | |
66 | int Add( const wxBitmap& bitmap ); | |
67 | int Add( const wxBitmap& bitmap, const wxBitmap& mask ); | |
68 | int Add( const wxBitmap& bitmap, const wxColour& maskColour ); | |
69 | wxBitmap GetBitmap(int index) const; | |
70 | wxIcon GetIcon(int index) const; | |
71 | bool Replace( int index, const wxIcon &bitmap ); | |
72 | bool Replace( int index, const wxBitmap &bitmap ); | |
5b9003ae | 73 | bool Replace( int index, const wxBitmap &bitmap, const wxBitmap &mask ); |
32c19f25 SC |
74 | bool Remove( int index ); |
75 | bool RemoveAll(); | |
76 | ||
77 | virtual bool Draw(int index, wxDC& dc, int x, int y, | |
78 | int flags = wxIMAGELIST_DRAW_NORMAL, | |
79 | bool solidBackground = false); | |
80 | ||
81 | private: | |
82 | wxList m_images; | |
83 | ||
84 | int m_width; | |
85 | int m_height; | |
86 | ||
87 | DECLARE_DYNAMIC_CLASS(wxImageList) | |
8cf73271 SC |
88 | }; |
89 | ||
32c19f25 SC |
90 | #endif // _WX_IMAGLIST_H_ |
91 |