![]() |
OWLNext 7.0
Borland's Object Windows Library for the modern age
|
TBtnBitmap is an enhanced version of TBitmap with the ability to update the face color of a bitmap to match the system setting (COLOR_BTNFACE). More...
#include <owl/glyphbtn.h>
Public Member Functions | |
TBtnBitmap (HINSTANCE hInstance, TResId resId, const TColor &faceColor=TColor::LtGray) | |
Loads the specified bitmap and updates the face color, if necessary. | |
TBtnBitmap (HBITMAP hBitmap, const TColor &faceColor=TColor::LtGray, TAutoDelete autoDelete=NoAutoDelete) | |
Aliases the specified bitmap handle and updates the face color, if necessary. | |
void | UpdateFaceColor () |
Updates the face color of the associated bitmap to the current system setting. | |
![]() | |
TBitmap (HBITMAP handle, TAutoDelete autoDelete=NoAutoDelete) | |
Construct an alias TBitmap for an existing bitmap handle. | |
TBitmap (const TClipboard &clipboard) | |
Creates a TBitmap object with values from the given Clipboard. | |
TBitmap (const TBitmap &bitmap) | |
Creates a copy of the given bitmap object. | |
TBitmap (int width, int height, uint8 planes=1, uint8 bitCount=1, const void *bits=nullptr) | |
Creates a bitmap object from bitCount bits in the bits buffer with the given width, height, and planes argument values. | |
TBitmap (const BITMAP &bitmap) | |
Creates a bitmap object with the values found in the given bitmap structure. | |
TBitmap (const TDC &, int width, int height, bool discardable=false) | |
Creates a bitmap object for the given device context with the given argument values. | |
TBitmap (const TDC &, const TDib &dib, uint32 usage=CBM_INIT) | |
Creates a bitmap object for the given device context with the given dib and usage argument values. | |
TBitmap (const TMetaFilePict &metaFile, TPalette &palette, const TSize &size) | |
Creates a bitmap object from the given metaFile using the given palette and size arguments. | |
TBitmap (const TDib &dib, const TPalette *palette=nullptr) | |
Creates a bitmap object from the given dib and palette arguments. | |
TBitmap (HINSTANCE, TResId) | |
Creates a bitmap object for the given application instance from the given resource. | |
~TBitmap () | |
HBITMAP | GetHandle () const |
Returns the handle of the bitmap of type BITMAP. | |
operator HBITMAP () const | |
Typecasting operator. | |
bool | GetObject (BITMAP &bitmap) const |
Retrieves data (width, height, and color format) for this bitmap and sets it in the given BITMAP structure. | |
BITMAP | GetObject () const |
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. | |
TSize | Size () const |
The width and height of the bitmap in pixels. | |
int | Planes () const |
Returns the number of planes in this bitmap. | |
int | BitsPixel () const |
Returns the number of bits per pixel in this bitmap. | |
uint32 | GetBitmapBits (uint32 count, void *bits) const |
Copies up to count bits of this bitmap to the buffer bits. | |
uint32 | SetBitmapBits (uint32 count, const void *bits) |
Copies up to count bits from the bits buffer to this bitmap. | |
bool | GetBitmapDimension (TSize &size) const |
Retrieves the size of this bitmap (width and height, measured in tenths of millimeters) and sets it in the size argument. | |
TSize | GetBitmapDimension () const |
Functional-style overload. | |
bool | SetBitmapDimension (const TSize &size, TSize *oldSize=nullptr) |
Sets the size of this bitmap from the given size argument (width and height, measured in tenths of millimeters). | |
void | ToClipboard (TClipboard &clipboard) |
Put a device-dependent bitmap on the clipboard as a (DD)BITMAP. | |
![]() | |
~TGdiObject () | |
Decrement the reference count on this object. | |
HGDIOBJ | GetGdiHandle () const |
Returns the handle of the GDI object. | |
operator HGDIOBJ () const | |
Typecasting operator that converts this GDI object handle to type HGDIOBJ. | |
int | GetObject (int count, void *object) const |
Retrieve the object's attributes into a buffer. | |
bool | operator== (const TGdiObject &other) const |
Returns true if the handles are equal. This is a binary compare. | |
bool | operator< (const TGdiObject &other) const |
not implemented just to make happy STL | |
bool | IsGDIObject () const |
Returns true if this represents a real GDI object. | |
uint32 | GetObjectType () const |
Returns the type of the GDI object. | |
auto | IsHandleOwner () const -> bool |
Returns true if handle lifetime is managed. | |
Static Public Member Functions | |
static void | MapColor (TDC &dc, TDC &srcDC, const TColor &toColor, const TColor &fromColor, int width, int height) |
Helper routine used to map the face color of the underlying bitmap. | |
![]() | |
static TObjInfo * | RefFind (HANDLE object) |
Searches for the given object handle. | |
static void | RefAdd (HANDLE handle, TType type) |
RefAdd adds a reference entry for the object with the given handle and type. | |
static void | RefRemove (HANDLE handle) |
Removes the reference entry to the object with the given handle. | |
static void | RefInc (HANDLE handle) |
Increments by 1 the reference count of the object associated with the given handle. | |
static void | RefDec (HANDLE handle, bool wantDelete) |
Decrements this object's reference count by 1 and deletes the object when the reference count reaches zero. | |
static int | RefCount (HANDLE handle) |
Returns this object's current reference count or -1 if the object is not found. | |
Protected Attributes | |
TColor | FaceColor |
Current face color of bitmap. | |
![]() | |
HANDLE | Handle |
GDI handle of this object. | |
bool | ShouldDelete |
Should object delete GDI handle in dtor? | |
Additional Inherited Members | |
![]() | |
typedef HBITMAP | THandle |
TBitmap encapsulates an HBITMAP. | |
![]() | |
enum | TType { None , Pen , Brush , Font , Palette , Bitmap , TextBrush } |
This enumeration is used to store the object type in the struct TObjInfo. More... | |
typedef HGDIOBJ | THandle |
TGdiObject encapsulates an HGDIOBJ. | |
![]() | |
TBitmap () | |
void | Create (const TDib &dib, const TPalette &palette) |
Create a bitmap & get its handle, given a dib and a palette Used by ctors here and in derived classes. | |
void | Create (const TBitmap &src) |
Create a bitmap & get its handle, given an other bitmap Used by ctors here and in derived classes. | |
![]() | |
TGdiObject () | |
This default constructor sets Handle to 0 and ShouldDelete to true. | |
TGdiObject (HANDLE handle, TAutoDelete autoDelete=NoAutoDelete) | |
Create a wrapper for a given GDI object. | |
void | CheckValid (uint resId=IDS_GDIFAILURE) |
![]() | |
static void | _CheckValid (HANDLE handle, uint resId=IDS_GDIFAILURE) |
TBtnBitmap is an enhanced version of TBitmap with the ability to update the face color of a bitmap to match the system setting (COLOR_BTNFACE).
Definition at line 49 of file glyphbtn.h.
owl::TBtnBitmap::TBtnBitmap | ( | HINSTANCE | hInstance, |
TResId | resId, | ||
const TColor & | faceColor = TColor::LtGray ) |
Loads the specified bitmap and updates the face color, if necessary.
If not specified, the default face color is assumed to be TColor::LtGray.
Definition at line 53 of file glyphbtn.cpp.
References UpdateFaceColor().
owl::TBtnBitmap::TBtnBitmap | ( | HBITMAP | hBitmap, |
const TColor & | faceColor = TColor::LtGray, | ||
TAutoDelete | autoDelete = NoAutoDelete ) |
Aliases the specified bitmap handle and updates the face color, if necessary.
If not specified, the default face color is assumed to be TColor::LtGray.
Definition at line 67 of file glyphbtn.cpp.
References UpdateFaceColor().
|
static |
Helper routine used to map the face color of the underlying bitmap.
Definition at line 101 of file glyphbtn.cpp.
References owl::TDC::BitBlt(), owl::TDC::RestoreBrush(), owl::RopDSPDxax, and owl::TDC::SelectObject().
void owl::TBtnBitmap::UpdateFaceColor | ( | ) |
Updates the face color of the associated bitmap to the current system setting.
Does nothing if the current face color already matches the system color.
Definition at line 82 of file glyphbtn.cpp.
References FaceColor, owl::TBitmap::Height(), MapColor(), owl::TColor::Sys3dFace, and owl::TBitmap::Width().
|
protected |
Current face color of bitmap.
Definition at line 62 of file glyphbtn.h.