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