Search documentation of wx

# View Source wxImageList (wx v2.4.2)

Functions for wxImageList class

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.

`wxImageList` is used principally in conjunction with `wxTreeCtrl` and `wxListCtrl` classes.

See: `wxTreeCtrl`, `wxListCtrl`

wxWidgets docs: wxImageList

# Summary

## Types

wxImageList()

## Functions

add(This, Icon)

Adds a new image using an icon.

add/3

Adds a new image or images using a bitmap and mask colour.

create(This, Width, Height)
create/4

Initializes the list.

destroy(This)

Destroys the object.

draw(This, Index, Dc, X, Y)
draw/6

Draws a specified image onto a device context.

getBitmap(This, Index)

Returns the bitmap corresponding to the given index.

getIcon(This, Index)

Returns the icon corresponding to the given index.

getImageCount(This)

Returns the number of images in the list.

getSize(This, Index)

Retrieves the size of the images in the list.

new()

Default ctor.

new(Width, Height)
new(Width, Height, Options)

Constructor specifying the image size, whether image masks should be created, and the initial size of the list.

remove(This, Index)

Removes the image at the given position.

removeAll(This)

Removes all the images in the list.

replace(This, Index, Icon)

Replaces the existing image with the new image.

replace(This, Index, Bitmap, Mask)

Replaces the existing image with the new image.

# Types

Link to this type

# wxImageList()

View Source

    -type wxImageList() :: wx:wx_object().

# Functions

Link to this function

# add(This, Icon)

View Source

    -spec 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: The original bitmap or icon is not affected by the `add/3` operation, and can be deleted afterwards. 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

Link to this function

# add/3

View Source

    -spec 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.

Return: The new zero-based image index.

Remark: The original bitmap or icon is not affected by the `add/3` operation, and can be deleted afterwards. 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.

Link to this function

# create(This, Width, Height)

View Source

    -spec create(This, Width, Height) -> boolean()
                    when This :: wxImageList(), Width :: integer(), Height :: integer().

Link to this function

# create/4

View Source

    -spec 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.

Link to this function

# destroy(This)

View Source

    -spec destroy(This :: wxImageList()) -> ok.

Destroys the object.

Link to this function

# draw(This, Index, Dc, X, Y)

View Source

    -spec draw(This, Index, Dc, X, Y) -> boolean()
                  when
                      This :: wxImageList(),
                      Index :: integer(),
                      Dc :: wxDC:wxDC(),
                      X :: integer(),
                      Y :: integer().

Link to this function

# draw/6

View Source

    -spec 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.

Link to this function

# getBitmap(This, Index)

View Source

    -spec getBitmap(This, Index) -> wxBitmap:wxBitmap() when This :: wxImageList(), Index :: integer().

Returns the bitmap corresponding to the given index.

Link to this function

# getIcon(This, Index)

View Source

    -spec getIcon(This, Index) -> wxIcon:wxIcon() when This :: wxImageList(), Index :: integer().

Returns the icon corresponding to the given index.

Link to this function

# getImageCount(This)

View Source

    -spec getImageCount(This) -> integer() when This :: wxImageList().

Returns the number of images in the list.

Link to this function

# getSize(This, Index)

View Source

    -spec 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.

Return: true if the function succeeded, false if it failed (for example, if the image list was not yet initialized).

Link to this function

# new()

View Source

    -spec new() -> wxImageList().

Default ctor.

Link to this function

# new(Width, Height)

View Source

    -spec new(Width, Height) -> wxImageList() when Width :: integer(), Height :: integer().

Link to this function

# new(Width, Height, Options)

View Source

    -spec 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`

Link to this function

# remove(This, Index)

View Source

    -spec remove(This, Index) -> boolean() when This :: wxImageList(), Index :: integer().

Removes the image at the given position.

Link to this function

# removeAll(This)

View Source

    -spec removeAll(This) -> boolean() when This :: wxImageList().

Removes all the images in the list.

Link to this function

# replace(This, Index, Icon)

View Source

    -spec replace(This, Index, Icon) -> boolean()
                     when
                         This :: wxImageList(),
                         Index :: integer(),
                         Icon :: wxIcon:wxIcon() | wxBitmap:wxBitmap().

Replaces the existing image with the new image.

Return: true if the replacement was successful, false otherwise.

Remark: The original bitmap or icon is not affected by the `replace/4` operation, and can be deleted afterwards.

Only for:wxmsw,wxosx

Link to this function

# replace(This, Index, Bitmap, Mask)

View Source

    -spec 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.

Return: true if the replacement was successful, false otherwise.

Remark: The original bitmap or icon is not affected by the `replace/4` operation, and can be deleted afterwards.