File: wx117.htm

package info (click to toggle)
wxwin2-doc 2.01-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,540 kB
  • ctags: 5,968
  • sloc: cpp: 15,157; makefile: 434; sh: 6
file content (253 lines) | stat: -rw-r--r-- 7,567 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<HTML>
<head><title>wxImageList</title></head>

<BODY BGCOLOR=#FFFFFF>
<A NAME="wximagelist"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx116.htm#wximagehandler"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx118.htm#wxindividuallayoutconstraint"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>

<H2>wxImageList</H2>
<P>
A wxImageList contains a list of images, which are stored in
an unspecified form. Images can have masks for transparent
drawing, and can be made from a variety of sources including bitmaps
and icons.<P>
wxImageList is used principally in conjunction with <A HREF="wx250.htm#wxtreectrl">wxTreeCtrl</A> and
<A HREF="wx129.htm#wxlistctrl">wxListCtrl</A> classes.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
&lt;wx/imaglist.h&gt;<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx250.htm#wxtreectrl">wxTreeCtrl</A>, <A HREF="wx129.htm#wxlistctrl">wxListCtrl</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#wximagelistconstr">wxImageList::wxImageList</A><BR>
<A HREF="#wximagelistadd">wxImageList::Add</A><BR>
<A HREF="#wximagelistcreate">wxImageList::Create</A><BR>
<A HREF="#wximagelistdraw">wxImageList::Draw</A><BR>
<A HREF="#wximagelistgetimagecount">wxImageList::GetImageCount</A><BR>
<A HREF="#wximagelistremove">wxImageList::Remove</A><BR>
<A HREF="#wximagelistremoveall">wxImageList::RemoveAll</A><BR>
<A HREF="#wximagelistreplace">wxImageList::Replace</A><BR>
<P>

<HR>
<A NAME="wximagelistconstr"></A>
<H3>wxImageList::wxImageList</H3>
<P>
<B></B> <B>wxImageList</B>()<P>
Default constructor.<P>
<B></B> <B>wxImageList</B>(<B>int </B><I>width</I>, <B>int </B><I>height</I>, <B>const bool </B><I>mask = TRUE</I>,
<B>int </B><I>initialCount = 1</I>)<P>
Constructor specifying the image size, whether image masks should be created, and the initial size of the list.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>width</I><UL><UL>
Width of the images in the list.</UL></UL>
<P>
<I>height</I><UL><UL>
Height of the images in the list.</UL></UL>
<P>
<I>mask</I><UL><UL>
TRUE if masks should be created for all images.</UL></UL>
<P>
<I>initialCount</I><UL><UL>
The initial size of the list.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx117.htm#wximagelistcreate">wxImageList::Create</A><P>

<HR>
<A NAME="wximagelistadd"></A>
<H3>wxImageList::Add</H3>
<P>
<B>int</B> <B>Add</B>(<B>const wxBitmap&amp;</B><I> bitmap</I>, <B>const wxBitmap&amp;</B><I> mask = wxNullBitmap</I>)<P>
Adds a new image using a bitmap and optional mask bitmap.<P>
<B>int</B> <B>Add</B>(<B>const wxBitmap&amp;</B><I> bitmap</I>, <B>const wxColour&amp;</B><I> maskColour</I>)<P>
Adds a new image using a bitmap and mask colour.<P>
<B>int</B> <B>Add</B>(<B>const wxIcon&amp;</B><I> icon</I>)<P>
Adds a new image using an icon.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>bitmap</I><UL><UL>
Bitmap representing the opaque areas of the image.</UL></UL>
<P>
<I>mask</I><UL><UL>
Monochrome mask bitmap, representing the transparent areas of the image.</UL></UL>
<P>
<I>maskColour</I><UL><UL>
Colour indicating which parts of the image are transparent.</UL></UL>
<P>
<I>icon</I><UL><UL>
Icon to use as the image.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
The new zero-based image index.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
The original bitmap or icon is not affected by the <B>Add</B> operation, and can be deleted afterwards.<P>
<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
 In place of a single overloaded method name, wxPython
implements the following methods:<P>

<UL><UL>

<TABLE>


<TR><TD VALIGN=TOP>
<B>Add(bitmap, mask=wxNullBitmap)</B>
</TD>

<TD VALIGN=TOP>

</TD></TR>


<TR><TD VALIGN=TOP>
<B>AddWithColourMask(bitmap, colour)</B>
</TD>

<TD VALIGN=TOP>

