]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/imaglist.tex
More typos.
[wxWidgets.git] / docs / latex / wx / imaglist.tex
CommitLineData
a660d684
KB
1\section{\class{wxImageList}}\label{wximagelist}
2
3A wxImageList contains a list of images, which are stored in
4an unspecified form. Images can have masks for transparent
5drawing, and can be made from a variety of sources including bitmaps
6and icons.
7
8wxImageList is used principally in conjunction with \helpref{wxTreeCtrl}{wxtreectrl} and
9\rtfsp\helpref{wxListCtrl}{wxlistctrl} classes.
10
11\wxheading{Derived from}
12
13\helpref{wxObject}{wxobject}
14
954b8ae6
JS
15\wxheading{Include files}
16
17<wx/imaglist.h>
18
a660d684
KB
19\wxheading{See also}
20
21\helpref{wxTreeCtrl}{wxtreectrl}, \helpref{wxListCtrl}{wxlistctrl}
22
23\latexignore{\rtfignore{\wxheading{Members}}}
24
25\membersection{wxImageList::wxImageList}\label{wximagelistconstr}
26
27\func{}{wxImageList}{\void}
28
29Default constructor.
30
cc81d32f 31\func{}{wxImageList}{\param{int }{width}, \param{int }{height}, \param{const bool }{mask = true},\rtfsp
eaaa6a06 32\param{int }{initialCount = 1}}
a660d684
KB
33
34Constructor specifying the image size, whether image masks should be created, and the initial size of the list.
35
36\wxheading{Parameters}
37
38\docparam{width}{Width of the images in the list.}
39
40\docparam{height}{Height of the images in the list.}
41
cc81d32f 42\docparam{mask}{true if masks should be created for all images.}
a660d684
KB
43
44\docparam{initialCount}{The initial size of the list.}
45
46\wxheading{See also}
47
48\helpref{wxImageList::Create}{wximagelistcreate}
49
50\membersection{wxImageList::Add}\label{wximagelistadd}
51
52\func{int}{Add}{\param{const wxBitmap\&}{ bitmap}, \param{const wxBitmap\&}{ mask = wxNullBitmap}}
53
54Adds a new image using a bitmap and optional mask bitmap.
55
56\func{int}{Add}{\param{const wxBitmap\&}{ bitmap}, \param{const wxColour\&}{ maskColour}}
57
58Adds a new image using a bitmap and mask colour.
59
884360bc 60\func{int}{Add}{\param{const wxIcon\&}{ icon}}
a660d684
KB
61
62Adds a new image using an icon.
63
64\wxheading{Parameters}
65
66\docparam{bitmap}{Bitmap representing the opaque areas of the image.}
67
68\docparam{mask}{Monochrome mask bitmap, representing the transparent areas of the image.}
69
70\docparam{maskColour}{Colour indicating which parts of the image are transparent.}
71
72\docparam{icon}{Icon to use as the image.}
73
74\wxheading{Return value}
75
76The new zero-based image index.
77
78\wxheading{Remarks}
79
80The original bitmap or icon is not affected by the {\bf Add} operation, and can be deleted afterwards.
81
06d20283
RD
82\pythonnote{In place of a single overloaded method name, wxPython
83implements the following methods:\par
84\indented{2cm}{\begin{twocollist}
c9110876
VS
85\twocolitem{{\bf Add(bitmap, mask=wxNullBitmap)}}{}
86\twocolitem{{\bf AddWithColourMask(bitmap, colour)}}{}
87\twocolitem{{\bf AddIcon(icon)}}{}
06d20283
RD
88\end{twocollist}}
89}
a660d684
KB
90\membersection{wxImageList::Create}\label{wximagelistcreate}
91
cc81d32f 92\func{bool}{Create}{\param{int }{width}, \param{int }{height}, \param{const bool }{mask = true},\rtfsp
eaaa6a06 93\param{int }{initialCount = 1}}
a660d684
KB
94
95Initializes the list. See \helpref{wxImageList::wxImageList}{wximagelistconstr} for details.
96
97\membersection{wxImageList::Draw}\label{wximagelistdraw}
98
eaaa6a06 99\func{bool}{Draw}{\param{int}{ index}, \param{wxDC\&}{ dc}, \param{int }{x},\rtfsp
43e8916f 100\param{int }{y}, \param{int }{flags = wxIMAGELIST\_DRAW\_NORMAL},\rtfsp
cc81d32f 101\param{const bool }{solidBackground = false}}
a660d684
KB
102
103Draws a specified image onto a device context.
104
105\wxheading{Parameters}
106
107\docparam{index}{Image index, starting from zero.}
108
109\docparam{dc}{Device context to draw on.}
110
111\docparam{x}{X position on the device context.}
112
113\docparam{y}{Y position on the device context.}
114
115\docparam{flags}{How to draw the image. A bitlist of a selection of the following:
116
117\begin{twocollist}\itemsep=0pt
118\twocolitem{{\bf wxIMAGELIST\_DRAW\_NORMAL}}{Draw the image normally.}
119\twocolitem{{\bf wxIMAGELIST\_DRAW\_TRANSPARENT}}{Draw the image with transparency.}
120\twocolitem{{\bf wxIMAGELIST\_DRAW\_SELECTED}}{Draw the image in selected state.}
2edb0bde 121\twocolitem{{\bf wxIMAGELIST\_DRAW\_FOCUSED}}{Draw the image in a focused state.}
a660d684
KB
122\end{twocollist}
123}
124
125\docparam{solidBackground}{For optimisation - drawing can be faster if the function is told
126that the background is solid.}
127
2a138829
JS
128\membersection{wxImageList::GetBitmap}\label{wximagelistgetbitmap}
129
130\constfunc{wxBitmap}{GetBitmap}{\param{int }{index}}
131
132Returns the bitmap corresponding to the given index.
133
134\membersection{wxImageList::GetIcon}\label{wximagelistgeticon}
135
136\constfunc{wxIcon}{GetIcon}{\param{int }{index}}
137
138Returns the icon corresponding to the given index.
139
a660d684
KB
140\membersection{wxImageList::GetImageCount}\label{wximagelistgetimagecount}
141
142\constfunc{int}{GetImageCount}{\void}
143
144Returns the number of images in the list.
145
f6bcfd97
BP
146\membersection{wxImageList::GetSize}\label{wximagelistgetsize}
147
148\constfunc{bool}{GetSize}{\param{int }{index}, \param{int\& }{width}, \param{int \&}{height}}
149
150Retrieves the size of the images in the list. Currently, the {\it index}
151parameter is ignored as all images in the list have the same size.
152
153\wxheading{Parameters}
154
155\docparam{index}{currently unused, should be 0}
156
157\docparam{width}{receives the width of the images in the list}
158
159\docparam{height}{receives the height of the images in the list}
160
161\wxheading{Return value}
162
cc81d32f 163true if the function succeeded, false if it failed (for example, if the image
f6bcfd97
BP
164list was not yet initialized).
165
a660d684
KB
166\membersection{wxImageList::Remove}\label{wximagelistremove}
167
eaaa6a06 168\func{bool}{Remove}{\param{int}{ index}}
a660d684
KB
169
170Removes the image at the given position.
171
172\membersection{wxImageList::RemoveAll}\label{wximagelistremoveall}
173
174\func{bool}{RemoveAll}{\void}
175
176Removes all the images in the list.
177
178\membersection{wxImageList::Replace}\label{wximagelistreplace}
179
eaaa6a06 180\func{bool}{Replace}{\param{int}{ index}, \param{const wxBitmap\&}{ bitmap}, \param{const wxBitmap\&}{ mask = wxNullBitmap}}
a660d684
KB
181
182Replaces the existing image with the new image.
183
f6e9a818
RN
184Windows only.
185
eaaa6a06 186\func{bool}{Replace}{\param{int}{ index}, \param{const wxIcon\&}{ icon}}
a660d684
KB
187
188Replaces the existing image with the new image.
189
190\wxheading{Parameters}
191
192\docparam{bitmap}{Bitmap representing the opaque areas of the image.}
193
194\docparam{mask}{Monochrome mask bitmap, representing the transparent areas of the image.}
195
196\docparam{icon}{Icon to use as the image.}
197
198\wxheading{Return value}
199
cc81d32f 200true if the replacement was successful, false otherwise.
a660d684
KB
201
202\wxheading{Remarks}
203
204The original bitmap or icon is not affected by the {\bf Replace} operation, and can be deleted afterwards.
205
c9110876 206\pythonnote{The second form is called {\tt ReplaceIcon} in wxPython.}
06d20283 207
a660d684 208