]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/mac/imaglist.h
added conversion routines to CIconHandle, removing pre 8.6 routines
[wxWidgets.git] / include / wx / mac / imaglist.h
... / ...
CommitLineData
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
39enum {
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.
49class 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 bool GetSize(int index, int&width, int &height) const;
77
78 // Operations
79 ////////////////////////////////////////////////////////////////////////////
80
81 // Creates an image list
82 // width, height specify the size of the images in the list (all the same).
83 // mask specifies whether the images have masks or not.
84 // initialNumber is the initial number of images to reserve.
85 bool Create(int width, int height, bool mask = TRUE, int initialNumber = 1);
86
87 // Adds a bitmap, and optionally a mask bitmap.
88 // Note that wxImageList creates *new* bitmaps, so you may delete
89 // 'bitmap' and 'mask' after calling Add.
90 int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
91
92 // Adds a bitmap, using the specified colour to create the mask bitmap
93 // Note that wxImageList creates *new* bitmaps, so you may delete
94 // 'bitmap' after calling Add.
95 int Add(const wxBitmap& bitmap, const wxColour& maskColour);
96
97 // Adds a bitmap and mask from an icon.
98 int Add(const wxIcon& icon);
99
100 // Replaces a bitmap, optionally passing a mask bitmap.
101 // Note that wxImageList creates new bitmaps, so you may delete
102 // 'bitmap' and 'mask' after calling Replace.
103 bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
104
105/* Not supported by Win95
106 // Replacing a bitmap, using the specified colour to create the mask bitmap
107 // Note that wxImageList creates new bitmaps, so you may delete
108 // 'bitmap'.
109 bool Replace(int index, const wxBitmap& bitmap, const wxColour& maskColour);
110*/
111
112 // Replaces a bitmap and mask from an icon.
113 // You can delete 'icon' after calling Replace.
114 bool Replace(int index, const wxIcon& icon);
115
116 // Removes the image at the given index.
117 bool Remove(int index);
118
119 // Remove all images
120 bool RemoveAll();
121
122 // Draws the given image on a dc at the specified position.
123 // If 'solidBackground' is TRUE, Draw sets the image list background
124 // colour to the background colour of the wxDC, to speed up
125 // drawing by eliminating masked drawing where possible.
126 bool Draw(int index, wxDC& dc, int x, int y,
127 int flags = wxIMAGELIST_DRAW_NORMAL, bool solidBackground = FALSE);
128
129/* TODO (optional?)
130 wxIcon *MakeIcon(int index);
131*/
132
133/* TODO
134 // Implementation
135 ////////////////////////////////////////////////////////////////////////////
136
137 // Returns the native image list handle
138 inline WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; }
139
140protected:
141 WXHIMAGELIST m_hImageList;
142*/
143
144};
145
146#endif
147 // _WX_IMAGLIST_H_