</TD></TR>


<TR><TD VALIGN=TOP>
<B>AddIcon(icon)</B>
</TD>

<TD VALIGN=TOP>

</TD></TR>


</TABLE>
</UL></UL>



<HR>
<A NAME="wximagelistcreate"></A>
<H3>wxImageList::Create</H3>
<P>
<B>bool</B> <B>Create</B>(<B>int </B><I>width</I>, <B>int </B><I>height</I>, <B>const bool </B><I>mask = TRUE</I>,
<B>int </B><I>initialCount = 1</I>)<P>
Initializes the list. See <A HREF="wx117.htm#wximagelistconstr">wxImageList::wxImageList</A> for details.<P>

<HR>
<A NAME="wximagelistdraw"></A>
<H3>wxImageList::Draw</H3>
<P>
<B>bool</B> <B>Draw</B>(<B>int</B><I> index</I>, <B>wxDC&amp;</B><I> dc</I>, <B>int </B><I>x</I>,
<B>int </B><I>x</I>, <B>int </B><I>flags = wxIMAGELIST_DRAW_NORMAL</I>,
<B>const bool </B><I>solidBackground = FALSE</I>)<P>
Draws a specified image onto a device context.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>index</I><UL><UL>
Image index, starting from zero.</UL></UL>
<P>
<I>dc</I><UL><UL>
Device context to draw on.</UL></UL>
<P>
<I>x</I><UL><UL>
X position on the device context.</UL></UL>
<P>
<I>y</I><UL><UL>
Y position on the device context.</UL></UL>
<P>
<I>flags</I><UL><UL>
How to draw the image. A bitlist of a selection of the following:<P>

<TABLE>


<TR><TD VALIGN=TOP>
<B>wxIMAGELIST_DRAW_NORMAL</B>
</TD>

<TD VALIGN=TOP>
Draw the image normally.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>wxIMAGELIST_DRAW_TRANSPARENT</B>
</TD>

<TD VALIGN=TOP>
Draw the image with transparency.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>wxIMAGELIST_DRAW_SELECTED</B>
</TD>

<TD VALIGN=TOP>
Draw the image in selected state.
</TD></TR>


<TR><TD VALIGN=TOP>
<B>wxIMAGELIST_DRAW_FOCUSED</B>
</TD>

<TD VALIGN=TOP>
Draw the image in a focussed state.
</TD></TR>


</TABLE>

</UL></UL>
<P>
<I>solidBackground</I><UL><UL>
For optimisation - drawing can be faster if the function is told
that the background is solid.</UL></UL>
<P>

<HR>
<A NAME="wximagelistgetimagecount"></A>
<H3>wxImageList::GetImageCount</H3>
<P>
<B>int</B> <B>GetImageCount</B>() <B>const</B><P>
Returns the number of images in the list.<P>

<HR>
<A NAME="wximagelistremove"></A>
<H3>wxImageList::Remove</H3>
<P>
<B>bool</B> <B>Remove</B>(<B>int</B><I> index</I>)<P>
Removes the image at the given position.<P>

<HR>
<A NAME="wximagelistremoveall"></A>
<H3>wxImageList::RemoveAll</H3>
<P>
<B>bool</B> <B>RemoveAll</B>()<P>
Removes all the images in the list.<P>

<HR>
<A NAME="wximagelistreplace"></A>
<H3>wxImageList::Replace</H3>
<P>
<B>bool</B> <B>Replace</B>(<B>int</B><I> index</I>, <B>const wxBitmap&amp;</B><I> bitmap</I>, <B>const wxBitmap&amp;</B><I> mask = wxNullBitmap</I>)<P>
Replaces the existing image with the new image.<P>
<B>bool</B> <B>Replace</B>(<B>int</B><I> index</I>, <B>const wxIcon&amp;</B><I> icon</I>)<P>
Replaces the existing image with the new image.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>bitmap</I><UL><UL>
Bitmap representing the opaque areas of the image.</UL></UL>
<P>
<I>mask</I><UL><UL>
Monochrome mask bitmap, representing the transparent areas of the image.</UL></UL>
<P>
<I>icon</I><UL><UL>
Icon to use as the image.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
TRUE if the replacement was successful, FALSE otherwise.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
The original bitmap or icon is not affected by the <B>Replace</B> operation, and can be deleted afterwards.<P>
<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
 The second form is called <TT>ReplaceIcon</TT> in wxPython.<P>


</BODY></HTML>