]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/imaglist.h
[1231183] 'cleanup: mismatched indentation' and other cleanings.
[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 19#include "wx/list.h"
f45fac95 20#include "wx/icon.h"
00dd3b18
MB
21
22class WXDLLEXPORT wxDC;
23class WXDLLEXPORT wxBitmap;
24class WXDLLEXPORT wxColour;
c801d85f
KB
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
3cd94a0d
JS
40#if !defined(wxIMAGELIST_DRAW_NORMAL)
41
c801d85f
KB
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
e2414cbe
RR
48// Flag values for Set/GetImageList
49enum {
50 wxIMAGE_LIST_NORMAL, // Normal icons
51 wxIMAGE_LIST_SMALL, // Small icons
52 wxIMAGE_LIST_STATE // State icons: unimplemented (see WIN32 documentation)
53};
54
3cd94a0d
JS
55#endif
56
57class WXDLLEXPORT wxGenericImageList: public wxObject
c801d85f 58{
f6bcfd97 59public:
77bf4cef 60 wxGenericImageList() { m_width = m_height = 0; }
ca65c044 61 wxGenericImageList( int width, int height, bool mask = true, int initialCount = 1 );
3cd94a0d 62 ~wxGenericImageList();
ca65c044 63 bool Create( int width, int height, bool mask = true, int initialCount = 1 );
0423b685 64 bool Create();
f6bcfd97 65
3cd94a0d
JS
66 virtual int GetImageCount() const;
67 virtual bool GetSize( int index, int &width, int &height ) const;
f6bcfd97 68
4d449473
VS
69 int Add( const wxBitmap& bitmap );
70 int Add( const wxBitmap& bitmap, const wxBitmap& mask );
71 int Add( const wxBitmap& bitmap, const wxColour& maskColour );
49bf4e3e
JS
72 wxBitmap GetBitmap(int index) const;
73 wxIcon GetIcon(int index) const;
0423b685
VZ
74 bool Replace( int index, const wxBitmap &bitmap );
75 bool Remove( int index );
76 bool RemoveAll();
debe6624 77
3cd94a0d 78 virtual bool Draw(int index, wxDC& dc, int x, int y,
f6bcfd97 79 int flags = wxIMAGELIST_DRAW_NORMAL,
ca65c044 80 bool solidBackground = false);
c801d85f 81
49bf4e3e
JS
82 // Internal use only
83 const wxBitmap *GetBitmapPtr(int index) const;
f6bcfd97 84private:
c801d85f 85 wxList m_images;
f6bcfd97 86
219f895a
RR
87 int m_width;
88 int m_height;
f6bcfd97 89
3cd94a0d 90 DECLARE_DYNAMIC_CLASS(wxGenericImageList)
c801d85f
KB
91};
92
3a5bcc4d 93#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__)
b31989e2
JS
94/*
95 * wxImageList has to be a real class or we have problems with
96 * the run-time information.
97 */
98
99class WXDLLEXPORT wxImageList: public wxGenericImageList
100{
101 DECLARE_DYNAMIC_CLASS(wxImageList)
102
103public:
104 wxImageList() {}
105
ca65c044 106 wxImageList( int width, int height, bool mask = true, int initialCount = 1 )
b31989e2
JS
107 : wxGenericImageList(width, height, mask, initialCount)
108 {
109 }
110};
3a5bcc4d 111#endif // !__WXMSW__ || __WXUNIVERSAL__
b31989e2 112
c801d85f
KB
113#endif // __IMAGELISTH_G__
114