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{wxTreeCtrl
}{wxtreectrl
},
\helpref{wxListCtrl
}{wxlistctrl
}
23 \latexignore{\rtfignore{\wxheading{Members
}}}
25 \membersection{wxImageList::wxImageList
}\label{wximagelistconstr
}
27 \func{}{wxImageList
}{\void}
31 \func{}{wxImageList
}{\param{int
}{width
},
\param{int
}{height
},
\param{bool
}{mask = true
},
\rtfsp
32 \param{int
}{initialCount =
1}}
34 Constructor specifying the image size, whether image masks should be created, and the initial size of the list.
36 \wxheading{Parameters
}
38 \docparam{width
}{Width of the images in the list.
}
40 \docparam{height
}{Height of the images in the list.
}
42 \docparam{mask
}{true if masks should be created for all images.
}
44 \docparam{initialCount
}{The initial size of the list.
}
48 \helpref{wxImageList::Create
}{wximagelistcreate
}
50 \membersection{wxImageList::Add
}\label{wximagelistadd
}
52 \func{int
}{Add
}{\param{const wxBitmap\&
}{ bitmap
},
\param{const wxBitmap\&
}{ mask = wxNullBitmap
}}
54 Adds a new image or images using a bitmap and optional mask bitmap.
56 \func{int
}{Add
}{\param{const wxBitmap\&
}{ bitmap
},
\param{const wxColour\&
}{ maskColour
}}
58 Adds a new image or images using a bitmap and mask colour.
60 \func{int
}{Add
}{\param{const wxIcon\&
}{ icon
}}
62 Adds a new image using an icon.
64 \wxheading{Parameters
}
66 \docparam{bitmap
}{Bitmap representing the opaque areas of the image.
}
68 \docparam{mask
}{Monochrome mask bitmap, representing the transparent areas of the image.
}
70 \docparam{maskColour
}{Colour indicating which parts of the image are transparent.
}
72 \docparam{icon
}{Icon to use as the image.
}
74 \wxheading{Return value
}
76 The new zero-based image index.
80 The original bitmap or icon is not affected by the
{\bf Add
} operation, and can be deleted afterwards.
82 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.
84 \pythonnote{In place of a single overloaded method name, wxPython
85 implements the following methods:
\par
86 \indented{2cm
}{\begin{twocollist
}
87 \twocolitem{{\bf Add(bitmap, mask=wxNullBitmap)
}}{}
88 \twocolitem{{\bf AddWithColourMask(bitmap, colour)
}}{}
89 \twocolitem{{\bf AddIcon(icon)
}}{}
92 \membersection{wxImageList::Create
}\label{wximagelistcreate
}
94 \func{bool
}{Create
}{\param{int
}{width
},
\param{int
}{height
},
\param{bool
}{mask = true
},
\rtfsp
95 \param{int
}{initialCount =
1}}
97 Initializes the list. See
\helpref{wxImageList::wxImageList
}{wximagelistconstr
} for details.
99 \membersection{wxImageList::Draw
}\label{wximagelistdraw
}
101 \func{bool
}{Draw
}{\param{int
}{ index
},
\param{wxDC\&
}{ dc
},
\param{int
}{x
},
\rtfsp
102 \param{int
}{y
},
\param{int
}{flags = wxIMAGELIST
\_DRAW\_NORMAL},
\rtfsp
103 \param{bool
}{solidBackground = false
}}
105 Draws a specified image onto a device context.
107 \wxheading{Parameters
}
109 \docparam{index
}{Image index, starting from zero.
}
111 \docparam{dc
}{Device context to draw on.
}
113 \docparam{x
}{X position on the device context.
}
115 \docparam{y
}{Y position on the device context.
}
117 \docparam{flags
}{How to draw the image. A bitlist of a selection of the following:
119 \begin{twocollist
}\itemsep=
0pt
120 \twocolitem{{\bf wxIMAGELIST
\_DRAW\_NORMAL}}{Draw the image normally.
}
121 \twocolitem{{\bf wxIMAGELIST
\_DRAW\_TRANSPARENT}}{Draw the image with transparency.
}
122 \twocolitem{{\bf wxIMAGELIST
\_DRAW\_SELECTED}}{Draw the image in selected state.
}
123 \twocolitem{{\bf wxIMAGELIST
\_DRAW\_FOCUSED}}{Draw the image in a focused state.
}
127 \docparam{solidBackground
}{For optimisation - drawing can be faster if the function is told
128 that the background is solid.
}
130 \membersection{wxImageList::GetBitmap
}\label{wximagelistgetbitmap
}
132 \constfunc{wxBitmap
}{GetBitmap
}{\param{int
}{index
}}
134 Returns the bitmap corresponding to the given index.
136 \membersection{wxImageList::GetIcon
}\label{wximagelistgeticon
}
138 \constfunc{wxIcon
}{GetIcon
}{\param{int
}{index
}}
140 Returns the icon corresponding to the given index.
142 \membersection{wxImageList::GetImageCount
}\label{wximagelistgetimagecount
}
144 \constfunc{int
}{GetImageCount
}{\void}
146 Returns the number of images in the list.
148 \membersection{wxImageList::GetSize
}\label{wximagelistgetsize
}
150 \constfunc{bool
}{GetSize
}{\param{int
}{index
},
\param{int\&
}{width
},
\param{int \&
}{height
}}
152 Retrieves the size of the images in the list. Currently, the
{\it index
}
153 parameter is ignored as all images in the list have the same size.
155 \wxheading{Parameters
}
157 \docparam{index
}{currently unused, should be
0}
159 \docparam{width
}{receives the width of the images in the list
}
161 \docparam{height
}{receives the height of the images in the list
}
163 \wxheading{Return value
}
165 true if the function succeeded, false if it failed (for example, if the image
166 list was not yet initialized).
168 \membersection{wxImageList::Remove
}\label{wximagelistremove
}
170 \func{bool
}{Remove
}{\param{int
}{ index
}}
172 Removes the image at the given position.
174 \membersection{wxImageList::RemoveAll
}\label{wximagelistremoveall
}
176 \func{bool
}{RemoveAll
}{\void}
178 Removes all the images in the list.
180 \membersection{wxImageList::Replace
}\label{wximagelistreplace
}
182 \func{bool
}{Replace
}{\param{int
}{ index
},
\param{const wxBitmap\&
}{ bitmap
},
\param{const wxBitmap\&
}{ mask = wxNullBitmap
}}
184 Replaces the existing image with the new image.
188 \func{bool
}{Replace
}{\param{int
}{ index
},
\param{const wxIcon\&
}{ icon
}}
190 Replaces the existing image with the new image.
192 \wxheading{Parameters
}
194 \docparam{bitmap
}{Bitmap representing the opaque areas of the image.
}
196 \docparam{mask
}{Monochrome mask bitmap, representing the transparent areas of the image.
}
198 \docparam{icon
}{Icon to use as the image.
}
200 \wxheading{Return value
}
202 true if the replacement was successful, false otherwise.
206 The original bitmap or icon is not affected by the
{\bf Replace
} operation, and can be deleted afterwards.
208 \pythonnote{The second form is called
{\tt ReplaceIcon
} in wxPython.
}