Harlinn.Windows 0.1
|
#include <HWStdCtrls.h>
Public Types | |
using | Base = Handle<ImageList, HIMAGELIST> |
![]() | |
using | DerivedType |
using | HandleType |
Public Member Functions | |
constexpr | ImageList () noexcept |
constexpr | ImageList (HIMAGELIST handle, bool closeHandle=true) noexcept |
ImageList (int elementWidth, int elementHeight, int count, int growBy, ImageListFlags flags, ImageListColor color) | |
Creates a new image list. | |
void | Close () noexcept |
Destroys the image list. | |
int | Add (const BitmapHandle &bitmap) const |
Adds an image or images to an image list. | |
int | Add (const BitmapHandle &bitmap, const BitmapHandle &mask) const |
Adds an image or images to an image list. | |
int | Add (const BitmapHandle &bitmap, COLORREF maskColor) const |
Adds an image or images to an image list, generating a mask from the specified bitmap. | |
void | Move (int indexOfDestinationImage, int indexOfSourceImage) const |
The source image is copied to the destination image's index. This operation results in multiple instances of a given image. | |
void | Swap (int indexOfFirstImage, int indexOfSecondImage) const |
The source and destination images exchange positions within the image list. | |
ImageList | Clone () const |
Creates a duplicate of an existing image list. | |
void | BeginDrag (int indexOfTrackImage, int dxHotspot, int dyHotspot) const |
Begins dragging an image. | |
void | BeginDrag (int indexOfTrackImage, const POINT &hotspot) const |
Begins dragging an image. | |
void | BeginDrag (int indexOfTrackImage, const Point &hotspot) const |
Begins dragging an image. | |
void | Draw (int indexOfImage, HDC hDC, int x, int y, ImageListDrawFlags flags) const |
Draws an image list item in the specified device context. | |
void | Draw (int indexOfImage, HDC hDC, int x, int y, int dx, int dy, COLORREF background, COLORREF foreground, ImageListDrawFlags flags) const |
Draws an image list item in the specified device context. The function uses the specified drawing style and blends the image with the specified color. | |
COLORREF | GetBkColor () const |
Retrieves the current background color for an image list. | |
COLORREF | BackgroundColor () const |
Retrieves the current background color for an image list. | |
IconHandle | GetIcon (int indexOfImage, ImageListDrawFlags flags=ImageListDrawFlags::Normal) const |
Creates an icon from an image and mask in an image list. | |
void | GetIconSize (int *x, int *y) const |
Retrieves the dimensions of images in an image list. All images in an image list have the same dimensions. | |
void | GetIconSize (SIZE &size) const |
Retrieves the dimensions of images in an image list. All images in an image list have the same dimensions. | |
void | GetIconSize (Size &size) const |
Retrieves the dimensions of images in an image list. All images in an image list have the same dimensions. | |
Size | GetIconSize () const |
Retrieves the dimensions of images in an image list. All images in an image list have the same dimensions. | |
void | GetImageSize (int *x, int *y) const |
Retrieves the dimensions of images in an image list. All images in an image list have the same dimensions. | |
void | GetImageSize (SIZE &size) const |
Retrieves the dimensions of images in an image list. All images in an image list have the same dimensions. | |
void | GetImageSize (Size &size) const |
Retrieves the dimensions of images in an image list. All images in an image list have the same dimensions. | |
Size | GetImageSize () const |
Retrieves the dimensions of images in an image list. All images in an image list have the same dimensions. | |
int | Count () const |
Retrieves the number of images in an image list. | |
void | GetImageInfo (int imageIndex, IMAGEINFO &imageinfo) const |
Retrieves information about an image. | |
void | GetImageInfo (int imageIndex, IMAGEINFO *imageinfo) const |
Retrieves information about an image. | |
ImageList | Merge (int i1, HIMAGELIST himl2, int i2, int dx, int dy) const |
Creates a new image by combining two existing images. The function also creates a new image list in which to store the image. | |
bool | Remove (int index) const |
Removes an image from the image list. | |
bool | Replace (int index, HBITMAP image, HBITMAP mask) const |
Replaces an image in the image list with a new image. | |
int | Replace (int index, HICON icon) const |
Replaces an image with an icon or cursor. | |
ColorRef | SetBkColor (const ColorRef &newBackgroundColor) const |
Sets the background color for an image list. This function only works if you add an icon or use Add with a black and white bitmap. Without a mask, the entire image is drawn; hence the background color is not visible. | |
![]() | |
Handle (const Handle &other)=delete | |
Handle (Handle &&other) noexcept | |
virtual | ~Handle () noexcept |
constexpr bool | IsValid () const noexcept |
Handle & | operator= (Handle &other)=delete |
Handle & | operator= (Handle &&other) noexcept |
constexpr auto | operator<=> (const Handle &other) const noexcept |
constexpr auto | operator<=> (HandleType handle) const noexcept |
constexpr bool | operator== (const Handle &other) const noexcept |
constexpr bool | operator== (HandleType handle) const noexcept |
constexpr | operator HandleType () const noexcept |
constexpr HandleType | Value () const noexcept |
constexpr bool | OwnsHandle () const noexcept |
Static Public Member Functions | |
static void | DragEnter (HWND hwndLock, int x, int y) |
Displays the drag image at the specified position within the window. | |
static void | DragEnter (Control &control, int x, int y) |
Displays the drag image at the specified position within the control. | |
static void | DragLeave (HWND hwndLock) |
Unlocks the specified window and hides the drag image, allowing the window to be updated. | |
static void | DragLeave (Control &control) |
Unlocks the specified control and hides the drag image, allowing the control to be updated. | |
static void | DragMove (int x, int y) |
Moves the image that is being dragged during a drag-and-drop operation. This function is typically called in response to a WM_MOUSEMOVE message. | |
static void | DragShowNolock (bool showImage) |
Shows or hides the image being dragged. | |
static void | EndDrag () |
Ends a drag operation. | |
static ImageList | GetDragImage (POINT *ppt, POINT *pptHotspot) |
Retrieves the temporary image list that is used for the drag image. The function also retrieves the current drag position and the offset of the drag image relative to the drag position. | |
static ImageList | GetDragImage (Point *ppt, Point *pptHotspot) |
Retrieves the temporary image list that is used for the drag image. The function also retrieves the current drag position and the offset of the drag image relative to the drag position. | |
static void | Draw (const IMAGELISTDRAWPARAMS *imagelistDrawOarams) |
Draws an image list image based on an IMAGELISTDRAWPARAMS structure. | |
static void | Draw (const IMAGELISTDRAWPARAMS &imagelistDrawParams) |
Draws an image list image based on an IMAGELISTDRAWPARAMS structure. | |
static ImageList | Load (HINSTANCE hInstance, const wchar_t *name, int imageWidth, int growBy, COLORREF maskColor, ImageListLoadFlags flags) |
Creates an image list from the specified bitmap. | |
static ImageList | LoadFromFile (const wchar_t *name, int imageWidth, int growBy, COLORREF maskColor, ImageListLoadFlags flags) |
Creates an image list from the specified bitmap. | |
static ImageList | LoadFromFile (const wchar_t *name, int imageWidth) |
Creates an image list from the specified bitmap. | |
static ImageList | Merge (HIMAGELIST himl1, int i1, HIMAGELIST himl2, int i2, int dx, int dy) |
Creates a new image by combining two existing images. The function also creates a new image list in which to store the image. | |
static ImageList | Read (LPSTREAM stream) |
Reads an image list from a stream. | |
![]() | |
static constexpr HandleType | InvalidHandleValue () noexcept |
Static Private Member Functions | |
static HIMAGELIST | CreateImageList (int elementWidth, int elementHeight, int count, int growBy, ImageListFlags flags, ImageListColor color) |
Additional Inherited Members | |
![]() | |
constexpr | Handle () noexcept |
constexpr | Handle (HandleType handle, bool ownsHandle=true) noexcept |
void | SetValue (HandleType handle, bool ownsHandle=true) |
![]() | |
HandleType | value_ |
using Harlinn::Windows::ImageList::Base = Handle<ImageList, HIMAGELIST> |
|
inlineconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inline |
Creates a new image list.
elementWidth | The width, in pixels, of each image |
elementHeight | The height, in pixels, of each image |
count | The number of images that the image list initially contains. |
growBy | The number of images by which the image list can grow when the system needs to make room for new images. This parameter represents the number of new images that the resized image list can contain. |
flags | A set of bit flags that specify the type of image list to create. |
color | Specifies the color-depth of the imagelist |
|
inline |
Adds an image or images to an image list.
bitmap | A handle to the bitmap that contains the image or images. The number of images is inferred from the width of the bitmap. |
|
inline |
Adds an image or images to an image list, generating a mask from the specified bitmap.
bitmap | A handle to the bitmap that contains one or more images. The number of images is inferred from the width of the bitmap. |
maskColor | The color used to generate the mask. Each pixel of this color in the specified bitmap is changed to black, and the corresponding bit in the mask is set to 1. |
|
inline |
Adds an image or images to an image list.
bitmap | A handle to the bitmap that contains the image or images. The number of images is inferred from the width of the bitmap. |
mask | A handle to the bitmap that contains the mask. If no mask is used with the image list, this parameter is ignored. |
|
inline |
Retrieves the current background color for an image list.
|
inline |
Begins dragging an image.
indexOfTrackImage | The index of the image to drag. |
hotspot | The x and y coordinates of the location of the drag position relative to the upper-left corner of the image. |
|
inline |
Begins dragging an image.
indexOfTrackImage | The index of the image to drag. |
hotspot | The x and y coordinates of the location of the drag position relative to the upper-left corner of the image. |
|
inline |
Begins dragging an image.
indexOfTrackImage | The index of the image to drag. |
dxHotspot | The x-coordinate of the location of the drag position relative to the upper-left corner of the image. |
dyHotspot | The y-coordinate of the location of the drag position relative to the upper-left corner of the image. |
|
inline |
Creates a duplicate of an existing image list.
|
inlinenoexcept |
Destroys the image list.
|
inline |
Retrieves the number of images in an image list.
|
inlinestaticprivate |
|
inlinestatic |
Displays the drag image at the specified position within the control.
control | The control that owns the drag image. |
x | The x-coordinate at which to display the drag image. The coordinate is relative to the upper-left corner of the control, not the client area. |
y | The y-coordinate at which to display the drag image. The coordinate is relative to the upper-left corner of the control, not the client area. |
|
inlinestatic |
Displays the drag image at the specified position within the window.
hwndLock | A handle to the window that owns the drag image. |
x | The x-coordinate at which to display the drag image. The coordinate is relative to the upper-left corner of the window, not the client area. |
y | The y-coordinate at which to display the drag image. The coordinate is relative to the upper-left corner of the window, not the client area. |
|
inlinestatic |
Unlocks the specified control and hides the drag image, allowing the control to be updated.
control | The Control that owns the drag image |
|
inlinestatic |
Unlocks the specified window and hides the drag image, allowing the window to be updated.
hwndLock | A handle to the window that owns the drag image |
|
inlinestatic |
Moves the image that is being dragged during a drag-and-drop operation. This function is typically called in response to a WM_MOUSEMOVE message.
x | The x-coordinate at which to display the drag image. The coordinate is relative to the upper-left corner of the window, not the client area. |
y | The y-coordinate at which to display the drag image. The coordinate is relative to the upper-left corner of the window, not the client area. |
|
inlinestatic |
Shows or hides the image being dragged.
showImage | A value specifying whether to show or hide the image being dragged. Specify true to show the image or false to hide the image. |
|
inlinestatic |
Draws an image list image based on an IMAGELISTDRAWPARAMS structure.
imagelistDrawParams | A reference to an IMAGELISTDRAWPARAMS structure that contains information about the draw operation. |
|
inlinestatic |
Draws an image list image based on an IMAGELISTDRAWPARAMS structure.
imagelistDrawOarams | A pointer to an IMAGELISTDRAWPARAMS structure that contains information about the draw operation. |
|
inline |
Draws an image list item in the specified device context.
indexOfImage | The index of the image to draw. |
hDC | A handle to the destination device context. |
x | The x-coordinate at which to draw within the specified device context. |
y | The y-coordinate at which to draw within the specified device context. |
flags | The drawing style and, optionally, the overlay image. |
|
inline |
Draws an image list item in the specified device context. The function uses the specified drawing style and blends the image with the specified color.
indexOfImage | The index of the image to draw. |
hDC | A handle to the destination device context. |
x | The x-coordinate at which to draw within the specified device context. |
y | The y-coordinate at which to draw within the specified device context. |
dx | The width of the portion of the image to draw relative to the upper-left corner of the image. If dx and dy are zero, the function draws the entire image. The function does not ensure that the parameters are valid. |
dy | The height of the portion of the image to draw, relative to the upper-left corner of the image. If dx and dy are zero, the function draws the entire image. The function does not ensure that the parameters are valid. |
background | The background color of the image. This parameter can be an application-defined RGB value or one of the following values:
|
foreground | The foreground color of the image. This parameter can be an application-defined RGB value or one of the following values:
|
flags |
|
inlinestatic |
Ends a drag operation.
|
inline |
Retrieves the current background color for an image list.
|
inlinestatic |
Retrieves the temporary image list that is used for the drag image. The function also retrieves the current drag position and the offset of the drag image relative to the drag position.
ppt | A pointer to a POINT structure that receives the current drag position. Can be nullptr. |
pptHotspot | A pointer to a POINT structure that receives the offset of the drag image relative to the drag position. Can be nullptr. |
The temporary image list is destroyed when the EndDrag function is called. To begin a drag operation, use the ImageList::BeginDrag function.
|
inlinestatic |
Retrieves the temporary image list that is used for the drag image. The function also retrieves the current drag position and the offset of the drag image relative to the drag position.
ppt | A pointer to a Point object that receives the current drag position. Can be nullptr. |
pptHotspot | A pointer to a Point object that receives the offset of the drag image relative to the drag position. Can be nullptr. |
The temporary image list is destroyed when the EndDrag function is called. To begin a drag operation, use the ImageList::BeginDrag function.
|
inline |
Creates an icon from an image and mask in an image list.
indexOfImage | An index of the image. |
flags | A combination of flags that specify the drawing style |
|
inline |
Retrieves the dimensions of images in an image list. All images in an image list have the same dimensions.
|
inline |
Retrieves the dimensions of images in an image list. All images in an image list have the same dimensions.
x | A pointer to an integer variable that receives the width, in pixels, of each image. |
y | A pointer to an integer variable that receives the height, in pixels, of each image. |
|
inline |
Retrieves the dimensions of images in an image list. All images in an image list have the same dimensions.
size | A reference to a SIZE structure that receives the width and height, in pixels, of each image. |
|
inline |
Retrieves the dimensions of images in an image list. All images in an image list have the same dimensions.
size | A reference to a Size object that receives the width and height, in pixels, of each image. |
|
inline |
Retrieves information about an image.
An application should not call DeleteObject to destroy the bitmaps retrieved by GetImageInfo. The system destroys the bitmaps when the imagelist is desroyed.
imageIndex | The index of the image. |
imageinfo | A reference to an IMAGEINFO structure that receives information about the image. The information in this structure can be used to directly manipulate the bitmaps for the image. |
|
inline |
Retrieves information about an image.
An application should not call DeleteObject to destroy the bitmaps retrieved by GetImageInfo. The system destroys the bitmaps when the imagelist is desroyed.
imageIndex | The index of the image. |
imageinfo | A pointer to an IMAGEINFO structure that receives information about the image. The information in this structure can be used to directly manipulate the bitmaps for the image. |
|
inline |
Retrieves the dimensions of images in an image list. All images in an image list have the same dimensions.
|
inline |
Retrieves the dimensions of images in an image list. All images in an image list have the same dimensions.
x | A pointer to an integer variable that receives the width, in pixels, of each image. |
y | A pointer to an integer variable that receives the height, in pixels, of each image. |
|
inline |
Retrieves the dimensions of images in an image list. All images in an image list have the same dimensions.
size | A reference to a SIZE structure that receives the width and height, in pixels, of each image. |
|
inline |
Retrieves the dimensions of images in an image list. All images in an image list have the same dimensions.
size | A reference to a Size object that receives the width and height, in pixels, of each image. |
|
inlinestatic |
Creates an image list from the specified bitmap.
hInstance | A handle to the instance that contains the resource. |
name | The address of a null-terminated string that contains the name of the image resource in the module |
imageWidth | The width of each image. The height of each image and the initial number of images are inferred by the dimensions of the specified resource. |
growBy | The number of images by which the image list can grow when the system needs to make room for new images. This parameter represents the number of new images that the resized image list can contain. |
maskColor | The color used to generate a mask. Each pixel of this color in the specified bitmap, cursor, or icon is changed to black, and the corresponding bit in the mask is set to 1. If this parameter is the CLR_NONE value, no mask is generated. If this parameter is the CLR_DEFAULT value, the color of the pixel at the upper-left corner of the image is treated as the mask color. |
flags | Flags that specify how to load the image |
|
inlinestatic |
Creates an image list from the specified bitmap.
name | The address of a null-terminated string that names the file containing the image to load. |
imageWidth | The width of each image. The height of each image and the initial number of images are inferred by the dimensions of the specified resource. |
|
inlinestatic |
Creates an image list from the specified bitmap.
name | The address of a null-terminated string that names the file containing the image to load. |
imageWidth | The width of each image. The height of each image and the initial number of images are inferred by the dimensions of the specified resource. |
growBy | The number of images by which the image list can grow when the system needs to make room for new images. This parameter represents the number of new images that the resized image list can contain. |
maskColor | The color used to generate a mask. Each pixel of this color in the specified bitmap, cursor, or icon is changed to black, and the corresponding bit in the mask is set to 1. If this parameter is the CLR_NONE value, no mask is generated. If this parameter is the CLR_DEFAULT value, the color of the pixel at the upper-left corner of the image is treated as the mask color. |
flags | Flags that specify how to load the image |
|
inlinestatic |
Creates a new image by combining two existing images. The function also creates a new image list in which to store the image.
himl1 | A handle to the first image list. |
i1 | The index of the first existing image. |
himl2 | A handle to the second image list. |
i2 | The index of the second existing image. |
dx | The x-offset of the second image relative to the first image. |
dy | The y-offset of the second image relative to the first image. |
|
inline |
Creates a new image by combining two existing images. The function also creates a new image list in which to store the image.
i1 | The index of the first existing image. |
himl2 | A handle to the second image list. |
i2 | The index of the second existing image. |
dx | The x-offset of the second image relative to the first image. |
dy | The y-offset of the second image relative to the first image. |
|
inline |
The source image is copied to the destination image's index. This operation results in multiple instances of a given image.
indexOfDestinationImage | The zero-based index of the image to be used as the destination of the copy operation. |
indexOfSourceImage | The zero-based index of the image to be used as the source of the copy operation. |
|
inlinestatic |
Reads an image list from a stream.
stream | A pointer to the stream |
|
inline |
Removes an image from the image list.
index | The index of the image to remove. If this parameter is -1, the function removes all images. |
|
inline |
Replaces an image in the image list with a new image.
index | The index of the image to replace |
image | The handle to the bitmap that contains the new image. |
mask | The handle to the bitmap that contains the mask. If no mask is used with the image list, this parameter is ignored. |
|
inline |
Replaces an image with an icon or cursor.
index | The index of the image to replace. If index is -1, the function appends the image to the end of the list. |
icon | The handle to the icon or cursor that contains the bitmap and mask for the new image. |
|
inline |
Sets the background color for an image list. This function only works if you add an icon or use Add with a black and white bitmap. Without a mask, the entire image is drawn; hence the background color is not visible.
newBackgroundColor | The background color to set. This parameter can be the value returned from ColorRef::None( ), CLR_NONE, value; in which case, images are drawn transparently using the mask. |
|
inline |
The source and destination images exchange positions within the image list.
indexOfFirstImage | The zero-based index of the first image |
indexOfSecondImage | The zero-based index of the second image |