wxImageList(3)
π wxImageList π
okay bestie, so this is wxImageList, straight out of the Erlang Module Definition corner of the wx docs. grab a strawberry π and let's get into it.
β¨ NAME β¨
wxImageList β A wxImageList contains a list of images, which are stored in an unspecified form. yes, unspecified, we don't ask questions, we just vibe π
πΈ DESCRIPTION πΈ
okay so first things first: images can have masks for transparent drawing, and they can be made from a whole bunch of sources β bitmaps, icons, the whole menu. it's giving range. it's giving versatility. π
wxImageList is used principally in conjunction with these two icons of the game:
wxTreeCtrlwxListCtrl
like, that's its whole moment. that's its main character energy.
See also:
wxTreeCtrlwxListCtrl
wxWidgets docs: wxImageList β they have the lore, fr fr.
π¦ DATA TYPES π¦
wxImageList() :: wx:wx_object().
that's it, that's the type. short, sweet, iconic. β¨
π FUNCTIONS π
add(This, Icon) -> integer()
add(This, Icon) -> integer()
when
This :: wxImageList(),
Icon :: wxIcon:wxIcon() | wxBitmap:wxBitmap().
Adds a new image using an icon. π
Return: the new zero-based image index.
Remark: okay this bit matters, listen up bestie β the original bitmap or icon is not affected by the add/3 operation, and can be deleted afterwards. so no, it does not steal your bitmap, it just borrows the look. π Also, 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.
Only for: wxmsw, wxosx
add(This, Bitmap, Mask) -> integer() / add(This, Bitmap, MaskColour) -> integer()
add(This, Bitmap, Mask) -> integer()
when
This :: wxImageList(),
Bitmap :: wxBitmap:wxBitmap(),
Mask :: wxBitmap:wxBitmap();
(This, Bitmap, MaskColour) -> integer()
when
This :: wxImageList(),
Bitmap :: wxBitmap:wxBitmap(),
MaskColour :: wx:wx_colour().
Adds a new image or images using a bitmap and mask colour. two flavours, one vibe.
Return: the new zero-based image index.
Remark: same deal as before, no cap β the original bitmap or icon is not affected by the add/3 operation, and can be deleted afterwards. and 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.
create(This, Width, Height, [Option]) -> boolean()
create(This, Width, Height, [Option]) -> boolean()
when
This :: wxImageList(),
Width :: integer(),
Height :: integer(),
Option ::
{mask, boolean()} | {initialCount, integer()}.
Initializes the list. π±
See new/3 for details β the tea is over there, go sip it.
destroy(This :: wxImageList()) -> ok.
destroy(This :: wxImageList()) -> ok.
Destroys the object. π gone, not forgotten.
draw(This, Index, Dc, X, Y, [Option]) -> boolean()
draw(This, Index, Dc, X, Y, [Option]) -> boolean()
when
This :: wxImageList(),
Index :: integer(),
Dc :: wxDC:wxDC(),
X :: integer(),
Y :: integer(),
Option ::
{flags, integer()} | {solidBackground, boolean()}.
Draws a specified image onto a device context. ποΈ put the picture on the canvas, slay.
getBitmap(This, Index) -> wxBitmap:wxBitmap()
getBitmap(This, Index) -> wxBitmap:wxBitmap()
when This :: wxImageList(), Index :: integer().
Returns the bitmap corresponding to the given index. π
getIcon(This, Index) -> wxIcon:wxIcon()
getIcon(This, Index) -> wxIcon:wxIcon()
when This :: wxImageList(), Index :: integer().
Returns the icon corresponding to the given index. β
getImageCount(This) -> integer()
getImageCount(This) -> integer() when This :: wxImageList().
Returns the number of images in the list. π’ counting era, honestly.
getSize(This, Index) -> Result
getSize(This, Index) -> Result
when
Result ::
{Res :: boolean(),
Width :: integer(),
Height :: integer()},
This :: wxImageList(),
Index :: integer().
Retrieves the size of the images in the list. π
Currently, the index parameter is ignored as all images in the list have the same size. so like, don't stress about passing it.
Return: true if the function succeeded, false if it failed (for example, if the image list was not yet initialized). lowkey important that false case.
new() -> wxImageList()
new() -> wxImageList().
Default ctor. the classic. the blueprint. π
new(Width, Height, [Option]) -> wxImageList()
new(Width, Height, [Option]) -> wxImageList()
when
Width :: integer(),
Height :: integer(),
Option :: {mask, boolean()} | {initialCount,
integer()}.
Constructor specifying the image size, whether image masks should be created, and the initial size of the list. β¨
See: create/4 β they're besties, they reference each other, adorable.
remove(This, Index) -> boolean()
remove(This, Index) -> boolean()
when This :: wxImageList(), Index :: integer().
Removes the image at the given position. π«Ά bye babe, you were great.
removeAll(This) -> boolean()
removeAll(This) -> boolean() when This :: wxImageList().
Removes all the images in the list. full reset π everything must go.
replace(This, Index, Icon) -> boolean()
replace(This, Index, Icon) -> boolean()
when
This :: wxImageList(),
Index :: integer(),
Icon :: wxIcon:wxIcon() | wxBitmap:wxBitmap().
Replaces the existing image with the new image. glow-up moment. π
Return: true if the replacement was successful, false otherwise.
Remark: you already know the drill, bestie β the original bitmap or icon is not affected by the replace/4 operation, and can be deleted afterwards.
Only for: wxmsw, wxosx
replace(This, Index, Bitmap, Mask) -> boolean()
replace(This, Index, Bitmap, Mask) -> boolean()
when
This :: wxImageList(),
Index :: integer(),
Bitmap :: wxBitmap:wxBitmap(),
Mask :: wxBitmap:wxBitmap().
Replaces the existing image with the new image. π₯
Windows only. yes, this specific one, we're being real with you.
Return: true if the replacement was successful, false otherwise.
Remark: once again, for the people in the back β the original bitmap or icon is not affected by the replace/4 operation, and can be deleted afterwards.
β οΈ friendly reminder from me to you: whenever the docs say the original bitmap or icon is not affected and can be deleted afterwards, they MEAN it. don't be out here leaking bitmaps, bestie. π«Ά
and that's the whole page, no notes, you ate it π β¨
this has been the wxImageList(3) moment, brought to you by Ericsson AB, wx 2.6, dated however long the original said β go be iconic with it, ily, bye π¦πΈ
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms