1 \section{\class{wxImageList
}}\label{wximagelist
}
3 A wxImageList contains a list of images, which are stored in
4 an unspecified form. Images can have masks for transparent
5 drawing, and can be made from a variety of sources including bitmaps
8 wxImageList is used principally in conjunction with
\helpref{wxTreeCtrl
}{wxtreectrl
} and
9 \rtfsp\helpref{wxListCtrl
}{wxlistctrl
} classes.
11 \wxheading{Derived from
}
13 \helpref{wxObject
}{wxobject
}
15 \wxheading{Include files
}
21 \helpref{wxCore
}{librarieslist
}
25 \helpref{wxTreeCtrl
}{wxtreectrl
},
\helpref{wxListCtrl
}{wxlistctrl
}
27 \latexignore{\rtfignore{\wxheading{Members
}}}
29 \membersection{wxImageList::wxImageList
}\label{wximagelistconstr
}
31 \func{}{wxImageList
}{\void}
35 \func{}{wxImageList
}{\param{int
}{width
},
\param{int
}{height
},
\param{bool
}{mask = true
},
\rtfsp
36 \param{int
}{initialCount =
1}}
38 Constructor specifying the image size, whether image masks should be created, and the initial size of the list.
40 \wxheading{Parameters
}
42 \docparam{width
}{Width of the images in the list.
}
44 \docparam{height
}{Height of the images in the list.
}
46 \docparam{mask
}{true if masks should be created for all images.
}
48 \docparam{initialCount
}{The initial size of the list.
}
52 \helpref{wxImageList::Create
}{wximagelistcreate
}
54 \membersection{wxImageList::Add
}\label{wximagelistadd
}
56 \func{int
}{Add
}{\param{const wxBitmap\&
}{ bitmap
},
\param{const wxBitmap\&
}{ mask = wxNullBitmap
}}
58 Adds a new image or images using a bitmap and optional mask bitmap.
60 \func{int
}{Add
}{\param{const wxBitmap\&
}{ bitmap
},
\param{const wxColour\&
}{ maskColour
}}
62 Adds a new image or images using a bitmap and mask colour.
64 \func{int
}{Add
}{\param{const wxIcon\&
}{ icon
}}
66 Adds a new image using an icon.
68 \wxheading{Parameters
}
70 \docparam{bitmap
}{Bitmap representing the opaque areas of the image.
}
72 \docparam{mask
}{Monochrome mask bitmap, representing the transparent areas of the image.
}
74 \docparam{maskColour
}{Colour indicating which parts of the image are transparent.
}
76 \docparam{icon
}{Icon to use as the image.
}
78 \wxheading{Return value
}
80 The new zero-based image index.
84 The original bitmap or icon is not affected by the
{\bf Add
} operation, and can be deleted afterwards.
86 If the bitmap is wider than the images in the list, then the bitmap will automatically be split into smaller images, each matching the dimensions of the image list. This does not apply when adding icons.
88 \pythonnote{In place of a single overloaded method name, wxPython
89 implements the following methods:
\par
90 \indented{2cm
}{\begin{twocollist
}
91 \twocolitem{{\bf Add(bitmap, mask=wxNullBitmap)
}}{}
92 \twocolitem{{\bf AddWithColourMask(bitmap, colour)
}}{}
93 \twocolitem{{\bf AddIcon(icon)
}}{}
96 \membersection{wxImageList::Create
}\label{wximagelistcreate
}
98 \func{bool
}{Create
}{\param{int
}{width
},
\param{int
}{height
},
\param{bool
}{mask = true
},
\rtfsp
99 \param{int
}{initialCount =
1}}
101 Initializes the list. See
\helpref{wxImageList::wxImageList
}{wximagelistconstr
} for details.
103 \membersection{wxImageList::Draw
}\label{wximagelistdraw
}
105 \func{bool
}{Draw
}{\param{int
}{ index
},
\param{wxDC\&
}{ dc
},
\param{int
}{x
},
\rtfsp
106 \param{int
}{y
},
\param{int
}{flags = wxIMAGELIST
\_DRAW\_NORMAL},
\rtfsp
107 \param{bool
}{solidBackground = false
}}
109 Draws a specified image onto a device context.
111 \wxheading{Parameters
}
113 \docparam{index
}{Image index, starting from zero.
}
115 \docparam{dc
}{Device context to draw on.
}
117 \docparam{x
}{X position on the device context.
}
119 \docparam{y
}{Y position on the device context.
}
121 \docparam{flags
}{How to draw the image. A bitlist of a selection of the following:
123 \begin{twocollist
}\itemsep=
0pt
124 \twocolitem{{\bf wxIMAGELIST
\_DRAW\_NORMAL}}{Draw the image normally.
}
125 \twocolitem{{\bf wxIMAGELIST
\_DRAW\_TRANSPARENT}}{Draw the image with transparency.
}
126 \twocolitem{{\bf wxIMAGELIST
\_DRAW\_SELECTED}}{Draw the image in selected state.
}
127 \twocolitem{{\bf wxIMAGELIST
\_DRAW\_FOCUSED}}{Draw the image in a focused state.
}
131 \docparam{solidBackground
}{For optimisation - drawing can be faster if the function is told
132 that the background is solid.
}
134 \membersection{wxImageList::GetBitmap
}\label{wximagelistgetbitmap
}
136 \constfunc{wxBitmap
}{GetBitmap
}{\param{int
}{index
}}
138 Returns the bitmap corresponding to the given index.
140 \membersection{wxImageList::GetIcon
}\label{wximagelistgeticon
}
142 \constfunc{wxIcon
}{GetIcon
}{\param{int
}{index
}}
144 Returns the icon corresponding to the given index.
146 \membersection{wxImageList::GetImageCount
}\label{wximagelistgetimagecount
}
148 \constfunc{int
}{GetImageCount
}{\void}
150 Returns the number of images in the list.
152 \membersection{wxImageList::GetSize
}\label{wximagelistgetsize
}
154 \constfunc{bool
}{GetSize
}{\param{int
}{index
},
\param{int\&
}{width
},
\param{int \&
}{height
}}
156 Retrieves the size of the images in the list. Currently, the
{\it index
}
157 parameter is ignored as all images in the list have the same size.
159 \wxheading{Parameters
}
161 \docparam{index
}{currently unused, should be
0}
163 \docparam{width
}{receives the width of the images in the list
}
165 \docparam{height
}{receives the height of the images in the list
}
167 \wxheading{Return value
}
169 true if the function succeeded, false if it failed (for example, if the image
170 list was not yet initialized).
172 \membersection{wxImageList::Remove
}\label{wximagelistremove
}
174 \func{bool
}{Remove
}{\param{int
}{ index
}}
176 Removes the image at the given position.
178 \membersection{wxImageList::RemoveAll
}\label{wximagelistremoveall
}
180 \func{bool
}{RemoveAll
}{\void}
182 Removes all the images in the list.
184 \membersection{wxImageList::Replace
}\label{wximagelistreplace
}
186 \func{bool
}{Replace
}{\param{int
}{ index
},
\param{const wxBitmap\&
}{ bitmap
},
\param{const wxBitmap\&
}{ mask = wxNullBitmap
}}
188 Replaces the existing image with the new image.
192 \func{bool
}{Replace
}{\param{int
}{ index
},
\param{const wxIcon\&
}{ icon
}}
194 Replaces the existing image with the new image.
196 \wxheading{Parameters
}
198 \docparam{bitmap
}{Bitmap representing the opaque areas of the image.
}
200 \docparam{mask
}{Monochrome mask bitmap, representing the transparent areas of the image.
}
202 \docparam{icon
}{Icon to use as the image.
}
204 \wxheading{Return value
}
206 true if the replacement was successful, false otherwise.
210 The original bitmap or icon is not affected by the
{\bf Replace
} operation, and can be deleted afterwards.
212 \pythonnote{The second form is called
{\tt ReplaceIcon
} in wxPython.
}