11#if defined(__BORLANDC__)
24 memset(
this,0,
sizeof(IMAGELISTDRAWPARAMS));
25 cbSize =
sizeof(IMAGELISTDRAWPARAMS);
42 ImageSize =
TSize(imageSize.cx, imageSize.cy);
43 Handle = ImageList_Create(imageSize.cx, imageSize.cy, flags, initCapacity, growBy);
44 WARNX(OwlCommCtrl, !Handle, 0,
"Cannot create ImageList");
58 Handle = ImageList_Create(ImageSize.cx, ImageSize.cy, flags, imageCount, growBy);
59 WARNX(OwlCommCtrl, !Handle, 0,
"Cannot create ImageList");
77 Handle = ImageList_Create(ImageSize.cx, ImageSize.cy, flags, imageCount, growBy);
78 WARNX(OwlCommCtrl, !Handle, 0,
"Cannot create ImageList");
84 TPalette pal((HPALETTE)::GetStockObject(DEFAULT_PALETTE));
98 Handle = ImageList_LoadImage(h,
id, imageWidth, growBy, mask, type, flags);
99 WARNX(OwlCommCtrl, !Handle, 0,
"Cannot create ImageList");
100 ImageSize =
TSize(0);
114 WARNX(OwlCommCtrl, !Handle, 0,
"Cannot create ImageList");
117 ImageList_GetIconSize(Handle, &cx, &cy);
130 ImageSize =
TSize(0);
131 Handle = ImageList_GetDragImage(&pt, &hotspot);
132 WARNX(OwlCommCtrl, !Handle, 0,
"Cannot create ImageList");
145 WARNX(OwlCommCtrl, !Handle, 0,
_T(
"TImageList::TImageList: ImageList_Duplicate failed"));
154 ImageList_Destroy(Handle);
177 if (
this == &src)
return *
this;
178 const auto d = ImageList_Duplicate(src);
179 WARNX(OwlCommCtrl, !d, 0,
_T(
"TImageList::operator =: ImageList_Duplicate failed"));
180 if (!d)
throw TXOwl{
_T(
"TImageList::operator = failed")};
183 [[maybe_unused]]
const auto ok = ImageList_Destroy(Handle) != FALSE;
184 WARNX(OwlCommCtrl, !ok, 0,
_T(
"TImageList::operator =: ImageList_Destroy failed"));
205 if (!Bitmap || (HBITMAP)*Bitmap != ii.
GetImageBM()) {
222 style |= INDEXTOOVERLAYMASK(overlay);
223 return ImageList_Draw(Handle, index, dc, x, y, style);
237 style |= INDEXTOOVERLAYMASK(overlay);
238 COLORREF bgCr = (bgClr ==
TColor::None) ?
static_cast<COLORREF
>(CLR_NONE) :
static_cast<COLORREF
>(bgClr);
239 COLORREF fgCr = (fgClr ==
TColor::None) ?
static_cast<COLORREF
>(CLR_NONE) :
static_cast<COLORREF
>(fgClr);
241 return ImageList_DrawEx(Handle, index, dc, x, y, dx, dy, bgCr, fgCr, style);
251 return ImageList_GetImageCount(Handle);
262 return ImageList_Add(Handle, image,
nullptr);
273 return ImageList_Add(Handle, image, mask);
285 return ImageList_AddMasked(Handle, image, mskColor);
295 return ImageList_AddIcon(Handle, icon);
305 return ImageList_Remove(Handle, index);
315 return ImageList_Replace(Handle, index, image,
nullptr);
325 return ImageList_Replace(Handle, index, image, mask);
335 return ImageList_GetIcon(Handle, index, flags);
345 return ImageList_ReplaceIcon(Handle, index, icon);
355 return ImageList_GetIconSize(Handle, &cx, &cy);
365 return ImageList_GetImageInfo(Handle, index,
static_cast<IMAGEINFO*
>(&imageInfo));
376 if (!r)
throw TXOwl{
_T(
"GetImageInfo failed")};
387 return ImageList_GetBkColor(Handle);
398 return ImageList_SetBkColor(Handle, color);
408 return ImageList_SetOverlayImage(Handle, index, overlay);
421 return ImageList_SetDragCursorImage(Handle, drag, dxHotspot, dyHotspot);
432 return ImageList_BeginDrag(Handle, index, dxHotspot, dyHotspot);
444 return ImageList_DragEnter(hWndLock, x, y);
454 return ImageList_DragMove(x, y);
464 return ImageList_DragLeave(hWndLock);
482 return ImageList_DragShowNolock(show);
492 return ImageList_Copy(Handle, ito, src, ifrom, flags);
502 return ImageList_DrawIndirect(&ca);
512 HIMAGELIST hImg = ImageList_Duplicate(Handle);
513 return (hImg) ?
new TImageList(hImg) :
nullptr;
522 return ImageList_SetImageCount(Handle, newcount);
#define WARNX(group, condition, level, message)
#define PRECONDITION(condition)
TBitmap is the GDI bitmap class derived from TGdiObject.
int Width() const
Returns the width of this bitmap using GDI's GetObject.
int Height() const
Returns the height of this bitmap using GDI's GetObject.
Class wrapper for management of color values.
static const TColor None
not-a-color
static const TColor Sys3dFace
The symbolic system color value for the face color of 3-dimensional display elements.
TDC is the root class for GDI DC wrappers.
Pseudo-GDI object Device Independent Bitmap (DIB) class.
TDib()
Protected ctor- derived classes need to fill in handle & get info.
int Width() const
Returns the width of the DIB.
int Height() const
Returns the height of the DIB.
TIcon, derived from TGdiObject, represents the GDI object icon class.
TImageInfo is a wrapper class for a structure that describes an image within an image list.
HBITMAP GetImageBM() const
Gets the image bitmap.
TRect GetImageRect() const
Gets the area of the image.
TImageList is a wrapper class for the ImageList common "control".
bool BeginDrag(int index, int dxHotspot, int dyHotspot)
BeginDrag sets this imagelist to be the drag imagelist.
static bool DragMove(int x, int y)
DragMove is typically called when receiving a WM_MOUSEMOVE message.
bool GetIconSize(int &cx, int &cy)
Returns the icon size.
TColor SetBkColor(const TColor &newColor)
Sets the current background color for this ImageList, returning the previous color.
TRect GetImageRect(int cel) const
Returns the bounding rect of a given image in the ImageList's bitmap.
bool SetDragCursorImage(int drag, int dxHotspot, int dyHotspot)
Combines the current drag image with another image in the list.
static bool DragEnter(HWND hwndLock, int x, int y)
Typically, this function is called in response to a WM_LBUTTONDOWN message.
TImageList & operator=(const TImageList &)
Replaces the image list by a duplicate of the given image list.
bool SetImageCount(uint newcount)
static bool DragShowNolock(bool show)
Locks or unlocks the window from updates.
bool DrawIndirect(const TImageListDrawParam &imldp)
static bool DragLeave(HWND hwndLock)
DragLeave is typically called when receiving a WM_LBUTTONUP message.
TColor GetBkColor() const
Gets the current background color for this ImageList.
int GetImageCount() const
Returns number of images currently in this ImageList.
TImageList(const TSize &imageSize, uint flags, int initCapacity, int growBy)
Constructs an empty ImageList of a given size.
int Add(const TBitmap &image)
Adds new image(s) to the ImageList.
void CheckValid()
Throws an exception if this image list handle is invalid.
bool Copy(TImageList &imgsrc, int ifrom, int ito, uint flags=ILCF_MOVE)
bool Remove(int index)
Removes an image (or all images if index is -1) from this ImageList.
HICON GetIcon(int index, uint flags) const
Creates and retrieves an icon from an image and mask in the ImageList.
~TImageList()
Destructs the ImageList and cleans up the image list handle.
bool GetImageInfo(int index, TImageInfo &celInfo) const
Gets general information about a given image.
bool Draw(int index, TDC &, int x, int y, uint style=ILD_NORMAL, int overlay=0)
Draws an image onto a target DC at a given coordinate and with a given style.
bool Replace(int index, const TBitmap &image)
Replaces an image in this ImageList.
bool SetOverlayImage(int index, int overlay)
Selects an image for use as an overlay. Up to four can be selected.
static void EndDrag()
EndDrag removes the current drag imagelist from the system.
int ReplaceIcon(int index, HICON hicon)
Replaces the image at index 'index' with the icon or cursor.
TPalette is the GDI Palette class derived from TGdiObject.
TPoint is a support class, derived from tagPOINT.
TSize Size() const
Returns the size of rectangle.
The tagSIZE struct is defined as.
TSize()
Default constructor that does nothing.
static void Raise()
Constructs a TXCommCtrl exception from scratch, and throws it.
TXOwl is root class of the ObjectWindows exception hierarchy.
Definition of class TImageList, an ImageList Common Control wrapper.
Object Windows Library (OWLNext Core).
DIAG_DECLARE_GROUP(OwlThread)