]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/imaglist.h
Rewrote wxNotebook, incl. PAGE_CHANGING event
[wxWidgets.git] / include / wx / mac / imaglist.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: imaglist.h
3 // Purpose: wxImageList class. Note: if your GUI doesn't have
4 // an image list equivalent, you can use the generic class
5 // in src/generic.
6 // Author: AUTHOR
7 // Modified by:
8 // Created: ??/??/98
9 // RCS-ID: $Id$
10 // Copyright: (c) AUTHOR
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
13
14 #ifndef _WX_IMAGLIST_H_
15 #define _WX_IMAGLIST_H_
16
17 #ifdef __GNUG__
18 #pragma interface "imaglist.h"
19 #endif
20
21 #include "wx/bitmap.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 */
31
32 // Flags for Draw
33 #define wxIMAGELIST_DRAW_NORMAL 0x0001
34 #define wxIMAGELIST_DRAW_TRANSPARENT 0x0002
35 #define wxIMAGELIST_DRAW_SELECTED 0x0004
36 #define wxIMAGELIST_DRAW_FOCUSED 0x0008
37
38 // Flag values for Set/GetImageList
39 enum {
40 wxIMAGE_LIST_NORMAL, // Normal icons
41 wxIMAGE_LIST_SMALL, // Small icons
42 wxIMAGE_LIST_STATE // State icons: unimplemented (see WIN32 documentation)
43 };
44
45 // Eventually we'll make this a reference-counted wxGDIObject. For
46 // now, the app must take care of ownership issues. That is, the
47 // image lists must be explicitly deleted after the control(s) that uses them
48 // is (are) deleted, or when the app exits.
49 class WXDLLEXPORT wxImageList: public wxObject
50 {
51 DECLARE_DYNAMIC_CLASS(wxImageList)
52 public:
53 /*
54 * Public interface
55 */
56
57 wxImageList();
58
59 // Creates an image list.
60 // Specify the width and height of the images in the list,
61 // whether there are masks associated with them (e.g. if creating images
62 // from icons), and the initial size of the list.
63 inline wxImageList(int width, int height, bool mask = TRUE, int initialCount = 1)
64 {
65 Create(width, height, mask, initialCount);
66 }
67 ~wxImageList();
68
69
70 // Attributes
71 ////////////////////////////////////////////////////////////////////////////
72
73 // Returns the number of images in the image list.
74 int GetImageCount() const;
75
76 // Operations
77 ////////////////////////////////////////////////////////////////////////////
78
79 // Creates an image list
80 // width, height specify the size of the images in the list (all the same).
81 // mask specifies whether the images have masks or not.
82 // initialNumber is the initial number of images to reserve.
83 bool Create(int width, int height, bool mask = TRUE, int initialNumber = 1);
84
85 // Adds a bitmap, and optionally a mask bitmap.
86 // Note that wxImageList creates *new* bitmaps, so you may delete
87 // 'bitmap' and 'mask' after calling Add.
88 int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
89
90 // Adds a bitmap, using the specified colour to create the mask bitmap
91 // Note that wxImageList creates *new* bitmaps, so you may delete
92 // 'bitmap' after calling Add.
93 int Add(const wxBitmap& bitmap, const wxColour& maskColour);
94
95 // Adds a bitmap and mask from an icon.
96 int Add(const wxIcon& icon);
97
98 // Replaces a bitmap, optionally passing a mask bitmap.
99 // Note that wxImageList creates new bitmaps, so you may delete
100 // 'bitmap' and 'mask' after calling Replace.
101 bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
102
103 /* Not supported by Win95
104 // Replacing a bitmap, using the specified colour to create the mask bitmap
105 // Note that wxImageList creates new bitmaps, so you may delete
106 // 'bitmap'.
107 bool Replace(int index, const wxBitmap& bitmap, const wxColour& maskColour);
108 */
109
110 // Replaces a bitmap and mask from an icon.
111 // You can delete 'icon' after calling Replace.
112 bool Replace(int index, const wxIcon& icon);
113
114 // Removes the image at the given index.
115 bool Remove(int index);
116
117 // Remove all images
118 bool RemoveAll();
119
120 // Draws the given image on a dc at the specified position.
121 // If 'solidBackground' is TRUE, Draw sets the image list background
122 // colour to the background colour of the wxDC, to speed up
123 // drawing by eliminating masked drawing where possible.
124 bool Draw(int index, wxDC& dc, int x, int y,
125 int flags = wxIMAGELIST_DRAW_NORMAL, bool solidBackground = FALSE);
126
127 /* TODO (optional?)
128 wxIcon *MakeIcon(int index);
129 */
130
131 /* TODO
132 // Implementation
133 ////////////////////////////////////////////////////////////////////////////
134
135 // Returns the native image list handle
136 inline WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; }
137
138 protected:
139 WXHIMAGELIST m_hImageList;
140 */
141
142 };
143
144 #endif
145 // _WX_IMAGLIST_H_