OWLNext 7.0
Borland's Object Windows Library for the modern age
|
TImageList is a wrapper class for the ImageList common "control". More...
#include <owl/imagelst.h>
Public Member Functions | |
TImageList (const TSize &imageSize, uint flags, int initCapacity, int growBy) | |
Constructs an empty ImageList of a given size. | |
TImageList (const TBitmap &bmp, uint flags, int imageCount, int growBy) | |
Constructs a TImageList from a bitmap, slicing it up into a horizontal array of the given number of evenly sized images. | |
TImageList (const TDib &dib, uint flags, int imageCount, int growBy) | |
Constructs a TImageList from a DIB, slicing the bitmap up into a horizontal array of the given number of evenly sized images. | |
TImageList (HINSTANCE, TResId, int imageWidth, int growBy, const TColor &mask, uint type=IMAGE_BITMAP, uint flags=LR_CREATEDIBSECTION) | |
Constructs an ImageList from a bitmap resource. | |
TImageList (HIMAGELIST imageList) | |
Constructs a C++ alias for an existing imagelist. | |
TImageList (TPoint &pt, TPoint &hotspot) | |
Constructs a wrapper for the current drag imagelist and specifies the location and hotspot of the imagelist. | |
TImageList (const TImageList &src) | |
Creates a duplicate of the given image list. | |
~TImageList () | |
Destructs the ImageList and cleans up the image list handle. | |
TImageList & | operator= (const TImageList &) |
Replaces the image list by a duplicate of the given image list. | |
operator TBitmap & () | |
Returns the image bitmap used by this ImageList. | |
operator HIMAGELIST () const | |
Converts to the HIMAGELIST structure. | |
int | GetImageCount () const |
Returns number of images currently in this ImageList. | |
TSize | GetImageSize () const |
Returns the size each image. | |
TPoint | GetImageOffset (int cel) const |
Returns the offset of a given image in the ImageList's bitmap. | |
TRect | GetImageRect (int cel) const |
Returns the bounding rect of a given image in the ImageList's bitmap. | |
TRect | operator[] (int cel) const |
Returns the rectangle of the image at index 'index'. | |
int | Add (const TBitmap &image) |
Adds new image(s) to the ImageList. | |
int | Add (const TBitmap &image, const TBitmap &mask) |
Adds new image/mask pair(s) to the ImageList. Returns index of new addition. | |
int | Add (const TBitmap &image, const TColor &mask) |
Adds new image(s) to ImageList, specifying a mask color to generate a mask. | |
int | Add (const TIcon &) |
Adds an icon to the ImageList. Returns index of new addition. | |
bool | Remove (int index) |
Removes an image (or all images if index is -1) from this ImageList. | |
bool | RemoveAll () |
Removes all images from the list. | |
bool | Replace (int index, const TBitmap &image) |
Replaces an image in this ImageList. | |
bool | Replace (int index, const TBitmap &image, const TBitmap &mask) |
Replaces an image and mask in the ImageList. | |
int | ReplaceIcon (int index, HICON hicon) |
Replaces the image at index 'index' with the icon or cursor. | |
HICON | GetIcon (int index, uint flags) const |
Creates and retrieves an icon from an image and mask in the ImageList. | |
bool | GetIconSize (int &cx, int &cy) |
Returns the icon size. | |
bool | GetImageInfo (int index, TImageInfo &celInfo) const |
Gets general information about a given image. | |
TImageInfo | GetImageInfo (int index) const |
Functional-style overload. | |
TColor | GetBkColor () const |
Gets the current background color for this ImageList. | |
TColor | SetBkColor (const TColor &newColor) |
Sets the current background color for this ImageList, returning the previous color. | |
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 | Draw (int index, TDC &dc, const TPoint &p, uint style=ILD_NORMAL, int overlay=0) |
bool | Draw (int index, TDC &, int x, int y, int dx, int dy, const TColor &bgClr, const TColor &fgClr, uint style=ILD_NORMAL, int overlay=0) |
Extended version of draw that takes a foreground color and background color. | |
bool | Draw (int index, TDC dc, const TPoint &p, const TSize &s, const TColor &bgClr, const TColor &fgClr, uint style=ILD_NORMAL, int overlay=0) |
bool | SetOverlayImage (int index, int overlay) |
Selects an image for use as an overlay. Up to four can be selected. | |
bool | SetDragCursorImage (int drag, int dxHotspot, int dyHotspot) |
Combines the current drag image with another image in the list. | |
bool | BeginDrag (int index, int dxHotspot, int dyHotspot) |
BeginDrag sets this imagelist to be the drag imagelist. | |
bool | Copy (TImageList &imgsrc, int ifrom, int ito, uint flags=ILCF_MOVE) |
bool | DrawIndirect (const TImageListDrawParam &imldp) |
TImageList * | Duplicate () |
bool | SetImageCount (uint newcount) |
Static Public Member Functions | |
static bool | DragEnter (HWND hwndLock, int x, int y) |
Typically, this function is called in response to a WM_LBUTTONDOWN message. | |
static bool | DragMove (int x, int y) |
DragMove is typically called when receiving a WM_MOUSEMOVE message. | |
static bool | DragLeave (HWND hwndLock) |
DragLeave is typically called when receiving a WM_LBUTTONUP message. | |
static void | EndDrag () |
EndDrag removes the current drag imagelist from the system. | |
static bool | DragShowNolock (bool show) |
Locks or unlocks the window from updates. | |
Protected Member Functions | |
void | CheckValid () |
Throws an exception if this image list handle is invalid. | |
TImageList is a wrapper class for the ImageList common "control".
Definition at line 64 of file imagelst.h.
Constructs an empty ImageList of a given size.
The imageSize
is the individual image size, not the total size of the list. The initCapacity
parameter describes the initial capacity of the list, i.e. how many images it can hold before it needs to grow (perform a reallocation). Note that the list remains empty after construction, regardless of capacity. The growBy
parameter specifies how much the capacity will grow when needed.
Definition at line 38 of file imagelst.cpp.
References CheckValid(), and WARNX.
Constructs a TImageList from a bitmap, slicing it up into a horizontal array of the given number of evenly sized images.
Definition at line 53 of file imagelst.cpp.
References Add(), CheckValid(), owl::TColor::Sys3dFace, and WARNX.
Constructs a TImageList from a DIB, slicing the bitmap up into a horizontal array of the given number of evenly sized images.
Definition at line 72 of file imagelst.cpp.
References Add(), CheckValid(), owl::TColor::Sys3dFace, and WARNX.
owl::TImageList::TImageList | ( | HINSTANCE | h, |
TResId | id, | ||
int | imageWidth, | ||
int | growBy, | ||
const TColor & | mask, | ||
uint | type = IMAGE_BITMAP, | ||
uint | flags = LR_CREATEDIBSECTION ) |
Constructs an ImageList from a bitmap resource.
type
must be IMAGE_BITMAP. flags
can be one of the flags specified for the ImageList_LoadImage function in the Windows API. The default is LR_CREATEDIBSECTION which will load the bitmap as a device-independent bitmap (DIB) with no colour mapping performed.
Definition at line 96 of file imagelst.cpp.
References CheckValid(), and WARNX.
owl::TImageList::TImageList | ( | HIMAGELIST | imageList | ) |
Constructs a C++ alias for an existing imagelist.
The object takes ownership of the given handle, i.e. it will be destroyed in the destructor at the end of the object's lifetime.
Definition at line 111 of file imagelst.cpp.
References CheckValid(), and WARNX.
Constructs a wrapper for the current drag imagelist and specifies the location and hotspot of the imagelist.
Definition at line 128 of file imagelst.cpp.
References CheckValid(), and WARNX.
owl::TImageList::TImageList | ( | const TImageList & | src | ) |
Creates a duplicate of the given image list.
Definition at line 142 of file imagelst.cpp.
References _T, CheckValid(), and WARNX.
owl::TImageList::~TImageList | ( | ) |
Destructs the ImageList and cleans up the image list handle.
Definition at line 152 of file imagelst.cpp.
Adds new image(s) to the ImageList.
Returns index of new addition. No mask bitmap is added.
Definition at line 259 of file imagelst.cpp.
References PRECONDITION.
Adds new image/mask pair(s) to the ImageList. Returns index of new addition.
Definition at line 270 of file imagelst.cpp.
References PRECONDITION.
Adds new image(s) to ImageList, specifying a mask color to generate a mask.
Returns index of the new addition.
Definition at line 282 of file imagelst.cpp.
References PRECONDITION.
Adds an icon to the ImageList. Returns index of new addition.
Definition at line 292 of file imagelst.cpp.
References PRECONDITION.
BeginDrag sets this imagelist to be the drag imagelist.
There can only be one drag imagelist at any time.
Definition at line 429 of file imagelst.cpp.
References PRECONDITION.
|
protected |
Throws an exception if this image list handle is invalid.
Definition at line 163 of file imagelst.cpp.
References owl::TXCommCtrl::Raise().
Definition at line 489 of file imagelst.cpp.
References PRECONDITION.
Typically, this function is called in response to a WM_LBUTTONDOWN message.
The 'x' and 'y' parameters are relative to the upper-left corner of the window's rectangle and NOT the client area. The window 'hWndLock' is locked from further updates.
Definition at line 442 of file imagelst.cpp.
DragLeave is typically called when receiving a WM_LBUTTONUP message.
The 'hWndLock' window is unlocked from updates.
Definition at line 462 of file imagelst.cpp.
DragMove is typically called when receiving a WM_MOUSEMOVE message.
The 'x' and 'y' parameters are generally passed from the message to this function.
Definition at line 452 of file imagelst.cpp.
Locks or unlocks the window from updates.
Definition at line 480 of file imagelst.cpp.
bool owl::TImageList::Draw | ( | int | index, |
TDC & | dc, | ||
int | x, | ||
int | y, | ||
int | dx, | ||
int | dy, | ||
const TColor & | bgClr, | ||
const TColor & | fgClr, | ||
uint | style = ILD_NORMAL, | ||
int | overlay = 0 ) |
Extended version of draw that takes a foreground color and background color.
Definition at line 231 of file imagelst.cpp.
References owl::TColor::None, and PRECONDITION.
bool owl::TImageList::Draw | ( | int | index, |
TDC & | dc, | ||
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.
Definition at line 218 of file imagelst.cpp.
References PRECONDITION.
|
inline |
Definition at line 127 of file imagelst.h.
|
inline |
Definition at line 134 of file imagelst.h.
bool owl::TImageList::DrawIndirect | ( | const TImageListDrawParam & | imldp | ) |
Definition at line 499 of file imagelst.cpp.
TImageList * owl::TImageList::Duplicate | ( | ) |
Definition at line 509 of file imagelst.cpp.
References TImageList(), and PRECONDITION.
|
static |
EndDrag removes the current drag imagelist from the system.
Definition at line 471 of file imagelst.cpp.
TColor owl::TImageList::GetBkColor | ( | ) | const |
Gets the current background color for this ImageList.
Definition at line 384 of file imagelst.cpp.
References PRECONDITION.
Creates and retrieves an icon from an image and mask in the ImageList.
Definition at line 332 of file imagelst.cpp.
References PRECONDITION.
Returns the icon size.
Definition at line 352 of file imagelst.cpp.
References PRECONDITION.
int owl::TImageList::GetImageCount | ( | ) | const |
Returns number of images currently in this ImageList.
Definition at line 248 of file imagelst.cpp.
References PRECONDITION.
TImageInfo owl::TImageList::GetImageInfo | ( | int | index | ) | const |
Functional-style overload.
Definition at line 372 of file imagelst.cpp.
References _T, and GetImageInfo().
bool owl::TImageList::GetImageInfo | ( | int | index, |
TImageInfo & | celInfo ) const |
Gets general information about a given image.
Definition at line 362 of file imagelst.cpp.
References PRECONDITION.
Returns the offset of a given image in the ImageList's bitmap.
Definition at line 226 of file imagelst.h.
Returns the bounding rect of a given image in the ImageList's bitmap.
Definition at line 233 of file imagelst.h.
|
inline |
Returns the size each image.
Each image of the list must be the same size.
Definition at line 219 of file imagelst.h.
|
inline |
Converts to the HIMAGELIST structure.
Definition at line 254 of file imagelst.h.
owl::TImageList::operator TBitmap & | ( | ) |
Returns the image bitmap used by this ImageList.
Definition at line 199 of file imagelst.cpp.
TImageList & owl::TImageList::operator= | ( | const TImageList & | src | ) |
Replaces the image list by a duplicate of the given image list.
Definition at line 175 of file imagelst.cpp.
Returns the rectangle of the image at index 'index'.
Definition at line 240 of file imagelst.h.
References GetImageRect().
Removes an image (or all images if index is -1) from this ImageList.
Definition at line 302 of file imagelst.cpp.
References PRECONDITION.
|
inline |
Replaces an image in this ImageList.
Definition at line 312 of file imagelst.cpp.
References PRECONDITION.
Replaces an image and mask in the ImageList.
Definition at line 322 of file imagelst.cpp.
References PRECONDITION.
Replaces the image at index 'index' with the icon or cursor.
Definition at line 342 of file imagelst.cpp.
References PRECONDITION.
Sets the current background color for this ImageList, returning the previous color.
Definition at line 395 of file imagelst.cpp.
References PRECONDITION.
Combines the current drag image with another image in the list.
Typically, a mouse cursor would be added to the image list and merged with the drag image list.
Definition at line 418 of file imagelst.cpp.
References PRECONDITION.
Definition at line 520 of file imagelst.cpp.
Selects an image for use as an overlay. Up to four can be selected.
Definition at line 405 of file imagelst.cpp.
References PRECONDITION.