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